@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.
- package/.turbo/turbo-build.log +99 -7
- package/.vscode/settings.json +5 -1
- package/dist/base-Cz4DfmJf.js +37 -0
- package/dist/base-D3FrPu8C.cjs +1 -0
- package/dist/binary.cjs +1 -0
- package/dist/binary.js +37 -0
- package/dist/bounds-1ouRnRJS.cjs +1 -0
- package/dist/bounds-BYz3mV9U.js +129 -0
- package/dist/bounds.cjs +1 -0
- package/dist/bounds.js +4 -0
- package/dist/box-CHDDKvN3.cjs +1 -0
- package/dist/box-Q7p9JFnX.js +204 -0
- package/dist/box.cjs +1 -0
- package/dist/box.js +4 -0
- package/dist/caseconv.cjs +1 -0
- package/dist/caseconv.js +4 -0
- package/dist/change-C-YELKx6.cjs +1 -0
- package/dist/change-DLl6DccR.js +12 -0
- package/dist/change.cjs +1 -0
- package/dist/change.js +4 -0
- package/dist/compare.cjs +1 -0
- package/dist/compare.js +4 -0
- package/dist/debounce.cjs +1 -0
- package/dist/debounce.js +17 -0
- package/dist/deep.cjs +1 -0
- package/dist/deep.js +119 -0
- package/dist/destructor.cjs +1 -0
- package/dist/destructor.js +1 -0
- package/dist/dimensions-9gLSFjFx.js +44 -0
- package/dist/dimensions-Fe8DhhXU.cjs +1 -0
- package/dist/dimensions.cjs +1 -0
- package/dist/dimensions.js +4 -0
- package/dist/direction-dXjlmg4_.cjs +1 -0
- package/dist/direction-wsPTe9a1.js +15 -0
- package/dist/direction.cjs +1 -0
- package/dist/direction.js +4 -0
- package/dist/external-B-DoBvh7.cjs +1 -0
- package/dist/external-DI9122wF.js +27 -0
- package/dist/identity.cjs +1 -0
- package/dist/identity.js +4 -0
- package/dist/index-Bcm6lEr8.js +73 -0
- package/dist/index-CnZb0cyW.cjs +1 -0
- package/dist/index-POWYBOZm.js +356 -0
- package/dist/index-xjptNL6Z.cjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +136 -0
- package/dist/kv.cjs +1 -0
- package/dist/kv.js +6 -0
- package/dist/location-C4YaXxjI.js +94 -0
- package/dist/location-CZOgJmu5.cjs +1 -0
- package/dist/location.cjs +1 -0
- package/dist/location.js +4 -0
- package/dist/observe.cjs +1 -0
- package/dist/observe.js +43 -0
- package/dist/path-BfHj5x9k.js +62 -0
- package/dist/path-By98WcWm.cjs +1 -0
- package/dist/position-BjhXUSEO.cjs +1 -0
- package/dist/position-PSYLZzqw.js +87 -0
- package/dist/position.cjs +1 -0
- package/dist/position.js +4 -0
- package/dist/record.cjs +1 -0
- package/dist/record.js +9 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.js +4 -0
- package/dist/scale-DCbi48di.js +205 -0
- package/dist/scale-DUBO0Q4s.cjs +1 -0
- package/dist/scale.cjs +1 -0
- package/dist/scale.js +4 -0
- package/dist/search.cjs +1 -0
- package/dist/search.js +15 -0
- package/dist/series-CSutMOtt.cjs +11 -0
- package/dist/series-DCv8f29w.js +1629 -0
- package/dist/spatial-6OGCmDve.js +11 -0
- package/dist/spatial-R5OeJgR6.cjs +1 -0
- package/dist/spatial.cjs +1 -0
- package/dist/spatial.js +20 -0
- package/dist/{binary → src/binary}/encoder.d.ts +7 -2
- package/dist/src/binary/encoder.d.ts.map +1 -0
- package/dist/src/binary/encoder.spec.d.ts.map +1 -0
- package/dist/src/binary/index.d.ts.map +1 -0
- package/dist/src/caseconv/caseconv.d.ts +4 -0
- package/dist/src/caseconv/caseconv.d.ts.map +1 -0
- package/dist/src/caseconv/index.d.ts +2 -0
- package/dist/src/caseconv/index.d.ts.map +1 -0
- package/dist/{change → src/change}/change.d.ts +10 -9
- package/dist/src/change/change.d.ts.map +1 -0
- package/dist/src/change/index.d.ts.map +1 -0
- package/dist/src/clamp/clamp.d.ts.map +1 -0
- package/dist/src/clamp/index.d.ts +2 -0
- package/dist/src/clamp/index.d.ts.map +1 -0
- package/dist/{compare → src/compare}/compare.d.ts +5 -4
- package/dist/src/compare/compare.d.ts.map +1 -0
- package/dist/src/compare/index.d.ts.map +1 -0
- package/dist/src/control/control.d.ts +107 -0
- package/dist/src/control/control.d.ts.map +1 -0
- package/dist/src/control/index.d.ts +2 -0
- package/dist/src/control/index.d.ts.map +1 -0
- package/dist/src/debounce/debounce.d.ts.map +1 -0
- package/dist/src/debounce/debounce.spec.d.ts +2 -0
- package/dist/src/debounce/debounce.spec.d.ts.map +1 -0
- package/dist/src/debounce/index.d.ts +2 -0
- package/dist/src/debounce/index.d.ts.map +1 -0
- package/dist/src/deep/copy.d.ts.map +1 -0
- package/dist/{deep → src/deep}/delete.d.ts +2 -1
- package/dist/src/deep/delete.d.ts.map +1 -0
- package/dist/{deep → src/deep}/delete.spec.d.ts.map +1 -1
- package/dist/src/deep/difference.d.ts.map +1 -0
- package/dist/src/deep/difference.spec.d.ts.map +1 -0
- package/dist/src/deep/equal.d.ts.map +1 -0
- package/dist/{deep → src/deep}/equal.spec.d.ts.map +1 -1
- package/dist/{deep → src/deep}/external.d.ts +3 -4
- package/dist/src/deep/external.d.ts.map +1 -0
- package/dist/src/deep/index.d.ts.map +1 -0
- package/dist/src/deep/merge.d.ts +12 -0
- package/dist/src/deep/merge.d.ts.map +1 -0
- package/dist/{deep → src/deep}/merge.spec.d.ts.map +1 -1
- package/dist/src/deep/partial.d.ts.map +1 -0
- package/dist/src/deep/path.d.ts +45 -0
- package/dist/src/deep/path.d.ts.map +1 -0
- package/dist/{deep → src/deep}/path.spec.d.ts.map +1 -1
- package/dist/src/destructor.d.ts.map +1 -0
- package/dist/{identity.d.ts → src/identity.d.ts} +2 -1
- package/dist/src/identity.d.ts.map +1 -0
- package/dist/{index.d.ts → src/index.d.ts} +22 -20
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/invert.d.ts.map +1 -0
- package/dist/src/join.d.ts.map +1 -0
- package/dist/src/kv/index.d.ts.map +1 -0
- package/dist/src/kv/types.d.ts.map +1 -0
- package/dist/src/math/index.d.ts +2 -0
- package/dist/src/math/index.d.ts.map +1 -0
- package/dist/src/math/math.d.ts +11 -0
- package/dist/src/math/math.d.ts.map +1 -0
- package/dist/src/migrate/index.d.ts.map +1 -0
- package/dist/{migrate → src/migrate}/migrate.d.ts +2 -1
- package/dist/src/migrate/migrate.d.ts.map +1 -0
- package/dist/src/migrate/migrate.spec.d.ts.map +1 -0
- package/dist/{mock → src/mock}/MockGLBufferController.d.ts +2 -1
- package/dist/src/mock/MockGLBufferController.d.ts.map +1 -0
- package/dist/src/mock/index.d.ts.map +1 -0
- package/dist/src/observe/index.d.ts.map +1 -0
- package/dist/src/observe/observe.d.ts +24 -0
- package/dist/src/observe/observe.d.ts.map +1 -0
- package/dist/src/observe/obsever.spec.d.ts +2 -0
- package/dist/src/observe/obsever.spec.d.ts.map +1 -0
- package/dist/src/optional.d.ts.map +1 -0
- package/dist/{primitive.d.ts → src/primitive.d.ts} +2 -1
- package/dist/src/primitive.d.ts.map +1 -0
- package/dist/{record.d.ts → src/record.d.ts} +7 -8
- package/dist/src/record.d.ts.map +1 -0
- package/dist/{renderable.d.ts → src/renderable.d.ts} +2 -1
- package/dist/src/renderable.d.ts.map +1 -0
- package/dist/src/runtime/detect.d.ts.map +1 -0
- package/dist/src/runtime/external.d.ts.map +1 -0
- package/dist/src/runtime/index.d.ts.map +1 -0
- package/dist/src/runtime/os.d.ts +20 -0
- package/dist/src/runtime/os.d.ts.map +1 -0
- package/dist/{search.d.ts → src/search.d.ts} +5 -2
- package/dist/src/search.d.ts.map +1 -0
- package/dist/src/shallowCopy.d.ts +2 -0
- package/dist/src/shallowCopy.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/base.d.ts +30 -5
- package/dist/src/spatial/base.d.ts.map +1 -0
- package/dist/src/spatial/bounds/bounds.d.ts +148 -0
- package/dist/src/spatial/bounds/bounds.d.ts.map +1 -0
- package/dist/src/spatial/bounds/bounds.spec.d.ts.map +1 -0
- package/dist/src/spatial/bounds/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/box/box.d.ts +69 -22
- package/dist/src/spatial/box/box.d.ts.map +1 -0
- package/dist/src/spatial/box/box.spec.d.ts.map +1 -0
- package/dist/src/spatial/box/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/dimensions/dimensions.d.ts +4 -3
- package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -0
- package/dist/src/spatial/dimensions/dimensions.spec.d.ts.map +1 -0
- package/dist/src/spatial/dimensions/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/direction/direction.d.ts +3 -2
- package/dist/src/spatial/direction/direction.d.ts.map +1 -0
- package/dist/src/spatial/direction/direction.spec.d.ts.map +1 -0
- package/dist/src/spatial/direction/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/external.d.ts +2 -2
- package/dist/src/spatial/external.d.ts.map +1 -0
- package/dist/src/spatial/index.d.ts.map +1 -0
- package/dist/src/spatial/location/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/location/location.d.ts +4 -3
- package/dist/src/spatial/location/location.d.ts.map +1 -0
- package/dist/src/spatial/location/location.spec.d.ts.map +1 -0
- package/dist/src/spatial/position/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/position/position.d.ts +4 -4
- package/dist/src/spatial/position/position.d.ts.map +1 -0
- package/dist/src/spatial/position/position.spec.d.ts.map +1 -0
- package/dist/src/spatial/scale/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/scale/scale.d.ts +15 -62
- package/dist/src/spatial/scale/scale.d.ts.map +1 -0
- package/dist/src/spatial/scale/scale.spec.d.ts.map +1 -0
- package/dist/src/spatial/spatial.d.ts +2 -0
- package/dist/src/spatial/spatial.d.ts.map +1 -0
- package/dist/src/spatial/xy/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/xy/xy.d.ts +15 -24
- package/dist/src/spatial/xy/xy.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/xy/xy.spec.d.ts.map +1 -1
- package/dist/src/telem/generate.d.ts +4 -0
- package/dist/src/telem/generate.d.ts.map +1 -0
- package/dist/src/telem/gl.d.ts.map +1 -0
- package/dist/{telem → src/telem}/index.d.ts +1 -1
- package/dist/src/telem/index.d.ts.map +1 -0
- package/dist/{telem → src/telem}/series.d.ts +10 -8
- package/dist/src/telem/series.d.ts.map +1 -0
- package/dist/{telem → src/telem}/series.spec.d.ts.map +1 -1
- package/dist/{telem → src/telem}/telem.d.ts +19 -21
- package/dist/src/telem/telem.d.ts.map +1 -0
- package/dist/{telem → src/telem}/telem.spec.d.ts.map +1 -1
- package/dist/src/toArray.d.ts.map +1 -0
- package/dist/src/transform.d.ts +6 -0
- package/dist/src/transform.d.ts.map +1 -0
- package/dist/src/unique.d.ts.map +1 -0
- package/dist/src/url/index.d.ts +2 -0
- package/dist/src/url/index.d.ts.map +1 -0
- package/dist/src/url/url.d.ts.map +1 -0
- package/dist/{url → src/url}/url.spec.d.ts.map +1 -1
- package/dist/src/worker/index.d.ts +2 -0
- package/dist/src/worker/index.d.ts.map +1 -0
- package/dist/{worker → src/worker}/worker.d.ts +4 -4
- package/dist/src/worker/worker.d.ts.map +1 -0
- package/dist/src/worker/worker.spec.d.ts.map +1 -0
- package/dist/src/zodutil/index.d.ts +2 -0
- package/dist/src/zodutil/index.d.ts.map +1 -0
- package/dist/src/zodutil/zodutil.d.ts +6 -0
- package/dist/src/zodutil/zodutil.d.ts.map +1 -0
- package/dist/src/zodutil/zodutil.spec.d.ts +2 -0
- package/dist/src/zodutil/zodutil.spec.d.ts.map +1 -0
- package/dist/telem.cjs +1 -0
- package/dist/telem.js +17 -0
- package/dist/toArray.cjs +1 -0
- package/dist/toArray.js +5 -0
- package/dist/unique.cjs +1 -0
- package/dist/unique.js +4 -0
- package/dist/url.cjs +1 -0
- package/dist/url.js +54 -0
- package/dist/worker.cjs +1 -0
- package/dist/worker.js +47 -0
- package/dist/xy-B4SvvNaG.cjs +1 -0
- package/dist/xy-H8aUVW_X.js +90 -0
- package/dist/xy.cjs +1 -0
- package/dist/xy.js +4 -0
- package/dist/zodutil.cjs +1 -0
- package/dist/zodutil.js +22 -0
- package/eslint.config.js +12 -0
- package/package.json +159 -15
- package/src/binary/encoder.spec.ts +31 -6
- package/src/binary/encoder.ts +26 -15
- package/src/binary/index.ts +1 -1
- package/src/{case.ts → caseconv/caseconv.ts} +4 -9
- package/src/caseconv/index.ts +10 -0
- package/src/change/change.ts +7 -6
- package/src/change/index.ts +1 -1
- package/src/{clamp.ts → clamp/clamp.ts} +1 -1
- package/src/clamp/index.ts +10 -0
- package/src/compare/compare.ts +6 -9
- package/src/compare/index.ts +1 -1
- package/src/control/control.ts +77 -0
- package/src/control/index.ts +1 -0
- package/src/debounce/debounce.spec.ts +52 -0
- package/src/{debounce.ts → debounce/debounce.ts} +4 -4
- package/src/debounce/index.ts +10 -0
- package/src/deep/copy.ts +2 -3
- package/src/deep/delete.spec.ts +2 -2
- package/src/deep/delete.ts +3 -2
- package/src/deep/difference.spec.ts +28 -27
- package/src/deep/difference.ts +13 -11
- package/src/deep/equal.spec.ts +4 -4
- package/src/deep/equal.ts +5 -5
- package/src/deep/external.ts +4 -5
- package/src/deep/index.ts +1 -1
- package/src/deep/merge.spec.ts +120 -4
- package/src/deep/merge.ts +50 -6
- package/src/deep/partial.ts +1 -1
- package/src/deep/path.spec.ts +90 -39
- package/src/deep/path.ts +105 -46
- package/src/destructor.ts +2 -2
- package/src/identity.ts +1 -1
- package/src/index.ts +23 -21
- package/src/invert.ts +9 -0
- package/src/join.ts +1 -1
- package/src/kv/index.ts +1 -1
- package/src/kv/types.ts +1 -1
- package/src/math/index.ts +10 -0
- package/src/math/math.ts +33 -0
- package/src/migrate/index.ts +9 -0
- package/src/migrate/migrate.spec.ts +12 -2
- package/src/migrate/migrate.ts +9 -0
- package/src/mock/MockGLBufferController.ts +6 -6
- package/src/mock/index.ts +1 -1
- package/src/observe/index.ts +1 -1
- package/src/observe/observe.ts +37 -6
- package/src/observe/obsever.spec.ts +56 -0
- package/src/optional.ts +3 -4
- package/src/primitive.ts +1 -1
- package/src/record.ts +10 -6
- package/src/renderable.ts +1 -1
- package/src/runtime/detect.ts +3 -3
- package/src/runtime/external.ts +1 -1
- package/src/runtime/index.ts +1 -1
- package/src/runtime/os.ts +17 -5
- package/src/search.ts +3 -1
- package/src/shallowCopy.ts +5 -6
- package/src/spatial/base.ts +13 -5
- package/src/spatial/bounds/bounds.spec.ts +259 -180
- package/src/spatial/bounds/bounds.ts +200 -85
- package/src/spatial/bounds/index.ts +2 -2
- package/src/spatial/box/box.spec.ts +163 -2
- package/src/spatial/box/box.ts +82 -38
- package/src/spatial/box/index.ts +2 -2
- package/src/spatial/dimensions/dimensions.spec.ts +1 -1
- package/src/spatial/dimensions/dimensions.ts +4 -4
- package/src/spatial/dimensions/index.ts +2 -2
- package/src/spatial/direction/direction.spec.ts +1 -1
- package/src/spatial/direction/direction.ts +5 -5
- package/src/spatial/direction/index.ts +2 -2
- package/src/spatial/external.ts +3 -3
- package/src/spatial/index.ts +1 -1
- package/src/spatial/location/index.ts +2 -2
- package/src/spatial/location/location.spec.ts +1 -1
- package/src/spatial/location/location.ts +21 -21
- package/src/spatial/position/index.ts +1 -1
- package/src/spatial/position/position.spec.ts +1 -1
- package/src/spatial/position/position.ts +3 -20
- package/src/spatial/scale/index.ts +2 -2
- package/src/spatial/scale/scale.spec.ts +3 -3
- package/src/spatial/scale/scale.ts +3 -3
- package/src/spatial/spatial.ts +5 -5
- package/src/spatial/xy/index.ts +2 -2
- package/src/spatial/xy/xy.spec.ts +93 -44
- package/src/spatial/xy/xy.ts +17 -25
- package/src/telem/generate.ts +1 -1
- package/src/telem/gl.ts +1 -1
- package/src/telem/index.ts +2 -2
- package/src/telem/series.spec.ts +64 -5
- package/src/telem/series.ts +47 -35
- package/src/telem/telem.spec.ts +105 -2
- package/src/telem/telem.ts +63 -23
- package/src/toArray.ts +2 -2
- package/src/transform.ts +9 -2
- package/src/unique.ts +1 -1
- package/src/url/index.ts +2 -2
- package/src/url/url.spec.ts +2 -2
- package/src/url/url.ts +4 -4
- package/src/worker/index.ts +10 -0
- package/src/worker/worker.spec.ts +2 -2
- package/src/worker/worker.ts +13 -13
- package/src/zodutil/index.ts +10 -0
- package/src/zodutil/zodutil.spec.ts +103 -0
- package/src/zodutil/zodutil.ts +45 -0
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.ts +39 -3
- package/.eslintrc.cjs +0 -18
- package/dist/binary/encoder.d.ts.map +0 -1
- package/dist/binary/encoder.spec.d.ts.map +0 -1
- package/dist/binary/index.d.ts.map +0 -1
- package/dist/case.d.ts +0 -6
- package/dist/case.d.ts.map +0 -1
- package/dist/change/change.d.ts.map +0 -1
- package/dist/change/index.d.ts.map +0 -1
- package/dist/clamp.d.ts.map +0 -1
- package/dist/compare/compare.d.ts.map +0 -1
- package/dist/compare/index.d.ts.map +0 -1
- package/dist/debounce.d.ts.map +0 -1
- package/dist/deep/copy.d.ts.map +0 -1
- package/dist/deep/delete.d.ts.map +0 -1
- package/dist/deep/difference.d.ts.map +0 -1
- package/dist/deep/difference.spec.d.ts.map +0 -1
- package/dist/deep/equal.d.ts.map +0 -1
- package/dist/deep/external.d.ts.map +0 -1
- package/dist/deep/index.d.ts.map +0 -1
- package/dist/deep/memo.d.ts +0 -2
- package/dist/deep/memo.d.ts.map +0 -1
- package/dist/deep/merge.d.ts +0 -3
- package/dist/deep/merge.d.ts.map +0 -1
- package/dist/deep/partial.d.ts.map +0 -1
- package/dist/deep/path.d.ts +0 -37
- package/dist/deep/path.d.ts.map +0 -1
- package/dist/destructor.d.ts.map +0 -1
- package/dist/identity.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/invert.d.ts.map +0 -1
- package/dist/join.d.ts.map +0 -1
- package/dist/kv/index.d.ts.map +0 -1
- package/dist/kv/types.d.ts.map +0 -1
- package/dist/migrate/index.d.ts.map +0 -1
- package/dist/migrate/migrate.d.ts.map +0 -1
- package/dist/migrate/migrate.spec.d.ts.map +0 -1
- package/dist/mock/MockGLBufferController.d.ts.map +0 -1
- package/dist/mock/index.d.ts.map +0 -1
- package/dist/observe/index.d.ts.map +0 -1
- package/dist/observe/observe.d.ts +0 -12
- package/dist/observe/observe.d.ts.map +0 -1
- package/dist/optional.d.ts.map +0 -1
- package/dist/primitive.d.ts.map +0 -1
- package/dist/record.d.ts.map +0 -1
- package/dist/renderable.d.ts.map +0 -1
- package/dist/runtime/detect.d.ts.map +0 -1
- package/dist/runtime/external.d.ts.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/os.d.ts +0 -10
- package/dist/runtime/os.d.ts.map +0 -1
- package/dist/search.d.ts.map +0 -1
- package/dist/shallowCopy.d.ts +0 -2
- package/dist/shallowCopy.d.ts.map +0 -1
- package/dist/spatial/base.d.ts.map +0 -1
- package/dist/spatial/bounds/bounds.d.ts +0 -71
- package/dist/spatial/bounds/bounds.d.ts.map +0 -1
- package/dist/spatial/bounds/bounds.spec.d.ts.map +0 -1
- package/dist/spatial/bounds/index.d.ts.map +0 -1
- package/dist/spatial/box/box.d.ts.map +0 -1
- package/dist/spatial/box/box.spec.d.ts.map +0 -1
- package/dist/spatial/box/index.d.ts.map +0 -1
- package/dist/spatial/dimensions/dimensions.d.ts.map +0 -1
- package/dist/spatial/dimensions/dimensions.spec.d.ts.map +0 -1
- package/dist/spatial/dimensions/index.d.ts.map +0 -1
- package/dist/spatial/direction/direction.d.ts.map +0 -1
- package/dist/spatial/direction/direction.spec.d.ts.map +0 -1
- package/dist/spatial/direction/index.d.ts.map +0 -1
- package/dist/spatial/external.d.ts.map +0 -1
- package/dist/spatial/index.d.ts.map +0 -1
- package/dist/spatial/location/index.d.ts.map +0 -1
- package/dist/spatial/location/location.d.ts.map +0 -1
- package/dist/spatial/location/location.spec.d.ts.map +0 -1
- package/dist/spatial/position/index.d.ts.map +0 -1
- package/dist/spatial/position/position.d.ts.map +0 -1
- package/dist/spatial/position/position.spec.d.ts.map +0 -1
- package/dist/spatial/scale/index.d.ts.map +0 -1
- package/dist/spatial/scale/scale.d.ts.map +0 -1
- package/dist/spatial/scale/scale.spec.d.ts.map +0 -1
- package/dist/spatial/spatial.d.ts +0 -2
- package/dist/spatial/spatial.d.ts.map +0 -1
- package/dist/spatial/xy/index.d.ts.map +0 -1
- package/dist/spatial/xy/xy.d.ts.map +0 -1
- package/dist/telem/generate.d.ts +0 -3
- package/dist/telem/generate.d.ts.map +0 -1
- package/dist/telem/gl.d.ts.map +0 -1
- package/dist/telem/index.d.ts.map +0 -1
- package/dist/telem/series.d.ts.map +0 -1
- package/dist/telem/telem.d.ts.map +0 -1
- package/dist/toArray.d.ts.map +0 -1
- package/dist/transform.d.ts +0 -2
- package/dist/transform.d.ts.map +0 -1
- package/dist/unique.d.ts.map +0 -1
- package/dist/url/index.d.ts +0 -2
- package/dist/url/index.d.ts.map +0 -1
- package/dist/url/url.d.ts.map +0 -1
- package/dist/worker/worker.d.ts.map +0 -1
- package/dist/worker/worker.spec.d.ts.map +0 -1
- package/dist/x.cjs +0 -12
- package/dist/x.cjs.map +0 -1
- package/dist/x.js +0 -5935
- package/dist/x.js.map +0 -1
- package/src/deep/memo.ts +0 -24
- /package/dist/{binary → src/binary}/encoder.spec.d.ts +0 -0
- /package/dist/{binary → src/binary}/index.d.ts +0 -0
- /package/dist/{change → src/change}/index.d.ts +0 -0
- /package/dist/{clamp.d.ts → src/clamp/clamp.d.ts} +0 -0
- /package/dist/{compare → src/compare}/index.d.ts +0 -0
- /package/dist/{debounce.d.ts → src/debounce/debounce.d.ts} +0 -0
- /package/dist/{deep → src/deep}/copy.d.ts +0 -0
- /package/dist/{deep → src/deep}/delete.spec.d.ts +0 -0
- /package/dist/{deep → src/deep}/difference.d.ts +0 -0
- /package/dist/{deep → src/deep}/difference.spec.d.ts +0 -0
- /package/dist/{deep → src/deep}/equal.d.ts +0 -0
- /package/dist/{deep → src/deep}/equal.spec.d.ts +0 -0
- /package/dist/{deep → src/deep}/index.d.ts +0 -0
- /package/dist/{deep → src/deep}/merge.spec.d.ts +0 -0
- /package/dist/{deep → src/deep}/partial.d.ts +0 -0
- /package/dist/{deep → src/deep}/path.spec.d.ts +0 -0
- /package/dist/{destructor.d.ts → src/destructor.d.ts} +0 -0
- /package/dist/{invert.d.ts → src/invert.d.ts} +0 -0
- /package/dist/{join.d.ts → src/join.d.ts} +0 -0
- /package/dist/{kv → src/kv}/index.d.ts +0 -0
- /package/dist/{kv → src/kv}/types.d.ts +0 -0
- /package/dist/{migrate → src/migrate}/index.d.ts +0 -0
- /package/dist/{migrate → src/migrate}/migrate.spec.d.ts +0 -0
- /package/dist/{mock → src/mock}/index.d.ts +0 -0
- /package/dist/{observe → src/observe}/index.d.ts +0 -0
- /package/dist/{optional.d.ts → src/optional.d.ts} +0 -0
- /package/dist/{runtime → src/runtime}/detect.d.ts +0 -0
- /package/dist/{runtime → src/runtime}/external.d.ts +0 -0
- /package/dist/{runtime → src/runtime}/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/bounds/bounds.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/bounds/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/box/box.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/box/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/dimensions/dimensions.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/dimensions/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/direction/direction.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/direction/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/location/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/location/location.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/position/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/position/position.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/scale/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/scale/scale.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/xy/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/xy/xy.spec.d.ts +0 -0
- /package/dist/{telem → src/telem}/gl.d.ts +0 -0
- /package/dist/{telem → src/telem}/series.spec.d.ts +0 -0
- /package/dist/{telem → src/telem}/telem.spec.d.ts +0 -0
- /package/dist/{toArray.d.ts → src/toArray.d.ts} +0 -0
- /package/dist/{unique.d.ts → src/unique.d.ts} +0 -0
- /package/dist/{url → src/url}/url.d.ts +0 -0
- /package/dist/{url → src/url}/url.spec.d.ts +0 -0
- /package/dist/{worker → src/worker}/worker.spec.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
});
|
package/src/spatial/xy/xy.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
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
|
-
|
|
16
|
-
xy,
|
|
16
|
+
type Direction,
|
|
17
17
|
type NumberCouple,
|
|
18
|
-
|
|
19
|
-
type XY,
|
|
18
|
+
numberCouple,
|
|
20
19
|
signedDimensions,
|
|
21
|
-
type
|
|
20
|
+
type XY,
|
|
21
|
+
xy,
|
|
22
22
|
} from "@/spatial/base";
|
|
23
23
|
|
|
24
|
-
export {
|
|
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)) };
|
package/src/telem/generate.ts
CHANGED
package/src/telem/gl.ts
CHANGED
package/src/telem/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
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";
|
package/src/telem/series.spec.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
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
|
|
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 {
|
|
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
|
-
|
|
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
|
});
|
package/src/telem/series.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
22
|
+
isTelemValue,
|
|
23
|
+
type NumericTelemValue,
|
|
21
24
|
type Rate,
|
|
22
25
|
Size,
|
|
23
|
-
TimeRange,
|
|
24
|
-
TimeStamp,
|
|
25
|
-
type CrudeDataType,
|
|
26
26
|
type TelemValue,
|
|
27
|
-
|
|
27
|
+
TimeRange,
|
|
28
28
|
TimeSpan,
|
|
29
|
-
|
|
30
|
-
type
|
|
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?:
|
|
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:
|
|
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 =
|
|
138
|
+
alignment = 0n,
|
|
138
139
|
key = nanoid(),
|
|
139
140
|
} = props;
|
|
140
141
|
const { data } = props;
|
|
141
142
|
|
|
142
|
-
if (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.
|
|
150
|
-
this.
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
153
|
-
this.
|
|
154
|
-
this.
|
|
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(
|
|
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
|
-
|
|
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
|
|
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:
|
|
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> {
|