@kymoscope/sdk 0.12.0 → 0.13.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/{importers-4CjV0qH8.js → importers-IlQKVrkS.js} +3 -3
- package/dist/{keys-ved5HXBj.js → keys-BPymBse7.js} +3 -3
- package/dist/kymoscope-embed.js +84 -84
- package/dist/kymoscope-sdk.js +84 -86
- package/dist/types/engine/columns.d.ts +1 -10
- package/dist/types/engine/createEngine.d.ts +3 -13
- package/dist/types/engine/types.d.ts +0 -8
- package/dist/types/index.d.ts +3 -11
- package/dist/types/lib/cycles/evaluator.d.ts +1 -2
- package/dist/types/lib/duckdb/duckdbInstance.d.ts +0 -5
- package/dist/types/lib/live/blockWire.d.ts +1 -1
- package/dist/types/lib/live/crypto.d.ts +0 -3
- package/dist/types/lib/recordings/export.d.ts +0 -1
- package/dist/types/lib/segments/liveAxis.d.ts +8 -40
- package/dist/types/lib/segments/rules.d.ts +3 -42
- package/dist/types/lib/workspaces/io.d.ts +0 -6
- package/dist/types/lib/yAxisTicks.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/lib/data/historyDataSource.d.ts +0 -51
- package/dist/types/lib/historian/blockCache.d.ts +0 -32
- package/dist/types/lib/historian/export.d.ts +0 -31
- package/dist/types/lib/historian/khd1.d.ts +0 -41
- package/dist/types/lib/historian/parquet.d.ts +0 -21
- package/dist/types/lib/historian/reader.d.ts +0 -73
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reading a time range of a history (spec D1; plan Formats "Reading a range"): one file per local day at the wanted
|
|
3
|
-
* level (else the nearest that day has), its footer (memo, cache, one suffix GET, or the whole file when small), then
|
|
4
|
-
* only the blocks that overlap the range and hold a wanted channel (neighbours in one GET), RANGE_PARALLEL requests at
|
|
5
|
-
* a time; opened with the history key and decoded into pieces. Days need no joining: each block carries its own times.
|
|
6
|
-
*/
|
|
7
|
-
import { type HistoryPiece } from '../data/historyDataSource';
|
|
8
|
-
import { type HistoryKind, type HistoryLevel, type KhdFooter } from './khd1';
|
|
9
|
-
import type { BlockCache } from './blockCache';
|
|
10
|
-
/** One verified file of a history (the latest version of its day, kind and level). */
|
|
11
|
-
export interface HistorySegmentRef {
|
|
12
|
-
id: string;
|
|
13
|
-
day: string;
|
|
14
|
-
kind: HistoryKind;
|
|
15
|
-
level: HistoryLevel;
|
|
16
|
-
bytes: number;
|
|
17
|
-
keyId: string;
|
|
18
|
-
}
|
|
19
|
-
export interface HistoryReadOptions {
|
|
20
|
-
historyStreamId: string;
|
|
21
|
-
/** Segments of the days in range (any levels; the latest version of each). */
|
|
22
|
-
segments: HistorySegmentRef[];
|
|
23
|
-
t0: number;
|
|
24
|
-
t1: number;
|
|
25
|
-
channels: string[];
|
|
26
|
-
level: HistoryLevel;
|
|
27
|
-
key: (keyId: string) => Promise<CryptoKey>;
|
|
28
|
-
/** Bytes [start, end) of a segment's file. */
|
|
29
|
-
fetchRange: (segmentId: string, start: number, end: number, signal?: AbortSignal) => Promise<Uint8Array>;
|
|
30
|
-
cache?: BlockCache;
|
|
31
|
-
/** Opened footers by segment id, kept by the caller between reads of one history. */
|
|
32
|
-
footers?: Map<string, KhdFooter>;
|
|
33
|
-
signal?: AbortSignal;
|
|
34
|
-
/** The segments of the same days listed again. A read that fails (a 404 or 403, or no URL for a segment) asks for
|
|
35
|
-
* it once: a newer version may have replaced a segment meanwhile (today's summaries every 15 min, a late-data
|
|
36
|
-
* rebuild), and the older one is deleted. When the listing picks other files the read runs again on them; when it
|
|
37
|
-
* picks the same, the error stands. */
|
|
38
|
-
relist?: () => Promise<HistorySegmentRef[]>;
|
|
39
|
-
/** false: blocks are read from `cache` but not added to it (an export would push out what charts reuse). Default true. */
|
|
40
|
-
cacheWrite?: boolean;
|
|
41
|
-
/** 'gap': a segment whose `fetchRange` throws an error with `code: 'missing'` (its file is gone from storage) is read
|
|
42
|
-
* as no data for its day, listed in `missingDays`, and the rest of the range is read. Default 'error': the read fails. */
|
|
43
|
-
onMissing?: 'error' | 'gap';
|
|
44
|
-
}
|
|
45
|
-
export interface HistoryRange {
|
|
46
|
-
pieces: HistoryPiece[];
|
|
47
|
-
units: Record<string, string>;
|
|
48
|
-
/** The level each day was read at (a day without the wanted level falls back). */
|
|
49
|
-
levels: Record<string, HistoryLevel>;
|
|
50
|
-
/** Days whose file is missing from storage (onMissing 'gap'): read as no data. */
|
|
51
|
-
missingDays: string[];
|
|
52
|
-
}
|
|
53
|
-
export declare const RANGE_PARALLEL = 16;
|
|
54
|
-
export declare const HISTORY_PIXELS = 2000;
|
|
55
|
-
/** The coarsest level giving at least half a bucket per pixel over `spanS` (plan P2). */
|
|
56
|
-
export declare function chooseLevel(spanS: number, pixels?: number): HistoryLevel;
|
|
57
|
-
/** One file per day, in day order: the wanted level, else the nearest the day has (raw expired, today, a failed upload). */
|
|
58
|
-
export declare function pickSegments(segments: HistorySegmentRef[], level: HistoryLevel): HistorySegmentRef[];
|
|
59
|
-
/** f over items, n at a time; results in order. */
|
|
60
|
-
export declare function pool<T, R>(items: T[], n: number, f: (x: T) => Promise<R>): Promise<R[]>;
|
|
61
|
-
/** Byte ranges covering `blocks`: neighbours closer than 64 KiB join, up to 8 MiB per range. */
|
|
62
|
-
export declare function coalesce(blocks: Array<{
|
|
63
|
-
off: number;
|
|
64
|
-
len: number;
|
|
65
|
-
}>): Array<{
|
|
66
|
-
start: number;
|
|
67
|
-
end: number;
|
|
68
|
-
}>;
|
|
69
|
-
type Reader = Pick<HistoryReadOptions, 'historyStreamId' | 'key' | 'fetchRange' | 'cache' | 'footers' | 'signal'>;
|
|
70
|
-
/** A segment's opened footer: the memo, else the cache, else the file (whole when ≤ 512 KiB, kept in `whole`). */
|
|
71
|
-
export declare function readFooter(o: Reader, s: HistorySegmentRef, whole?: Map<string, Uint8Array<ArrayBufferLike>>): Promise<KhdFooter>;
|
|
72
|
-
export declare function readHistoryRange(o: HistoryReadOptions): Promise<HistoryRange>;
|
|
73
|
-
export {};
|