@synnaxlabs/x 0.14.1 → 0.14.2

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.1 build /home/runner/work/synnax/synnax/x/ts
2
+ > @synnaxlabs/x@0.14.2 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 209.89 kB │ gzip: 49.04 kB │ map: 632.82 kB
14
- [vite:dts] Declaration files built in 3265ms.
13
+ dist/x.js 213.15 kB │ gzip: 49.72 kB │ map: 639.91 kB
14
+ [vite:dts] Declaration files built in 3061ms.
15
15
  
16
- dist/x.cjs 137.61 kB │ gzip: 39.21 kB │ map: 612.53 kB
17
- ✓ built in 4.16s
16
+ dist/x.cjs 140.09 kB │ gzip: 39.81 kB │ map: 619.46 kB
17
+ ✓ built in 3.99s
@@ -1,2 +1,2 @@
1
- import { DataTypeT, NativeTypedArray } from './telem';
2
- export declare const randomSeries: (length: number, dataType: DataTypeT) => NativeTypedArray;
1
+ import { type DataTypeT, type TypedArray } from './telem';
2
+ export declare const randomSeries: (length: number, dataType: DataTypeT) => TypedArray;
@@ -1,7 +1,7 @@
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 NativeTypedArray, type Rate, Size, TimeRange, type TimeStamp, type CrudeDataType } from './telem';
4
+ import { DataType, type TypedArray, type Rate, Size, TimeRange, TimeStamp, type CrudeDataType, type TelemValue } from './telem';
5
5
  export type SampleValue = number | bigint;
6
6
  export interface SeriesDigest {
7
7
  key: string;
@@ -20,8 +20,10 @@ interface BaseSeriesProps {
20
20
  alignment?: number;
21
21
  key?: string;
22
22
  }
23
+ export type CrudeSeries = Series | ArrayBuffer | TypedArray | string[] | number[] | boolean[] | unknown[] | TimeStamp[] | Date[] | TelemValue;
24
+ export declare const isCrudeSeries: (value: unknown) => value is CrudeSeries;
23
25
  export interface SeriesProps extends BaseSeriesProps {
24
- data: ArrayBuffer | NativeTypedArray;
26
+ data: CrudeSeries;
25
27
  }
26
28
  export interface SeriesAllocProps extends BaseSeriesProps {
27
29
  capacity: number;
@@ -56,19 +58,20 @@ export declare class Series {
56
58
  readonly _timeRange?: TimeRange;
57
59
  readonly alignment: number;
58
60
  /** A cached minimum value. */
59
- private _min?;
61
+ private _cachedMin?;
60
62
  /** A cached maximum value. */
61
- private _max?;
63
+ private _cachedMax?;
62
64
  /** The write position of the buffer. */
63
65
  private writePos;
64
66
  /** Tracks the number of entities currently using this array. */
65
67
  private _refCount;
68
+ private _cachedLength?;
69
+ constructor(props: SeriesProps | CrudeSeries);
66
70
  static alloc({ capacity: length, dataType, ...props }: SeriesAllocProps): Series;
67
71
  static generateTimestamps(length: number, rate: Rate, start: TimeStamp): Series;
68
72
  get refCount(): number;
69
73
  static fromStrings(data: string[], timeRange?: TimeRange): Series;
70
74
  static fromJSON<T>(data: T[], timeRange?: TimeRange): Series;
71
- constructor({ data, dataType, timeRange, sampleOffset, glBufferUsage, alignment, key, }: SeriesProps);
72
75
  acquire(gl?: GLBufferController): void;
73
76
  release(): void;
74
77
  /**
@@ -84,7 +87,7 @@ export declare class Series {
84
87
  get buffer(): ArrayBufferLike;
85
88
  private get underlyingData();
86
89
  /** @returns a native typed array with the proper data type. */
87
- get data(): NativeTypedArray;
90
+ get data(): TypedArray;
88
91
  toStrings(): string[];
89
92
  toUUIDs(): string[];
90
93
  parseJSON<Z extends z.ZodTypeAny>(schema: Z): Array<z.output<Z>>;
@@ -98,6 +101,7 @@ export declare class Series {
98
101
  get byteLength(): Size;
99
102
  /** @returns the number of samples in this array. */
100
103
  get length(): number;
104
+ private calculateCachedLength;
101
105
  /**
102
106
  * Creates a new array with a different data type.
103
107
  * @param target the data type to convert to.
@@ -565,10 +565,11 @@ export declare class DataType extends String implements Stringer {
565
565
  /**
566
566
  * @returns the TypedArray constructor for the DataType.
567
567
  */
568
- get Array(): NativeTypedArrayConstructor;
568
+ get Array(): TypedArrayConstructor;
569
569
  equals(other: DataType): boolean;
570
570
  /** @returns a string representation of the DataType. */
571
571
  toString(): string;
572
+ get isVariable(): boolean;
572
573
  get density(): Density;
573
574
  /**
574
575
  * Checks whether the given TypedArray is of the same type as the DataType.
@@ -576,7 +577,7 @@ export declare class DataType extends String implements Stringer {
576
577
  * @param array - The TypedArray to check.
577
578
  * @returns True if the TypedArray is of the same type as the DataType.
578
579
  */
579
- checkArray(array: NativeTypedArray): boolean;
580
+ checkArray(array: TypedArray): boolean;
580
581
  toJSON(): string;
581
582
  get usesBigInt(): boolean;
582
583
  /** Represents an Unknown/Invalid DataType. */
@@ -601,6 +602,8 @@ export declare class DataType extends String implements Stringer {
601
602
  static readonly UINT16: DataType;
602
603
  /** Represents a 8-bit unsigned integer value. */
603
604
  static readonly UINT8: DataType;
605
+ /** Represents a boolean value. Alias for UINT8. */
606
+ static readonly BOOLEAN: DataType;
604
607
  /** Represents a 64-bit unix epoch. */
605
608
  static readonly TIMESTAMP: DataType;
606
609
  /** Represents a UUID data type */
@@ -611,7 +614,7 @@ export declare class DataType extends String implements Stringer {
611
614
  /** Represents a JSON data type. JSON has an unknown density, and is separated by a
612
615
  * newline character. */
613
616
  static readonly JSON: DataType;
614
- static readonly ARRAY_CONSTRUCTORS: Map<string, NativeTypedArrayConstructor>;
617
+ static readonly ARRAY_CONSTRUCTORS: Map<string, TypedArrayConstructor>;
615
618
  static readonly ARRAY_CONSTRUCTOR_DATA_TYPES: Map<string, DataType>;
616
619
  static readonly DENSITIES: Map<string, Density>;
617
620
  /** All the data types. */
@@ -697,7 +700,7 @@ export type CrudeRate = Rate | number | Number;
697
700
  export type RateT = number;
698
701
  export type CrudeDensity = Density | number | Number;
699
702
  export type DensityT = number;
700
- export type CrudeDataType = DataType | string | NativeTypedArray;
703
+ export type CrudeDataType = DataType | string | TypedArray;
701
704
  export type DataTypeT = string;
702
705
  export type CrudeSize = Size | number | Number;
703
706
  export type SizeT = number;
@@ -705,9 +708,11 @@ export interface CrudeTimeRange {
705
708
  start: CrudeTimeStamp;
706
709
  end: CrudeTimeStamp;
707
710
  }
708
- export declare const nativeTypedArray: 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>]>;
709
- export type NativeTypedArray = z.infer<typeof nativeTypedArray>;
710
- type NativeTypedArrayConstructor = Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | BigUint64ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor | BigInt64ArrayConstructor;
711
- type TelemValue = number | bigint;
712
- export declare const convertDataType: (source: DataType, target: DataType, value: TelemValue, offset?: number | bigint) => TelemValue;
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
+ export type TypedArray = z.infer<typeof typedArrayZ>;
713
+ type TypedArrayConstructor = Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | BigUint64ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor | BigInt64ArrayConstructor;
714
+ type NumericTelemValue = number | bigint;
715
+ export type TelemValue = number | bigint | string | boolean | Date | TimeStamp | TimeSpan;
716
+ export declare const isTelemValue: (value: unknown) => value is TelemValue;
717
+ export declare const convertDataType: (source: DataType, target: DataType, value: NumericTelemValue, offset?: number | bigint) => NumericTelemValue;
713
718
  export {};