@synnaxlabs/x 0.14.2 → 0.15.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @synnaxlabs/x@0.14.2 build /home/runner/work/synnax/synnax/x/ts
2
+ > @synnaxlabs/x@0.15.0 build /home/runner/work/synnax/synnax/x/ts
3
3
  > tsc --noEmit && vite build
4
4
 
5
5
  vite v5.1.2 building for production...
@@ -10,8 +10,8 @@ rendering chunks...
10
10
  
11
11
  [vite:dts] Start generate declaration files...
12
12
  computing gzip size...
13
- dist/x.js 213.15 kB │ gzip: 49.72 kB │ map: 639.91 kB
14
- [vite:dts] Declaration files built in 3061ms.
13
+ dist/x.js 217.59 kB │ gzip: 50.60 kB │ map: 651.51 kB
14
+ [vite:dts] Declaration files built in 3123ms.
15
15
  
16
- dist/x.cjs 140.09 kB │ gzip: 39.81 kB │ map: 619.46 kB
17
- ✓ built in 3.99s
16
+ dist/x.cjs 143.43 kB │ gzip: 40.54 kB │ map: 630.60 kB
17
+ ✓ built in 4.05s
@@ -1,12 +1,11 @@
1
1
  import { type z } from "zod";
2
2
  import { bounds } from '../spatial';
3
3
  import { type GLBufferController, type GLBufferUsage } from './gl';
4
- import { DataType, type TypedArray, type Rate, Size, TimeRange, TimeStamp, type CrudeDataType, type TelemValue } from './telem';
5
- export type SampleValue = number | bigint;
4
+ import { DataType, type TypedArray, type Rate, Size, TimeRange, TimeStamp, type CrudeDataType, type TelemValue, type NumericTelemValue } from './telem';
6
5
  export interface SeriesDigest {
7
6
  key: string;
8
7
  dataType: string;
9
- sampleOffset: SampleValue;
8
+ sampleOffset: NumericTelemValue;
10
9
  alignment: bounds.Bounds;
11
10
  timeRange?: string;
12
11
  length: number;
@@ -15,7 +14,7 @@ export interface SeriesDigest {
15
14
  interface BaseSeriesProps {
16
15
  dataType?: CrudeDataType;
17
16
  timeRange?: TimeRange;
18
- sampleOffset?: SampleValue;
17
+ sampleOffset?: NumericTelemValue;
19
18
  glBufferUsage?: GLBufferUsage;
20
19
  alignment?: number;
21
20
  key?: string;
@@ -39,7 +38,7 @@ export interface SeriesMemInfo {
39
38
  * Series is a strongly typed array of telemetry samples backed by an underlying binary
40
39
  * buffer.
41
40
  */
42
- export declare class Series {
41
+ export declare class Series<T extends TelemValue = TelemValue> {
43
42
  key: string;
44
43
  /** The data type of the array */
45
44
  readonly dataType: DataType;
@@ -48,7 +47,7 @@ export declare class Series {
48
47
  * downwards. Typically used to convert arrays to lower precision while preserving
49
48
  * the relative range of actual values.
50
49
  */
51
- sampleOffset: SampleValue;
50
+ sampleOffset: NumericTelemValue;
52
51
  /**
53
52
  * Stores information about the buffer state of this array into a WebGL buffer.
54
53
  */
@@ -111,34 +110,55 @@ export declare class Series {
111
110
  * WARNING: This method is expensive and copies the entire underlying array. There
112
111
  * also may be untimely precision issues when converting between data types.
113
112
  */
114
- convert(target: DataType, sampleOffset?: SampleValue): Series;
113
+ convert(target: DataType, sampleOffset?: NumericTelemValue): Series;
115
114
  private calcRawMax;
116
115
  /** @returns the maximum value in the array */
117
- get max(): SampleValue;
116
+ get max(): NumericTelemValue;
118
117
  private calcRawMin;
119
118
  /** @returns the minimum value in the array */
120
- get min(): SampleValue;
119
+ get min(): NumericTelemValue;
121
120
  /** @returns the bounds of this array. */
122
121
  get bounds(): bounds.Bounds;
123
122
  private maybeRecomputeMinMax;
124
123
  enrich(): void;
125
- get range(): SampleValue;
126
- at(index: number, required: true): SampleValue;
127
- at(index: number, required?: false): SampleValue | undefined;
124
+ get range(): NumericTelemValue;
125
+ at(index: number, required: true): T;
126
+ at(index: number, required?: false): T | undefined;
127
+ private atVariable;
128
128
  /**
129
129
  * @returns the index of the first sample that is greater than or equal to the given value.
130
130
  * The underlying array must be sorted. If it is not, the behavior of this method is undefined.
131
131
  * @param value the value to search for.
132
132
  */
133
- binarySearch(value: SampleValue): number;
133
+ binarySearch(value: NumericTelemValue): number;
134
134
  updateGLBuffer(gl: GLBufferController): void;
135
+ as(dataType: "string"): Series<string>;
136
+ as(dataType: "number"): Series<number>;
137
+ as(dataType: "bigint"): Series<bigint>;
138
+ as(dataType: "numeric"): Series<NumericTelemValue>;
135
139
  get digest(): SeriesDigest;
136
140
  get memInfo(): SeriesMemInfo;
137
141
  get alignmentBounds(): bounds.Bounds;
138
142
  private maybeGarbageCollectGLBuffer;
139
143
  get glBuffer(): WebGLBuffer;
144
+ [Symbol.iterator](): Iterator<T>;
140
145
  slice(start: number, end?: number): Series;
141
146
  reAlign(alignment: number): Series;
142
147
  }
143
- export declare const addSamples: (a: SampleValue, b: SampleValue) => SampleValue;
148
+ export declare const addSamples: (a: NumericTelemValue, b: NumericTelemValue) => NumericTelemValue;
149
+ export declare class MultiSeries<T extends TelemValue = TelemValue> implements Iterable<T> {
150
+ readonly series: Array<Series<T>>;
151
+ constructor(series: Array<Series<T>>);
152
+ as(dataType: "string"): MultiSeries<string>;
153
+ as(dataType: "number"): MultiSeries<number>;
154
+ as(dataType: "bigint"): MultiSeries<bigint>;
155
+ as(dataType: "numeric"): MultiSeries<NumericTelemValue>;
156
+ get dataType(): DataType;
157
+ get timeRange(): TimeRange;
158
+ push(series: Series<T>): void;
159
+ get length(): number;
160
+ at(index: number, required: true): T;
161
+ at(index: number, required?: false): T | undefined;
162
+ [Symbol.iterator](): Iterator<T>;
163
+ }
144
164
  export {};
@@ -711,7 +711,7 @@ export interface CrudeTimeRange {
711
711
  export declare const typedArrayZ: z.ZodUnion<[z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>, z.ZodType<Uint16Array, z.ZodTypeDef, Uint16Array>, z.ZodType<Uint32Array, z.ZodTypeDef, Uint32Array>, z.ZodType<BigUint64Array, z.ZodTypeDef, BigUint64Array>, z.ZodType<Float32Array, z.ZodTypeDef, Float32Array>, z.ZodType<Float64Array, z.ZodTypeDef, Float64Array>, z.ZodType<Int8Array, z.ZodTypeDef, Int8Array>, z.ZodType<Int16Array, z.ZodTypeDef, Int16Array>, z.ZodType<Int32Array, z.ZodTypeDef, Int32Array>, z.ZodType<BigInt64Array, z.ZodTypeDef, BigInt64Array>]>;
712
712
  export type TypedArray = z.infer<typeof typedArrayZ>;
713
713
  type TypedArrayConstructor = Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | BigUint64ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor | BigInt64ArrayConstructor;
714
- type NumericTelemValue = number | bigint;
714
+ export type NumericTelemValue = number | bigint;
715
715
  export type TelemValue = number | bigint | string | boolean | Date | TimeStamp | TimeSpan;
716
716
  export declare const isTelemValue: (value: unknown) => value is TelemValue;
717
717
  export declare const convertDataType: (source: DataType, target: DataType, value: NumericTelemValue, offset?: number | bigint) => NumericTelemValue;