@kymoscope/sdk 0.19.0 → 0.21.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/dist/assets/importer.worker-jzXF4fDD.js +1040 -0
- package/dist/importer-DhJq-CnQ.js +12 -0
- package/dist/importers-C8Byhb42.js +1036 -0
- package/dist/kymoscope-embed.js +1126 -94
- package/dist/kymoscope-sdk.js +87 -87
- package/dist/types/engine/createEngine.d.ts +4 -0
- package/dist/types/engine/types.d.ts +2 -0
- package/dist/types/lib/beacon.d.ts +6 -0
- package/dist/types/lib/importers/ccsds/format.d.ts +2 -0
- package/dist/types/lib/importers/ccsds/frames.d.ts +67 -0
- package/dist/types/lib/importers/ccsds/importer.d.ts +2 -0
- package/dist/types/lib/importers/ccsds/packets.d.ts +49 -0
- package/dist/types/lib/importers/ccsds/xtce.d.ts +79 -0
- package/dist/types/lib/importers/ch10/format.d.ts +10 -0
- package/dist/types/lib/importers/ch10/importer.d.ts +2 -0
- package/dist/types/lib/importers/ch10/packets.d.ts +46 -0
- package/dist/types/lib/importers/ch10/pcm.d.ts +59 -0
- package/dist/types/lib/importers/ch10/tmats.d.ts +93 -0
- package/dist/types/lib/importers/combine.d.ts +2 -1
- package/dist/types/lib/importers/delimited/format.d.ts +3 -0
- package/dist/types/lib/importers/delimited/importer.d.ts +5 -0
- package/dist/types/lib/importers/delimited/parse.d.ts +11 -0
- package/dist/types/lib/importers/formats.d.ts +2 -0
- package/dist/types/lib/importers/iena/format.d.ts +9 -0
- package/dist/types/lib/importers/iena/importer.d.ts +2 -0
- package/dist/types/lib/importers/iena/layout.d.ts +58 -0
- package/dist/types/lib/importers/iena/pcap.d.ts +48 -0
- package/dist/types/lib/importers/iena/xidml.d.ts +29 -0
- package/dist/types/lib/importers/mcap/decode.d.ts +26 -0
- package/dist/types/lib/importers/mcap/format.d.ts +2 -0
- package/dist/types/lib/importers/mcap/importer.d.ts +2 -0
- package/dist/types/lib/importers/mcap/lz4.d.ts +5 -0
- package/dist/types/lib/importers/mcap/protobuf.d.ts +2 -0
- package/dist/types/lib/importers/mseed/format.d.ts +7 -0
- package/dist/types/lib/importers/mseed/importer.d.ts +2 -0
- package/dist/types/lib/importers/mseed/steim.d.ts +6 -0
- package/dist/types/lib/importers/openImport.d.ts +1 -0
- package/dist/types/lib/importers/parquet/format.d.ts +2 -0
- package/dist/types/lib/importers/parquet/importer.d.ts +5 -0
- package/dist/types/lib/importers/pqdif/format.d.ts +2 -0
- package/dist/types/lib/importers/pqdif/importer.d.ts +2 -0
- package/dist/types/lib/importers/pqdif/records.d.ts +70 -0
- package/dist/types/lib/importers/pqdif/tags.d.ts +98 -0
- package/dist/types/lib/importers/table/importer.d.ts +10 -0
- package/dist/types/lib/importers/table/long.d.ts +44 -0
- package/dist/types/lib/importers/table/table.d.ts +51 -0
- package/dist/types/lib/importers/types.d.ts +9 -1
- package/dist/types/lib/importers/ulog/format.d.ts +3 -0
- package/dist/types/lib/importers/ulog/importer.d.ts +2 -0
- package/dist/types/lib/importers/xlsx/format.d.ts +2 -0
- package/dist/types/lib/importers/xlsx/importer.d.ts +23 -0
- package/dist/types/lib/importers/xlsx/xml.d.ts +24 -0
- package/dist/types/lib/importers/xlsx/zip.d.ts +12 -0
- package/dist/types/lib/yAxisTicks.d.ts +6 -0
- package/dist/types/types/loadedDataset.d.ts +4 -0
- package/package.json +9 -1
- package/dist/assets/importer.worker-BTbPiEHd.js +0 -6
- package/dist/importer-O00bqqEU.js +0 -11
- package/dist/importers-C90FOCV-.js +0 -5
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Dict } from './layout';
|
|
2
|
+
/**
|
|
3
|
+
* XidML 3.x (xidml.org, XidML-3.0.1 schemas) as an IENA dictionary: `IENA` packages (and the older
|
|
4
|
+
* `IENA-Ethernet-UDP-Basic`) with their key, payload type, end word and rate; their mappings (parameter references or
|
|
5
|
+
* inline parameters at Offset_Words or Offset_Bits from the start of the packet, Occurrences equally spaced over the
|
|
6
|
+
* packet or several Location elements, NumberOfDataBits); parameters with size, data format (BitVector, OffsetBinary,
|
|
7
|
+
* TwosComplement, SignedMagnitude, BinaryCodedDecimal, IEEE-754 single and double), endianness, base unit, a
|
|
8
|
+
* ParameterUnit (scale, offset) and a Polynomial algorithm; a mapping's Justification, Mask and Complement. What else
|
|
9
|
+
* it names is noted, not read (Parity and FillValue are not checked).
|
|
10
|
+
*/
|
|
11
|
+
export interface Node {
|
|
12
|
+
name: string;
|
|
13
|
+
attrs: string;
|
|
14
|
+
kids: Node[];
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
/** A small XML tree (local names, no namespaces, DTDs skipped); linear in the text. */
|
|
18
|
+
export declare function parseXml(s: string): Node;
|
|
19
|
+
export declare const kid: (n: Node | undefined, name: string) => Node | undefined;
|
|
20
|
+
export declare const kidsOf: (n: Node | undefined, name: string) => Node[];
|
|
21
|
+
export declare const text: (n: Node | undefined, name: string) => string | undefined;
|
|
22
|
+
export declare const attr: (n: Node, name: string) => string | undefined;
|
|
23
|
+
/** Every descendant named `name` (iterative). */
|
|
24
|
+
export declare function all(n: Node, name: string): Node[];
|
|
25
|
+
export declare const numberOf: (s: string | undefined) => number | null;
|
|
26
|
+
/** Bits [pos, pos + n) of `b`, most significant first, as an unsigned number (n ≤ 53 exact). */
|
|
27
|
+
export declare function bitsAt(b: Uint8Array, pos: number, n: number): number;
|
|
28
|
+
export declare function parseXidml(xml: string): Dict;
|
|
29
|
+
export declare const hex: (k: number) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** What a channel needs to be decoded (plain data: kept in the plan's state). */
|
|
2
|
+
export interface ChannelInfo {
|
|
3
|
+
messageEncoding: string;
|
|
4
|
+
schemaName: string;
|
|
5
|
+
schemaEncoding: string;
|
|
6
|
+
schemaData: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
export type Decoder = (bytes: Uint8Array) => unknown;
|
|
9
|
+
/** A decoder for the channel, or the reason it has none (`'/topic: ' + reason`). */
|
|
10
|
+
export declare function makeDecoder(c: ChannelInfo): Decoder | string;
|
|
11
|
+
export type Value = number | string;
|
|
12
|
+
/**
|
|
13
|
+
* `value` flattened into `out` by path (`linear_acceleration.x`, `orientation_covariance[4]`): numbers, bigints and
|
|
14
|
+
* booleans (0/1) as numbers, strings (and enums by name) as text; arrays of numbers or booleans by element (a null
|
|
15
|
+
* element is NaN); fields that cannot be channels go to `skipped`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function flatten(value: unknown, prefix: string, out: Map<string, Value>, skipped: Set<string>): void;
|
|
18
|
+
/** One step of a path: an object key or an array index. */
|
|
19
|
+
export type Seg = string | number;
|
|
20
|
+
/**
|
|
21
|
+
* The keys leading to each path of `want` that `flatten` would name in `value`, into `found` (the last of a name wins,
|
|
22
|
+
* as in `flatten`). Lets the stream read its channels straight from each message instead of flattening it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function locate(value: unknown, want: Set<string>, found: Map<string, Seg[]>, prefix?: string, segs?: Seg[]): void;
|
|
25
|
+
/** The value at `segs` in `value` as `flatten` gives it, or undefined where `flatten` gives none. */
|
|
26
|
+
export declare function valueAt(value: unknown, segs: Seg[]): Value | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LZ4 frames (one or more, back to back) inflated into exactly `size` bytes. Every length is checked against the
|
|
3
|
+
* input left and the output declared, so damaged data throws at once instead of running on. Checksums are skipped.
|
|
4
|
+
*/
|
|
5
|
+
export declare function lz4Frames(src: Uint8Array, size: number): Uint8Array;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FormatInfo } from '../formats';
|
|
2
|
+
/** A plausible BTIME (year, day of year, hour, minute, second) at `o`, in that byte order. */
|
|
3
|
+
export declare function plausibleBtime(h: Uint8Array, o: number, le: boolean): boolean;
|
|
4
|
+
/** A miniSEED 2 fixed header at `o`: 6 digits or spaces, a quality code, a space or NUL, a plausible start time. */
|
|
5
|
+
export declare function isV2Header(h: Uint8Array, o?: number): boolean;
|
|
6
|
+
export declare const isV3Header: (h: Uint8Array, o?: number) => boolean;
|
|
7
|
+
export declare const MSEED_FORMAT: FormatInfo;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Steim-1 / Steim-2 frames (64 bytes: a control word of 2-bit nibbles, then 15
|
|
3
|
+
* words) to `sampleCount` samples. Frame 0's words 1 and 2 are the first and
|
|
4
|
+
* last sample (X0, Xn); the reconstructed last sample must equal Xn.
|
|
5
|
+
*/
|
|
6
|
+
export declare function decodeSteim(bytes: Uint8Array, steimVersion: 1 | 2, sampleCount: number, littleEndian?: boolean): Int32Array;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlobReader } from '../blobReader';
|
|
2
|
+
import { type TableFile } from '../table/table';
|
|
3
|
+
/** A Parquet file as one table, read row group by row group through the BlobReader (never whole). */
|
|
4
|
+
export declare function openParquet(io: BlobReader, batchValues?: number): Promise<TableFile>;
|
|
5
|
+
export declare const parquetImporter: import("../types").Importer;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PQDIF physical layer (IEEE 1159.3; layouts as Gemstone.PQDIF's Physical/PhysicalParser.cs reads them): a chain
|
|
3
|
+
* of records, each a 64-byte header (signature, record type, header size, body size, next record, checksum,
|
|
4
|
+
* reserved) and a body that is a tree of elements. An element is 28 bytes: tag GUID, element type, physical
|
|
5
|
+
* type, embedded flag, reserved, then 8 bytes holding either an embedded scalar or a link (body offset) to
|
|
6
|
+
* the collection / vector / scalar. All little-endian.
|
|
7
|
+
*/
|
|
8
|
+
import type { BlobReader } from '../blobReader';
|
|
9
|
+
export declare const DAMAGED_PQDIF = "This PQDIF file is damaged.";
|
|
10
|
+
/** A GUID at `o` in .NET's text form (Data1-3 little-endian). */
|
|
11
|
+
export declare function guidAt(b: Uint8Array, o: number): string;
|
|
12
|
+
/** Element types (Physical/Element.cs `ElementType`). */
|
|
13
|
+
export declare const COLLECTION = 1, SCALAR = 2, VECTOR = 3;
|
|
14
|
+
export declare const TIMESTAMP = 50;
|
|
15
|
+
export declare const sizeOf: (phys: number) => number;
|
|
16
|
+
export interface El {
|
|
17
|
+
tag: string;
|
|
18
|
+
type: number;
|
|
19
|
+
phys: number;
|
|
20
|
+
/** Body offset of the value (scalar) or of the first value (vector). */
|
|
21
|
+
at: number;
|
|
22
|
+
/** Values in a vector (1 for a scalar). */
|
|
23
|
+
size: number;
|
|
24
|
+
kids: El[];
|
|
25
|
+
/** The value's bytes: a scalar's; a vector's values up to SMALL bytes (larger ones: null until `load`). */
|
|
26
|
+
bytes: Uint8Array | null;
|
|
27
|
+
}
|
|
28
|
+
/** Bytes [at, at + length) of a record body. */
|
|
29
|
+
export type Read = (at: number, length: number) => Promise<Uint8Array>;
|
|
30
|
+
/**
|
|
31
|
+
* The element tree of a record body of `size` bytes, read through `read`: collections, scalars and small vectors,
|
|
32
|
+
* never the series values (a body may hold the whole file). Every link stays inside the body, depth ≤ 32,
|
|
33
|
+
* elements ≤ body / 28.
|
|
34
|
+
*/
|
|
35
|
+
export declare function decodeBody(read: Read, size: number): Promise<El[]>;
|
|
36
|
+
/** A vector's values, read now if decoding left them (series values). */
|
|
37
|
+
export declare function load(read: Read, e: El): Promise<Uint8Array>;
|
|
38
|
+
/** A value of physical type `phys` at byte `o` of `v` as a number (NaN for complex, GUID, timestamp). */
|
|
39
|
+
export declare function numAt(v: DataView, phys: number, o: number): number;
|
|
40
|
+
/** Value `i` of a numeric scalar or (loaded) vector as a number (NaN for complex, GUID, timestamp). */
|
|
41
|
+
export declare const num: (e: El, i?: number) => number;
|
|
42
|
+
/** A timestamp scalar or vector value: days since 1900-01-01 (PQDIF's count) and seconds since midnight. */
|
|
43
|
+
export declare const stamp: (e: El, i?: number) => [number, number];
|
|
44
|
+
/** Seconds since 1970 of a PQDIF timestamp (the standard's 25569-day offset, as Gemstone reads it). */
|
|
45
|
+
export declare const unixOf: ([days, sec]: [number, number]) => number;
|
|
46
|
+
/** A Char1 / Char2 vector as text, up to its first NUL. */
|
|
47
|
+
export declare function text(e: El | undefined): string;
|
|
48
|
+
export declare const guidOf: (e: El | undefined) => string;
|
|
49
|
+
export declare const find: (els: El[] | undefined, tag: string) => El | undefined;
|
|
50
|
+
export declare const findAll: (els: El[] | undefined, tag: string) => El[];
|
|
51
|
+
export interface RecordRef {
|
|
52
|
+
type: string;
|
|
53
|
+
body: number;
|
|
54
|
+
size: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The record chain from the start of the file. A link must move past the record's body and stay inside the file
|
|
58
|
+
* (0, or the end of the file, ends the chain); anything else (a loop, records that overlap) is damage.
|
|
59
|
+
*/
|
|
60
|
+
export declare function records(io: BlobReader): Promise<RecordRef[]>;
|
|
61
|
+
/** A record's body bytes, inflated when the file compresses each record (zlib). */
|
|
62
|
+
export declare function body(io: BlobReader, r: RecordRef, compressed: boolean): Promise<Uint8Array>;
|
|
63
|
+
/**
|
|
64
|
+
* A record body to decode: inflated whole when compressed (ponytail: as `body`), else read from the file as needed
|
|
65
|
+
* (1 MiB cached pages), so a body holding the file's series values is never read whole.
|
|
66
|
+
*/
|
|
67
|
+
export declare function bodyReader(io: BlobReader, r: RecordRef, compressed: boolean): Promise<{
|
|
68
|
+
read: Read;
|
|
69
|
+
size: number;
|
|
70
|
+
}>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The IEEE 1159.3 GUIDs this importer reads, copied from Gemstone.PQDIF's source (MIT,
|
|
3
|
+
* github.com/gemstone/pqdif, src/Gemstone.PQDIF): each names the constant it came from.
|
|
4
|
+
* Lowercase, in .NET's text form (the first three groups are stored little-endian).
|
|
5
|
+
*/
|
|
6
|
+
/** Physical/Record.cs `Record.Signature`: the first 16 bytes of every record. */
|
|
7
|
+
export declare const SIGNATURE = "4a111440-e49f-11cf-9900-505144494600";
|
|
8
|
+
/** Physical/Record.cs record type table (`Record.GetTypeAsTag`). */
|
|
9
|
+
export declare const RECORD: {
|
|
10
|
+
container: string;
|
|
11
|
+
dataSource: string;
|
|
12
|
+
monitorSettings: string;
|
|
13
|
+
observation: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const TAG: {
|
|
16
|
+
/** `ContainerRecord.TitleTag` */
|
|
17
|
+
title: string;
|
|
18
|
+
/** `ContainerRecord.CompressionStyleTag` */
|
|
19
|
+
compressionStyle: string;
|
|
20
|
+
/** `ContainerRecord.CompressionAlgorithmTag` */
|
|
21
|
+
compressionAlgorithm: string;
|
|
22
|
+
/** `DataSourceRecord.DataSourceNameTag` */
|
|
23
|
+
dataSourceName: string;
|
|
24
|
+
/** `DataSourceRecord.ChannelDefinitionsTag` */
|
|
25
|
+
channelDefinitions: string;
|
|
26
|
+
/** `DataSourceRecord.OneChannelDefinitionTag` */
|
|
27
|
+
oneChannelDefinition: string;
|
|
28
|
+
/** `ChannelDefinition.ChannelDefinitionIndexTag` (also in channel instances and channel settings) */
|
|
29
|
+
channelDefinitionIndex: string;
|
|
30
|
+
/** `ChannelDefinition.ChannelNameTag` */
|
|
31
|
+
channelName: string;
|
|
32
|
+
/** `ChannelDefinition.PhaseIDTag` */
|
|
33
|
+
phaseId: string;
|
|
34
|
+
/** `ChannelDefinition.QuantityTypeIDTag` */
|
|
35
|
+
quantityTypeId: string;
|
|
36
|
+
/** `ChannelDefinition.QuantityMeasuredIDTag` */
|
|
37
|
+
quantityMeasuredId: string;
|
|
38
|
+
/** `ChannelDefinition.SeriesDefinitionsTag` */
|
|
39
|
+
seriesDefinitions: string;
|
|
40
|
+
/** `ChannelDefinition.OneSeriesDefinitionTag` */
|
|
41
|
+
oneSeriesDefinition: string;
|
|
42
|
+
/** `SeriesDefinition.ValueTypeIDTag` */
|
|
43
|
+
valueTypeId: string;
|
|
44
|
+
/** `SeriesDefinition.QuantityUnitsIDTag` */
|
|
45
|
+
quantityUnitsId: string;
|
|
46
|
+
/** `SeriesDefinition.QuantityCharacteristicIDTag` */
|
|
47
|
+
quantityCharacteristicId: string;
|
|
48
|
+
/** `SeriesDefinition.StorageMethodIDTag` */
|
|
49
|
+
storageMethodId: string;
|
|
50
|
+
/** `SeriesDefinition.ValueTypeNameTag` */
|
|
51
|
+
valueTypeName: string;
|
|
52
|
+
/** `MonitorSettingsRecord.UseTransducerTag` */
|
|
53
|
+
useTransducer: string;
|
|
54
|
+
/** `MonitorSettingsRecord.ChannelSettingsArrayTag` */
|
|
55
|
+
channelSettingsArray: string;
|
|
56
|
+
/** `MonitorSettingsRecord.OneChannelSettingTag` */
|
|
57
|
+
oneChannelSetting: string;
|
|
58
|
+
/** `ChannelSetting.XDSystemSideRatioTag` */
|
|
59
|
+
xdSystemSideRatio: string;
|
|
60
|
+
/** `ChannelSetting.XDMonitorSideRatioTag` */
|
|
61
|
+
xdMonitorSideRatio: string;
|
|
62
|
+
/** `ObservationRecord.ObservationNameTag` */
|
|
63
|
+
observationName: string;
|
|
64
|
+
/** `ObservationRecord.TimeStartTag` */
|
|
65
|
+
timeStart: string;
|
|
66
|
+
/** `ObservationRecord.TimeTriggeredTag` */
|
|
67
|
+
timeTriggered: string;
|
|
68
|
+
/** `ObservationRecord.ChannelInstancesTag` */
|
|
69
|
+
channelInstances: string;
|
|
70
|
+
/** `ObservationRecord.OneChannelInstanceTag` */
|
|
71
|
+
oneChannelInstance: string;
|
|
72
|
+
/** `ChannelInstance.SeriesInstancesTag` */
|
|
73
|
+
seriesInstances: string;
|
|
74
|
+
/** `ChannelInstance.OneSeriesInstanceTag` */
|
|
75
|
+
oneSeriesInstance: string;
|
|
76
|
+
/** `SeriesInstance.SeriesScaleTag` */
|
|
77
|
+
seriesScale: string;
|
|
78
|
+
/** `SeriesInstance.SeriesOffsetTag` */
|
|
79
|
+
seriesOffset: string;
|
|
80
|
+
/** `SeriesInstance.SeriesValuesTag` */
|
|
81
|
+
seriesValues: string;
|
|
82
|
+
/** `SeriesInstance.SeriesShareChannelIndexTag` */
|
|
83
|
+
seriesShareChannelIndex: string;
|
|
84
|
+
/** `SeriesInstance.SeriesShareSeriesIndexTag` */
|
|
85
|
+
seriesShareSeriesIndex: string;
|
|
86
|
+
};
|
|
87
|
+
/** Logical/QuantityType.cs `QuantityType.*`: those that are not time series (skipped, counted in a note: one, many). */
|
|
88
|
+
export declare const NOT_TIME_SERIES: Record<string, [string, string]>;
|
|
89
|
+
/** Logical/SeriesValueType.cs `SeriesValueType.Time` */
|
|
90
|
+
export declare const VALUE_TIME = "c690e862-f755-11cf-9d89-0080c72e70a3";
|
|
91
|
+
/** Logical/SeriesValueType.cs `SeriesValueType.*`: the label each adds to a channel name ('' for a plain value). */
|
|
92
|
+
export declare const VALUE_TYPE: Record<string, string>;
|
|
93
|
+
/**
|
|
94
|
+
* Logical/QuantityCharacteristic.cs `QuantityCharacteristic.*`, every one: the label each adds to a channel name
|
|
95
|
+
* (Gemstone's name, a plainer one for the common ones; '' for none). A characteristic not here names the channel by
|
|
96
|
+
* its definition's channel name.
|
|
97
|
+
*/
|
|
98
|
+
export declare const CHARACTERISTIC: Record<string, string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BlobReader } from '../blobReader';
|
|
2
|
+
import type { FormatInfo } from '../formats';
|
|
3
|
+
import type { ImportFiles, Importer } from '../types';
|
|
4
|
+
import { type TableFile } from './table';
|
|
5
|
+
/**
|
|
6
|
+
* An importer for table-shaped files: each table is a group, its first time column the time base (dates: seconds
|
|
7
|
+
* from the file's first date, which is the plan's start time). A table in long form (time, tag, value[, unit])
|
|
8
|
+
* becomes one channel per tag, unless the file is opened as a table (`ImportFiles.asTable`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function tableImporter(format: FormatInfo, open: (files: ImportFiles, io: BlobReader) => Promise<TableFile>): Importer;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Batch } from '../types';
|
|
2
|
+
import type { Table, TableColumn } from './table';
|
|
3
|
+
/** A table in long form, one row per sample: its time, tag, value and (optional) unit columns. */
|
|
4
|
+
export interface LongShape {
|
|
5
|
+
time: number;
|
|
6
|
+
tag: number;
|
|
7
|
+
value: number;
|
|
8
|
+
unit: number | null;
|
|
9
|
+
}
|
|
10
|
+
/** What one pass over a long table found. */
|
|
11
|
+
export interface LongScan {
|
|
12
|
+
/** Tags in order of first appearance, and the unit each first came with. */
|
|
13
|
+
tags: string[];
|
|
14
|
+
units: string[];
|
|
15
|
+
rows: number;
|
|
16
|
+
/** Distinct times: the rows reading makes (sorted tables; an unsorted one says `rows`, an upper bound). */
|
|
17
|
+
times: number;
|
|
18
|
+
sorted: boolean;
|
|
19
|
+
/** The smallest time. */
|
|
20
|
+
start: number;
|
|
21
|
+
/**
|
|
22
|
+
* Rows repeating a (time, tag) already seen (reading keeps the first). ponytail: counted in a sorted table only (the
|
|
23
|
+
* tag's last time); an unsorted one says 0. A set per tag if unsorted files with repeats matter.
|
|
24
|
+
*/
|
|
25
|
+
repeated: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The long-form shape of these columns, or null: exactly one time column, one number column and one or two text
|
|
29
|
+
* columns, with the tag named like a tag or the value like a value (so Time, Mode, Speed stays a table). With two
|
|
30
|
+
* text columns the tag is the one named like a tag (else the first); the other is the unit.
|
|
31
|
+
*/
|
|
32
|
+
export declare function longShape(cols: TableColumn[]): LongShape | null;
|
|
33
|
+
/**
|
|
34
|
+
* One pass over the time, tag and unit columns; null when it isn't long form after all (tags more than half the rows,
|
|
35
|
+
* or a tag whose unit changes).
|
|
36
|
+
*/
|
|
37
|
+
export declare function scanLong(t: Table, s: LongShape, signal?: AbortSignal): Promise<LongScan | null>;
|
|
38
|
+
/**
|
|
39
|
+
* A long table's rows as samples of their tag's channel (`picked`: tag indices, in output order): a row per time at
|
|
40
|
+
* which a picked tag has a sample, NaN in the channels without one there, `origin` subtracted from times. A repeated
|
|
41
|
+
* (time, tag) keeps the first. An unsorted table is sorted first. ponytail: that holds every picked sample (20 bytes
|
|
42
|
+
* each); an external sort if unsorted files beyond memory show up.
|
|
43
|
+
*/
|
|
44
|
+
export declare function readLong(t: Table, s: LongShape, scan: LongScan, picked: number[], group: number, origin: number, signal?: AbortSignal): AsyncGenerator<Batch>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table-shaped files (Parquet, a workbook's sheets, delimited text with one row per sample) for `tableImporter`:
|
|
3
|
+
* named columns read in row batches. Spec: docs/superpowers/specs/2026-11-24-import-formats-wave2-design.md.
|
|
4
|
+
*/
|
|
5
|
+
export type TableKind = 'number' | 'text' | 'time';
|
|
6
|
+
export interface TableColumn {
|
|
7
|
+
name: string;
|
|
8
|
+
unit: string;
|
|
9
|
+
kind: TableKind;
|
|
10
|
+
/** A 'time' column of dates (Unix seconds); else seconds of the file's own clock. */
|
|
11
|
+
absolute?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Dates as seconds after this Unix second (set by the first read at the latest): sub-second steps stay exact,
|
|
14
|
+
* which Unix seconds as doubles (~0.2 µs apart today) cannot keep.
|
|
15
|
+
*/
|
|
16
|
+
origin?: number;
|
|
17
|
+
}
|
|
18
|
+
/** Rows of some columns: numbers and times as Float64Array (NaN: empty), text as strings (null: empty). */
|
|
19
|
+
export interface TableBatch {
|
|
20
|
+
length: number;
|
|
21
|
+
columns: (Float64Array | (string | null)[])[];
|
|
22
|
+
}
|
|
23
|
+
export interface Table {
|
|
24
|
+
/** The group's name (a sheet's, else the file's kind). */
|
|
25
|
+
name: string;
|
|
26
|
+
columns: TableColumn[];
|
|
27
|
+
/** Rows; -1 when unknown before reading. */
|
|
28
|
+
rows: number;
|
|
29
|
+
/** What was skipped, in plain English. */
|
|
30
|
+
notes: string[];
|
|
31
|
+
/** These columns' rows in file order, in batches. */
|
|
32
|
+
read(columns: number[], signal?: AbortSignal): AsyncIterable<TableBatch>;
|
|
33
|
+
}
|
|
34
|
+
export interface TableFile {
|
|
35
|
+
format: string;
|
|
36
|
+
tables: Table[];
|
|
37
|
+
notes: string[];
|
|
38
|
+
}
|
|
39
|
+
/** Names that mean the file's own clock in seconds ("Time", "t", "t (s)", "elapsed time", "cycle_time"). */
|
|
40
|
+
export declare const TIME_NAME: RegExp;
|
|
41
|
+
/** Unix seconds of an ISO 8601 date-time (no zone: the viewer's), else NaN. */
|
|
42
|
+
export declare function isoSeconds(s: string): number;
|
|
43
|
+
/**
|
|
44
|
+
* Unix seconds of a wall-clock time stored without a zone (Excel cells, ISO text without an offset, naive Parquet
|
|
45
|
+
* timestamps), in the viewer's time zone. `asUtc`: that wall clock read as if it were UTC.
|
|
46
|
+
*/
|
|
47
|
+
export declare function wallClock(asUtc: number): number;
|
|
48
|
+
/** Whole seconds a wall clock without a zone is ahead of UTC at this instant (`asUtc` as in `wallClock`). */
|
|
49
|
+
export declare const wallOffset: (asUtc: number) => number;
|
|
50
|
+
/** The first non-empty value of a number or time column (NaN when it has none). */
|
|
51
|
+
export declare function firstValue(t: Table, column: number, signal?: AbortSignal): Promise<number>;
|
|
@@ -95,6 +95,8 @@ export interface ImportFiles {
|
|
|
95
95
|
companions: File[];
|
|
96
96
|
/** A cloud recording's keys (the `krc` importer only): structured-cloned to the worker, never extracted. */
|
|
97
97
|
keys?: import('../recordings/keys').RecordingKey[];
|
|
98
|
+
/** Open a long-form table (one row per sample) as the table it is, not one channel per tag. */
|
|
99
|
+
asTable?: boolean;
|
|
98
100
|
}
|
|
99
101
|
export interface StreamArgs {
|
|
100
102
|
files: ImportFiles;
|
|
@@ -136,10 +138,14 @@ export interface DatasetFileInfo {
|
|
|
136
138
|
}[];
|
|
137
139
|
/** What this dataset holds. */
|
|
138
140
|
selection: GroupSelection[];
|
|
139
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* Several groups on one time base: how many, the base rate, and whether several groups' timestamps make it
|
|
143
|
+
* (irregular groups joined; absent before 2026-11-25).
|
|
144
|
+
*/
|
|
140
145
|
combined: {
|
|
141
146
|
groups: number;
|
|
142
147
|
rateHz: number | null;
|
|
148
|
+
merged?: boolean;
|
|
143
149
|
} | null;
|
|
144
150
|
/** Datasets split from one file share this key. */
|
|
145
151
|
splitKey: string | null;
|
|
@@ -147,6 +153,8 @@ export interface DatasetFileInfo {
|
|
|
147
153
|
notes: string[];
|
|
148
154
|
meta: Record<string, string>;
|
|
149
155
|
events: FileEvent[];
|
|
156
|
+
/** The dataset's true first rows, when its rows are a reduced sample (out of core). */
|
|
157
|
+
preview?: Record<string, number | string | null>[];
|
|
150
158
|
}
|
|
151
159
|
/** What `chooseChannels` is asked before a large or ambiguous binary file is read. */
|
|
152
160
|
export interface ChannelRequest {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BlobReader } from '../blobReader';
|
|
2
|
+
import { type TableFile } from '../table/table';
|
|
3
|
+
/** A sheet's cells by column: numbers (NaN where none), which of them are dates, and text by row. */
|
|
4
|
+
interface GridCol {
|
|
5
|
+
num: Float64Array;
|
|
6
|
+
date: Uint8Array;
|
|
7
|
+
text: Map<number, string>;
|
|
8
|
+
}
|
|
9
|
+
/** A sheet's cells, at most `budget` of them allocated (numbers by column up to their last row, plus texts). */
|
|
10
|
+
export declare class Grid {
|
|
11
|
+
#private;
|
|
12
|
+
rows: number;
|
|
13
|
+
cols: (GridCol | undefined)[];
|
|
14
|
+
readonly budget: number;
|
|
15
|
+
constructor(budget?: number);
|
|
16
|
+
put(row: number, col: number, v: number | string, date: boolean): void;
|
|
17
|
+
numbersIn(r: number): number;
|
|
18
|
+
textsIn(r: number): number;
|
|
19
|
+
}
|
|
20
|
+
/** A workbook's sheets as tables (sheets without numbers skipped, with a note). */
|
|
21
|
+
export declare function openXlsx(io: BlobReader): Promise<TableFile>;
|
|
22
|
+
export declare const xlsxImporter: import("../types").Importer;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const unescapeXml: (s: string) => string;
|
|
2
|
+
/** An attribute of a start tag's text (`name="value"`), unescaped. */
|
|
3
|
+
export declare function attr(tag: string, name: string): string | undefined;
|
|
4
|
+
/** The workbook's sheets in order (name, part path) and whether its dates count from 1904. */
|
|
5
|
+
export declare function workbookSheets(workbook: string, rels: string): {
|
|
6
|
+
sheets: {
|
|
7
|
+
name: string;
|
|
8
|
+
path: string;
|
|
9
|
+
}[];
|
|
10
|
+
date1904: boolean;
|
|
11
|
+
};
|
|
12
|
+
/** A number format that shows a date or time: built-in ids 14–22 and 45–47, or a code with d, m, y, h or s outside quotes and [colour] tags. */
|
|
13
|
+
export declare function isDateFormat(id: number, code: string | undefined): boolean;
|
|
14
|
+
/** For each cell style (a cell's s attribute), whether its number format is a date. */
|
|
15
|
+
export declare function dateStyles(styles: string): boolean[];
|
|
16
|
+
/** The shared strings table (rich text runs joined, phonetic runs left out); at most `max` strings. */
|
|
17
|
+
export declare function sharedStrings(xml: string, max?: number): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Every non-empty cell of a sheet's XML arriving in pieces: `cell(row, col, value, isDate)` (0-based), formulas by
|
|
20
|
+
* their saved value. Returns how many formula cells had no saved value. Elements are matched by local name (a
|
|
21
|
+
* namespace prefix such as the .NET SDK's `x:` is fine). The hot path walks char codes: no string per cell except
|
|
22
|
+
* text values and numbers the in-place parser leaves to Number.
|
|
23
|
+
*/
|
|
24
|
+
export declare function scanSheet(pieces: AsyncIterable<string>, strings: string[], dates: boolean[], cell: (row: number, col: number, v: number | string, date: boolean) => void): Promise<number>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BlobReader } from '../blobReader';
|
|
2
|
+
export interface ZipEntry {
|
|
3
|
+
method: number;
|
|
4
|
+
compressed: number;
|
|
5
|
+
offset: number;
|
|
6
|
+
}
|
|
7
|
+
/** The ZIP's entries by name, from its central directory at the end. ZIP64 (over 4 GB) is refused. */
|
|
8
|
+
export declare function zipEntries(io: BlobReader): Promise<Map<string, ZipEntry>>;
|
|
9
|
+
/** An entry's text, decoded in pieces as it is inflated (never the whole entry's bytes at once). */
|
|
10
|
+
export declare function entryText(io: BlobReader, e: ZipEntry): AsyncGenerator<string>;
|
|
11
|
+
/** A whole (small) entry as one string: workbook, relationships, styles, shared strings. */
|
|
12
|
+
export declare function entryString(io: BlobReader, e: ZipEntry | undefined): Promise<string>;
|
|
@@ -7,6 +7,12 @@ export declare function effectiveMajorMinor(scaleMin: number, scaleMax: number,
|
|
|
7
7
|
minorStep: number;
|
|
8
8
|
};
|
|
9
9
|
export declare function majorTickValues(lo: number, hi: number, step: number): number[];
|
|
10
|
+
/** An axis' ticks at `step`, or at `autoStep` when `step` would draw more than `max` of them: a saved step far finer
|
|
11
|
+
* than the view (set while the data was a sliver) would draw up to 10,000 crowded ticks on every frame. */
|
|
12
|
+
export declare function cappedMajorTicks(lo: number, hi: number, step: number, autoStep: number, max?: number): {
|
|
13
|
+
step: number;
|
|
14
|
+
ticks: number[];
|
|
15
|
+
};
|
|
10
16
|
export declare function minorTickValues(lo: number, hi: number, minorStep: number, majorVals: number[]): number[];
|
|
11
17
|
/**
|
|
12
18
|
* Decimals that write `step` exactly (0.05 → 2, 0.25 → 2, 2.5 → 1, 20 → 0),
|
|
@@ -36,6 +36,10 @@ export interface LoadedDataset {
|
|
|
36
36
|
fromColumns?: boolean;
|
|
37
37
|
/** Arrays a column was replaced from, reused by the next writeColumns (engine internal). */
|
|
38
38
|
columnSpares?: Map<string, Float64Array>;
|
|
39
|
+
/** Opened as a table from a long-form file (datasets.openAsTable): the importer that reads it as one channel per tag. */
|
|
40
|
+
fromLong?: {
|
|
41
|
+
importer: string;
|
|
42
|
+
};
|
|
39
43
|
/** Beacon lap split; when set, the dataset is shown/selected as its laps. */
|
|
40
44
|
beacon?: BeaconConfig;
|
|
41
45
|
/** Cut into cycles by a rule (datasets.cut): shown and selected as its cycles and their phases, as laps are. Wins over `beacon`. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kymoscope/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "The Kymoscope data engine and charts for the browser: import large measurement files, plot them, stream live data end-to-end encrypted.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://kymoscope.com/docs/introduction",
|
|
@@ -41,11 +41,19 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@duckdb/duckdb-wasm": "^1.33.1-dev45.0",
|
|
44
|
+
"@foxglove/rosmsg": "5.0.5",
|
|
45
|
+
"@foxglove/rosmsg2-serialization": "3.1.2",
|
|
46
|
+
"@mcap/core": "2.4.0",
|
|
44
47
|
"@msgpack/msgpack": "^3.1.3",
|
|
48
|
+
"@types/js-yaml": "4.0.9",
|
|
45
49
|
"apache-arrow": "17.0.0",
|
|
46
50
|
"delaunator": "^5.1.0",
|
|
47
51
|
"fflate": "^0.8.3",
|
|
52
|
+
"fzstd": "0.1.1",
|
|
48
53
|
"h5wasm": "0.10.3",
|
|
54
|
+
"hyparquet": "1.33.1",
|
|
55
|
+
"hyparquet-compressors": "1.1.3",
|
|
56
|
+
"js-yaml": "4.1.1",
|
|
49
57
|
"mathjs": "^15.2.0"
|
|
50
58
|
},
|
|
51
59
|
"scripts": {
|