@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.
- package/.turbo/turbo-build.log +5 -5
- package/dist/telem/generate.d.ts +2 -2
- package/dist/telem/series.d.ts +10 -6
- package/dist/telem/telem.d.ts +14 -9
- package/dist/x.cjs +9 -5
- package/dist/x.cjs.map +1 -1
- package/dist/x.js +1820 -1754
- package/dist/x.js.map +1 -1
- package/package.json +2 -2
- package/src/telem/generate.ts +2 -2
- package/src/telem/series.spec.ts +101 -4
- package/src/telem/series.ts +164 -58
- package/src/telem/telem.spec.ts +9 -0
- package/src/telem/telem.ts +55 -26
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @synnaxlabs/x@0.14.
|
|
2
|
+
> @synnaxlabs/x@0.14.2 build /home/runner/work/synnax/synnax/x/ts
|
|
3
3
|
> tsc --noEmit && vite build
|
|
4
4
|
|
|
5
5
|
[36mvite v5.1.2 [32mbuilding for production...[36m[39m
|
|
@@ -10,8 +10,8 @@ rendering chunks...
|
|
|
10
10
|
[32m
|
|
11
11
|
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
12
12
|
computing gzip size...
|
|
13
|
-
[2mdist/[22m[36mx.js [39m[1m[
|
|
14
|
-
[32m[36m[vite:dts][32m Declaration files built in
|
|
13
|
+
[2mdist/[22m[36mx.js [39m[1m[2m213.15 kB[22m[1m[22m[2m │ gzip: 49.72 kB[22m[2m │ map: 639.91 kB[22m
|
|
14
|
+
[32m[36m[vite:dts][32m Declaration files built in 3061ms.
|
|
15
15
|
[39m
|
|
16
|
-
[2mdist/[22m[36mx.cjs [39m[1m[
|
|
17
|
-
[32m✓ built in
|
|
16
|
+
[2mdist/[22m[36mx.cjs [39m[1m[2m140.09 kB[22m[1m[22m[2m │ gzip: 39.81 kB[22m[2m │ map: 619.46 kB[22m
|
|
17
|
+
[32m✓ built in 3.99s[39m
|
package/dist/telem/generate.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DataTypeT,
|
|
2
|
-
export declare const randomSeries: (length: number, dataType: DataTypeT) =>
|
|
1
|
+
import { type DataTypeT, type TypedArray } from './telem';
|
|
2
|
+
export declare const randomSeries: (length: number, dataType: DataTypeT) => TypedArray;
|
package/dist/telem/series.d.ts
CHANGED
|
@@ -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
|
|
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:
|
|
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
|
|
61
|
+
private _cachedMin?;
|
|
60
62
|
/** A cached maximum value. */
|
|
61
|
-
private
|
|
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():
|
|
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.
|
package/dist/telem/telem.d.ts
CHANGED
|
@@ -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():
|
|
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:
|
|
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,
|
|
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 |
|
|
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
|
|
709
|
-
export type
|
|
710
|
-
type
|
|
711
|
-
type
|
|
712
|
-
export
|
|
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 {};
|