@synnaxlabs/x 0.42.3 → 0.43.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 +93 -105
- package/.vscode/settings.json +4 -6
- package/README.md +1 -7
- package/dist/array.cjs +1 -0
- package/dist/array.js +7 -0
- package/dist/base-B5lQIJKc.js +38 -0
- package/dist/base-CTq-lhpU.cjs +1 -0
- package/dist/binary.cjs +1 -1
- package/dist/binary.js +1 -1
- package/dist/bounds.cjs +1 -1
- package/dist/bounds.js +2 -2
- 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.cjs +1 -1
- package/dist/change.js +10 -2
- package/dist/compare.cjs +1 -1
- package/dist/compare.js +1 -1
- package/dist/deep.cjs +1 -1
- package/dist/deep.js +92 -79
- package/dist/dimensions.cjs +1 -1
- package/dist/dimensions.js +41 -2
- package/dist/direction.cjs +1 -1
- package/dist/direction.js +1 -1
- package/dist/index-4GlOgZuh.js +99 -0
- package/dist/{direction-C-b6XTeU.cjs → index-B58dnYRu.cjs} +1 -1
- package/dist/index-BMGaoK93.cjs +1 -0
- package/dist/index-BTet04Hd.cjs +6 -0
- package/dist/{scale-DfJe9755.js → index-BUa-NXAX.js} +46 -46
- package/dist/{xy-D_LqxaGt.js → index-C-qYOegc.js} +62 -62
- package/dist/index-C07SBJhr.js +128 -0
- package/dist/{bounds-Bn5_l4Z3.js → index-C9EdKeu1.js} +77 -76
- package/dist/index-CM8ZDZ6s.cjs +1 -0
- package/dist/index-CV2JaHfw.cjs +1 -0
- package/dist/index-CeBvOwG8.cjs +3 -0
- package/dist/index-ClrGyGDp.js +205 -0
- package/dist/index-CqQXXeCI.cjs +1 -0
- package/dist/{location-C3aeu046.js → index-D6V-8SKw.js} +26 -26
- package/dist/index-DBGAIs_7.js +2492 -0
- package/dist/index-DEdq2tza.cjs +1 -0
- package/dist/index-DKMnHBGR.cjs +1 -0
- package/dist/index-Dql5FMcH.js +47 -0
- package/dist/{direction-BL0PhD1k.js → index-DxU1zwsd.js} +1 -1
- package/dist/index-WwMnwoLy.cjs +1 -0
- package/dist/index.cjs +5 -3
- package/dist/index.js +5372 -650
- package/dist/kv.cjs +1 -1
- package/dist/kv.js +45 -2
- package/dist/location.cjs +1 -1
- package/dist/location.js +1 -1
- package/dist/position.cjs +1 -1
- package/dist/position.js +83 -2
- package/dist/record.cjs +1 -1
- package/dist/record.js +8 -10
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +27 -2
- package/dist/scale.cjs +1 -1
- package/dist/scale.js +1 -1
- package/dist/schemas-55Usj0Fg.js +3998 -0
- package/dist/schemas-DbXuI2Qr.cjs +27 -0
- package/dist/spatial.cjs +1 -1
- package/dist/spatial.js +25 -18
- package/dist/src/array/index.d.ts +2 -0
- package/dist/src/array/index.d.ts.map +1 -0
- package/dist/src/array/toArray.d.ts +19 -0
- package/dist/src/array/toArray.d.ts.map +1 -0
- package/dist/src/array/toArray.spec.d.ts +2 -0
- package/dist/src/array/toArray.spec.d.ts.map +1 -0
- package/dist/src/binary/codec.d.ts +8 -16
- package/dist/src/binary/codec.d.ts.map +1 -1
- package/dist/src/breaker/breaker.d.ts +6 -6
- package/dist/src/breaker/breaker.d.ts.map +1 -1
- package/dist/src/caseconv/caseconv.d.ts +1 -1
- package/dist/src/caseconv/caseconv.d.ts.map +1 -1
- package/dist/src/change/change.d.ts +3 -3
- package/dist/src/change/change.d.ts.map +1 -1
- package/dist/src/color/color.d.ts +61 -37
- package/dist/src/color/color.d.ts.map +1 -1
- package/dist/src/color/external.d.ts +0 -1
- package/dist/src/color/external.d.ts.map +1 -1
- package/dist/src/color/gradient.d.ts +7 -7
- package/dist/src/color/gradient.d.ts.map +1 -1
- package/dist/src/color/palette.d.ts +10 -10
- 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 +32 -32
- package/dist/src/control/control.d.ts.map +1 -1
- package/dist/src/debounce/debounce.d.ts +1 -1
- package/dist/src/debounce/debounce.d.ts.map +1 -1
- package/dist/src/deep/delete.d.ts +1 -1
- package/dist/src/deep/delete.d.ts.map +1 -1
- package/dist/src/deep/difference.d.ts.map +1 -1
- package/dist/src/deep/equal.d.ts +4 -4
- package/dist/src/deep/equal.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/errors/errors.d.ts +62 -36
- package/dist/src/errors/errors.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/instance/index.d.ts +2 -0
- package/dist/src/instance/index.d.ts.map +1 -0
- package/dist/src/instance/matcher.d.ts +79 -0
- package/dist/src/instance/matcher.d.ts.map +1 -0
- package/dist/src/instance/matcher.spec.d.ts +2 -0
- package/dist/src/instance/matcher.spec.d.ts.map +1 -0
- package/dist/src/jsonrpc/jsonrpc.d.ts +40 -9
- package/dist/src/jsonrpc/jsonrpc.d.ts.map +1 -1
- package/dist/src/kv/types.d.ts +2 -2
- package/dist/src/kv/types.d.ts.map +1 -1
- package/dist/src/migrate/migrate.d.ts +5 -5
- 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/primitive/index.d.ts +2 -0
- package/dist/src/primitive/index.d.ts.map +1 -0
- package/dist/src/primitive/primitive.d.ts +39 -0
- package/dist/src/primitive/primitive.d.ts.map +1 -0
- package/dist/src/primitive/primitive.spec.d.ts +2 -0
- package/dist/src/primitive/primitive.spec.d.ts.map +1 -0
- package/dist/src/record.d.ts +2 -2
- package/dist/src/record.d.ts.map +1 -1
- package/dist/src/renderable.d.ts +1 -1
- package/dist/src/renderable.d.ts.map +1 -1
- package/dist/src/replace.d.ts.map +1 -1
- package/dist/src/runtime/detect.d.ts.map +1 -1
- 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 +10 -10
- package/dist/src/spatial/base.d.ts.map +1 -1
- package/dist/src/spatial/bounds/bounds.d.ts +82 -16
- package/dist/src/spatial/bounds/bounds.d.ts.map +1 -1
- package/dist/src/spatial/box/box.d.ts +7 -7
- package/dist/src/spatial/box/box.d.ts.map +1 -1
- package/dist/src/spatial/dimensions/dimensions.d.ts +5 -5
- package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -1
- package/dist/src/spatial/direction/direction.d.ts +1 -1
- package/dist/src/spatial/location/location.d.ts +4 -4
- package/dist/src/spatial/location/location.d.ts.map +1 -1
- package/dist/src/spatial/scale/scale.d.ts +11 -11
- package/dist/src/spatial/scale/scale.d.ts.map +1 -1
- package/dist/src/spatial/xy/xy.d.ts +5 -5
- package/dist/src/spatial/xy/xy.d.ts.map +1 -1
- package/dist/src/status/index.d.ts +2 -0
- package/dist/src/status/index.d.ts.map +1 -0
- package/dist/src/status/types.d.ts +11 -0
- package/dist/src/status/types.d.ts.map +1 -0
- package/dist/src/sync/index.d.ts.map +1 -1
- package/dist/src/sync/mutex.d.ts +0 -1
- package/dist/src/sync/mutex.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 +468 -62
- package/dist/src/telem/series.d.ts.map +1 -1
- package/dist/src/telem/telem.d.ts +243 -53
- package/dist/src/telem/telem.d.ts.map +1 -1
- package/dist/src/uuid/index.d.ts +2 -0
- package/dist/src/uuid/index.d.ts.map +1 -0
- package/dist/src/uuid/uuid.d.ts +35 -0
- package/dist/src/uuid/uuid.d.ts.map +1 -0
- package/dist/src/uuid/uuid.spec.d.ts +2 -0
- package/dist/src/uuid/uuid.spec.d.ts.map +1 -0
- package/dist/src/zod/external.d.ts +1 -1
- package/dist/src/zod/external.d.ts.map +1 -1
- package/dist/src/zod/nullToUndefined.d.ts +3 -0
- package/dist/src/zod/nullToUndefined.d.ts.map +1 -0
- package/dist/src/zod/nullToUndefined.spec.d.ts +2 -0
- package/dist/src/zod/nullToUndefined.spec.d.ts.map +1 -0
- package/dist/src/zod/util.d.ts +2 -2
- package/dist/src/zod/util.d.ts.map +1 -1
- package/dist/telem.cjs +1 -1
- package/dist/telem.js +1 -1
- package/dist/xy.cjs +1 -1
- package/dist/xy.js +1 -1
- package/dist/zod.cjs +1 -1
- package/dist/zod.js +19 -2
- package/eslint.config.js +1 -1
- package/package.json +17 -15
- package/src/{toArray.ts → array/index.ts} +1 -5
- package/src/array/toArray.spec.ts +56 -0
- package/src/array/toArray.ts +28 -0
- package/src/binary/codec.spec.ts +201 -278
- package/src/binary/codec.ts +20 -76
- package/src/breaker/breaker.ts +3 -3
- package/src/caseconv/caseconv.ts +6 -4
- package/src/change/change.ts +2 -2
- package/src/color/color.spec.ts +113 -2
- package/src/color/color.ts +89 -59
- package/src/color/external.ts +0 -1
- package/src/color/gradient.ts +20 -28
- package/src/color/palette.ts +1 -1
- package/src/compare/compare.ts +5 -5
- package/src/control/control.ts +22 -19
- package/src/debounce/debounce.ts +1 -1
- package/src/deep/delete.ts +5 -4
- package/src/deep/difference.ts +6 -2
- package/src/deep/equal.spec.ts +1 -1
- package/src/deep/equal.ts +5 -5
- package/src/deep/merge.spec.ts +13 -1
- package/src/deep/merge.ts +16 -7
- package/src/deep/path.ts +1 -1
- package/src/errors/errors.ts +65 -44
- package/src/index.ts +4 -1
- package/src/instance/index.ts +10 -0
- package/src/instance/matcher.spec.ts +78 -0
- package/src/instance/matcher.ts +98 -0
- package/src/jsonrpc/jsonrpc.spec.ts +2 -1
- package/src/jsonrpc/jsonrpc.ts +36 -7
- package/src/kv/types.ts +1 -1
- package/src/migrate/migrate.spec.ts +1 -1
- package/src/migrate/migrate.ts +7 -7
- package/src/notation/notation.ts +1 -1
- package/src/primitive/index.ts +10 -0
- package/src/primitive/primitive.spec.ts +126 -0
- package/src/primitive/primitive.ts +82 -0
- package/src/record.ts +3 -5
- package/src/renderable.ts +1 -1
- package/src/replace.ts +9 -0
- package/src/runtime/detect.ts +0 -2
- package/src/runtime/os.ts +1 -1
- package/src/spatial/base.ts +1 -1
- package/src/spatial/bounds/bounds.spec.ts +20 -0
- package/src/spatial/bounds/bounds.ts +101 -18
- package/src/spatial/box/box.ts +1 -1
- package/src/spatial/dimensions/dimensions.ts +3 -3
- package/src/spatial/location/location.ts +1 -1
- package/src/spatial/scale/scale.ts +1 -1
- package/src/spatial/xy/xy.ts +1 -1
- package/src/status/index.ts +10 -0
- package/src/status/types.ts +22 -0
- package/src/sync/index.ts +9 -0
- package/src/sync/mutex.ts +9 -4
- package/src/telem/gl.ts +1 -1
- package/src/telem/series.spec.ts +735 -68
- package/src/telem/series.ts +536 -195
- package/src/telem/telem.spec.ts +60 -7
- package/src/telem/telem.ts +287 -95
- package/src/uuid/index.ts +10 -0
- package/src/uuid/uuid.spec.ts +82 -0
- package/src/uuid/uuid.ts +48 -0
- package/src/zod/external.ts +1 -1
- package/src/zod/nullToUndefined.spec.ts +31 -0
- package/src/zod/nullToUndefined.ts +23 -0
- package/src/zod/util.spec.ts +1 -1
- package/src/zod/util.ts +6 -6
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +1 -1
- package/dist/base-BAM2mqCy.cjs +0 -1
- package/dist/base-DFq0vvGn.js +0 -38
- package/dist/bounds-BQo7rvs9.cjs +0 -1
- package/dist/box-0YrQibkB.cjs +0 -1
- package/dist/box-Cc8IzcNo.js +0 -205
- package/dist/change-C-YELKx6.cjs +0 -1
- package/dist/change-DLl6DccR.js +0 -12
- package/dist/dimensions-CRgergMS.js +0 -43
- package/dist/dimensions-D2QGoNXO.cjs +0 -1
- package/dist/external-BPgtxa8d.js +0 -29
- package/dist/external-C-dNgNQw.cjs +0 -1
- package/dist/external-C8TFju8Q.js +0 -29
- package/dist/external-DWQITF5_.cjs +0 -1
- package/dist/external-DqPrWKvU.js +0 -47
- package/dist/external-uXk0Avrg.cjs +0 -1
- package/dist/index-BywOGO8U.js +0 -1074
- package/dist/index-CYYjI7Uf.cjs +0 -1
- package/dist/index-C_6NXBlg.cjs +0 -3
- package/dist/index-Dd8DLyMx.cjs +0 -1
- package/dist/index-DizUWH6z.js +0 -47
- package/dist/index-QGplUHuy.js +0 -98
- package/dist/location-BGl5Ddds.cjs +0 -1
- package/dist/position-Cai5-wi1.cjs +0 -1
- package/dist/position-DIglP1l2.js +0 -85
- package/dist/scale-BtZINJ-A.cjs +0 -1
- package/dist/series-B9JERcqi.js +0 -1977
- package/dist/series-DqJ6f97G.cjs +0 -11
- package/dist/spatial-BSWPzMkK.js +0 -11
- package/dist/spatial-DGpZ2sO3.cjs +0 -1
- package/dist/src/color/transformColorsToHex.d.ts +0 -6
- package/dist/src/color/transformColorsToHex.d.ts.map +0 -1
- package/dist/src/primitive.d.ts +0 -9
- package/dist/src/primitive.d.ts.map +0 -1
- package/dist/src/toArray.d.ts +0 -3
- package/dist/src/toArray.d.ts.map +0 -1
- package/dist/src/zod/integer.d.ts +0 -10
- package/dist/src/zod/integer.d.ts.map +0 -1
- package/dist/src/zod/integer.spec.d.ts +0 -2
- package/dist/src/zod/integer.spec.d.ts.map +0 -1
- package/dist/toArray.cjs +0 -1
- package/dist/toArray.js +0 -5
- package/dist/xy-B7065J2S.cjs +0 -1
- package/src/color/transformColorsToHex.ts +0 -30
- package/src/primitive.ts +0 -46
- package/src/zod/integer.spec.ts +0 -148
- package/src/zod/integer.ts +0 -38
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { instance } from '../instance';
|
|
2
3
|
import { math } from '../math';
|
|
3
4
|
import { bounds } from '../spatial';
|
|
4
5
|
import { GLBufferController, GLBufferUsage } from './gl';
|
|
5
|
-
import { CrudeDataType, DataType,
|
|
6
|
-
|
|
6
|
+
import { CrudeDataType, DataType, Size, TelemValue, TimeRange, TimeStamp, TypedArray } from './telem';
|
|
7
|
+
interface IterableIterator<T> extends Iterator<T>, Iterable<T> {
|
|
7
8
|
}
|
|
9
|
+
/** A condensed set of information describing the layout of a series. */
|
|
8
10
|
export interface SeriesDigest {
|
|
9
11
|
key: string;
|
|
10
12
|
dataType: string;
|
|
@@ -17,7 +19,7 @@ export interface SeriesDigest {
|
|
|
17
19
|
length: number;
|
|
18
20
|
capacity: number;
|
|
19
21
|
}
|
|
20
|
-
interface
|
|
22
|
+
interface BaseSeriesArgs {
|
|
21
23
|
dataType?: CrudeDataType;
|
|
22
24
|
timeRange?: TimeRange;
|
|
23
25
|
sampleOffset?: math.Numeric;
|
|
@@ -25,33 +27,38 @@ interface BaseSeriesProps {
|
|
|
25
27
|
alignment?: bigint;
|
|
26
28
|
key?: string;
|
|
27
29
|
}
|
|
30
|
+
/** A value or set of values that a series can be constructed from. */
|
|
28
31
|
export type CrudeSeries = Series | ArrayBuffer | TypedArray | string[] | number[] | boolean[] | unknown[] | TimeStamp[] | Date[] | TelemValue;
|
|
29
|
-
|
|
30
|
-
export interface
|
|
32
|
+
/** Arguments for constructing a {@link Series}. */
|
|
33
|
+
export interface SeriesArgs extends BaseSeriesArgs {
|
|
31
34
|
data?: CrudeSeries | null;
|
|
32
35
|
}
|
|
33
|
-
|
|
36
|
+
/** Arguments for allocating a {@link Series} with a given capacity and data type. */
|
|
37
|
+
export interface SeriesAllocArgs extends BaseSeriesArgs {
|
|
34
38
|
capacity: number;
|
|
35
39
|
dataType: CrudeDataType;
|
|
36
40
|
}
|
|
37
|
-
export interface SeriesMemInfo {
|
|
38
|
-
key: string;
|
|
39
|
-
length: number;
|
|
40
|
-
byteLength: Size;
|
|
41
|
-
glBuffer: boolean;
|
|
42
|
-
}
|
|
43
41
|
/**
|
|
44
42
|
* Series is a strongly typed array of telemetry samples backed by an underlying binary
|
|
45
43
|
* buffer.
|
|
46
44
|
*/
|
|
47
|
-
export declare class Series<T extends TelemValue = TelemValue> {
|
|
45
|
+
export declare class Series<T extends TelemValue = TelemValue> implements instance.Discriminated {
|
|
46
|
+
/**
|
|
47
|
+
* A unique identifier for the series. If specified by the user, it is their
|
|
48
|
+
* responsibility to ensure that it is unique. If not specified, a new ID will be
|
|
49
|
+
* generated.
|
|
50
|
+
*/
|
|
48
51
|
key: string;
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
/**
|
|
53
|
+
* A discriminator used for identifying instances of the series class even
|
|
54
|
+
* when bundlers mangle the class name.
|
|
55
|
+
*/
|
|
56
|
+
discriminator: string;
|
|
57
|
+
/** The data type of the series. */
|
|
51
58
|
readonly dataType: DataType;
|
|
52
59
|
/**
|
|
53
60
|
* A sample offset that can be used to shift the values of all samples upwards or
|
|
54
|
-
* downwards.
|
|
61
|
+
* downwards. Useful to convert series to lower precision data types while preserving
|
|
55
62
|
* the relative range of actual values.
|
|
56
63
|
*/
|
|
57
64
|
sampleOffset: math.Numeric;
|
|
@@ -61,81 +68,188 @@ export declare class Series<T extends TelemValue = TelemValue> {
|
|
|
61
68
|
private readonly gl;
|
|
62
69
|
/** The underlying data. */
|
|
63
70
|
private readonly _data;
|
|
71
|
+
/** The time range occupied by the series' data. */
|
|
64
72
|
readonly timeRange: TimeRange;
|
|
73
|
+
/**
|
|
74
|
+
* Alignment defines the location of the series relative to other series in a logical
|
|
75
|
+
* group. Useful for defining the position of the series within a channel's data.
|
|
76
|
+
*/
|
|
65
77
|
readonly alignment: bigint;
|
|
66
78
|
/** A cached minimum value. */
|
|
67
|
-
private
|
|
79
|
+
private cachedMin?;
|
|
68
80
|
/** A cached maximum value. */
|
|
69
|
-
private
|
|
81
|
+
private cachedMax?;
|
|
70
82
|
/** The write position of the buffer. */
|
|
71
83
|
private writePos;
|
|
72
84
|
/** Tracks the number of entities currently using this array. */
|
|
73
85
|
private _refCount;
|
|
74
86
|
/** Caches the length of the array for variable length data types. */
|
|
75
|
-
private
|
|
87
|
+
private cachedLength?;
|
|
76
88
|
/** Caches the indexes of the array for variable length data types. */
|
|
77
89
|
private _cachedIndexes?;
|
|
90
|
+
/**
|
|
91
|
+
* A zod schema that can be used to validate that a particular value
|
|
92
|
+
* can be constructed into a series.
|
|
93
|
+
*/
|
|
78
94
|
static readonly crudeZ: z.ZodObject<{
|
|
79
95
|
timeRange: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
80
96
|
start: z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
81
97
|
value: z.ZodBigInt;
|
|
82
|
-
},
|
|
98
|
+
}, z.core.$strip>, z.ZodTransform<TimeStamp, {
|
|
83
99
|
value: bigint;
|
|
84
|
-
}>>, z.ZodPipe<z.ZodString, z.ZodTransform<TimeStamp, string>>, z.ZodPipe<z.ZodCustom<Number,
|
|
100
|
+
}>>, z.ZodPipe<z.ZodString, z.ZodTransform<TimeStamp, string>>, z.ZodPipe<z.ZodCustom<Number, Number>, z.ZodTransform<TimeStamp, Number>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<TimeStamp, number>>, z.ZodCustom<TimeStamp, TimeStamp>]>;
|
|
85
101
|
end: z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
86
102
|
value: z.ZodBigInt;
|
|
87
|
-
},
|
|
103
|
+
}, z.core.$strip>, z.ZodTransform<TimeStamp, {
|
|
88
104
|
value: bigint;
|
|
89
|
-
}>>, z.ZodPipe<z.ZodString, z.ZodTransform<TimeStamp, string>>, z.ZodPipe<z.ZodCustom<Number,
|
|
90
|
-
},
|
|
105
|
+
}>>, z.ZodPipe<z.ZodString, z.ZodTransform<TimeStamp, string>>, z.ZodPipe<z.ZodCustom<Number, Number>, z.ZodTransform<TimeStamp, Number>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<TimeStamp, number>>, z.ZodCustom<TimeStamp, TimeStamp>]>;
|
|
106
|
+
}, z.core.$strip>, z.ZodTransform<TimeRange, {
|
|
91
107
|
start: TimeStamp;
|
|
92
108
|
end: TimeStamp;
|
|
93
|
-
}>>, z.ZodCustom<TimeRange,
|
|
94
|
-
dataType: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DataType, string>>, z.ZodCustom<DataType,
|
|
95
|
-
alignment: z.ZodOptional<z.
|
|
96
|
-
data: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<ArrayBuffer, string>>, z.ZodPipe<z.ZodUnion<readonly [z.ZodNull, z.ZodUndefined]>, z.ZodTransform<ArrayBuffer, null | undefined>>, z.ZodCustom<ArrayBuffer,
|
|
109
|
+
}>>, z.ZodCustom<TimeRange, TimeRange>]>>;
|
|
110
|
+
dataType: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DataType, string>>, z.ZodCustom<DataType, DataType>]>;
|
|
111
|
+
alignment: z.ZodOptional<z.ZodCoercedBigInt<unknown>>;
|
|
112
|
+
data: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<ArrayBuffer, string>>, z.ZodPipe<z.ZodUnion<readonly [z.ZodNull, z.ZodUndefined]>, z.ZodTransform<ArrayBuffer, null | undefined>>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
|
|
97
113
|
glBufferUsage: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
98
114
|
static: "static";
|
|
99
115
|
dynamic: "dynamic";
|
|
100
116
|
}>>>>;
|
|
101
|
-
},
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
/**
|
|
119
|
+
* A zod schema that validates and constructs a series from it's crude
|
|
120
|
+
* representation.
|
|
121
|
+
*/
|
|
102
122
|
static readonly z: z.ZodPipe<z.ZodObject<{
|
|
103
123
|
timeRange: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
104
124
|
start: z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
105
125
|
value: z.ZodBigInt;
|
|
106
|
-
},
|
|
126
|
+
}, z.core.$strip>, z.ZodTransform<TimeStamp, {
|
|
107
127
|
value: bigint;
|
|
108
|
-
}>>, z.ZodPipe<z.ZodString, z.ZodTransform<TimeStamp, string>>, z.ZodPipe<z.ZodCustom<Number,
|
|
128
|
+
}>>, z.ZodPipe<z.ZodString, z.ZodTransform<TimeStamp, string>>, z.ZodPipe<z.ZodCustom<Number, Number>, z.ZodTransform<TimeStamp, Number>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<TimeStamp, number>>, z.ZodCustom<TimeStamp, TimeStamp>]>;
|
|
109
129
|
end: z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
110
130
|
value: z.ZodBigInt;
|
|
111
|
-
},
|
|
131
|
+
}, z.core.$strip>, z.ZodTransform<TimeStamp, {
|
|
112
132
|
value: bigint;
|
|
113
|
-
}>>, z.ZodPipe<z.ZodString, z.ZodTransform<TimeStamp, string>>, z.ZodPipe<z.ZodCustom<Number,
|
|
114
|
-
},
|
|
133
|
+
}>>, z.ZodPipe<z.ZodString, z.ZodTransform<TimeStamp, string>>, z.ZodPipe<z.ZodCustom<Number, Number>, z.ZodTransform<TimeStamp, Number>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<TimeStamp, number>>, z.ZodCustom<TimeStamp, TimeStamp>]>;
|
|
134
|
+
}, z.core.$strip>, z.ZodTransform<TimeRange, {
|
|
115
135
|
start: TimeStamp;
|
|
116
136
|
end: TimeStamp;
|
|
117
|
-
}>>, z.ZodCustom<TimeRange,
|
|
118
|
-
dataType: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DataType, string>>, z.ZodCustom<DataType,
|
|
119
|
-
alignment: z.ZodOptional<z.
|
|
120
|
-
data: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<ArrayBuffer, string>>, z.ZodPipe<z.ZodUnion<readonly [z.ZodNull, z.ZodUndefined]>, z.ZodTransform<ArrayBuffer, null | undefined>>, z.ZodCustom<ArrayBuffer,
|
|
137
|
+
}>>, z.ZodCustom<TimeRange, TimeRange>]>>;
|
|
138
|
+
dataType: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DataType, string>>, z.ZodCustom<DataType, DataType>]>;
|
|
139
|
+
alignment: z.ZodOptional<z.ZodCoercedBigInt<unknown>>;
|
|
140
|
+
data: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<ArrayBuffer, string>>, z.ZodPipe<z.ZodUnion<readonly [z.ZodNull, z.ZodUndefined]>, z.ZodTransform<ArrayBuffer, null | undefined>>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
|
|
121
141
|
glBufferUsage: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
122
142
|
static: "static";
|
|
123
143
|
dynamic: "dynamic";
|
|
124
144
|
}>>>>;
|
|
125
|
-
},
|
|
126
|
-
alignment?: bigint | undefined;
|
|
127
|
-
timeRange?: TimeRange | undefined;
|
|
128
|
-
glBufferUsage?: "static" | "dynamic" | undefined;
|
|
145
|
+
}, z.core.$strip>, z.ZodTransform<Series<TelemValue>, {
|
|
129
146
|
dataType: DataType;
|
|
130
147
|
data: ArrayBuffer | Uint8Array<ArrayBuffer>;
|
|
148
|
+
timeRange?: TimeRange | undefined;
|
|
149
|
+
alignment?: bigint | undefined;
|
|
150
|
+
glBufferUsage?: "static" | "dynamic" | undefined;
|
|
131
151
|
}>>;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
152
|
+
/**
|
|
153
|
+
* The Series constructor accepts either a SeriesArgs object or a CrudeSeries value.
|
|
154
|
+
*
|
|
155
|
+
* SeriesArgs interface properties:
|
|
156
|
+
* @property {CrudeSeries | null} [data] - The data to construct the series from. Can be:
|
|
157
|
+
* - A typed array (e.g. Float32Array, Int32Array)
|
|
158
|
+
* - A JS array of numbers, strings, or objects
|
|
159
|
+
* - A single value (number, string, bigint, etc.)
|
|
160
|
+
* - An ArrayBuffer
|
|
161
|
+
* - Another Series instance
|
|
162
|
+
* @property {CrudeDataType} [dataType] - The data type of the series. If not provided,
|
|
163
|
+
* will be inferred from the data. Required when constructing from an ArrayBuffer, or
|
|
164
|
+
* an empty JS array.
|
|
165
|
+
* @property {TimeRange} [timeRange] - The time range occupied by the series' data.
|
|
166
|
+
* Defaults to TimeRange.ZERO.
|
|
167
|
+
* @property {math.Numeric} [sampleOffset] - An offset to apply to each sample value.
|
|
168
|
+
* Useful for converting arrays to lower precision while preserving relative range.
|
|
169
|
+
* Defaults to 0.
|
|
170
|
+
* @property {GLBufferUsage} [glBufferUsage] - The WebGL buffer usage hint. Can be
|
|
171
|
+
* "static" or "dynamic". Defaults to "static".
|
|
172
|
+
* @property {bigint} [alignment] - The logical position of the series relative to other
|
|
173
|
+
* series in a group. Defaults to 0n.
|
|
174
|
+
* @property {string} [key] - A unique identifier for the series. If not provided,
|
|
175
|
+
* a new ID will be generated.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* // Create a series from a typed array
|
|
179
|
+
* const s1 = new Series(new Float32Array([1, 2, 3]));
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* // Create a series from a JS array with explicit data type
|
|
183
|
+
* const s2 = new Series({ data: [1, 2, 3], dataType: DataType.FLOAT32 });
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* // Create a series from a single value (data type inferred)
|
|
187
|
+
* const s3 = new Series(1); // Creates a FLOAT64 series
|
|
188
|
+
* const s4 = new Series("abc"); // Creates a STRING series
|
|
189
|
+
* const s5 = new Series(1n); // Creates an INT64 series
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* // Create a series from objects (automatically uses JSON data type)
|
|
193
|
+
* const s6 = new Series([{ a: 1, b: "apple" }]);
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* // Create a series with time range and alignment
|
|
197
|
+
* const s7 = new Series({
|
|
198
|
+
* data: new Float32Array([1, 2, 3]),
|
|
199
|
+
* timeRange: new TimeRange(1, 2),
|
|
200
|
+
* alignment: 1n
|
|
201
|
+
* });
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* // Create a series from another series (copies properties)
|
|
205
|
+
* const s8 = new Series(s1);
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* // Create a series with sample offset
|
|
209
|
+
* const s9 = new Series({
|
|
210
|
+
* data: new Float32Array([1, 2, 3]),
|
|
211
|
+
* sampleOffset: 2
|
|
212
|
+
* }); // Values will be 3, 4, 5
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* // Create a series with WebGL buffer usage
|
|
216
|
+
* const s10 = new Series({
|
|
217
|
+
* data: new Float32Array([1, 2, 3]),
|
|
218
|
+
* glBufferUsage: "dynamic"
|
|
219
|
+
* });
|
|
220
|
+
*
|
|
221
|
+
* @throws Error if constructing from an empty JS array without specifying data type
|
|
222
|
+
* @throws Error if constructing from an ArrayBuffer without specifying data type
|
|
223
|
+
* @throws Error if data type cannot be inferred from input
|
|
224
|
+
*/
|
|
225
|
+
constructor(props: SeriesArgs | CrudeSeries);
|
|
226
|
+
/**
|
|
227
|
+
* Allocates a new series with a given capacity and data type.
|
|
228
|
+
* @param args.capacity the capacity of the series in samples. If the data type is of
|
|
229
|
+
* variable density (i.e. JSON, STRING, BYTES), this is the capacity in bytes.
|
|
230
|
+
* @param args.dataType the data type of the series.
|
|
231
|
+
* @param args.rest the rest of the arguments to pass to the series constructor.
|
|
232
|
+
*/
|
|
233
|
+
static alloc({ capacity, dataType, ...rest }: SeriesAllocArgs): Series;
|
|
234
|
+
/**
|
|
235
|
+
* @returns the number of references to this series i.e. the number of times this
|
|
236
|
+
* series has been acquired (by calling acquire) and not released (by calling
|
|
237
|
+
* release).
|
|
238
|
+
*/
|
|
135
239
|
get refCount(): number;
|
|
136
|
-
|
|
137
|
-
|
|
240
|
+
/**
|
|
241
|
+
* Acquires a reference to this series, optionally buffering its data into the
|
|
242
|
+
* specified buffer controller. This method is useful for managing the life span
|
|
243
|
+
* of series buffered to the GPU.
|
|
244
|
+
* @param gl the buffer controller to buffer the series to. If not provided, the series
|
|
245
|
+
* will not be buffered to the GPU.
|
|
246
|
+
*/
|
|
138
247
|
acquire(gl?: GLBufferController): void;
|
|
248
|
+
/**
|
|
249
|
+
* Releases a reference to this series. If the reference count to the series reaches
|
|
250
|
+
* 0 and the series has been buffered to the GPU, the series will be deleted from
|
|
251
|
+
* the GPU.
|
|
252
|
+
*/
|
|
139
253
|
release(): void;
|
|
140
254
|
/**
|
|
141
255
|
* Writes the given series to this series. If the series being written exceeds the
|
|
@@ -152,18 +266,54 @@ export declare class Series<T extends TelemValue = TelemValue> {
|
|
|
152
266
|
/** @returns the underlying buffer backing this array. */
|
|
153
267
|
get buffer(): ArrayBuffer;
|
|
154
268
|
private get underlyingData();
|
|
155
|
-
/**
|
|
269
|
+
/**
|
|
270
|
+
* Returns a native JS typed array with the proper data type.
|
|
271
|
+
* If the series is not full, returns a view of the data up to the write position.
|
|
272
|
+
* @returns A typed array containing the series data.
|
|
273
|
+
*/
|
|
156
274
|
get data(): TypedArray;
|
|
275
|
+
/**
|
|
276
|
+
* Returns an array of the values in the series as strings.
|
|
277
|
+
* For variable length data types (like STRING or JSON), this decodes the underlying buffer.
|
|
278
|
+
* @returns An array of string representations of the series values.
|
|
279
|
+
*/
|
|
157
280
|
toStrings(): string[];
|
|
281
|
+
/**
|
|
282
|
+
* Returns a parsed array of UUIDs from the series.
|
|
283
|
+
* @throws Error if the series does not have a data type of UUID.
|
|
284
|
+
* @returns An array of UUID strings.
|
|
285
|
+
*/
|
|
158
286
|
toUUIDs(): string[];
|
|
159
|
-
|
|
160
|
-
|
|
287
|
+
/**
|
|
288
|
+
* Parses a JSON series into an array of values using the provided zod schema.
|
|
289
|
+
* @template Z The zod schema type.
|
|
290
|
+
* @param schema The zod schema to use to parse the JSON series.
|
|
291
|
+
* @throws Error if the series does not have a data type of JSON.
|
|
292
|
+
* @returns An array of values parsed from the JSON series.
|
|
293
|
+
*/
|
|
294
|
+
parseJSON<Z extends z.ZodType>(schema: Z): Array<z.infer<Z>>;
|
|
295
|
+
/**
|
|
296
|
+
* Returns the capacity of the series in bytes.
|
|
297
|
+
* @returns The size of the underlying buffer in bytes.
|
|
298
|
+
*/
|
|
161
299
|
get byteCapacity(): Size;
|
|
162
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* Returns the capacity of the series in samples.
|
|
302
|
+
* For variable length data types, this is the capacity in bytes.
|
|
303
|
+
* @returns The number of samples that can be stored in the series.
|
|
304
|
+
*/
|
|
163
305
|
get capacity(): number;
|
|
164
|
-
/**
|
|
306
|
+
/**
|
|
307
|
+
* Returns the length of the series in bytes.
|
|
308
|
+
* For variable length data types, this is the actual number of bytes used.
|
|
309
|
+
* @returns The size of the data in bytes.
|
|
310
|
+
*/
|
|
165
311
|
get byteLength(): Size;
|
|
166
|
-
/**
|
|
312
|
+
/**
|
|
313
|
+
* Returns the number of samples in this array.
|
|
314
|
+
* For variable length data types, this is calculated by counting newlines.
|
|
315
|
+
* @returns The number of samples in the series.
|
|
316
|
+
*/
|
|
167
317
|
get length(): number;
|
|
168
318
|
private calculateCachedLength;
|
|
169
319
|
/**
|
|
@@ -179,17 +329,37 @@ export declare class Series<T extends TelemValue = TelemValue> {
|
|
|
179
329
|
private calcRawMax;
|
|
180
330
|
/** @returns the maximum value in the array */
|
|
181
331
|
get max(): math.Numeric;
|
|
332
|
+
private calcMax;
|
|
182
333
|
private calcRawMin;
|
|
183
334
|
/** @returns the minimum value in the array */
|
|
184
335
|
get min(): math.Numeric;
|
|
185
|
-
|
|
336
|
+
private calcMin;
|
|
337
|
+
/** @returns the bounds of the series. */
|
|
186
338
|
get bounds(): bounds.Bounds;
|
|
187
339
|
private maybeRecomputeMinMax;
|
|
188
|
-
|
|
189
|
-
|
|
340
|
+
/**
|
|
341
|
+
* @returns the value at the given alignment.
|
|
342
|
+
* @param alignment the alignment to get the value at.
|
|
343
|
+
* @param required throws an error if the value is not found.
|
|
344
|
+
*/
|
|
190
345
|
atAlignment(alignment: bigint, required: true): T;
|
|
346
|
+
/**
|
|
347
|
+
* @returns the value at the given alignment.
|
|
348
|
+
* @param alignment the alignment to get the value at.
|
|
349
|
+
* @param required throws an error if the value is not found.
|
|
350
|
+
*/
|
|
191
351
|
atAlignment(alignment: bigint, required?: false): T | undefined;
|
|
352
|
+
/**
|
|
353
|
+
* @returns the value at the given index.
|
|
354
|
+
* @param index the index to get the value at.
|
|
355
|
+
* @param required throws an error if the value is not found.
|
|
356
|
+
*/
|
|
192
357
|
at(index: number, required: true): T;
|
|
358
|
+
/**
|
|
359
|
+
* @returns the value at the given index.
|
|
360
|
+
* @param index the index to get the value at.
|
|
361
|
+
* @param required throws an error if the value is not found.
|
|
362
|
+
*/
|
|
193
363
|
at(index: number, required?: false): T | undefined;
|
|
194
364
|
private atVariable;
|
|
195
365
|
/**
|
|
@@ -198,54 +368,290 @@ export declare class Series<T extends TelemValue = TelemValue> {
|
|
|
198
368
|
* @param value the value to search for.
|
|
199
369
|
*/
|
|
200
370
|
binarySearch(value: math.Numeric): number;
|
|
371
|
+
/**
|
|
372
|
+
* Updates the WebGL buffer for the series if it is not up to date. This method
|
|
373
|
+
* should be called whenever a series has been previously buffered to the GPU and
|
|
374
|
+
* then modified via calls to write().
|
|
375
|
+
* @param gl the buffer controller to update the buffer for. This controller should
|
|
376
|
+
* be the same buffer previously passed to {@method acquire} or {@method updateGLBuffer}.
|
|
377
|
+
*/
|
|
201
378
|
updateGLBuffer(gl: GLBufferController): void;
|
|
379
|
+
/**
|
|
380
|
+
* Reinterprets the series as containing strings as its JS primitive type.
|
|
381
|
+
* @throws if the series does not have a data type of STRING or JSON.
|
|
382
|
+
*/
|
|
202
383
|
as(jsType: "string"): Series<string>;
|
|
384
|
+
/**
|
|
385
|
+
* Reinterprets the series as containing numbers as its JS primitive type.
|
|
386
|
+
* @throws if the series does not have a numeric data type.
|
|
387
|
+
*/
|
|
203
388
|
as(jsType: "number"): Series<number>;
|
|
389
|
+
/**
|
|
390
|
+
* Reinterprets the series as containing bigints as its JS primitive type.
|
|
391
|
+
* @throws if the series does not have a data type that requires bigints i.e.
|
|
392
|
+
* INT64 and UINT64.
|
|
393
|
+
*/
|
|
204
394
|
as(jsType: "bigint"): Series<bigint>;
|
|
395
|
+
/** @returns a digest containing information about the series. */
|
|
205
396
|
get digest(): SeriesDigest;
|
|
206
|
-
|
|
397
|
+
/**
|
|
398
|
+
* @returns the alignment bounds of the series, representing the logical space
|
|
399
|
+
* occupied by the series in a group of series. This is typically used to order the
|
|
400
|
+
* series within a channel's data.
|
|
401
|
+
*
|
|
402
|
+
* The lower bound is the alignment of the first sample, and the upper bound is the
|
|
403
|
+
* alignment of the last sample + 1. The lower bound is inclusive, while the upper bound
|
|
404
|
+
* is exclusive.
|
|
405
|
+
*/
|
|
207
406
|
get alignmentBounds(): bounds.Bounds<bigint>;
|
|
208
407
|
private maybeGarbageCollectGLBuffer;
|
|
408
|
+
/**
|
|
409
|
+
* @returns the WebGL buffer for the series. This method should only be called after
|
|
410
|
+
* the series has been buffered to the GPU via a call to {@method acquire} or
|
|
411
|
+
* {@method updateGLBuffer}.
|
|
412
|
+
* @throws if the series has not been buffered to the GPU.
|
|
413
|
+
*/
|
|
209
414
|
get glBuffer(): WebGLBuffer;
|
|
210
415
|
[Symbol.iterator](): Iterator<T>;
|
|
416
|
+
/**
|
|
417
|
+
* Returns a slice of the series from start to end.
|
|
418
|
+
* @param start The start index (inclusive).
|
|
419
|
+
* @param end The end index (exclusive).
|
|
420
|
+
* @returns A new series containing the sliced data.
|
|
421
|
+
*/
|
|
211
422
|
slice(start: number, end?: number): Series;
|
|
423
|
+
/**
|
|
424
|
+
* Returns a subarray view of the series from start to end.
|
|
425
|
+
* @param start The start index (inclusive).
|
|
426
|
+
* @param end The end index (exclusive).
|
|
427
|
+
* @returns A new series containing the subarray data.
|
|
428
|
+
*/
|
|
212
429
|
sub(start: number, end?: number): Series;
|
|
213
|
-
|
|
214
|
-
|
|
430
|
+
/**
|
|
431
|
+
* Returns an iterator over a portion of the series.
|
|
432
|
+
* @param start The start index (inclusive).
|
|
433
|
+
* @param end The end index (exclusive).
|
|
434
|
+
* @returns An iterator over the specified range.
|
|
435
|
+
*/
|
|
436
|
+
subIterator(start: number, end?: number): Iterator<T>;
|
|
437
|
+
/**
|
|
438
|
+
* Returns an iterator over a portion of the series based on alignment.
|
|
439
|
+
* @param start The start alignment (inclusive).
|
|
440
|
+
* @param end The end alignment (exclusive).
|
|
441
|
+
* @returns An iterator over the specified alignment range.
|
|
442
|
+
*/
|
|
443
|
+
subAlignmentIterator(start: bigint, end: bigint): Iterator<T>;
|
|
215
444
|
private subBytes;
|
|
216
445
|
private sliceSub;
|
|
446
|
+
/**
|
|
447
|
+
* Creates a new series with a different alignment.
|
|
448
|
+
* @param alignment The new alignment value.
|
|
449
|
+
* @returns A new series with the specified alignment.
|
|
450
|
+
*/
|
|
217
451
|
reAlign(alignment: bigint): Series;
|
|
452
|
+
/**
|
|
453
|
+
* Returns a string representation of the series.
|
|
454
|
+
* For series with more than 10 elements, shows the first 5 and last 5 elements.
|
|
455
|
+
* @returns A string representation of the series.
|
|
456
|
+
*/
|
|
218
457
|
toString(): string;
|
|
219
458
|
}
|
|
459
|
+
/** @returns true if a Series can be constructed from the given value, and false otherwise. */
|
|
460
|
+
export declare const isCrudeSeries: (value: unknown) => value is CrudeSeries;
|
|
461
|
+
/**
|
|
462
|
+
* MultiSeries represents a collection of Series instances that share the same data type.
|
|
463
|
+
* It provides a unified interface for working with multiple series as if they were a single
|
|
464
|
+
* continuous series.
|
|
465
|
+
*
|
|
466
|
+
|
|
467
|
+
*/
|
|
220
468
|
export declare class MultiSeries<T extends TelemValue = TelemValue> implements Iterable<T> {
|
|
469
|
+
/** The array of series in this collection */
|
|
221
470
|
readonly series: Array<Series<T>>;
|
|
471
|
+
/**
|
|
472
|
+
* The MultiSeries constructor accepts an optional array of Series instances. All series
|
|
473
|
+
* in the collection must have the same data type.
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* // Create an empty MultiSeries
|
|
477
|
+
* const ms1 = new MultiSeries();
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* // Create a MultiSeries from multiple numeric series
|
|
481
|
+
* const s1 = new Series(new Float32Array([1, 2, 3]));
|
|
482
|
+
* const s2 = new Series(new Float32Array([4, 5, 6]));
|
|
483
|
+
* const ms2 = new MultiSeries([s1, s2]);
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* // Create a MultiSeries from string series
|
|
487
|
+
* const s3 = new Series(["apple", "banana"]);
|
|
488
|
+
* const s4 = new Series(["carrot", "date"]);
|
|
489
|
+
* const ms3 = new MultiSeries([s3, s4]);
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* // Create a MultiSeries from JSON series
|
|
493
|
+
* const s5 = new Series([{ a: 1, b: "apple" }]);
|
|
494
|
+
* const s6 = new Series([{ a: 2, b: "banana" }]);
|
|
495
|
+
* const ms4 = new MultiSeries([s5, s6]);
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* // Add series to an existing MultiSeries
|
|
499
|
+
* const ms5 = new MultiSeries();
|
|
500
|
+
* ms5.push(s1);
|
|
501
|
+
* ms5.push(s2);
|
|
502
|
+
*
|
|
503
|
+
* @example
|
|
504
|
+
* // Combine two MultiSeries
|
|
505
|
+
* const ms6 = new MultiSeries([s1]);
|
|
506
|
+
* const ms7 = new MultiSeries([s2]);
|
|
507
|
+
* ms6.push(ms7);
|
|
508
|
+
*
|
|
509
|
+
* @throws Error if attempting to add a series with a different data type
|
|
510
|
+
*/
|
|
222
511
|
constructor(series?: Array<Series<T>>);
|
|
512
|
+
/**
|
|
513
|
+
* Reinterprets the series as containing strings as its JS primitive type.
|
|
514
|
+
* @throws if the series does not have a data type of STRING or JSON.
|
|
515
|
+
*/
|
|
223
516
|
as(jsType: "string"): MultiSeries<string>;
|
|
517
|
+
/**
|
|
518
|
+
* Reinterprets the series as containing numbers as its JS primitive type.
|
|
519
|
+
* @throws if the series does not have a numeric data type.
|
|
520
|
+
*/
|
|
224
521
|
as(jsType: "number"): MultiSeries<number>;
|
|
522
|
+
/**
|
|
523
|
+
* Reinterprets the series as containing bigints as its JS primitive type.
|
|
524
|
+
* @throws if the series does not have a data type that requires bigints i.e.
|
|
525
|
+
* INT64 and UINT64.
|
|
526
|
+
*/
|
|
225
527
|
as(jsType: "bigint"): MultiSeries<bigint>;
|
|
528
|
+
/**
|
|
529
|
+
* Returns the data type of the series in this collection. If the collection is empty,
|
|
530
|
+
* returns DataType.UNKNOWN.
|
|
531
|
+
*/
|
|
226
532
|
get dataType(): DataType;
|
|
533
|
+
/**
|
|
534
|
+
* Returns the combined time range of all series in the collection. If the collection
|
|
535
|
+
* is empty, returns TimeRange.ZERO. The time range spans from the start of the first
|
|
536
|
+
* series to the end of the last series.
|
|
537
|
+
*/
|
|
227
538
|
get timeRange(): TimeRange;
|
|
539
|
+
/**
|
|
540
|
+
* Returns the alignment of the first series in the collection. If the collection is
|
|
541
|
+
* empty, returns 0n.
|
|
542
|
+
*/
|
|
228
543
|
get alignment(): bigint;
|
|
544
|
+
/**
|
|
545
|
+
* Returns the alignment bounds of the entire collection. The lower bound is the
|
|
546
|
+
* alignment of the first series, and the upper bound is the alignment of the last
|
|
547
|
+
* series + its length. If the collection is empty, returns bounds.construct(0n, 0n).
|
|
548
|
+
*/
|
|
229
549
|
get alignmentBounds(): bounds.Bounds<bigint>;
|
|
550
|
+
/**
|
|
551
|
+
* Adds a series or another MultiSeries to this collection.
|
|
552
|
+
* @param series - The series or MultiSeries to add. Must have the same data type
|
|
553
|
+
* as the existing series in this collection.
|
|
554
|
+
* @throws Error if the series being added has a different data type
|
|
555
|
+
*/
|
|
230
556
|
push(series: Series<T>): void;
|
|
231
557
|
push(series: MultiSeries<T>): void;
|
|
558
|
+
/**
|
|
559
|
+
* Returns the total length of all series in the collection.
|
|
560
|
+
* @returns The sum of the lengths of all series.
|
|
561
|
+
*/
|
|
232
562
|
get length(): number;
|
|
563
|
+
/**
|
|
564
|
+
* Returns the value at the specified alignment.
|
|
565
|
+
* @param alignment - The alignment to get the value at.
|
|
566
|
+
* @param required - If true, throws an error if the value is not found.
|
|
567
|
+
* @returns The value at the specified alignment, or undefined if not found.
|
|
568
|
+
* @throws Error if required is true and the value is not found.
|
|
569
|
+
*/
|
|
233
570
|
atAlignment(alignment: bigint, required: true): T;
|
|
234
571
|
atAlignment(alignment: bigint, required?: false): T | undefined;
|
|
572
|
+
/**
|
|
573
|
+
* Returns the value at the specified index.
|
|
574
|
+
* @param index - The index to get the value at.
|
|
575
|
+
* @param required - If true, throws an error if the value is not found.
|
|
576
|
+
* @returns The value at the specified index, or undefined if not found.
|
|
577
|
+
* @throws Error if required is true and the value is not found.
|
|
578
|
+
*/
|
|
235
579
|
at(index: number, required: true): T;
|
|
236
580
|
at(index: number, required?: false): T | undefined;
|
|
581
|
+
/**
|
|
582
|
+
* Returns an iterator over a portion of the multi-series.
|
|
583
|
+
* @param start - The start index (inclusive).
|
|
584
|
+
* @param end - The end index (exclusive).
|
|
585
|
+
* @returns An iterator over the specified range.
|
|
586
|
+
*/
|
|
237
587
|
subIterator(start: number, end?: number): IterableIterator<T>;
|
|
588
|
+
/**
|
|
589
|
+
* Returns an iterator over a portion of the multi-series based on alignment.
|
|
590
|
+
* @param start - The start alignment (inclusive).
|
|
591
|
+
* @param end - The end alignment (exclusive).
|
|
592
|
+
* @returns An iterator over the specified alignment range.
|
|
593
|
+
*/
|
|
238
594
|
subAlignmentIterator(start: bigint, end: bigint): IterableIterator<T>;
|
|
595
|
+
/**
|
|
596
|
+
* Returns an iterator over the specified alignment range and span.
|
|
597
|
+
* @param start - The start alignment (inclusive).
|
|
598
|
+
* @param span - The number of samples to include.
|
|
599
|
+
* @returns An iterator over the specified range.
|
|
600
|
+
*/
|
|
239
601
|
subAlignmentSpanIterator(start: bigint, span: number): IterableIterator<T>;
|
|
602
|
+
/**
|
|
603
|
+
* Updates the WebGL buffer for all series in the collection.
|
|
604
|
+
* @param gl - The WebGL buffer controller to use.
|
|
605
|
+
*/
|
|
240
606
|
updateGLBuffer(gl: GLBufferController): void;
|
|
607
|
+
/**
|
|
608
|
+
* Returns the bounds containing the minimum and maximum values across all series.
|
|
609
|
+
*/
|
|
241
610
|
get bounds(): bounds.Bounds;
|
|
611
|
+
/**
|
|
612
|
+
* Returns the sum of the byte lengths of all series.
|
|
613
|
+
*/
|
|
242
614
|
get byteLength(): Size;
|
|
615
|
+
/**
|
|
616
|
+
* Returns a combined typed array containing all data from all series.
|
|
617
|
+
* @returns A typed array containing all data from all series.
|
|
618
|
+
*/
|
|
243
619
|
get data(): TypedArray;
|
|
620
|
+
/**
|
|
621
|
+
* Traverses the alignment space by a given distance from a start point.
|
|
622
|
+
* @param start - The starting alignment.
|
|
623
|
+
* @param dist - The distance to traverse.
|
|
624
|
+
* @returns The resulting alignment after traversal.
|
|
625
|
+
*/
|
|
244
626
|
traverseAlignment(start: bigint, dist: bigint): bigint;
|
|
245
|
-
|
|
627
|
+
/**
|
|
628
|
+
* Acquires a reference to the WebGL buffer for all series.
|
|
629
|
+
* @param gl - Optional WebGL buffer controller to use.
|
|
630
|
+
*/
|
|
631
|
+
acquire(gl?: GLBufferController): void;
|
|
632
|
+
/**
|
|
633
|
+
* Releases the WebGL buffer reference for all series.
|
|
634
|
+
*/
|
|
246
635
|
release(): void;
|
|
636
|
+
/**
|
|
637
|
+
* Calculates the number of samples between two alignments in the multi-series.
|
|
638
|
+
* @param start - The starting alignment.
|
|
639
|
+
* @param end - The ending alignment.
|
|
640
|
+
* @returns The distance between the alignments.
|
|
641
|
+
*/
|
|
247
642
|
distance(start: bigint, end: bigint): bigint;
|
|
248
|
-
|
|
643
|
+
/**
|
|
644
|
+
* Parses a JSON multi-series into an array of values using the provided zod schema.
|
|
645
|
+
* @template Z - The zod schema type.
|
|
646
|
+
* @param schema - The zod schema to use to parse the JSON series.
|
|
647
|
+
* @throws Error if the series does not have a data type of JSON.
|
|
648
|
+
* @returns An array of values parsed from the JSON series.
|
|
649
|
+
*/
|
|
650
|
+
parseJSON<Z extends z.ZodType>(schema: Z): Array<z.infer<Z>>;
|
|
651
|
+
/**
|
|
652
|
+
* Returns an iterator over all values in the multi-series.
|
|
653
|
+
* @returns An iterator that yields all values from all series in sequence.
|
|
654
|
+
*/
|
|
249
655
|
[Symbol.iterator](): Iterator<T>;
|
|
250
656
|
}
|
|
251
657
|
interface AlignmentDigest {
|