@synnaxlabs/x 0.16.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (511) hide show
  1. package/.turbo/turbo-build.log +99 -7
  2. package/.vscode/settings.json +5 -1
  3. package/dist/base-Cz4DfmJf.js +37 -0
  4. package/dist/base-D3FrPu8C.cjs +1 -0
  5. package/dist/binary.cjs +1 -0
  6. package/dist/binary.js +37 -0
  7. package/dist/bounds-1ouRnRJS.cjs +1 -0
  8. package/dist/bounds-BYz3mV9U.js +129 -0
  9. package/dist/bounds.cjs +1 -0
  10. package/dist/bounds.js +4 -0
  11. package/dist/box-CHDDKvN3.cjs +1 -0
  12. package/dist/box-Q7p9JFnX.js +204 -0
  13. package/dist/box.cjs +1 -0
  14. package/dist/box.js +4 -0
  15. package/dist/caseconv.cjs +1 -0
  16. package/dist/caseconv.js +4 -0
  17. package/dist/change-C-YELKx6.cjs +1 -0
  18. package/dist/change-DLl6DccR.js +12 -0
  19. package/dist/change.cjs +1 -0
  20. package/dist/change.js +4 -0
  21. package/dist/compare.cjs +1 -0
  22. package/dist/compare.js +4 -0
  23. package/dist/debounce.cjs +1 -0
  24. package/dist/debounce.js +17 -0
  25. package/dist/deep.cjs +1 -0
  26. package/dist/deep.js +119 -0
  27. package/dist/destructor.cjs +1 -0
  28. package/dist/destructor.js +1 -0
  29. package/dist/dimensions-9gLSFjFx.js +44 -0
  30. package/dist/dimensions-Fe8DhhXU.cjs +1 -0
  31. package/dist/dimensions.cjs +1 -0
  32. package/dist/dimensions.js +4 -0
  33. package/dist/direction-dXjlmg4_.cjs +1 -0
  34. package/dist/direction-wsPTe9a1.js +15 -0
  35. package/dist/direction.cjs +1 -0
  36. package/dist/direction.js +4 -0
  37. package/dist/external-B-DoBvh7.cjs +1 -0
  38. package/dist/external-DI9122wF.js +27 -0
  39. package/dist/identity.cjs +1 -0
  40. package/dist/identity.js +4 -0
  41. package/dist/index-Bcm6lEr8.js +73 -0
  42. package/dist/index-CnZb0cyW.cjs +1 -0
  43. package/dist/index-POWYBOZm.js +356 -0
  44. package/dist/index-xjptNL6Z.cjs +1 -0
  45. package/dist/index.cjs +1 -0
  46. package/dist/index.js +136 -0
  47. package/dist/kv.cjs +1 -0
  48. package/dist/kv.js +6 -0
  49. package/dist/location-C4YaXxjI.js +94 -0
  50. package/dist/location-CZOgJmu5.cjs +1 -0
  51. package/dist/location.cjs +1 -0
  52. package/dist/location.js +4 -0
  53. package/dist/observe.cjs +1 -0
  54. package/dist/observe.js +43 -0
  55. package/dist/path-BfHj5x9k.js +62 -0
  56. package/dist/path-By98WcWm.cjs +1 -0
  57. package/dist/position-BjhXUSEO.cjs +1 -0
  58. package/dist/position-PSYLZzqw.js +87 -0
  59. package/dist/position.cjs +1 -0
  60. package/dist/position.js +4 -0
  61. package/dist/record.cjs +1 -0
  62. package/dist/record.js +9 -0
  63. package/dist/runtime.cjs +1 -0
  64. package/dist/runtime.js +4 -0
  65. package/dist/scale-DCbi48di.js +205 -0
  66. package/dist/scale-DUBO0Q4s.cjs +1 -0
  67. package/dist/scale.cjs +1 -0
  68. package/dist/scale.js +4 -0
  69. package/dist/search.cjs +1 -0
  70. package/dist/search.js +15 -0
  71. package/dist/series-CSutMOtt.cjs +11 -0
  72. package/dist/series-DCv8f29w.js +1629 -0
  73. package/dist/spatial-6OGCmDve.js +11 -0
  74. package/dist/spatial-R5OeJgR6.cjs +1 -0
  75. package/dist/spatial.cjs +1 -0
  76. package/dist/spatial.js +20 -0
  77. package/dist/{binary → src/binary}/encoder.d.ts +7 -2
  78. package/dist/src/binary/encoder.d.ts.map +1 -0
  79. package/dist/src/binary/encoder.spec.d.ts.map +1 -0
  80. package/dist/src/binary/index.d.ts.map +1 -0
  81. package/dist/src/caseconv/caseconv.d.ts +4 -0
  82. package/dist/src/caseconv/caseconv.d.ts.map +1 -0
  83. package/dist/src/caseconv/index.d.ts +2 -0
  84. package/dist/src/caseconv/index.d.ts.map +1 -0
  85. package/dist/{change → src/change}/change.d.ts +10 -9
  86. package/dist/src/change/change.d.ts.map +1 -0
  87. package/dist/src/change/index.d.ts.map +1 -0
  88. package/dist/src/clamp/clamp.d.ts.map +1 -0
  89. package/dist/src/clamp/index.d.ts +2 -0
  90. package/dist/src/clamp/index.d.ts.map +1 -0
  91. package/dist/{compare → src/compare}/compare.d.ts +5 -4
  92. package/dist/src/compare/compare.d.ts.map +1 -0
  93. package/dist/src/compare/index.d.ts.map +1 -0
  94. package/dist/src/control/control.d.ts +107 -0
  95. package/dist/src/control/control.d.ts.map +1 -0
  96. package/dist/src/control/index.d.ts +2 -0
  97. package/dist/src/control/index.d.ts.map +1 -0
  98. package/dist/src/debounce/debounce.d.ts.map +1 -0
  99. package/dist/src/debounce/debounce.spec.d.ts +2 -0
  100. package/dist/src/debounce/debounce.spec.d.ts.map +1 -0
  101. package/dist/src/debounce/index.d.ts +2 -0
  102. package/dist/src/debounce/index.d.ts.map +1 -0
  103. package/dist/src/deep/copy.d.ts.map +1 -0
  104. package/dist/{deep → src/deep}/delete.d.ts +2 -1
  105. package/dist/src/deep/delete.d.ts.map +1 -0
  106. package/dist/{deep → src/deep}/delete.spec.d.ts.map +1 -1
  107. package/dist/src/deep/difference.d.ts.map +1 -0
  108. package/dist/src/deep/difference.spec.d.ts.map +1 -0
  109. package/dist/src/deep/equal.d.ts.map +1 -0
  110. package/dist/{deep → src/deep}/equal.spec.d.ts.map +1 -1
  111. package/dist/{deep → src/deep}/external.d.ts +3 -4
  112. package/dist/src/deep/external.d.ts.map +1 -0
  113. package/dist/src/deep/index.d.ts.map +1 -0
  114. package/dist/src/deep/merge.d.ts +12 -0
  115. package/dist/src/deep/merge.d.ts.map +1 -0
  116. package/dist/{deep → src/deep}/merge.spec.d.ts.map +1 -1
  117. package/dist/src/deep/partial.d.ts.map +1 -0
  118. package/dist/src/deep/path.d.ts +45 -0
  119. package/dist/src/deep/path.d.ts.map +1 -0
  120. package/dist/{deep → src/deep}/path.spec.d.ts.map +1 -1
  121. package/dist/src/destructor.d.ts.map +1 -0
  122. package/dist/{identity.d.ts → src/identity.d.ts} +2 -1
  123. package/dist/src/identity.d.ts.map +1 -0
  124. package/dist/{index.d.ts → src/index.d.ts} +22 -20
  125. package/dist/src/index.d.ts.map +1 -0
  126. package/dist/src/invert.d.ts.map +1 -0
  127. package/dist/src/join.d.ts.map +1 -0
  128. package/dist/src/kv/index.d.ts.map +1 -0
  129. package/dist/src/kv/types.d.ts.map +1 -0
  130. package/dist/src/math/index.d.ts +2 -0
  131. package/dist/src/math/index.d.ts.map +1 -0
  132. package/dist/src/math/math.d.ts +11 -0
  133. package/dist/src/math/math.d.ts.map +1 -0
  134. package/dist/src/migrate/index.d.ts.map +1 -0
  135. package/dist/{migrate → src/migrate}/migrate.d.ts +2 -1
  136. package/dist/src/migrate/migrate.d.ts.map +1 -0
  137. package/dist/src/migrate/migrate.spec.d.ts.map +1 -0
  138. package/dist/{mock → src/mock}/MockGLBufferController.d.ts +2 -1
  139. package/dist/src/mock/MockGLBufferController.d.ts.map +1 -0
  140. package/dist/src/mock/index.d.ts.map +1 -0
  141. package/dist/src/observe/index.d.ts.map +1 -0
  142. package/dist/src/observe/observe.d.ts +24 -0
  143. package/dist/src/observe/observe.d.ts.map +1 -0
  144. package/dist/src/observe/obsever.spec.d.ts +2 -0
  145. package/dist/src/observe/obsever.spec.d.ts.map +1 -0
  146. package/dist/src/optional.d.ts.map +1 -0
  147. package/dist/{primitive.d.ts → src/primitive.d.ts} +2 -1
  148. package/dist/src/primitive.d.ts.map +1 -0
  149. package/dist/{record.d.ts → src/record.d.ts} +7 -8
  150. package/dist/src/record.d.ts.map +1 -0
  151. package/dist/{renderable.d.ts → src/renderable.d.ts} +2 -1
  152. package/dist/src/renderable.d.ts.map +1 -0
  153. package/dist/src/runtime/detect.d.ts.map +1 -0
  154. package/dist/src/runtime/external.d.ts.map +1 -0
  155. package/dist/src/runtime/index.d.ts.map +1 -0
  156. package/dist/src/runtime/os.d.ts +20 -0
  157. package/dist/src/runtime/os.d.ts.map +1 -0
  158. package/dist/{search.d.ts → src/search.d.ts} +5 -2
  159. package/dist/src/search.d.ts.map +1 -0
  160. package/dist/src/shallowCopy.d.ts +2 -0
  161. package/dist/src/shallowCopy.d.ts.map +1 -0
  162. package/dist/{spatial → src/spatial}/base.d.ts +30 -5
  163. package/dist/src/spatial/base.d.ts.map +1 -0
  164. package/dist/src/spatial/bounds/bounds.d.ts +148 -0
  165. package/dist/src/spatial/bounds/bounds.d.ts.map +1 -0
  166. package/dist/src/spatial/bounds/bounds.spec.d.ts.map +1 -0
  167. package/dist/src/spatial/bounds/index.d.ts.map +1 -0
  168. package/dist/{spatial → src/spatial}/box/box.d.ts +69 -22
  169. package/dist/src/spatial/box/box.d.ts.map +1 -0
  170. package/dist/src/spatial/box/box.spec.d.ts.map +1 -0
  171. package/dist/src/spatial/box/index.d.ts.map +1 -0
  172. package/dist/{spatial → src/spatial}/dimensions/dimensions.d.ts +4 -3
  173. package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -0
  174. package/dist/src/spatial/dimensions/dimensions.spec.d.ts.map +1 -0
  175. package/dist/src/spatial/dimensions/index.d.ts.map +1 -0
  176. package/dist/{spatial → src/spatial}/direction/direction.d.ts +3 -2
  177. package/dist/src/spatial/direction/direction.d.ts.map +1 -0
  178. package/dist/src/spatial/direction/direction.spec.d.ts.map +1 -0
  179. package/dist/src/spatial/direction/index.d.ts.map +1 -0
  180. package/dist/{spatial → src/spatial}/external.d.ts +2 -2
  181. package/dist/src/spatial/external.d.ts.map +1 -0
  182. package/dist/src/spatial/index.d.ts.map +1 -0
  183. package/dist/src/spatial/location/index.d.ts.map +1 -0
  184. package/dist/{spatial → src/spatial}/location/location.d.ts +4 -3
  185. package/dist/src/spatial/location/location.d.ts.map +1 -0
  186. package/dist/src/spatial/location/location.spec.d.ts.map +1 -0
  187. package/dist/src/spatial/position/index.d.ts.map +1 -0
  188. package/dist/{spatial → src/spatial}/position/position.d.ts +4 -4
  189. package/dist/src/spatial/position/position.d.ts.map +1 -0
  190. package/dist/src/spatial/position/position.spec.d.ts.map +1 -0
  191. package/dist/src/spatial/scale/index.d.ts.map +1 -0
  192. package/dist/{spatial → src/spatial}/scale/scale.d.ts +15 -62
  193. package/dist/src/spatial/scale/scale.d.ts.map +1 -0
  194. package/dist/src/spatial/scale/scale.spec.d.ts.map +1 -0
  195. package/dist/src/spatial/spatial.d.ts +2 -0
  196. package/dist/src/spatial/spatial.d.ts.map +1 -0
  197. package/dist/src/spatial/xy/index.d.ts.map +1 -0
  198. package/dist/{spatial → src/spatial}/xy/xy.d.ts +15 -24
  199. package/dist/src/spatial/xy/xy.d.ts.map +1 -0
  200. package/dist/{spatial → src/spatial}/xy/xy.spec.d.ts.map +1 -1
  201. package/dist/src/telem/generate.d.ts +4 -0
  202. package/dist/src/telem/generate.d.ts.map +1 -0
  203. package/dist/src/telem/gl.d.ts.map +1 -0
  204. package/dist/{telem → src/telem}/index.d.ts +1 -1
  205. package/dist/src/telem/index.d.ts.map +1 -0
  206. package/dist/{telem → src/telem}/series.d.ts +10 -8
  207. package/dist/src/telem/series.d.ts.map +1 -0
  208. package/dist/{telem → src/telem}/series.spec.d.ts.map +1 -1
  209. package/dist/{telem → src/telem}/telem.d.ts +19 -21
  210. package/dist/src/telem/telem.d.ts.map +1 -0
  211. package/dist/{telem → src/telem}/telem.spec.d.ts.map +1 -1
  212. package/dist/src/toArray.d.ts.map +1 -0
  213. package/dist/src/transform.d.ts +6 -0
  214. package/dist/src/transform.d.ts.map +1 -0
  215. package/dist/src/unique.d.ts.map +1 -0
  216. package/dist/src/url/index.d.ts +2 -0
  217. package/dist/src/url/index.d.ts.map +1 -0
  218. package/dist/src/url/url.d.ts.map +1 -0
  219. package/dist/{url → src/url}/url.spec.d.ts.map +1 -1
  220. package/dist/src/worker/index.d.ts +2 -0
  221. package/dist/src/worker/index.d.ts.map +1 -0
  222. package/dist/{worker → src/worker}/worker.d.ts +4 -4
  223. package/dist/src/worker/worker.d.ts.map +1 -0
  224. package/dist/src/worker/worker.spec.d.ts.map +1 -0
  225. package/dist/src/zodutil/index.d.ts +2 -0
  226. package/dist/src/zodutil/index.d.ts.map +1 -0
  227. package/dist/src/zodutil/zodutil.d.ts +6 -0
  228. package/dist/src/zodutil/zodutil.d.ts.map +1 -0
  229. package/dist/src/zodutil/zodutil.spec.d.ts +2 -0
  230. package/dist/src/zodutil/zodutil.spec.d.ts.map +1 -0
  231. package/dist/telem.cjs +1 -0
  232. package/dist/telem.js +17 -0
  233. package/dist/toArray.cjs +1 -0
  234. package/dist/toArray.js +5 -0
  235. package/dist/unique.cjs +1 -0
  236. package/dist/unique.js +4 -0
  237. package/dist/url.cjs +1 -0
  238. package/dist/url.js +54 -0
  239. package/dist/worker.cjs +1 -0
  240. package/dist/worker.js +47 -0
  241. package/dist/xy-B4SvvNaG.cjs +1 -0
  242. package/dist/xy-H8aUVW_X.js +90 -0
  243. package/dist/xy.cjs +1 -0
  244. package/dist/xy.js +4 -0
  245. package/dist/zodutil.cjs +1 -0
  246. package/dist/zodutil.js +22 -0
  247. package/eslint.config.js +12 -0
  248. package/package.json +159 -15
  249. package/src/binary/encoder.spec.ts +31 -6
  250. package/src/binary/encoder.ts +26 -15
  251. package/src/binary/index.ts +1 -1
  252. package/src/{case.ts → caseconv/caseconv.ts} +4 -9
  253. package/src/caseconv/index.ts +10 -0
  254. package/src/change/change.ts +7 -6
  255. package/src/change/index.ts +1 -1
  256. package/src/{clamp.ts → clamp/clamp.ts} +1 -1
  257. package/src/clamp/index.ts +10 -0
  258. package/src/compare/compare.ts +6 -9
  259. package/src/compare/index.ts +1 -1
  260. package/src/control/control.ts +77 -0
  261. package/src/control/index.ts +1 -0
  262. package/src/debounce/debounce.spec.ts +52 -0
  263. package/src/{debounce.ts → debounce/debounce.ts} +4 -4
  264. package/src/debounce/index.ts +10 -0
  265. package/src/deep/copy.ts +2 -3
  266. package/src/deep/delete.spec.ts +2 -2
  267. package/src/deep/delete.ts +3 -2
  268. package/src/deep/difference.spec.ts +28 -27
  269. package/src/deep/difference.ts +13 -11
  270. package/src/deep/equal.spec.ts +4 -4
  271. package/src/deep/equal.ts +5 -5
  272. package/src/deep/external.ts +4 -5
  273. package/src/deep/index.ts +1 -1
  274. package/src/deep/merge.spec.ts +120 -4
  275. package/src/deep/merge.ts +50 -6
  276. package/src/deep/partial.ts +1 -1
  277. package/src/deep/path.spec.ts +90 -39
  278. package/src/deep/path.ts +105 -46
  279. package/src/destructor.ts +2 -2
  280. package/src/identity.ts +1 -1
  281. package/src/index.ts +23 -21
  282. package/src/invert.ts +9 -0
  283. package/src/join.ts +1 -1
  284. package/src/kv/index.ts +1 -1
  285. package/src/kv/types.ts +1 -1
  286. package/src/math/index.ts +10 -0
  287. package/src/math/math.ts +33 -0
  288. package/src/migrate/index.ts +9 -0
  289. package/src/migrate/migrate.spec.ts +12 -2
  290. package/src/migrate/migrate.ts +9 -0
  291. package/src/mock/MockGLBufferController.ts +6 -6
  292. package/src/mock/index.ts +1 -1
  293. package/src/observe/index.ts +1 -1
  294. package/src/observe/observe.ts +37 -6
  295. package/src/observe/obsever.spec.ts +56 -0
  296. package/src/optional.ts +3 -4
  297. package/src/primitive.ts +1 -1
  298. package/src/record.ts +10 -6
  299. package/src/renderable.ts +1 -1
  300. package/src/runtime/detect.ts +3 -3
  301. package/src/runtime/external.ts +1 -1
  302. package/src/runtime/index.ts +1 -1
  303. package/src/runtime/os.ts +17 -5
  304. package/src/search.ts +3 -1
  305. package/src/shallowCopy.ts +5 -6
  306. package/src/spatial/base.ts +13 -5
  307. package/src/spatial/bounds/bounds.spec.ts +259 -180
  308. package/src/spatial/bounds/bounds.ts +200 -85
  309. package/src/spatial/bounds/index.ts +2 -2
  310. package/src/spatial/box/box.spec.ts +163 -2
  311. package/src/spatial/box/box.ts +82 -38
  312. package/src/spatial/box/index.ts +2 -2
  313. package/src/spatial/dimensions/dimensions.spec.ts +1 -1
  314. package/src/spatial/dimensions/dimensions.ts +4 -4
  315. package/src/spatial/dimensions/index.ts +2 -2
  316. package/src/spatial/direction/direction.spec.ts +1 -1
  317. package/src/spatial/direction/direction.ts +5 -5
  318. package/src/spatial/direction/index.ts +2 -2
  319. package/src/spatial/external.ts +3 -3
  320. package/src/spatial/index.ts +1 -1
  321. package/src/spatial/location/index.ts +2 -2
  322. package/src/spatial/location/location.spec.ts +1 -1
  323. package/src/spatial/location/location.ts +21 -21
  324. package/src/spatial/position/index.ts +1 -1
  325. package/src/spatial/position/position.spec.ts +1 -1
  326. package/src/spatial/position/position.ts +3 -20
  327. package/src/spatial/scale/index.ts +2 -2
  328. package/src/spatial/scale/scale.spec.ts +3 -3
  329. package/src/spatial/scale/scale.ts +3 -3
  330. package/src/spatial/spatial.ts +5 -5
  331. package/src/spatial/xy/index.ts +2 -2
  332. package/src/spatial/xy/xy.spec.ts +93 -44
  333. package/src/spatial/xy/xy.ts +17 -25
  334. package/src/telem/generate.ts +1 -1
  335. package/src/telem/gl.ts +1 -1
  336. package/src/telem/index.ts +2 -2
  337. package/src/telem/series.spec.ts +64 -5
  338. package/src/telem/series.ts +47 -35
  339. package/src/telem/telem.spec.ts +105 -2
  340. package/src/telem/telem.ts +63 -23
  341. package/src/toArray.ts +2 -2
  342. package/src/transform.ts +9 -2
  343. package/src/unique.ts +1 -1
  344. package/src/url/index.ts +2 -2
  345. package/src/url/url.spec.ts +2 -2
  346. package/src/url/url.ts +4 -4
  347. package/src/worker/index.ts +10 -0
  348. package/src/worker/worker.spec.ts +2 -2
  349. package/src/worker/worker.ts +13 -13
  350. package/src/zodutil/index.ts +10 -0
  351. package/src/zodutil/zodutil.spec.ts +103 -0
  352. package/src/zodutil/zodutil.ts +45 -0
  353. package/tsconfig.json +1 -0
  354. package/tsconfig.tsbuildinfo +1 -0
  355. package/vite.config.ts +39 -3
  356. package/.eslintrc.cjs +0 -18
  357. package/dist/binary/encoder.d.ts.map +0 -1
  358. package/dist/binary/encoder.spec.d.ts.map +0 -1
  359. package/dist/binary/index.d.ts.map +0 -1
  360. package/dist/case.d.ts +0 -6
  361. package/dist/case.d.ts.map +0 -1
  362. package/dist/change/change.d.ts.map +0 -1
  363. package/dist/change/index.d.ts.map +0 -1
  364. package/dist/clamp.d.ts.map +0 -1
  365. package/dist/compare/compare.d.ts.map +0 -1
  366. package/dist/compare/index.d.ts.map +0 -1
  367. package/dist/debounce.d.ts.map +0 -1
  368. package/dist/deep/copy.d.ts.map +0 -1
  369. package/dist/deep/delete.d.ts.map +0 -1
  370. package/dist/deep/difference.d.ts.map +0 -1
  371. package/dist/deep/difference.spec.d.ts.map +0 -1
  372. package/dist/deep/equal.d.ts.map +0 -1
  373. package/dist/deep/external.d.ts.map +0 -1
  374. package/dist/deep/index.d.ts.map +0 -1
  375. package/dist/deep/memo.d.ts +0 -2
  376. package/dist/deep/memo.d.ts.map +0 -1
  377. package/dist/deep/merge.d.ts +0 -3
  378. package/dist/deep/merge.d.ts.map +0 -1
  379. package/dist/deep/partial.d.ts.map +0 -1
  380. package/dist/deep/path.d.ts +0 -37
  381. package/dist/deep/path.d.ts.map +0 -1
  382. package/dist/destructor.d.ts.map +0 -1
  383. package/dist/identity.d.ts.map +0 -1
  384. package/dist/index.d.ts.map +0 -1
  385. package/dist/invert.d.ts.map +0 -1
  386. package/dist/join.d.ts.map +0 -1
  387. package/dist/kv/index.d.ts.map +0 -1
  388. package/dist/kv/types.d.ts.map +0 -1
  389. package/dist/migrate/index.d.ts.map +0 -1
  390. package/dist/migrate/migrate.d.ts.map +0 -1
  391. package/dist/migrate/migrate.spec.d.ts.map +0 -1
  392. package/dist/mock/MockGLBufferController.d.ts.map +0 -1
  393. package/dist/mock/index.d.ts.map +0 -1
  394. package/dist/observe/index.d.ts.map +0 -1
  395. package/dist/observe/observe.d.ts +0 -12
  396. package/dist/observe/observe.d.ts.map +0 -1
  397. package/dist/optional.d.ts.map +0 -1
  398. package/dist/primitive.d.ts.map +0 -1
  399. package/dist/record.d.ts.map +0 -1
  400. package/dist/renderable.d.ts.map +0 -1
  401. package/dist/runtime/detect.d.ts.map +0 -1
  402. package/dist/runtime/external.d.ts.map +0 -1
  403. package/dist/runtime/index.d.ts.map +0 -1
  404. package/dist/runtime/os.d.ts +0 -10
  405. package/dist/runtime/os.d.ts.map +0 -1
  406. package/dist/search.d.ts.map +0 -1
  407. package/dist/shallowCopy.d.ts +0 -2
  408. package/dist/shallowCopy.d.ts.map +0 -1
  409. package/dist/spatial/base.d.ts.map +0 -1
  410. package/dist/spatial/bounds/bounds.d.ts +0 -71
  411. package/dist/spatial/bounds/bounds.d.ts.map +0 -1
  412. package/dist/spatial/bounds/bounds.spec.d.ts.map +0 -1
  413. package/dist/spatial/bounds/index.d.ts.map +0 -1
  414. package/dist/spatial/box/box.d.ts.map +0 -1
  415. package/dist/spatial/box/box.spec.d.ts.map +0 -1
  416. package/dist/spatial/box/index.d.ts.map +0 -1
  417. package/dist/spatial/dimensions/dimensions.d.ts.map +0 -1
  418. package/dist/spatial/dimensions/dimensions.spec.d.ts.map +0 -1
  419. package/dist/spatial/dimensions/index.d.ts.map +0 -1
  420. package/dist/spatial/direction/direction.d.ts.map +0 -1
  421. package/dist/spatial/direction/direction.spec.d.ts.map +0 -1
  422. package/dist/spatial/direction/index.d.ts.map +0 -1
  423. package/dist/spatial/external.d.ts.map +0 -1
  424. package/dist/spatial/index.d.ts.map +0 -1
  425. package/dist/spatial/location/index.d.ts.map +0 -1
  426. package/dist/spatial/location/location.d.ts.map +0 -1
  427. package/dist/spatial/location/location.spec.d.ts.map +0 -1
  428. package/dist/spatial/position/index.d.ts.map +0 -1
  429. package/dist/spatial/position/position.d.ts.map +0 -1
  430. package/dist/spatial/position/position.spec.d.ts.map +0 -1
  431. package/dist/spatial/scale/index.d.ts.map +0 -1
  432. package/dist/spatial/scale/scale.d.ts.map +0 -1
  433. package/dist/spatial/scale/scale.spec.d.ts.map +0 -1
  434. package/dist/spatial/spatial.d.ts +0 -2
  435. package/dist/spatial/spatial.d.ts.map +0 -1
  436. package/dist/spatial/xy/index.d.ts.map +0 -1
  437. package/dist/spatial/xy/xy.d.ts.map +0 -1
  438. package/dist/telem/generate.d.ts +0 -3
  439. package/dist/telem/generate.d.ts.map +0 -1
  440. package/dist/telem/gl.d.ts.map +0 -1
  441. package/dist/telem/index.d.ts.map +0 -1
  442. package/dist/telem/series.d.ts.map +0 -1
  443. package/dist/telem/telem.d.ts.map +0 -1
  444. package/dist/toArray.d.ts.map +0 -1
  445. package/dist/transform.d.ts +0 -2
  446. package/dist/transform.d.ts.map +0 -1
  447. package/dist/unique.d.ts.map +0 -1
  448. package/dist/url/index.d.ts +0 -2
  449. package/dist/url/index.d.ts.map +0 -1
  450. package/dist/url/url.d.ts.map +0 -1
  451. package/dist/worker/worker.d.ts.map +0 -1
  452. package/dist/worker/worker.spec.d.ts.map +0 -1
  453. package/dist/x.cjs +0 -12
  454. package/dist/x.cjs.map +0 -1
  455. package/dist/x.js +0 -5935
  456. package/dist/x.js.map +0 -1
  457. package/src/deep/memo.ts +0 -24
  458. /package/dist/{binary → src/binary}/encoder.spec.d.ts +0 -0
  459. /package/dist/{binary → src/binary}/index.d.ts +0 -0
  460. /package/dist/{change → src/change}/index.d.ts +0 -0
  461. /package/dist/{clamp.d.ts → src/clamp/clamp.d.ts} +0 -0
  462. /package/dist/{compare → src/compare}/index.d.ts +0 -0
  463. /package/dist/{debounce.d.ts → src/debounce/debounce.d.ts} +0 -0
  464. /package/dist/{deep → src/deep}/copy.d.ts +0 -0
  465. /package/dist/{deep → src/deep}/delete.spec.d.ts +0 -0
  466. /package/dist/{deep → src/deep}/difference.d.ts +0 -0
  467. /package/dist/{deep → src/deep}/difference.spec.d.ts +0 -0
  468. /package/dist/{deep → src/deep}/equal.d.ts +0 -0
  469. /package/dist/{deep → src/deep}/equal.spec.d.ts +0 -0
  470. /package/dist/{deep → src/deep}/index.d.ts +0 -0
  471. /package/dist/{deep → src/deep}/merge.spec.d.ts +0 -0
  472. /package/dist/{deep → src/deep}/partial.d.ts +0 -0
  473. /package/dist/{deep → src/deep}/path.spec.d.ts +0 -0
  474. /package/dist/{destructor.d.ts → src/destructor.d.ts} +0 -0
  475. /package/dist/{invert.d.ts → src/invert.d.ts} +0 -0
  476. /package/dist/{join.d.ts → src/join.d.ts} +0 -0
  477. /package/dist/{kv → src/kv}/index.d.ts +0 -0
  478. /package/dist/{kv → src/kv}/types.d.ts +0 -0
  479. /package/dist/{migrate → src/migrate}/index.d.ts +0 -0
  480. /package/dist/{migrate → src/migrate}/migrate.spec.d.ts +0 -0
  481. /package/dist/{mock → src/mock}/index.d.ts +0 -0
  482. /package/dist/{observe → src/observe}/index.d.ts +0 -0
  483. /package/dist/{optional.d.ts → src/optional.d.ts} +0 -0
  484. /package/dist/{runtime → src/runtime}/detect.d.ts +0 -0
  485. /package/dist/{runtime → src/runtime}/external.d.ts +0 -0
  486. /package/dist/{runtime → src/runtime}/index.d.ts +0 -0
  487. /package/dist/{spatial → src/spatial}/bounds/bounds.spec.d.ts +0 -0
  488. /package/dist/{spatial → src/spatial}/bounds/index.d.ts +0 -0
  489. /package/dist/{spatial → src/spatial}/box/box.spec.d.ts +0 -0
  490. /package/dist/{spatial → src/spatial}/box/index.d.ts +0 -0
  491. /package/dist/{spatial → src/spatial}/dimensions/dimensions.spec.d.ts +0 -0
  492. /package/dist/{spatial → src/spatial}/dimensions/index.d.ts +0 -0
  493. /package/dist/{spatial → src/spatial}/direction/direction.spec.d.ts +0 -0
  494. /package/dist/{spatial → src/spatial}/direction/index.d.ts +0 -0
  495. /package/dist/{spatial → src/spatial}/index.d.ts +0 -0
  496. /package/dist/{spatial → src/spatial}/location/index.d.ts +0 -0
  497. /package/dist/{spatial → src/spatial}/location/location.spec.d.ts +0 -0
  498. /package/dist/{spatial → src/spatial}/position/index.d.ts +0 -0
  499. /package/dist/{spatial → src/spatial}/position/position.spec.d.ts +0 -0
  500. /package/dist/{spatial → src/spatial}/scale/index.d.ts +0 -0
  501. /package/dist/{spatial → src/spatial}/scale/scale.spec.d.ts +0 -0
  502. /package/dist/{spatial → src/spatial}/xy/index.d.ts +0 -0
  503. /package/dist/{spatial → src/spatial}/xy/xy.spec.d.ts +0 -0
  504. /package/dist/{telem → src/telem}/gl.d.ts +0 -0
  505. /package/dist/{telem → src/telem}/series.spec.d.ts +0 -0
  506. /package/dist/{telem → src/telem}/telem.spec.d.ts +0 -0
  507. /package/dist/{toArray.d.ts → src/toArray.d.ts} +0 -0
  508. /package/dist/{unique.d.ts → src/unique.d.ts} +0 -0
  509. /package/dist/{url → src/url}/url.d.ts +0 -0
  510. /package/dist/{url → src/url}/url.spec.d.ts +0 -0
  511. /package/dist/{worker → src/worker}/worker.spec.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -7,7 +7,7 @@
7
7
  // License, use of this software will be governed by the Apache License, Version 2.0,
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
- import { describe, expect, test } from "vitest";
10
+ import { describe, expect, it,test } from "vitest";
11
11
 
12
12
  import * as xy from "@/spatial/xy/xy";
13
13
 
@@ -26,51 +26,100 @@ describe("XY", () => {
26
26
  expect(p.y).toEqual(2);
27
27
  });
28
28
  });
29
+ it("should set the x coordinate if the direction is x", () => {
30
+ const p = xy.construct("x", 1);
31
+ expect(p.x).toEqual(1);
32
+ expect(p.y).toEqual(0);
33
+ });
34
+ it("should set the y coordinate if the direction is y", () => {
35
+ const p = xy.construct("y", 1);
36
+ expect(p.x).toEqual(0);
37
+ expect(p.y).toEqual(1);
38
+ });
39
+ });
40
+ test("translateX", () => {
41
+ let p = xy.construct([1, 2]);
42
+ p = xy.translateX(p, 5);
43
+ expect(p.x).toEqual(6);
44
+ expect(p.y).toEqual(2);
45
+ });
46
+ test("translateY", () => {
47
+ let p = xy.construct([1, 2]);
48
+ p = xy.translateY(p, 5);
49
+ expect(p.x).toEqual(1);
50
+ expect(p.y).toEqual(7);
51
+ });
52
+ test("translate", () => {
53
+ let p = xy.construct([1, 2]);
54
+ p = xy.translate(p, [5, 5]);
55
+ expect(p.x).toEqual(6);
56
+ expect(p.y).toEqual(7);
29
57
  });
30
- });
31
- test("translateX", () => {
32
- let p = xy.construct([1, 2]);
33
- p = xy.translateX(p, 5);
34
- expect(p.x).toEqual(6);
35
- expect(p.y).toEqual(2);
36
- });
37
- test("translateY", () => {
38
- let p = xy.construct([1, 2]);
39
- p = xy.translateY(p, 5);
40
- expect(p.x).toEqual(1);
41
- expect(p.y).toEqual(7);
42
- });
43
- test("translate", () => {
44
- let p = xy.construct([1, 2]);
45
- p = xy.translate(p, [5, 5]);
46
- expect(p.x).toEqual(6);
47
- expect(p.y).toEqual(7);
48
- });
49
58
 
50
- test("translate multiple", () => {
51
- let p = xy.construct([1, 2]);
52
- p = xy.translate(p, [5, 5], [2, 2]);
53
- expect(p.x).toEqual(8);
54
- expect(p.y).toEqual(9);
55
- });
59
+ test("translate multiple", () => {
60
+ let p = xy.construct([1, 2]);
61
+ p = xy.translate(p, [5, 5], [2, 2]);
62
+ expect(p.x).toEqual(8);
63
+ expect(p.y).toEqual(9);
64
+ });
56
65
 
57
- describe("equals", () => {
58
- const TESTS: Array<[xy.Crude, xy.Crude, boolean]> = [
59
- [[1, 1], { x: 1, y: 1 }, true],
60
- [[1, 1], [1, 1], true],
61
- [{ x: 1, y: 12 }, { x: 1, y: 1 }, false],
62
- [{ x: 1, y: 12 }, { width: 1, height: 12 }, true],
63
- [{ x: 1, y: 12 }, { width: 12, height: 1 }, false],
64
- [{ x: 1, y: 12 }, { signedWidth: 1, signedHeight: 12 }, true],
65
- ];
66
- TESTS.forEach(([one, two, expected], i) => {
67
- test(`equals ${i}`, () => {
68
- const p = xy.construct(one);
69
- expect(xy.equals(p, two)).toEqual(expected);
66
+ describe("equals", () => {
67
+ const TESTS: Array<[xy.Crude, xy.Crude, boolean]> = [
68
+ [[1, 1], { x: 1, y: 1 }, true],
69
+ [[1, 1], [1, 1], true],
70
+ [{ x: 1, y: 12 }, { x: 1, y: 1 }, false],
71
+ [{ x: 1, y: 12 }, { width: 1, height: 12 }, true],
72
+ [{ x: 1, y: 12 }, { width: 12, height: 1 }, false],
73
+ [{ x: 1, y: 12 }, { signedWidth: 1, signedHeight: 12 }, true],
74
+ ];
75
+ TESTS.forEach(([one, two, expected], i) => {
76
+ test(`equals ${i}`, () => {
77
+ const p = xy.construct(one);
78
+ expect(xy.equals(p, two)).toEqual(expected);
79
+ });
80
+ });
81
+ it("should retrun true if the two points are within the given threshold", () => {
82
+ const p = xy.construct([1, 1]);
83
+ expect(xy.equals(p, [1.1, 1.1], 0.15)).toBe(true);
84
+ });
85
+ });
86
+ test("couple", () => {
87
+ const p = xy.construct([1, 2]);
88
+ expect(xy.couple(p)).toEqual([1, 2]);
89
+ });
90
+ describe("isNan", () => {
91
+ it("should return true if x or y is NaN", () => {
92
+ expect(xy.isNan(xy.construct([1, NaN]))).toBe(true);
93
+ expect(xy.isNan(xy.construct([NaN, 1]))).toBe(true);
94
+ });
95
+ });
96
+ describe("isFinite", () => {
97
+ it("should return true if x or y is finite", () => {
98
+ expect(xy.isFinite(xy.construct([1, 2]))).toBe(true);
99
+ expect(xy.isFinite(xy.construct([Infinity, 2]))).toBe(false);
100
+ expect(xy.isFinite(xy.construct([1, Infinity]))).toBe(false);
101
+ });
102
+ });
103
+ describe("distance", () => {
104
+ it("should return the distance between two points", () => {
105
+ expect(xy.distance([1, 1], [1, 1])).toBe(0);
106
+ expect(xy.distance([1, 1], [1, 2])).toBe(1);
107
+ expect(xy.distance([1, 1], [2, 2])).toBe(Math.sqrt(2));
108
+ });
109
+ });
110
+ describe("css", () => {
111
+ it("should return the css properties of the point", () => {
112
+ expect(xy.css([1, 2])).toEqual({ left: 1, top: 2 });
113
+ });
114
+ });
115
+ describe("truncate", () => {
116
+ it("should truncate the point to the given precision", () => {
117
+ expect(xy.truncate([1.12345, 2.12345], 2)).toEqual({ x: 1.12, y: 2.12 });
118
+ });
119
+ });
120
+ describe("scale", () => {
121
+ it("should scale the point by the given factor", () => {
122
+ expect(xy.scale([1, 2], 2)).toEqual({ x: 2, y: 4 });
70
123
  });
71
124
  });
72
- });
73
- test("couple", () => {
74
- const p = xy.construct([1, 2]);
75
- expect(xy.couple(p)).toEqual([1, 2]);
76
125
  });
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -10,18 +10,18 @@
10
10
  import { z } from "zod";
11
11
 
12
12
  import {
13
+ type ClientXY,
13
14
  clientXY,
14
15
  dimensions,
15
- numberCouple,
16
- xy,
16
+ type Direction,
17
17
  type NumberCouple,
18
- type ClientXY,
19
- type XY,
18
+ numberCouple,
20
19
  signedDimensions,
21
- type Direction,
20
+ type XY,
21
+ xy,
22
22
  } from "@/spatial/base";
23
23
 
24
- export { clientXY, xy, type ClientXY as Client, type XY };
24
+ export { type ClientXY as Client, clientXY, type XY,xy };
25
25
 
26
26
  /** A crude representation of a {@link XY} coordinate as a zod schema. */
27
27
  export const crudeZ = z.union([
@@ -60,16 +60,16 @@ export const construct = (x: Crude | Direction, y?: number): XY => {
60
60
  };
61
61
 
62
62
  /** An x and y coordinate of zero */
63
- export const ZERO = { x: 0, y: 0 };
63
+ export const ZERO: XY = Object.freeze({ x: 0, y: 0 });
64
64
 
65
65
  /** An x and y coordinate of one */
66
- export const ONE = { x: 1, y: 1 };
66
+ export const ONE: XY = Object.freeze({ x: 1, y: 1 });
67
67
 
68
68
  /** An x and y coordinate of infinity */
69
- export const INFINITY = { x: Infinity, y: Infinity };
69
+ export const INFINITY: XY = Object.freeze({ x: Infinity, y: Infinity });
70
70
 
71
71
  /** An x and y coordinate of NaN */
72
- export const NAN = { x: NaN, y: NaN };
72
+ export const NAN: XY = Object.freeze({ x: NaN, y: NaN });
73
73
 
74
74
  /** @returns true if the two XY coordinates are semantically equal. */
75
75
  export const equals = (a: Crude, b: Crude, threshold: number = 0): boolean => {
@@ -138,20 +138,6 @@ export const distance = (ca: Crude, cb: Crude): number => {
138
138
  return Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2);
139
139
  };
140
140
 
141
- /** @returns the magnitude of the x distance between the two given coordinates. */
142
- export const xDistance = (ca: Crude, cb: Crude): number => {
143
- const a = construct(ca);
144
- const b = construct(cb);
145
- return Math.abs(a.x - b.x);
146
- };
147
-
148
- /** @returns the magnitude of the y distance between the two given coordinates. */
149
- export const yDistance = (ca: Crude, cb: Crude): number => {
150
- const a = construct(ca);
151
- const b = construct(cb);
152
- return Math.abs(a.y - b.y);
153
- };
154
-
155
141
  /**
156
142
  * @returns the translation that would need to be applied to move the first coordinate
157
143
  * to the second coordinate.
@@ -186,6 +172,12 @@ export const css = (a: Crude): { left: number; top: number } => {
186
172
  return { left: xy.x, top: xy.y };
187
173
  };
188
174
 
175
+ /**
176
+ * Truncate the given coordinates to the given precision.
177
+ * @param a - The coordinates to truncate.
178
+ * @param precision - The number of decimal places to truncate to.
179
+ * @returns The truncated coordinates.
180
+ */
189
181
  export const truncate = (a: Crude, precision: number = 0): XY => {
190
182
  const xy = construct(a);
191
183
  return { x: Number(xy.x.toFixed(precision)), y: Number(xy.y.toFixed(precision)) };
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/telem/gl.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -7,6 +7,6 @@
7
7
  // License, use of this software will be governed by the Apache License, Version 2.0,
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
+ export type { GLBufferController } from "@/telem/gl";
10
11
  export * from "@/telem/series";
11
12
  export * from "@/telem/telem";
12
- export type { GLBufferController } from "@/telem/gl";
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -7,11 +7,11 @@
7
7
  // License, use of this software will be governed by the Apache License, Version 2.0,
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
- import { describe, expect, test, it } from "vitest";
10
+ import { describe, expect, it,test } from "vitest";
11
11
  import { z } from "zod";
12
12
 
13
13
  import { MockGLBufferController } from "@/mock/MockGLBufferController";
14
- import { Series, isCrudeSeries, MultiSeries } from "@/telem/series";
14
+ import { isCrudeSeries, MultiSeries,Series } from "@/telem/series";
15
15
  import { DataType, Rate, Size, TimeRange, TimeSpan, TimeStamp } from "@/telem/telem";
16
16
 
17
17
  describe("Series", () => {
@@ -30,6 +30,26 @@ describe("Series", () => {
30
30
  });
31
31
  });
32
32
 
33
+ describe("length", () => {
34
+ it("should return the correct length for a fixed density series", () => {
35
+ const a = new Series({
36
+ data: new Float32Array([1, 2, 3]),
37
+ dataType: DataType.FLOAT32,
38
+ });
39
+ expect(a.length).toEqual(3);
40
+ });
41
+ it("should return the correct length for a variable density series", () => {
42
+ const a = new Series({
43
+ data: [{ value: 1 }, { value: 2, red: "blue" }, { value: 3, dog: "14" }],
44
+ });
45
+ expect(a.dataType.equals(DataType.JSON)).toBeTruthy();
46
+ expect(a.length).toEqual(3);
47
+ const buf = a.data.buffer;
48
+ const c = new Series({ data: buf, dataType: DataType.JSON });
49
+ expect(c.length).toEqual(3);
50
+ });
51
+ });
52
+
33
53
  test("from another series", () => {
34
54
  const a = new Series({
35
55
  data: new Float32Array([1, 2, 3]),
@@ -58,7 +78,7 @@ describe("Series", () => {
58
78
 
59
79
  test("from buffer without data type provided", () => {
60
80
  expect(() => {
61
- // eslint-disable-next-line no-new
81
+
62
82
  new Series({ data: new ArrayBuffer(4) });
63
83
  }).toThrow();
64
84
  });
@@ -98,6 +118,7 @@ describe("Series", () => {
98
118
  const s = new Series({ data: [{ a: 1, b: "apple" }] });
99
119
  expect(s.dataType.equals(DataType.JSON));
100
120
  expect(s.length).toEqual(1);
121
+ expect(s.data.at(-1)).toEqual(10);
101
122
  });
102
123
 
103
124
  it("should correctly interpret a bigint as an int64", () => {
@@ -560,7 +581,6 @@ describe("Series", () => {
560
581
  describe("bigint", () => {
561
582
  it("should correctly interpret the series as a bigint", () => {
562
583
  const s = new Series([BigInt(1), BigInt(2), BigInt(3)]);
563
- console.log(s.dataType);
564
584
  const s2 = s.as("bigint");
565
585
  expect(s2.at(0)).toEqual(BigInt(1));
566
586
  });
@@ -572,6 +592,30 @@ describe("Series", () => {
572
592
  });
573
593
  });
574
594
  });
595
+
596
+ describe("alignmentBounds", () => {
597
+ it("should correctly return the alignment bounds of a multi-series", () => {
598
+ const a = new Series({
599
+ data: new Float32Array([1, 2, 3]),
600
+ timeRange: new TimeRange(1, 2),
601
+ alignment: 1n,
602
+ });
603
+ expect(a.alignmentBounds).toEqual({ lower: 1n, upper: 4n });
604
+ });
605
+ });
606
+
607
+ describe("digest", () => {
608
+ it("should return a digest of information about the series", () => {
609
+ const digest = new Series({
610
+ data: new Float32Array([1, 2, 3]),
611
+ timeRange: new TimeRange(1, 3),
612
+ }).digest;
613
+ expect(digest.alignment).toEqual({ lower: 0n, upper: 3n });
614
+ expect(digest.dataType).toEqual("float32");
615
+ expect(digest.length).toEqual(3);
616
+ expect(digest.timeRange).toEqual(new TimeRange(1, 3).toString());
617
+ });
618
+ });
575
619
  });
576
620
 
577
621
  describe("MultiSeries", () => {
@@ -661,4 +705,19 @@ describe("MultiSeries", () => {
661
705
  expect(data).toEqual(new Float32Array([1, 2, 3, 4, 5, 6]));
662
706
  });
663
707
  });
708
+
709
+ describe("timeRange", () => {
710
+ it("should correctly return the time range of a multi-series", () => {
711
+ const a = new Series({
712
+ data: new Float32Array([1, 2, 3]),
713
+ timeRange: new TimeRange(1, 2),
714
+ });
715
+ const b = new Series({
716
+ data: new Float32Array([4, 5, 6]),
717
+ timeRange: new TimeRange(3, 4),
718
+ });
719
+ const multi = new MultiSeries([a, b]);
720
+ expect(multi.timeRange).toEqual(new TimeRange(1, 4));
721
+ });
722
+ });
664
723
  });
@@ -1,5 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-misused-new */
2
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
3
2
  //
4
3
  // Use of this software is governed by the Business Source License included in the file
5
4
  // licenses/BSL.txt.
@@ -11,23 +10,24 @@
11
10
  import { nanoid } from "nanoid/non-secure";
12
11
  import { type z } from "zod";
13
12
 
13
+ import { caseconv } from "@/caseconv";
14
14
  import { compare } from "@/compare";
15
15
  import { bounds } from "@/spatial";
16
16
  import { type GLBufferController, type GLBufferUsage } from "@/telem/gl";
17
17
  import {
18
18
  convertDataType,
19
+ type CrudeDataType,
20
+ type CrudeTimeStamp,
19
21
  DataType,
20
- type TypedArray,
22
+ isTelemValue,
23
+ type NumericTelemValue,
21
24
  type Rate,
22
25
  Size,
23
- TimeRange,
24
- TimeStamp,
25
- type CrudeDataType,
26
26
  type TelemValue,
27
- isTelemValue,
27
+ TimeRange,
28
28
  TimeSpan,
29
- type CrudeTimeStamp,
30
- type NumericTelemValue,
29
+ TimeStamp,
30
+ type TypedArray,
31
31
  } from "@/telem/telem";
32
32
 
33
33
  interface GL {
@@ -41,7 +41,7 @@ export interface SeriesDigest {
41
41
  key: string;
42
42
  dataType: string;
43
43
  sampleOffset: NumericTelemValue;
44
- alignment: bounds.Bounds;
44
+ alignment: bounds.Bounds<bigint>;
45
45
  timeRange?: string;
46
46
  length: number;
47
47
  capacity: number;
@@ -52,7 +52,7 @@ interface BaseSeriesProps {
52
52
  timeRange?: TimeRange;
53
53
  sampleOffset?: NumericTelemValue;
54
54
  glBufferUsage?: GLBufferUsage;
55
- alignment?: number;
55
+ alignment?: bigint;
56
56
  key?: string;
57
57
  }
58
58
 
@@ -101,6 +101,7 @@ export interface SeriesMemInfo {
101
101
  */
102
102
  export class Series<T extends TelemValue = TelemValue> {
103
103
  key: string = "";
104
+ isSynnaxSeries = true;
104
105
  /** The data type of the array */
105
106
  readonly dataType: DataType;
106
107
  /**
@@ -116,7 +117,7 @@ export class Series<T extends TelemValue = TelemValue> {
116
117
  /** The underlying data. */
117
118
  private readonly _data: ArrayBufferLike;
118
119
  readonly _timeRange?: TimeRange;
119
- readonly alignment: number = 0;
120
+ readonly alignment: bigint = 0n;
120
121
  /** A cached minimum value. */
121
122
  private _cachedMin?: NumericTelemValue;
122
123
  /** A cached maximum value. */
@@ -134,24 +135,30 @@ export class Series<T extends TelemValue = TelemValue> {
134
135
  timeRange,
135
136
  sampleOffset = 0,
136
137
  glBufferUsage = "static",
137
- alignment = 0,
138
+ alignment = 0n,
138
139
  key = nanoid(),
139
140
  } = props;
140
141
  const { data } = props;
141
142
 
142
- if (data instanceof Series) {
143
- this.key = data.key;
144
- this.dataType = data.dataType;
145
- this.sampleOffset = data.sampleOffset;
146
- this.gl = data.gl;
147
- this._data = data._data;
148
- this._timeRange = data._timeRange;
149
- this.alignment = data.alignment;
150
- this._cachedMin = data._cachedMin;
151
- this._cachedMax = data._cachedMax;
152
- this.writePos = data.writePos;
153
- this._refCount = data._refCount;
154
- this._cachedLength = data._cachedLength;
143
+ if (
144
+ data instanceof Series ||
145
+ (typeof data === "object" &&
146
+ "isSynnaxSeries" in data &&
147
+ data.isSynnaxSeries === true)
148
+ ) {
149
+ const data_ = data as Series;
150
+ this.key = data_.key;
151
+ this.dataType = data_.dataType;
152
+ this.sampleOffset = data_.sampleOffset;
153
+ this.gl = data_.gl;
154
+ this._data = data_._data;
155
+ this._timeRange = data_._timeRange;
156
+ this.alignment = data_.alignment;
157
+ this._cachedMin = data_._cachedMin;
158
+ this._cachedMax = data_._cachedMax;
159
+ this.writePos = data_.writePos;
160
+ this._refCount = data_._refCount;
161
+ this._cachedLength = data_._cachedLength;
155
162
  return;
156
163
  }
157
164
  const isSingle = isTelemValue(data);
@@ -291,7 +298,10 @@ export class Series<T extends TelemValue = TelemValue> {
291
298
  const available = this.capacity - this.writePos;
292
299
 
293
300
  const toWrite = available < other.length ? other.slice(0, available) : other;
294
- this.underlyingData.set(toWrite.data as ArrayLike<any>, this.writePos);
301
+ this.underlyingData.set(
302
+ toWrite.data as unknown as ArrayLike<bigint> & ArrayLike<number>,
303
+ this.writePos,
304
+ );
295
305
  this.maybeRecomputeMinMax(toWrite);
296
306
  this._cachedLength = undefined;
297
307
  this.writePos += toWrite.length;
@@ -342,7 +352,7 @@ export class Series<T extends TelemValue = TelemValue> {
342
352
  .decode(this.buffer)
343
353
  .split("\n")
344
354
  .slice(0, -1)
345
- .map((s) => schema.parse(JSON.parse(s)));
355
+ .map((s) => schema.parse(caseconv.toCamel(JSON.parse(s))));
346
356
  }
347
357
 
348
358
  /** @returns the time range of this array. */
@@ -475,7 +485,7 @@ export class Series<T extends TelemValue = TelemValue> {
475
485
 
476
486
  enrich(): void {
477
487
  let _ = this.max;
478
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
488
+
479
489
  _ = this.min;
480
490
  }
481
491
 
@@ -520,7 +530,9 @@ export class Series<T extends TelemValue = TelemValue> {
520
530
  const slice = this.data.slice(start, end);
521
531
  if (this.dataType.equals(DataType.STRING))
522
532
  return new TextDecoder().decode(slice) as unknown as T;
523
- return JSON.parse(new TextDecoder().decode(slice)) as unknown as T;
533
+ return caseconv.toCamel(
534
+ JSON.parse(new TextDecoder().decode(slice)),
535
+ ) as unknown as T;
524
536
  }
525
537
 
526
538
  /**
@@ -629,8 +641,8 @@ export class Series<T extends TelemValue = TelemValue> {
629
641
  };
630
642
  }
631
643
 
632
- get alignmentBounds(): bounds.Bounds {
633
- return bounds.construct(this.alignment, this.alignment + this.length);
644
+ get alignmentBounds(): bounds.Bounds<bigint> {
645
+ return bounds.construct(this.alignment, this.alignment + BigInt(this.length));
634
646
  }
635
647
 
636
648
  private maybeGarbageCollectGLBuffer(gl: GLBufferController): void {
@@ -667,11 +679,11 @@ export class Series<T extends TelemValue = TelemValue> {
667
679
  timeRange: this._timeRange,
668
680
  sampleOffset: this.sampleOffset,
669
681
  glBufferUsage: this.gl.bufferUsage,
670
- alignment: this.alignment + start,
682
+ alignment: this.alignment + BigInt(start),
671
683
  });
672
684
  }
673
685
 
674
- reAlign(alignment: number): Series {
686
+ reAlign(alignment: bigint): Series {
675
687
  return new Series({
676
688
  data: this.buffer,
677
689
  dataType: this.dataType,
@@ -724,7 +736,7 @@ class JSONSeriesIterator implements Iterator<unknown> {
724
736
  next(): IteratorResult<object> {
725
737
  const next = this.wrapped.next();
726
738
  if (next.done === true) return { done: true, value: undefined };
727
- return { done: false, value: JSON.parse(next.value) };
739
+ return { done: false, value: caseconv.toCamel(JSON.parse(next.value)) };
728
740
  }
729
741
 
730
742
  [Symbol.iterator](): Iterator<object> {