@kymoscope/sdk 0.19.0 → 0.20.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-B4rzpZKn.js +1006 -0
- package/dist/importer-D_Rxf-9b.js +12 -0
- package/dist/importers-D4cCElZQ.js +1004 -0
- package/dist/kymoscope-embed.js +1094 -94
- package/dist/kymoscope-sdk.js +70 -70
- package/dist/types/engine/createEngine.d.ts +2 -0
- 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/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 +50 -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 +37 -0
- package/dist/types/lib/importers/table/table.d.ts +44 -0
- package/dist/types/lib/importers/types.d.ts +2 -0
- 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/package.json +7 -1
- package/dist/assets/importer.worker-BTbPiEHd.js +0 -6
- package/dist/importer-O00bqqEU.js +0 -11
- package/dist/importers-C90FOCV-.js +0 -5
|
@@ -138,6 +138,8 @@ export declare function createEngine(options?: EngineOptions): {
|
|
|
138
138
|
chooseChannels(id: string, chooser: ChannelChooser): Promise<string[] | null>;
|
|
139
139
|
/** The datasets split from one file (pass any of them), combined again into one. Returns its id. */
|
|
140
140
|
combine(id: string): Promise<string>;
|
|
141
|
+
/** A file opened with one channel per tag (one row per sample) opened again as the table it is. Returns the new ids. */
|
|
142
|
+
openAsTable(id: string): Promise<string[]>;
|
|
141
143
|
/**
|
|
142
144
|
* A cloud recording as a dataset: its encrypted chunks (KRC1, in order) decrypted with `keys` in the import
|
|
143
145
|
* worker, in memory or out of core like a file. Returns the id.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlobReader } from '../blobReader';
|
|
2
|
+
import { type TableFile } from '../table/table';
|
|
3
|
+
/** A delimited text file as one table: header on the first line, kinds from the next 200. */
|
|
4
|
+
export declare function openLongText(io: BlobReader): Promise<TableFile>;
|
|
5
|
+
export declare const longTextImporter: import("../types").Importer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TableColumn } from '../table/table';
|
|
2
|
+
/** One line's fields: `sep`-separated; double-quoted fields may hold the separator and doubled quotes. ponytail: no newlines inside quotes. */
|
|
3
|
+
export declare function splitLine(line: string, sep: string): string[];
|
|
4
|
+
/** The separator (tab, semicolon, comma) that splits every line into the same number of fields, at least 3. */
|
|
5
|
+
export declare function separatorOf(lines: string[]): string | null;
|
|
6
|
+
/** A number ('' and words are NaN); with `comma`, a decimal comma. */
|
|
7
|
+
export declare function numberOf(s: string, comma: boolean): number;
|
|
8
|
+
/** Column kinds from sample rows: ISO dates → time (absolute), numbers → number (time under a time name), else text. */
|
|
9
|
+
export declare function kindsOf(names: string[], rows: string[][], comma: boolean): TableColumn[];
|
|
10
|
+
/** Whether the head of a text file is long form (time, tag, value[, unit]): its first complete lines. */
|
|
11
|
+
export declare function sniffLongText(head: string): boolean;
|
|
@@ -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,50 @@
|
|
|
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
|
+
}
|
|
26
|
+
/** The element tree of a record body. Every link stays inside the body, depth ≤ 32, elements ≤ body / 28. */
|
|
27
|
+
export declare function decodeBody(b: Uint8Array): El[];
|
|
28
|
+
export declare const find: (els: El[] | undefined, tag: string) => El | undefined;
|
|
29
|
+
export declare const findAll: (els: El[] | undefined, tag: string) => El[];
|
|
30
|
+
/** Value `i` of a numeric scalar or vector as a number (NaN for complex, GUID, timestamp). */
|
|
31
|
+
export declare function num(v: DataView, e: El, i?: number): number;
|
|
32
|
+
/** A timestamp scalar or vector value: days since 1900-01-01 (PQDIF's count) and seconds since midnight. */
|
|
33
|
+
export declare const stamp: (v: DataView, e: El, i?: number) => [number, number];
|
|
34
|
+
/** Seconds since 1970 of a PQDIF timestamp (the standard's 25569-day offset, as Gemstone reads it). */
|
|
35
|
+
export declare const unixOf: ([days, sec]: [number, number]) => number;
|
|
36
|
+
/** A Char1 / Char2 vector as text, up to its first NUL. */
|
|
37
|
+
export declare function text(b: Uint8Array, e: El | undefined): string;
|
|
38
|
+
export declare const guidOf: (b: Uint8Array, e: El | undefined) => string;
|
|
39
|
+
export interface RecordRef {
|
|
40
|
+
type: string;
|
|
41
|
+
body: number;
|
|
42
|
+
size: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The record chain from the start of the file. A link must move past the record's body and stay inside the file
|
|
46
|
+
* (0, or the end of the file, ends the chain); anything else (a loop, records that overlap) is damage.
|
|
47
|
+
*/
|
|
48
|
+
export declare function records(io: BlobReader): Promise<RecordRef[]>;
|
|
49
|
+
/** A record's body bytes, inflated when the file compresses each record (zlib). */
|
|
50
|
+
export declare function body(io: BlobReader, r: RecordRef, compressed: boolean): Promise<Uint8Array>;
|
|
@@ -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,37 @@
|
|
|
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
|
+
sorted: boolean;
|
|
17
|
+
/** The smallest time. */
|
|
18
|
+
start: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The long-form shape of these columns, or null: exactly one time column, one number column and one or two text
|
|
22
|
+
* columns, with the tag named like a tag or the value like a value (so Time, Mode, Speed stays a table). With two
|
|
23
|
+
* text columns the tag is the one named like a tag (else the first); the other is the unit.
|
|
24
|
+
*/
|
|
25
|
+
export declare function longShape(cols: TableColumn[]): LongShape | null;
|
|
26
|
+
/**
|
|
27
|
+
* One pass over the time, tag and unit columns; null when it isn't long form after all (tags more than half the rows,
|
|
28
|
+
* or a tag whose unit changes).
|
|
29
|
+
*/
|
|
30
|
+
export declare function scanLong(t: Table, s: LongShape, signal?: AbortSignal): Promise<LongScan | null>;
|
|
31
|
+
/**
|
|
32
|
+
* A long table's rows as samples of their tag's channel (`picked`: tag indices, in output order): a row per time at
|
|
33
|
+
* which a picked tag has a sample, NaN in the channels without one there, `origin` subtracted from times. A repeated
|
|
34
|
+
* (time, tag) keeps the first. An unsorted table is sorted first. ponytail: that holds every picked sample (20 bytes
|
|
35
|
+
* each); an external sort if unsorted files beyond memory show up.
|
|
36
|
+
*/
|
|
37
|
+
export declare function readLong(t: Table, s: LongShape, scan: LongScan, picked: number[], group: number, origin: number, signal?: AbortSignal): AsyncGenerator<Batch>;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
/** Rows of some columns: numbers and times as Float64Array (NaN: empty), text as strings (null: empty). */
|
|
14
|
+
export interface TableBatch {
|
|
15
|
+
length: number;
|
|
16
|
+
columns: (Float64Array | (string | null)[])[];
|
|
17
|
+
}
|
|
18
|
+
export interface Table {
|
|
19
|
+
/** The group's name (a sheet's, else the file's kind). */
|
|
20
|
+
name: string;
|
|
21
|
+
columns: TableColumn[];
|
|
22
|
+
/** Rows; -1 when unknown before reading. */
|
|
23
|
+
rows: number;
|
|
24
|
+
/** What was skipped, in plain English. */
|
|
25
|
+
notes: string[];
|
|
26
|
+
/** These columns' rows in file order, in batches. */
|
|
27
|
+
read(columns: number[], signal?: AbortSignal): AsyncIterable<TableBatch>;
|
|
28
|
+
}
|
|
29
|
+
export interface TableFile {
|
|
30
|
+
format: string;
|
|
31
|
+
tables: Table[];
|
|
32
|
+
notes: string[];
|
|
33
|
+
}
|
|
34
|
+
/** Names that mean the file's own clock in seconds ("Time", "t", "t (s)", "elapsed time", "cycle_time"). */
|
|
35
|
+
export declare const TIME_NAME: RegExp;
|
|
36
|
+
/** Unix seconds of an ISO 8601 date-time (no zone: the viewer's), else NaN. */
|
|
37
|
+
export declare function isoSeconds(s: string): number;
|
|
38
|
+
/**
|
|
39
|
+
* Unix seconds of a wall-clock time stored without a zone (Excel cells, ISO text without an offset, naive Parquet
|
|
40
|
+
* timestamps), in the viewer's time zone. `asUtc`: that wall clock read as if it were UTC.
|
|
41
|
+
*/
|
|
42
|
+
export declare function wallClock(asUtc: number): number;
|
|
43
|
+
/** The first non-empty value of a number or time column (NaN when it has none). */
|
|
44
|
+
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;
|
|
@@ -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),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kymoscope/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.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,17 @@
|
|
|
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",
|
|
45
48
|
"apache-arrow": "17.0.0",
|
|
46
49
|
"delaunator": "^5.1.0",
|
|
47
50
|
"fflate": "^0.8.3",
|
|
51
|
+
"fzstd": "0.1.1",
|
|
48
52
|
"h5wasm": "0.10.3",
|
|
53
|
+
"hyparquet": "1.33.1",
|
|
54
|
+
"hyparquet-compressors": "1.1.3",
|
|
49
55
|
"mathjs": "^15.2.0"
|
|
50
56
|
},
|
|
51
57
|
"scripts": {
|