@synnaxlabs/x 0.43.0 → 0.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +105 -93
- package/dist/base-BAM2mqCy.cjs +1 -0
- package/dist/base-DFq0vvGn.js +38 -0
- package/dist/binary.cjs +1 -1
- package/dist/binary.js +1 -1
- package/dist/bounds-D6e9xoHt.cjs +1 -0
- package/dist/bounds-Dj9nG39I.js +174 -0
- package/dist/bounds.cjs +1 -1
- package/dist/bounds.js +2 -2
- package/dist/box-CO_2_DGG.js +209 -0
- package/dist/box-Cxki783Y.cjs +1 -0
- package/dist/box.cjs +1 -1
- package/dist/box.js +1 -1
- package/dist/caseconv.cjs +1 -1
- package/dist/caseconv.js +2 -2
- package/dist/change-C-YELKx6.cjs +1 -0
- package/dist/change-DLl6DccR.js +12 -0
- package/dist/change.cjs +1 -1
- package/dist/change.js +2 -10
- package/dist/compare.cjs +1 -1
- package/dist/compare.js +1 -1
- package/dist/deep.cjs +1 -1
- package/dist/deep.js +95 -96
- package/dist/dimensions-CRgergMS.js +43 -0
- package/dist/dimensions-D2QGoNXO.cjs +1 -0
- package/dist/dimensions.cjs +1 -1
- package/dist/dimensions.js +2 -41
- package/dist/direction-386XDm2w.cjs +1 -0
- package/dist/{index-DxU1zwsd.js → direction-8etxfKaR.js} +4 -3
- package/dist/direction.cjs +1 -1
- package/dist/direction.js +1 -1
- package/dist/external-B9AAGv50.cjs +1 -0
- package/dist/external-BFgJjMcS.js +23 -0
- package/dist/external-BPgtxa8d.js +29 -0
- package/dist/external-BYuXBYJh.js +40 -0
- package/dist/external-mffsMzJx.cjs +1 -0
- package/dist/external-uXk0Avrg.cjs +1 -0
- package/dist/index-B1m2qvBT.cjs +1 -0
- package/dist/{index-4GlOgZuh.js → index-B5l_quQn.js} +35 -42
- package/dist/index-BQe8OIgm.cjs +3 -0
- package/dist/index-D2xcvEO5.js +46 -0
- package/dist/index-DdhM_E4k.cjs +1 -0
- package/dist/index-PNh31WTW.js +125 -0
- package/dist/index.cjs +3 -5
- package/dist/index.js +685 -5363
- package/dist/kv.cjs +1 -1
- package/dist/kv.js +2 -45
- package/dist/{index-D6V-8SKw.js → location-Ar5y2DX2.js} +26 -26
- package/dist/location-DZi8ftXp.cjs +1 -0
- package/dist/location.cjs +1 -1
- package/dist/location.js +1 -1
- package/dist/observe.cjs +1 -1
- package/dist/observe.js +16 -20
- package/dist/path-BXdMenka.js +101 -0
- package/dist/path-st_E5-LJ.cjs +1 -0
- package/dist/position-DSy2hONH.cjs +1 -0
- package/dist/position-PQ6op54I.js +85 -0
- package/dist/position.cjs +1 -1
- package/dist/position.js +2 -83
- package/dist/record-CAcQ5PNX.js +14 -0
- package/dist/record-YvCh7bzB.cjs +1 -0
- package/dist/record.cjs +1 -1
- package/dist/record.js +2 -8
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +2 -27
- package/dist/scale-C6qKDbRb.cjs +1 -0
- package/dist/{index-BUa-NXAX.js → scale-EWNUk-bn.js} +55 -59
- package/dist/scale.cjs +1 -1
- package/dist/scale.js +1 -1
- package/dist/{index-DBGAIs_7.js → series-Bn5y1tD1.js} +835 -759
- package/dist/series-CYAhDD6B.cjs +6 -0
- package/dist/spatial-BSWPzMkK.js +11 -0
- package/dist/spatial-DGpZ2sO3.cjs +1 -0
- package/dist/spatial.cjs +1 -1
- package/dist/spatial.js +18 -25
- package/dist/src/binary/codec.d.ts +1 -1
- package/dist/src/binary/codec.d.ts.map +1 -1
- package/dist/src/breaker/breaker.d.ts +2 -2
- package/dist/src/breaker/breaker.d.ts.map +1 -1
- package/dist/src/caseconv/caseconv.d.ts +0 -1
- package/dist/src/caseconv/caseconv.d.ts.map +1 -1
- package/dist/src/change/change.d.ts +1 -1
- package/dist/src/change/change.d.ts.map +1 -1
- package/dist/src/color/color.d.ts +2 -2
- package/dist/src/color/color.d.ts.map +1 -1
- package/dist/src/color/gradient.d.ts +1 -1
- package/dist/src/color/gradient.d.ts.map +1 -1
- package/dist/src/color/palette.d.ts +3 -3
- package/dist/src/color/palette.d.ts.map +1 -1
- package/dist/src/compare/compare.d.ts +4 -4
- package/dist/src/compare/compare.d.ts.map +1 -1
- package/dist/src/control/control.d.ts +9 -9
- package/dist/src/control/control.d.ts.map +1 -1
- package/dist/src/deep/merge.d.ts +1 -1
- package/dist/src/deep/merge.d.ts.map +1 -1
- package/dist/src/deep/path.d.ts +6 -6
- package/dist/src/deep/path.d.ts.map +1 -1
- package/dist/src/destructor.d.ts +6 -2
- package/dist/src/destructor.d.ts.map +1 -1
- package/dist/src/errors/errors.d.ts +5 -1
- package/dist/src/errors/errors.d.ts.map +1 -1
- package/dist/src/flush.d.ts +11 -0
- package/dist/src/flush.d.ts.map +1 -0
- package/dist/src/id/id.d.ts +1 -0
- package/dist/src/id/id.d.ts.map +1 -1
- package/dist/src/identity.d.ts +2 -2
- package/dist/src/identity.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/jsonrpc/jsonrpc.d.ts +1 -1
- package/dist/src/jsonrpc/jsonrpc.d.ts.map +1 -1
- package/dist/src/kv/types.d.ts +1 -1
- package/dist/src/kv/types.d.ts.map +1 -1
- package/dist/src/map/index.d.ts +2 -0
- package/dist/src/map/index.d.ts.map +1 -0
- package/dist/src/map/map.d.ts +2 -0
- package/dist/src/map/map.d.ts.map +1 -0
- package/dist/src/map/map.spec.d.ts +2 -0
- package/dist/src/map/map.spec.d.ts.map +1 -0
- package/dist/src/math/math.d.ts +2 -4
- package/dist/src/math/math.d.ts.map +1 -1
- package/dist/src/migrate/migrate.d.ts +1 -1
- package/dist/src/migrate/migrate.d.ts.map +1 -1
- package/dist/src/notation/notation.d.ts +1 -1
- package/dist/src/notation/notation.d.ts.map +1 -1
- package/dist/src/optional.d.ts +0 -3
- package/dist/src/optional.d.ts.map +1 -1
- package/dist/src/record/index.d.ts +2 -0
- package/dist/src/record/index.d.ts.map +1 -0
- package/dist/src/record/record.d.ts +90 -0
- package/dist/src/record/record.d.ts.map +1 -0
- package/dist/src/record/record.spec.d.ts.map +1 -0
- package/dist/src/runtime/os.d.ts +1 -1
- package/dist/src/runtime/os.d.ts.map +1 -1
- package/dist/src/spatial/base.d.ts +1 -1
- package/dist/src/spatial/base.d.ts.map +1 -1
- package/dist/src/spatial/box/box.d.ts +2 -1
- package/dist/src/spatial/box/box.d.ts.map +1 -1
- package/dist/src/spatial/dimensions/dimensions.d.ts +1 -1
- package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -1
- package/dist/src/spatial/direction/direction.d.ts +3 -3
- package/dist/src/spatial/direction/direction.d.ts.map +1 -1
- package/dist/src/spatial/location/location.d.ts +1 -1
- package/dist/src/spatial/location/location.d.ts.map +1 -1
- package/dist/src/spatial/scale/scale.d.ts +1 -1
- package/dist/src/spatial/scale/scale.d.ts.map +1 -1
- package/dist/src/spatial/xy/xy.d.ts +2 -1
- package/dist/src/spatial/xy/xy.d.ts.map +1 -1
- package/dist/src/status/index.d.ts +1 -1
- package/dist/src/status/index.d.ts.map +1 -1
- package/dist/src/status/status.d.ts +42 -0
- package/dist/src/status/status.d.ts.map +1 -0
- package/dist/src/status/status.spec.d.ts +2 -0
- package/dist/src/status/status.spec.d.ts.map +1 -0
- package/dist/src/strings/strings.d.ts +16 -0
- package/dist/src/strings/strings.d.ts.map +1 -1
- package/dist/src/telem/gl.d.ts +1 -1
- package/dist/src/telem/gl.d.ts.map +1 -1
- package/dist/src/telem/series.d.ts +17 -16
- package/dist/src/telem/series.d.ts.map +1 -1
- package/dist/src/telem/telem.d.ts +42 -19
- package/dist/src/telem/telem.d.ts.map +1 -1
- package/dist/src/testutil/testutil.d.ts +1 -0
- package/dist/src/testutil/testutil.d.ts.map +1 -1
- package/dist/src/testutil/testutil.spec.d.ts +2 -0
- package/dist/src/testutil/testutil.spec.d.ts.map +1 -0
- package/dist/src/zod/external.d.ts +1 -0
- package/dist/src/zod/external.d.ts.map +1 -1
- package/dist/src/zod/nullToUndefined.d.ts +1 -1
- package/dist/src/zod/nullToUndefined.d.ts.map +1 -1
- package/dist/src/zod/toArray.d.ts +3 -0
- package/dist/src/zod/toArray.d.ts.map +1 -0
- package/dist/src/zod/toArray.spec.d.ts +2 -0
- package/dist/src/zod/toArray.spec.d.ts.map +1 -0
- package/dist/src/zod/util.d.ts +1 -1
- package/dist/src/zod/util.d.ts.map +1 -1
- package/dist/telem.cjs +1 -1
- package/dist/telem.js +10 -11
- package/dist/url.cjs +1 -1
- package/dist/url.js +16 -19
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +18 -22
- package/dist/xy-CUE3QDNn.cjs +1 -0
- package/dist/{index-C-qYOegc.js → xy-C_-hb3Q2.js} +67 -62
- package/dist/xy.cjs +1 -1
- package/dist/xy.js +1 -1
- package/dist/zod.cjs +1 -1
- package/dist/zod.js +2 -19
- package/package.json +13 -18
- package/src/binary/codec.spec.ts +1 -1
- package/src/binary/codec.ts +1 -1
- package/src/breaker/breaker.ts +1 -1
- package/src/caseconv/caseconv.ts +10 -12
- package/src/change/change.ts +1 -1
- package/src/color/color.ts +1 -1
- package/src/color/gradient.ts +1 -1
- package/src/color/palette.ts +1 -1
- package/src/compare/compare.ts +5 -5
- package/src/control/control.ts +2 -2
- package/src/deep/merge.spec.ts +2 -15
- package/src/deep/merge.ts +1 -1
- package/src/deep/path.spec.ts +41 -0
- package/src/deep/path.ts +48 -17
- package/src/destructor.ts +6 -2
- package/src/errors/errors.spec.ts +20 -20
- package/src/errors/errors.ts +4 -1
- package/src/flush.ts +21 -0
- package/src/id/id.spec.ts +1 -1
- package/src/id/id.ts +3 -1
- package/src/identity.ts +2 -2
- package/src/index.ts +3 -1
- package/src/instance/matcher.spec.ts +7 -7
- package/src/jsonrpc/jsonrpc.ts +1 -1
- package/src/kv/types.ts +1 -1
- package/src/map/index.ts +10 -0
- package/src/map/map.spec.ts +132 -0
- package/src/map/map.ts +17 -0
- package/src/math/math.ts +19 -27
- package/src/migrate/migrate.spec.ts +2 -2
- package/src/migrate/migrate.ts +2 -2
- package/src/notation/notation.ts +1 -1
- package/src/optional.ts +0 -4
- package/src/primitive/primitive.spec.ts +1 -1
- package/src/record/index.ts +10 -0
- package/src/record/record.spec.ts +319 -0
- package/src/record/record.ts +118 -0
- package/src/runtime/os.ts +1 -1
- package/src/spatial/base.ts +1 -1
- package/src/spatial/box/box.ts +6 -1
- package/src/spatial/dimensions/dimensions.ts +1 -1
- package/src/spatial/direction/direction.ts +1 -1
- package/src/spatial/location/location.ts +1 -1
- package/src/spatial/scale/scale.ts +1 -1
- package/src/spatial/xy/xy.ts +6 -1
- package/src/status/index.ts +1 -1
- package/src/status/status.spec.ts +25 -0
- package/src/status/status.ts +91 -0
- package/src/strings/strings.spec.ts +51 -13
- package/src/strings/strings.ts +20 -0
- package/src/telem/gl.ts +1 -1
- package/src/telem/series.spec.ts +193 -53
- package/src/telem/series.ts +53 -18
- package/src/telem/telem.spec.ts +202 -83
- package/src/telem/telem.ts +53 -35
- package/src/testutil/testutil.spec.ts +161 -0
- package/src/testutil/testutil.ts +12 -0
- package/src/zod/external.ts +1 -0
- package/src/zod/nullToUndefined.spec.ts +1 -1
- package/src/zod/nullToUndefined.ts +1 -1
- package/src/zod/toArray.spec.ts +182 -0
- package/src/{status/types.ts → zod/toArray.ts} +3 -12
- package/src/zod/util.spec.ts +2 -2
- package/src/zod/util.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +1 -2
- package/dist/base-B5lQIJKc.js +0 -38
- package/dist/base-CTq-lhpU.cjs +0 -1
- package/dist/index-B58dnYRu.cjs +0 -1
- package/dist/index-BMGaoK93.cjs +0 -1
- package/dist/index-BTet04Hd.cjs +0 -6
- package/dist/index-C07SBJhr.js +0 -128
- package/dist/index-C9EdKeu1.js +0 -174
- package/dist/index-CM8ZDZ6s.cjs +0 -1
- package/dist/index-CV2JaHfw.cjs +0 -1
- package/dist/index-CeBvOwG8.cjs +0 -3
- package/dist/index-ClrGyGDp.js +0 -205
- package/dist/index-CqQXXeCI.cjs +0 -1
- package/dist/index-DEdq2tza.cjs +0 -1
- package/dist/index-DKMnHBGR.cjs +0 -1
- package/dist/index-Dql5FMcH.js +0 -47
- package/dist/index-WwMnwoLy.cjs +0 -1
- package/dist/path-1tZLZ4AN.cjs +0 -1
- package/dist/path-DD6ytXzr.js +0 -76
- package/dist/schemas-55Usj0Fg.js +0 -3998
- package/dist/schemas-DbXuI2Qr.cjs +0 -27
- package/dist/search.cjs +0 -1
- package/dist/search.js +0 -14
- package/dist/src/record.d.ts +0 -18
- package/dist/src/record.d.ts.map +0 -1
- package/dist/src/record.spec.d.ts.map +0 -1
- package/dist/src/search.d.ts +0 -18
- package/dist/src/search.d.ts.map +0 -1
- package/dist/src/status/types.d.ts +0 -11
- package/dist/src/status/types.d.ts.map +0 -1
- package/src/record.spec.ts +0 -38
- package/src/record.ts +0 -45
- package/src/search.ts +0 -42
- /package/dist/src/{record.spec.d.ts → record/record.spec.d.ts} +0 -0
package/src/telem/series.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
import { z } from "zod
|
|
10
|
+
import { z } from "zod";
|
|
11
11
|
|
|
12
12
|
import { binary } from "@/binary";
|
|
13
13
|
import { caseconv } from "@/caseconv";
|
|
@@ -118,8 +118,6 @@ const NEW_LINE = 10;
|
|
|
118
118
|
type JSType = "string" | "number" | "bigint";
|
|
119
119
|
|
|
120
120
|
const checkAsType = (jsType: JSType, dataType: DataType) => {
|
|
121
|
-
if (jsType === "string" && !dataType.isVariable)
|
|
122
|
-
throw new Error(`cannot convert series of type ${dataType.toString()} to string`);
|
|
123
121
|
if (jsType === "number" && !dataType.isNumeric)
|
|
124
122
|
throw new Error(`cannot convert series of type ${dataType.toString()} to number`);
|
|
125
123
|
if (jsType === "bigint" && !dataType.usesBigInt)
|
|
@@ -338,6 +336,8 @@ export class Series<T extends TelemValue = TelemValue>
|
|
|
338
336
|
} else this.dataType = new DataType(data);
|
|
339
337
|
|
|
340
338
|
if (!isArray && !isSingle) this._data = data as ArrayBuffer;
|
|
339
|
+
else if (isArray && data.length === 0)
|
|
340
|
+
this._data = new this.dataType.Array([]).buffer;
|
|
341
341
|
else {
|
|
342
342
|
let data_ = isSingle ? [data] : data;
|
|
343
343
|
const first = data_[0];
|
|
@@ -362,7 +362,7 @@ export class Series<T extends TelemValue = TelemValue>
|
|
|
362
362
|
).buffer;
|
|
363
363
|
else if (!this.dataType.usesBigInt && typeof first === "bigint")
|
|
364
364
|
this._data = new this.dataType.Array(
|
|
365
|
-
data_.map(
|
|
365
|
+
data_.map(Number) as number[] & bigint[],
|
|
366
366
|
).buffer;
|
|
367
367
|
else this._data = new this.dataType.Array(data_ as number[] & bigint[]).buffer;
|
|
368
368
|
}
|
|
@@ -507,19 +507,6 @@ export class Series<T extends TelemValue = TelemValue>
|
|
|
507
507
|
return Array.from(this).map((d) => d.toString());
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
/**
|
|
511
|
-
* Returns a parsed array of UUIDs from the series.
|
|
512
|
-
* @throws Error if the series does not have a data type of UUID.
|
|
513
|
-
* @returns An array of UUID strings.
|
|
514
|
-
*/
|
|
515
|
-
toUUIDs(): string[] {
|
|
516
|
-
if (!this.dataType.equals(DataType.UUID))
|
|
517
|
-
throw new Error("cannot convert non-uuid series to uuids");
|
|
518
|
-
const den = DataType.UUID.density.valueOf();
|
|
519
|
-
const d = new Uint8Array(this.underlyingData.buffer);
|
|
520
|
-
return Array.from({ length: this.length }, (_, i) => uuid.parse(d, i * den));
|
|
521
|
-
}
|
|
522
|
-
|
|
523
510
|
/**
|
|
524
511
|
* Parses a JSON series into an array of values using the provided zod schema.
|
|
525
512
|
* @template Z The zod schema type.
|
|
@@ -720,8 +707,9 @@ export class Series<T extends TelemValue = TelemValue>
|
|
|
720
707
|
*/
|
|
721
708
|
at(index: number, required?: false): T | undefined;
|
|
722
709
|
|
|
723
|
-
at(index: number, required
|
|
710
|
+
at(index: number, required: boolean = false): T | undefined {
|
|
724
711
|
if (this.dataType.isVariable) return this.atVariable(index, required ?? false);
|
|
712
|
+
if (this.dataType.equals(DataType.UUID)) return this.atUUID(index, required) as T;
|
|
725
713
|
if (index < 0) index = this.length + index;
|
|
726
714
|
const v = this.data[index];
|
|
727
715
|
if (v == null) {
|
|
@@ -731,6 +719,18 @@ export class Series<T extends TelemValue = TelemValue>
|
|
|
731
719
|
return addSamples(v, this.sampleOffset) as T;
|
|
732
720
|
}
|
|
733
721
|
|
|
722
|
+
private atUUID(index: number, required: boolean): string | undefined {
|
|
723
|
+
if (index < 0) index = this.length + index;
|
|
724
|
+
const uuidString = uuid.parse(
|
|
725
|
+
new Uint8Array(this.buffer, index * this.dataType.density.valueOf()),
|
|
726
|
+
);
|
|
727
|
+
if (uuidString == null) {
|
|
728
|
+
if (required) throw new Error(`[series] - no value at index ${index}`);
|
|
729
|
+
return undefined;
|
|
730
|
+
}
|
|
731
|
+
return uuidString;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
734
|
private atVariable(index: number, required: boolean): T | undefined {
|
|
735
735
|
let start = 0;
|
|
736
736
|
let end = 0;
|
|
@@ -903,6 +903,9 @@ export class Series<T extends TelemValue = TelemValue>
|
|
|
903
903
|
return new JSONSeriesIterator(s) as Iterator<T>;
|
|
904
904
|
return s as Iterator<T>;
|
|
905
905
|
}
|
|
906
|
+
if (this.dataType.equals(DataType.UUID))
|
|
907
|
+
return new UUIDSeriesIterator(this) as Iterator<T>;
|
|
908
|
+
|
|
906
909
|
return new FixedSeriesIterator(this) as Iterator<T>;
|
|
907
910
|
}
|
|
908
911
|
|
|
@@ -1094,6 +1097,29 @@ class JSONSeriesIterator implements Iterator<unknown> {
|
|
|
1094
1097
|
}
|
|
1095
1098
|
}
|
|
1096
1099
|
|
|
1100
|
+
class UUIDSeriesIterator implements Iterator<string> {
|
|
1101
|
+
private readonly series: Series;
|
|
1102
|
+
private index: number;
|
|
1103
|
+
private readonly data: Uint8Array;
|
|
1104
|
+
private readonly density: number;
|
|
1105
|
+
|
|
1106
|
+
constructor(series: Series) {
|
|
1107
|
+
if (!series.dataType.equals(DataType.UUID))
|
|
1108
|
+
throw new Error("cannot create a UUID series iterator for a non-UUID series");
|
|
1109
|
+
this.series = series;
|
|
1110
|
+
this.index = 0;
|
|
1111
|
+
this.data = new Uint8Array(series.buffer);
|
|
1112
|
+
this.density = DataType.UUID.density.valueOf();
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
next(): IteratorResult<string> {
|
|
1116
|
+
if (this.index >= this.series.length) return { done: true, value: undefined };
|
|
1117
|
+
const uuidString = uuid.parse(this.data, this.index * this.density);
|
|
1118
|
+
this.index++;
|
|
1119
|
+
return { done: false, value: uuidString };
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1097
1123
|
class FixedSeriesIterator implements Iterator<math.Numeric> {
|
|
1098
1124
|
series: Series;
|
|
1099
1125
|
index: number;
|
|
@@ -1472,6 +1498,15 @@ export class MultiSeries<T extends TelemValue = TelemValue> implements Iterable<
|
|
|
1472
1498
|
};
|
|
1473
1499
|
return new MultiSeriesIterator<T>(this.series);
|
|
1474
1500
|
}
|
|
1501
|
+
|
|
1502
|
+
/**
|
|
1503
|
+
* Returns an array of the values in the multi-series as strings.
|
|
1504
|
+
* For variable length data types (like STRING or JSON), this decodes the underlying buffer.
|
|
1505
|
+
* @returns An array of string representations of the multi-series values.
|
|
1506
|
+
*/
|
|
1507
|
+
toStrings(): string[] {
|
|
1508
|
+
return this.series.flatMap((s) => s.toStrings());
|
|
1509
|
+
}
|
|
1475
1510
|
}
|
|
1476
1511
|
|
|
1477
1512
|
class MultiSeriesIterator<T extends TelemValue = TelemValue> implements Iterator<T> {
|