API reference
Types
The main public TypeScript types exported by @kymoscope/sdk.
State
interface EngineState {
datasets: DatasetInfo[]
selection: string[] // dataset, lap and live connection ids
worksheets: WorksheetState[]
activeWorksheetId: string
mathChannels: MathChannel[]
live: LiveConnectionInfo[]
liveWindowSeconds: number | null
limits: KymoscopeLimits
importing: number
hasData: boolean
multiDataset: boolean // more than one static dataset or lap plotted
numericColumns: string[]
allColumns: string[]
columnUnits: Record<string, string>
history: { canUndo: boolean; canRedo: boolean } // engine.history
licensed: boolean | null // null while the first license check runs
}
interface WorksheetState {
id: string
name: string
xKey: string
xRange: [number, number] | null
charts: ChartModel[]
}
interface ChartModel {
id: string
kind: ChartKind
title: string | null
settings: PanelChartSettings
background: string | null
layout: { x: number; y: number; w: number; h: number }
}Data
interface ColumnsInput {
name: string
columns: Record<string, ArrayLike<number>>
units?: Record<string, string>
}
interface DatasetInfo {
id: string
name: string
kind: 'memory' | 'duckdb' | 'columnar'
columns: { name: string; unit: string; numeric: boolean }[]
rowCount: number // sampled rows for out-of-core datasets
color: string
customColor: boolean
offset: number
parseConfig: DatasetParseConfig | null // null for binary files
fileInfo: DatasetFileInfo | null // binary files: format, start time, groups, notes, events
beacon: BeaconConfig | null
laps: LapInfo[] | null
selected: boolean | 'partial'
}
interface LapInfo {
id: string
name: string
value: number | null
unit: string
isTime: boolean
color: string
offset: number
selected: boolean
}
interface BeaconConfig { channel: string; metric: string; stat: 'span' | 'mean' | 'max' | 'min' }
interface FolderEntry { path: string; file: File }
interface ImportResult { ids: string[]; errors: { file: string; error: Error }[]; cancelled?: boolean }
interface ImportOptions { signal?: AbortSignal; chooseChannels?: ChannelChooser; pickChannels?: boolean }
interface DatasetFileInfo {
format: string // e.g. 'MF4 4.10', 'EDF+', 'COMTRADE 1999 (BINARY)'
startTime: string | null // ISO 8601
groups: { name: string; channels: number; samples: number; rateHz: number | null }[]
selection: GroupSelection[] // what this dataset holds
combined: { groups: number; rateHz: number | null } | null
channels: number
notes: string[] // what was skipped or approximated
events: { time: number; text: string }[] // EDF+ annotations, XDF markers, the COMTRADE trigger
}
interface GroupSelection { group: number; channels: number[] }
type ChannelChooser = (request: ChannelRequest) => Promise<GroupSelection[] | null>
interface ChannelRequest {
file: string
format: string
groups: { name: string; rateHz: number | null; samples: number; channels: { name: string; unit: string }[] }[]
selection: GroupSelection[] // what would be read without a choice
estimate(selection: GroupSelection[]): number // values it would load
budget: number // in-memory values; above it the file goes out of core
used: number
notes: string[]
}
interface Exported { json: unknown; blob: Blob; filename: string }Limits
interface KymoscopeLimits {
maxChartsPerWorksheet: number | null // null = unlimited
maxChannelsPerChart: number | null
maxWorksheets: number | null
maxMathChannels: number | null
canImportExportWorkspaces: boolean
}
type LimitReason =
| 'charts-per-worksheet' | 'channels-per-chart' | 'worksheets'
| 'workspaces-io' | 'math-channels'Math channels
interface MathChannel {
id: string
name: string
units: string
formula: string
enabled: boolean
description?: string
createdAt: number
updatedAt: number
source: 'personal' | 'subscribed'
projectId: string | null // null: the owner's personal space
projectName?: string | null
/** @deprecated use projectId */
sharedWithOrgId: string | null
ownerUserId: string
ownerDisplayName: string | null
ownerLastName: string | null
}
interface MathChannelStoreAdapter {
create(channel: MathChannel): void | Promise<void>
update(id: string, patch: MathChannelPatch): void | Promise<void>
remove(id: string): void | Promise<void>
importMany(channels: MathChannel[]): void | Promise<void>
}Live
interface LiveRelayConfig {
url: string // e.g. wss://live.example.com
getToken: (streamId: string) => Promise<string | null>
}
interface LiveStreamDescriptor {
id: string
name: string
salt: string
key_check: EncryptedEnvelope // { iv, ciphertext }
owner_name?: string
visibility?: 'private' | 'public' | 'org' | 'project' // 'org': legacy, read as 'project'
org_name?: string | null
project_name?: string | null // null when you can't see the project
}
interface LiveMessage {
t: number // any monotonic clock
signals: { name: string; unit?: string; value: number }[]
}
interface LocalLiveStream {
id: string
push: (frames: LiveMessage | LiveMessage[]) => void
close: () => void
}
interface LiveConnectionInfo {
id: string
name: string
ownerName: string
visibility: 'private' | 'public' | 'org' | 'project'
orgName: string | null
status: 'connecting' | 'live' | 'stale' | 'error'
error: string | null
rowCount: number
selected: boolean
}