@synnaxlabs/x 0.14.2 → 0.15.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.
@@ -1,17 +1,17 @@
1
1
 
2
- > @synnaxlabs/x@0.14.2 build /home/runner/work/synnax/synnax/x/ts
2
+ > @synnaxlabs/x@0.15.1 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...
6
6
  transforming...
7
7
  [plugin:vite:resolve] Module "crypto" has been externalized for browser compatibility, imported by "/home/runner/work/synnax/synnax/node_modules/.pnpm/nanoid@3.0.0/node_modules/nanoid/index.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
8
- ✓ 127 modules transformed.
8
+ ✓ 123 modules transformed.
9
9
  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 179.61 kB │ gzip: 39.86 kB │ map: 522.06 kB
14
+ [vite:dts] Declaration files built in 3292ms.
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 118.93 kB │ gzip: 31.59 kB │ map: 503.70 kB
17
+ ✓ built in 4.12s
@@ -21,12 +21,6 @@ export interface EncoderDecoder {
21
21
  */
22
22
  decode: <P>(data: Uint8Array | ArrayBuffer, schema?: ZodSchema<P>) => P;
23
23
  }
24
- /** MsgpackEncoderDecoder is a msgpack implementation of EncoderDecoder. */
25
- export declare class MsgpackEncoderDecoder implements EncoderDecoder {
26
- contentType: string;
27
- encode(payload: unknown): ArrayBuffer;
28
- decode<P extends z.ZodTypeAny>(data: Uint8Array | ArrayBuffer, schema?: P): z.output<P>;
29
- }
30
24
  /** JSONEncoderDecoder is a JSON implementation of EncoderDecoder. */
31
25
  export declare class JSONEncoderDecoder implements EncoderDecoder {
32
26
  contentType: string;
@@ -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,53 @@ 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(jsType: "string"): Series<string>;
136
+ as(jsType: "number"): Series<number>;
137
+ as(jsType: "bigint"): Series<bigint>;
135
138
  get digest(): SeriesDigest;
136
139
  get memInfo(): SeriesMemInfo;
137
140
  get alignmentBounds(): bounds.Bounds;
138
141
  private maybeGarbageCollectGLBuffer;
139
142
  get glBuffer(): WebGLBuffer;
143
+ [Symbol.iterator](): Iterator<T>;
140
144
  slice(start: number, end?: number): Series;
141
145
  reAlign(alignment: number): Series;
142
146
  }
143
- export declare const addSamples: (a: SampleValue, b: SampleValue) => SampleValue;
147
+ export declare const addSamples: (a: NumericTelemValue, b: NumericTelemValue) => NumericTelemValue;
148
+ export declare class MultiSeries<T extends TelemValue = TelemValue> implements Iterable<T> {
149
+ readonly series: Array<Series<T>>;
150
+ constructor(series: Array<Series<T>>);
151
+ as(jsType: "string"): MultiSeries<string>;
152
+ as(jsType: "number"): MultiSeries<number>;
153
+ as(jsType: "bigint"): MultiSeries<bigint>;
154
+ get dataType(): DataType;
155
+ get timeRange(): TimeRange;
156
+ push(series: Series<T>): void;
157
+ get length(): number;
158
+ at(index: number, required: true): T;
159
+ at(index: number, required?: false): T | undefined;
160
+ [Symbol.iterator](): Iterator<T>;
161
+ }
144
162
  export {};
@@ -570,6 +570,9 @@ export declare class DataType extends String implements Stringer {
570
570
  /** @returns a string representation of the DataType. */
571
571
  toString(): string;
572
572
  get isVariable(): boolean;
573
+ get isNumeric(): boolean;
574
+ get isInteger(): boolean;
575
+ get isFloat(): boolean;
573
576
  get density(): Density;
574
577
  /**
575
578
  * Checks whether the given TypedArray is of the same type as the DataType.
@@ -711,7 +714,7 @@ export interface CrudeTimeRange {
711
714
  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
715
  export type TypedArray = z.infer<typeof typedArrayZ>;
713
716
  type TypedArrayConstructor = Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | BigUint64ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor | BigInt64ArrayConstructor;
714
- type NumericTelemValue = number | bigint;
717
+ export type NumericTelemValue = number | bigint;
715
718
  export type TelemValue = number | bigint | string | boolean | Date | TimeStamp | TimeSpan;
716
719
  export declare const isTelemValue: (value: unknown) => value is TelemValue;
717
720
  export declare const convertDataType: (source: DataType, target: DataType, value: NumericTelemValue, offset?: number | bigint) => NumericTelemValue;