// The types of `window.Structure.marketDataVisualizer`, the Market Data Visualizer's API for programs that drive it // through browser automation. Generated by `just wire` from web/src/api/types.ts and // web/wire/capture.fbs; served beside the app. The instructions are the tool's skill.md, beside the app's folder. // ───────────────────────────── the API ───────────────────────────── /** * The Market Data Visualizer's API for programs that drive it from outside the page: `window.Structure.marketDataVisualizer`, * called through browser automation (Playwright's `page.evaluate`, the Chrome DevTools Protocol's * `Runtime.evaluate`, WebDriver's `executeScript`). Everything it takes and answers is plain data * that crosses `page.evaluate` and JSON unchanged. * * This file is the API's contract, and `just wire` writes it with the capture schema's types into * one declaration file the site serves beside the app (`/app/viewer-api.d.ts`); so it imports only those types. */ /** When a call answers: once its actions are applied, once what they started has ended, or after the next frame is drawn too. */ export type Settle = "applied" | "effects" | "painted"; export type CallOptions = { /** * `applied`: once the call's actions went through the reducer. `effects` (the default): also * once the work they started (core answers, store writes, SQL runs, rows the new panes ask * for, and what that work starts in turn) has ended, so a `rows` or `state` call next reads * what the GUI shows. `painted`: also once the browser drew the next frame; a tab the browser * draws no frames for (hidden) answers `timed_out`. */ settle?: Settle; }; /** Why a JSON intent was refused, at `path`: the reasons of the generated JSON readers, and text that is no JSON. */ export type IntentProblem = "wrong_type" | "missing_field" | "unknown_field" | "unknown_member" | "out_of_range" | "page_only" | "not_json"; /** * What an intent of the type a refused intent names takes: its fields as one line of TypeScript, * each named type they reach written out, and an intent of that type the page takes. */ export type IntentShape = { type: string; shape: string; types: Readonly>; example: Intent }; /** Why a call failed: one closed set for every method. */ export type VisualizerError = /** * Intent `index` of the call is not an intent the page takes; nothing of the call was applied. * `expected`: what an intent of the type it names takes, when it names one the page has. */ | { kind: "invalid_intent"; index: number; problem: IntentProblem; path: string; message: string; expected: IntentShape | undefined } /** * An argument other than an intent is not what the method takes, or an intent's value is not * one the page takes (a filter that does not parse, a file that is no events file). `path` * names the value (`intents[0].filter`) and `span` the part of its text at fault, from * `start` to `end` in UTF-16 units, as the field the GUI draws marks it. */ | { kind: "bad_argument"; message: string; path?: string; span?: TextSpan } /** No palette command has this id. */ | { kind: "unknown_command"; id: string; message: string } /** The command cannot run on what is active, for the reason the palette shows beside it. */ | { kind: "unavailable"; message: string } /** The command needs a person's click or key in the page: the browser allows the clipboard and file pickers only then. */ | { kind: "needs_user"; message: string } /** A project, file, pane or action the call names is not there. */ | { kind: "not_found"; message: string } /** The page refused a change: a tree change the core refused, or one that would not be undoable. `seqs`: what the call applied before it. */ | { kind: "refused"; message: string; seqs: number[] } /** The SQL engine answered an error; `seq` is the recorded `sql.run`. */ | { kind: "sql_error"; message: string; seq: number } /** The call did not settle within `limits.settleMs`; what it applied stays applied and its work goes on. */ | { kind: "timed_out"; message: string; seqs: number[] } /** Something in the page threw; the message is the error's. */ | { kind: "failed"; message: string }; /** A method's answer: `ok` with its fields, or the error. */ export type Answer = ({ ok: true } & T) | { ok: false; error: VisualizerError }; /** What a call that changes the app applied, and when it answered. */ export type Applied = { /** The page load the `seq` numbers belong to; a reload or a restore of another load's capture starts others. */ loadId: number; /** * The actions the call recorded, in order: one per intent of `dispatch`, else every action * recorded while the call ran. An intent that continues the action before it (typing) keeps * that action's `seq`. */ seqs: number[]; /** The newest action when the call answered: actions after `seqs` are what their effects dispatched (`causeSeq`), or anything else that ran meanwhile. */ settledSeq: number; settle: Settle; elapsedMs: number; }; /** Part of a text: from `start` to `end`, in UTF-16 units as JavaScript counts them. */ export type TextSpan = { start: number; end: number }; /** * What a dispatched intent came to that the caller did not ask for: a seek past the captures' * last message (or time) landed on the last message, `landed`. */ export type DispatchNote = { index: number; kind: "clamped"; project: string; landed: number; message: string }; /** What `dispatch` applied, and what its intents came to beside what they asked (`notes`; empty for none, and with `settle: "applied"`, which waits for no landing). */ export type Dispatched = Applied & { notes: DispatchNote[] }; /** * A member of the intent catalog: its `type`, what it does, its fields, and whether only the page * dispatches it. A field's `type` is TypeScript whose names (`Root`, `SeekTarget`, `ReplayUnit`) * `Hello.types` writes out; `example` is one intent of the type the page takes, for every member * `dispatch` takes. */ export type IntentInfo = { type: string; doc: string; /** Dispatched by the page itself (an effect's answer, or one step of undo, redo, a rewind or a browser move); `dispatch` refuses it. */ pageOnly: boolean; fields: readonly { name: string; type: string; optional: boolean; doc: string }[]; example: Intent | undefined; }; /** What a command acts on, which a call to it names: a pane by its id, a project by its key, or neither (the app as a whole). */ export type CommandTakes = "pane" | "project" | "none"; /** A palette command: what it acts on, and whether it can run on what is active now. */ export type CommandInfo = { id: string; title: string; description: string; group: string; /** `Mod` is Cmd on macOS, Ctrl elsewhere. */ keybinding: string | undefined; /** What `command` names for it in its arguments: `{ pane }`, `{ project }`, or nothing. */ takes: CommandTakes; /** Whether it can run on the active pane and project, as the palette shows it; a call runs it on the pane or project it names. */ available: boolean; /** Why it cannot run on what is active, when it cannot. */ reason: string | undefined; /** It writes the clipboard or opens a file picker, which needs a person in the page; `command` answers `needs_user`. */ needsUser: boolean; }; /** Bounds of the API, each with its reason in the decision record. */ export type VisualizerLimits = { /** How long a call waits to settle before it answers `timed_out`. */ settleMs: number; /** Most rows `sql` answers. */ sqlRowsMax: number; /** Most rows one `rows` call answers. */ rowsMax: number; /** Most price rows one `rows` call answers of a book pane: the core's bound on one book read. */ ladderRowsMax: number; }; /** What the page is, what it runs and what it takes. */ export type Hello = { api: "Structure.marketDataVisualizer"; version: 1; /** The commit the page was built from. */ build: string; loadId: number; seq: number; engines: { core: "starting" | "ready" | "failed"; /** DuckDB-WASM, loaded on first use: `version` once it is ready. SQL is DuckDB's dialect (`read_parquet('')`). */ sql: { name: "DuckDB-WASM"; state: "idle" | "unsupported" | "downloading" | "starting" | "ready" | "failed" | "restarting"; version: string | undefined }; }; intents: readonly IntentInfo[]; /** * Every type the fields of `intents` name, as one line of TypeScript each: a union's members * written out (`SeekTarget`: `{ kind: "message"; message: number } | …`), an enum's values * (`ReplayUnit`: `"message" | "packet" | "event"`), a table's fields. */ types: Readonly>; commands: readonly CommandInfo[]; limits: VisualizerLimits; /** Where the instructions and the declaration file are, relative to the site's origin. */ docs: { skill: string; types: string }; }; /** A file or folder of a project as the explorer shows it. */ export type FileSummary = { node: number; kind: "file" | "dir"; /** Its path in the project, folders joined by `/`. */ path: string; /** What the core read it as; `null` for a file of no format it knows (an include it has not resolved, a text file). */ format: FormatKind | null; }; export type ProjectSummary = { /** The key every call and intent names the project by; its name is only for people. */ key: string; name: string; /** `saved`: in the browser's store, listed but not open; opening a file of it opens it. */ state: "open" | "saved"; active: boolean; files: FileSummary[]; }; export type PaneSummary = { id: string; kind: PaneKind["kind"]; title: string; /** The pane intents and commands act on. */ active: boolean; /** The tab its dock group shows. */ front: boolean; /** A view pane's view, form and root, and its selected row's key and schema node. */ view: string | undefined; form: Form | undefined; root: Root | undefined; selected: string | undefined; selectedPath: string | undefined; /** A SQL console's project, scope and query. */ sql: { project: string; scope: SqlScope; text: string } | undefined; }; /** * Offline mode in this browser, which `command("offline.on")` and `command("offline.off")` set; it * is no part of `state`, so a capture neither carries nor restores it. `on`: the page sends * nothing and loads nothing from the site, and a net op it would have made shows in `trace()` as * refused (`offline`). `copy`: the copy of the app the page runs from with no network, pinned to * the commit it was built from. `update`: what `command("offline.check")` found, and * `command("offline.update")` does about it. */ export type VisualizerOffline = { mode: "off" | "on"; copy: /** Offline mode is off: no copy is kept. */ | { kind: "none" } /** On, and this build or browser keeps no copy: the dev server, a private window, a page not on HTTPS. */ | { kind: "unsupported"; why: string } /** On, and the page is asking the copy how it is. */ | { kind: "asking" } /** The copy is being made: so many of its files and bytes are kept. */ | { kind: "copying"; files: number; filesTotal: number; bytes: number; bytesTotal: number } /** * The copy is whole: every method works with no network. `build`: the commit it is pinned * to. `serving`: this page runs from it (else reload). `newer`: the commit of an update being copied. */ | { kind: "ready"; build: string; files: number; bytes: number; serving: boolean; newer: string | undefined } /** The copy could not be made, or is gone. */ | { kind: "failed"; reason: string }; update: /** Not asked: the copy stays at its commit until the user checks. */ | { kind: "idle" } | { kind: "checking" } /** The site serves the commit this page runs. */ | { kind: "current"; commit: string } /** The site serves another commit: *Update* copies it and reloads. */ | { kind: "available"; commit: string } /** The new commit's copy is being made beside the one that serves; the page reloads once it is whole. */ | { kind: "updating"; commit: string; files: number; filesTotal: number; bytes: number; bytesTotal: number } /** The check or the new copy failed; the copy that serves stays. */ | { kind: "failed"; reason: string }; }; /** * Work under way that a call did not start, which `settled` waits for: a link the address bar * opened (`#open?…`) and what it opens, a capture's books opening, the index pass over a * project's captures, a replay playing (until it reaches the captures' end or is paused), and * core calls and SQL runs in flight. */ export type Pending = { kind: "link" } | { kind: "books"; project: string } | { kind: "indexing"; project: string } | { kind: "playing"; project: string } | { kind: "work"; open: number }; /** * Where a CME capture project's replay is now, which moves without actions while it plays: its * message (as `state.replays[project].message` reads it), when that message was sent, whether it * plays, and how many messages the index pass has read. */ export type ReplayNow = { message: number; time: CaptureTime | null; playing: boolean; messages: number }; /** The app as it is: a summary to read, the whole state the reducer holds, offline mode, which is not part of it, and work under way. */ export type VisualizerState = { loadId: number; seq: number; /** While the timeline shows an earlier state (`seek`): its action. Everything else here is the live state. */ seeking: number | undefined; projects: ProjectSummary[]; panes: PaneSummary[]; /** The state the reducer holds, except that a playing replay's `replays[project].message` is where play has reached, which no action records until it pauses. */ state: AppState; offline: VisualizerOffline; /** Work under way; empty once the page has settled. `settled()` waits for it to end. */ pending: Pending[]; /** Each CME capture project's replay as it is now, by the project's key: while it plays, where play has reached. */ replays: Record; }; /** What `settled` waited for: the page's load and its newest action once nothing was under way. */ export type Settled = { loadId: number; seq: number; elapsedMs: number }; /** * Which rows of a pane: `count` rows from display position `start`. A book pane's rows are its * ladder's prices, one a tick, from the highest price its book holds anything at (row 0) down to * the lowest (`total` rows); rows above the highest have negative positions. Left out, `start` * and `count` are the rows the pane shows. */ export type RowsRequest = { start?: number; count?: number }; /** A row as the pane draws it: its key, depth in the tree, schema node and the text of each cell. */ export type VisualizerRow = { position: number; key: string; depth: number; path: string | undefined; cells: string[] }; export type RowsWindow = /** A tree pane (symbols, text, detail, problems): `total` rows with the user's open and closed rows, `rows` from `first`. */ | { kind: "tree"; pane: string; total: number; first: number; headers: string[]; rows: VisualizerRow[] } /** A SQL console: the rows of its last run, each cell the engine's text or `null` for SQL NULL. */ | { kind: "sql"; pane: string; total: number; first: number; columns: SqlColumn[]; rows: (string | null)[][]; more: boolean } /** * A book pane: its instrument and the replay message its book is at, the best bid and ask in * ticks (`null`: that side is empty; a price is ticks times `tick`), its instrument's match * algorithm, the card pinned in it, and its price rows: `rows` from position `first` of the * `total` rows from `high` (row 0, the highest price the book holds anything at) down to `low` * (`null` and `total` 0 for an empty book). Row `i` is price `high - i` ticks: to read prices * from `p` ticks down, ask `start: high - p`. `more`: rows below the last one answered hold * the book still. */ | { kind: "ladder"; pane: string; security: number; message: number; bestBid: number | null; bestAsk: number | null; high: number | null; low: number | null; total: number; first: number; more: boolean; /** One tick in the units `price` is written in (the definition's `DisplayFactor` applied): `0.5`. */ tick: string; match: MatchAlgorithm | null; /** The card a click pinned on a block of this book (`book.pin`); `null` when none is. */ card: PinnedCard | null; rows: LadderRow[]; }; /** A `MatchAlgorithm` letter (FIX tag 1142) and the name CME's Globex Product Reference Sheet gives it: `A`, `allocation`; `name` is empty for a letter it names none for. */ export type MatchAlgorithm = { letter: string; name: string }; /** A sending time of the captures: nanoseconds since the Unix epoch in decimal (past what a `number` holds exactly), and as the cards write it. */ export type CaptureTime = { ns: string; text: string }; /** * Where a block stands in its price's queue, front first: `place` of `of` orders, with `ahead` * contracts before it. `atLeast`: the book is partial, so orders no message told of may stand * ahead and each number is a least value. */ export type QueuePlaceInfo = { place: number; of: number; ahead: number; atLeast: boolean }; /** * Whether an order is the top order of its side, the one an allocation book (`A`) fills first * because its price bettered the side's best when it entered (the feed has no field for it; the * page follows it from the orders it saw). `unallocated`: the instrument fills otherwise; * `unknown`: the side's top order may be one the book met in a snapshot; `top` since message * `since` (`null`: since before the book met it). */ export type TopOrder = { kind: "unallocated" } | { kind: "unknown" } | { kind: "not" } | { kind: "top"; since: number | null }; /** One trade that hit a resting order: the message that carried it, when it was sent, its price and contracts, and who took liquidity. */ export type OrderFillInfo = { message: number; time: CaptureTime; price: string; ticks: number; qty: number; aggressor: "none" | "buy" | "sell" }; /** * The card pinned on a block, as the card shows it: an order with what the book holds about it * (`card` is `null` until the page's core answered it), the contracts resting since before the * capture, or the folded back of a long queue. Prices are written in the ladder's units, beside * their ticks. */ export type PinnedCard = | { kind: "order"; side: "bid" | "ask"; order: string; price: string; ticks: number; /** Resting in the book at its message, gone from it at message `at`, or not in it (added later). */ state: { kind: "resting" } | { kind: "left"; at: number } | { kind: "absent" }; /** `null` while its row is out of the pane's window, or it rests no more. */ place: QueuePlaceInfo | null; card: { qty: number; firstQty: number; /** `MDOrderPriority` in decimal. */ priority: string; /** The message that added it, and when that message was sent. */ added: number; addedTime: CaptureTime; /** The last message that added, changed, filled or requeued it. */ changed: number; /** Why it joined the book: a new order, an update of one the book never held, the rest of an aggressor, a snapshot. */ origin: "new" | "unknownUpdate" | "restedAggressor" | "snapshot"; top: TopOrder; /** Its last fills, oldest first; `fillCount` and `filledQty` count every one. */ fills: OrderFillInfo[]; fillCount: number; filledQty: number; } | null; } | { kind: "beforeCapture"; side: "bid" | "ask"; price: string; ticks: number; qty: number } | { kind: "folded"; side: "bid" | "ask"; price: string; ticks: number; count: number; qty: number }; /** One order block of a ladder row, front of the queue first: an order, the contracts resting since before the capture, or the folded back of a long queue. */ export type LadderBlock = { kind: "order" | "beforeCapture" | "folded"; /** The order id in decimal; empty for a block that is no order. */ order: string; qty: number; /** Orders the block stands for: 1, those folded, or 0 for the before-capture remainder. */ count: number; }; /** * One side of a ladder row: its orders and size columns, its implied size (0 where none or hidden) * and its order blocks, which are the book's data: a pane that hides its block columns still has them. */ export type LadderSide = { orders: number; size: number; implied: number; blocks: LadderBlock[] }; /** One price row of a book pane: the price in ticks and as the pane writes it, and each side. */ export type LadderRow = { ticks: number; price: string; bid: LadderSide; ask: LadderSide }; /** The replay of a CME capture project a read names, by the project's key. */ export type ReplayRequest = { project: string }; /** * A project's events table, current with its captures: its file's node and path, whether this * call wrote it (`false`: it was current already), the name `sql()` reads it by (`null` when * another Parquet file of the project has the same stem; `table` reads it then), and `table`, * the `read_parquet(…)` that reads it whatever its name. */ export type EventsTableAnswer = Applied & { project: string; node: number; path: string; written: boolean; view: string | null; table: string }; /** One instrument of a project's captures, as its row of the replay's Instruments column and its card show it. */ export type InstrumentInfo = { /** `SecurityID`: what `book.open`, `replay.card` and `instruments.open` take as `security`. */ security: number; /** `Symbol`; empty without a definition. */ symbol: string; kind: "future" | "spread" | "undefined"; /** `SecurityExchange`, the MIC of the exchange that lists it; empty without a definition. */ exchange: string; group: string; asset: string; /** `MaturityMonthYear` as `YYYY-MM`, or `YYYY-MM-DD` where the definition names the day. */ maturity: string; channel: number | null; /** One tick (`MinPriceIncrement`) as the ladder writes prices, and as the wire carries it. */ tick: string | null; tickOnWire: string | null; displayFactor: string | null; match: MatchAlgorithm | null; /** Levels a side of its level book. */ depth: number; activation: CaptureTime | null; lastTrade: CaptureTime | null; legs: { security: number; symbol: string; side: "buy" | "sell"; ratio: number }[]; /** Entries of book and trade messages naming it, as far as the index pass has read: how busy its book is. */ updates: number; /** Its first trade message, as far as the index pass has read. */ firstTrade: number | null; /** The trade message whose prices lie furthest from its trade before, and how far, in the ladder's units. */ largestMove: { message: number; time: CaptureTime; distance: string } | null; /** The book panes of the replay that show it. */ books: string[]; /** Its page of the market explorer, opened in a new tab; `null` for an exchange it has none for. */ explorer: string | null; }; /** * A project's instruments in the order the Instruments column lists them with its filter * empty, and the one whose card the column shows (`replay.card`). `indexed`: whether the index * pass has read every message, or is reading still and may find more. */ export type InstrumentList = { project: string; indexed: "scanning" | "done"; card: number | null; instruments: InstrumentInfo[] }; /** * The steps of the match algorithm that gave a resting order its contracts: none to name (the * instrument does not fill by allocation), unknown (the page's split of the trade over the queue * it holds does not give the fills the trade lists), or the contracts of each step. */ export type FillSteps = { kind: "unallocated" } | { kind: "unknown" } | { kind: "known"; top: number; proRata: number; fifo: number }; /** * One fill of the step to a book: `filled` contracts of `order` (`null`: of the contracts resting * since before the capture, which stand for `orders` orders), `rest` of it resting on (`left`: it * left the book), where it stood in its queue before the step, and the steps that gave it. * `trade` is always the trade message (a TradeSummary) that took the contracts, and `message` the * book update that showed the fill, which CME sends after the trade; `trade` is `null` when the * step holds the book update but not the trade, as a seek straight to the book update does. */ export type FillInfo = { side: "bid" | "ask"; price: string; ticks: number; order: string | null; orders: number; filled: number; rest: number; left: boolean; trade: number | null; message: number; aggressor: "none" | "buy" | "sell"; /** `null` when its row was out of the pane's window, or the page folded the order. */ place: QueuePlaceInfo | null; steps: FillSteps; }; /** The fills one book pane lists: its instrument, the message the step led to, and each fill, grouped by price in the order the trades reached them, each queue's front first. */ export type BookFills = { book: string; security: number; symbol: string; message: number; fills: FillInfo[] }; /** * Which fills to read: those of the paused step, or (`message` set) those of the event that holds * message `message`. That lands the replay on the end of the event, stepping from the message * before as a link's `message=` does, and brings a book of the message's instruments into view * when none shows, as a step to a Filter match does: give it the `message` of a trade from * `matches` or from the events table. */ export type FillsRequest = { project: string; message?: number }; /** * What the replay's Fills pane lists: the fills of the paused step at `message` in every book pane * in view, the focused book's first. `seqs`: the moves a `FillsRequest.message` recorded, empty * for none. With no fill, `note` says why and which call answers them (a book to open, the event's * end to land on, play to pause); `null` when `books` holds fills. */ export type FillsList = { project: string; message: number; seqs: number[]; books: BookFills[]; note: string | null }; /** The message the Message pane shows, or one named: by default the pinned message, else the replay's. */ export type CaptureMessageRequest = { project: string; message?: number }; /** One row of a message's tree, in tree order, a row's children after it. */ export type CaptureMessageRow = { /** 0 for the pcap record itself. */ depth: number; /** Its parent's place in `rows`; -1 for the record. */ parent: number; /** A network or framing layer, fields read together (an SBE header, a group's dimensions), a field, a repeating group, one entry of a group, or bytes no layout reads. */ kind: "layer" | "composite" | "field" | "group" | "entry" | "raw"; /** A field's or layer's name, or `[i]` for entry `i`. */ name: string; /** Its value as text; `null` for a field's null value; empty for a row that holds others. */ value: string | null; /** The type as CME's documentation names it (`uInt32`, `PRICE9`). */ note: string; /** Bytes `start..start + len` of `bytes`. */ start: number; len: number; }; /** * One message of the merged stream and the pcap record that carried it, decoded beside its bytes: * the Message pane's tree. `file` is the capture file's node id; `offset` the file offset of * `bytes`' first byte; `bytes` the record in hex; `focus` the row of the message itself, the * packet's other messages its siblings. `shown: "cut"`: the rows stopped at the page's limit. */ export type CaptureMessage = { project: string; message: number; packet: number; file: number; template: number; offset: number; bytes: string; rows: CaptureMessageRow[]; focus: number; shown: "all" | "cut"; }; /** Records or packets not read, by reason. */ export type Refusals = { record: number; notUdp: number; fragment: number; packet: number; message: number; flows: number }; /** * The replay's Feeds: how far the index pass read, each capture file (by its node id) and each * flow (destination address and port) with its packets, the packets the other feed of its channel * brought first (`duplicates`), and those neither brought (`gaps`). */ export type FeedsList = { project: string; indexed: { state: "scanning" | "done"; scanned: number; total: number; messages: number }; files: { node: number; bytes: number; link: "ethernet" | number; records: number; refusals: Refusals }[]; flows: { ip: string; port: number; channel: number | null; feed: "A" | "B" | "unknown"; kind: "incremental" | "snapshotMbp" | "snapshotMbo" | "definitions" | "unknown"; files: number[]; time: { first: CaptureTime; last: CaptureTime } | null; packets: number; messages: number; duplicates: number; gaps: number; refusals: Refusals; }[]; }; /** Which matches of the replay's Filter: `count` from match `start` (0 is the first). */ export type MatchesRequest = { project: string; start?: number; count?: number }; /** * The replay's Filter (`replay.filter`) and what it matched: `state` as its row shows it (none, * being asked, found, refused with `error`, or failed with `error`), `total` messages matched, * `rank` the matches at or before the replay's message (the row's `rank of total`), `searchedTo` * the first message not searched once the page's index of matches filled (`null`: all were), and * the matches from `first`, each a message and the instruments of its rows that matched. * `replay.nextMatch` and `replay.previousMatch` step to them. */ export type FilterMatches = { project: string; filter: string; state: "none" | "asking" | "found" | "invalid" | "failed"; error: string | null; total: number; rank: number; searchedTo: number | null; first: number; matches: { message: number; securities: number[] }[]; }; /** The schema `messages` lists: a project by its key, and the schema's root file by its node id (`state().projects[].files[].node`). */ export type MessagesRequest = { project: string; file: number }; /** A message of an SBE schema: its id (`null` when the schema gives it none), its name, and its node path, which a `Root`'s `at.path` takes. */ export type MessageInfo = { id: number | null; name: string; path: string }; /** A schema's messages in the order it declares them, with the project's key and the schema a `Root`'s `at` takes beside a message's `path`. */ export type SchemaMessages = { project: string; schema: SchemaKey; messages: MessageInfo[] }; /** * A file to add: its bytes (base64 text, or an `ArrayBuffer` or `Uint8Array` made in the page), or * a URL of the page's own origin. The page fetches nothing from another origin (the site's policy * is `connect-src 'self'`): a URL there answers `bad_argument` before any fetch. For a file on the * web or on disk, fetch or read it on the caller's side and pass its bytes. */ export type FileSource = { name: string; bytes: string | ArrayBuffer | Uint8Array } | { name?: string; url: string }; /** The project `addFiles` adds to: one there is, by its key, or a new one of a name (a name taken already gets a number). */ export type ProjectTarget = { kind: "project"; key: string } | { kind: "new"; name: string }; export type AddFilesOptions = CallOptions & { project: ProjectTarget; /** A folder of the project, by path (`a/b`), made when absent. Absent: the project's top. */ folder?: string; }; export type Added = Applied & { /** The key of the project the files went to, made by the call for a `new` target. */ project: string; projectName: string; /** Each added file's node and path, in the order given; a `.zip`'s is the folder or file it opened as. */ files: { node: number; path: string }[]; }; /** A result column: its name and DuckDB's name of its type (`BIGINT`, `DECIMAL(38,9)`, `TIMESTAMP_NS`). */ export type SqlColumn = { name: string; type: string }; export type SqlOptions = CallOptions & { /** The project, by its key. */ project: string; /** One Parquet file of it, by its node id: the console of that file. Absent: the project's console, over all its Parquet files. */ file?: number; /** Most rows to answer; the console shows its own first rows of them. Default 1,000; at most `limits.sqlRowsMax`. */ rowsMax?: number; }; export type SqlAnswer = Applied & { /** The key of the project the statement ran over. */ project: string; /** The console that ran it, which shows the result. */ pane: string; /** The recorded `sql.run`. */ seq: number; result: | { kind: "rows"; columns: SqlColumn[]; /** Each value as the console shows it: DuckDB's text, exact for wide decimals and nanosecond times; `null` is SQL NULL. */ rows: (string | null)[][]; /** The statement returned more rows than `rowsMax`. */ more: boolean; rowsMax: number; elapsedMs: number; } /** A statement with no result set (`SET`, `CREATE VIEW`). */ | { kind: "done"; elapsedMs: number }; }; /** What `command` takes besides the id: the pane for a command that `takes` a pane, the project's key for one that takes a project, nothing for the others. */ export type CommandArgs = { pane?: string; project?: string }; /** What a command acted on: the pane or the project its arguments named, or the app as a whole. */ export type CommandTarget = { kind: "pane"; pane: string } | { kind: "project"; project: string } | { kind: "none" }; export type Commanded = Applied & { target: CommandTarget }; /** `session`: the log's base, its kept actions and the head; `state`: the state alone. */ export type CaptureKind = "session" | "state"; export type Exported = { kind: CaptureKind; /** The capture (`.pvc`) as base64. */ capture: string; bytes: number }; /** What a restore or a replay did. */ export type Restored = { baseSeq: number; atSeq: number; headSeq: number; /** Files the capture names that this page does not hold, or holds with other content, one line each. */ missing: string[]; /** What the capture holds that this build cannot read, one line each. */ dropped: string[]; /** Where the replayed state differs from the capture's head, one path each; empty before the last action. */ diverged: string[]; }; /** One kept action of the log. */ export type VisualizerAction = { seq: number; /** The page's clock when it was applied, milliseconds since the page loaded. */ timeMs: number; /** For an effect's answer: the action that started the effect. */ causeSeq: number | undefined; intent: Intent; /** The action as one line: `12 +3.4 s view.select view=v3 key=m48/g268 reveal=jump`. */ text: string; }; /** * One I/O op of the page's trace, or of a worker's it kept. Names no file, project, SQL text or * URL: `target` is structural (a store path, an asset path, a call or label name). */ export type VisualizerTraceRecord = { global: "page" | "core" | "sql"; /** The op's own number in its global. */ seq: number; /** The ingress that caused it; an `ingress` record's own number. */ cause: number; /** `flow`: passed on by the code the ingress started; `state`: a reaction to what that ingress left shown. */ via: "flow" | "state"; /** The page call a worker's op served, or the ingress that armed a timer; 0 for none. */ parent: number; /** What the op is: `ingress`, `state.dispatch`, `core.call`, `net.fetch`, … (`hello` lists no ops; the build's closed list does). */ kind: string; /** What it touched, as one line names it. */ target: string; /** Repeats folded into the record, from 1. */ count: number; bytes: number; status: "open" | "ok" | "failed" | "refused"; /** An HTTP status, or the index of a failure class. */ code: number; /** The page's clock, milliseconds since it loaded. */ startMs: number; endMs: number; }; /** * A load the browser timed (its Resource Timing, the page's navigation): matched to the op of the * page's that made it, or, for one no op made (a library's own fetch, a module the loader * fetched), named by the build's table of what the trace cannot see, or `unknown`. */ export type VisualizerObserved = { /** The global that made the load. */ global: "page" | "core" | "sql"; /** The same-origin path, without query or fragment; a load of another origin names that origin only; empty where the op that made it names none. */ path: string; /** The seq, in its global's numbering, of the net op that made it; 0 when none did. */ explained: number; /** For a load no op made: `duckdbWasm`, `duckdbExtension`, `script`, … from the build's closed table, or `unknown`. */ class: string; /** The page's clock, milliseconds since it loaded. */ startMs: number; endMs: number; /** The body's decoded size. */ bytes: number; }; /** The page's trace: its records oldest first, the same as lines grouped by ingress, what polls counted, and the loads it observed. */ export type VisualizerTrace = { records: VisualizerTraceRecord[]; lines: string[]; polls: { label: string; count: number; failed: number }[]; /** Loads no op made, oldest first. */ observed: VisualizerObserved[]; }; /** A histogram's bucket scale (the decision record of the metrics says each). */ export type MetricsScale = "frame" | "long" | "kib4" | "mib"; export type MetricsFaultKind = | "core_error" | "core_restart" | "project_dropped" | "worker_failed" | "uncaught_error" | "unhandled_rejection" | "sql_error" | "engine_failed" | "project_reopen_failed" | "project_save_failed"; /** Everything the page counted since it loaded, by name, and its faults. */ export type MetricsSnapshot = { build: string; /** Milliseconds since the page loaded. */ windowMs: number; series: ( | { name: string; kind: "counter" | "gauge"; labels: Record; value: number } | { name: string; kind: "histogram"; labels: Record; scale: MetricsScale; counts: number[]; count: number; sum: number; max: number } )[]; faults: { timeMs: number; afterActions: number; kind: MetricsFaultKind; code: number; site: string | undefined }[]; }; /** * The Market Data Visualizer's API, at `window.Structure.marketDataVisualizer`. Every method but `metrics` answers a promise that * waits for the app to start first. Methods that fail answer `{ ok: false, error }`; none * throws for a failure of the call. */ export type MarketDataVisualizer = { readonly version: 1; /** The build, its engines, every intent and command it takes, and the API's limits. */ hello(): Promise; /** * Applies intents, in order, as the GUI's gestures do: each is recorded as an action. Takes one * intent or a list, as objects or JSON text, in the reducer's own form (the `Intent` type; * `hello().intents` lists them). All are checked before any is applied, values too: a * `replay.filter` that does not parse, or a `replay.events` that names no current events file, * answers `bad_argument` and applies nothing. A later one that fails at run time (a tree change * the core refuses) stops the rest. `tree.op` takes `undo` `push` (a step of its own) or `join` * (one step with the change before); the page writes its `ticket`. `sql.run` runs the console's * query. `replay.play` answers once play has started (`state().replays[project].playing`); * `settled()` then waits for it to reach the captures' end, and `command("replay.playPause", { * project })` pauses it where it has reached. */ dispatch(intents: Intent | readonly Intent[] | string, options?: CallOptions): Promise>; /** * Runs a palette command by id, as the palette does, on the pane or project `args` names * (`CommandInfo.takes`), which the page makes active first, as a click in it does. * `project.delete` deletes the project it names without the explorer's confirm. */ command(id: string, args?: CommandArgs, options?: CallOptions): Promise>; commands(): Promise; /** The app as it is, and the work under way (`pending`). */ state(): Promise; /** * Waits until nothing is under way that a call did not start: a link the address bar opened * (`#open?…`, by load or by `location.hash`), a capture's books opening, the index pass over a * project's captures, a replay playing, core calls and SQL runs; then two frames with none, so * the next `state()` or `rows()` reads what the GUI shows. Answers `timed_out`, naming what is * still under way, after `limits.settleMs`. */ settled(options?: { settle?: "effects" | "painted" }): Promise>; /** A window of a pane's rows: as the pane shows them, or any window of a book pane's ladder (`RowsRequest`); at most `limits.rowsMax` at once, `limits.ladderRowsMax` of a ladder. */ rows(pane: string, window?: RowsRequest): Promise>; /** * A CME capture project's events table, as the replay's Views → Events opens it: the file is * written first when the project has none, or one written from other captures, which takes a * pass over the captures; then `sql()` over the project reads it as `view` (`SELECT … FROM * events`). Opens no pane. */ eventsTable(replay: ReplayRequest, options?: CallOptions): Promise>; /** The messages of an SBE schema, with the node path that names each (`m46`); a saved project opens first. */ messages(schema: MessagesRequest): Promise>; /** A CME capture project's instruments, as the replay's Instruments column lists them, with what each one's card shows. */ instruments(replay: ReplayRequest): Promise>; /** What the replay's Fills pane lists: each fill of the paused step in the book panes in view, its place in its queue and the allocation steps that gave it; with `message`, of the event that holds it (`FillsRequest`). With none, `note` names the call that answers them. */ fills(request: FillsRequest): Promise>; /** A message of the captures decoded beside its bytes, as the Message pane's tree shows it: by default the one the pane shows. */ captureMessage(request: CaptureMessageRequest): Promise>; /** The replay's Feeds: the capture files and flows the index pass read, with their gaps and duplicates. */ feeds(replay: ReplayRequest): Promise>; /** The replay's Filter and a window of the messages it matched; at most `limits.rowsMax` at once. */ matches(request: MatchesRequest): Promise>; /** * Moves the replay where the transport's Go to field does with the same text: a message * (`8195`, `#8,195`), a UTC time (`14:30:00.5`, a date before it optional), a move from the * cursor (`+250us`, `-1.5ms`), a channel's packet (`seq 3485 ch 312`) or an instrument's update * (`rpt 812 SR3Z6-SR3H7`). Text of no such form answers `bad_argument`; a packet or update the * captures lack, `not_found`. */ goTo(request: { project: string; text: string }, options?: CallOptions): Promise>; /** * Adds files as a drop does, to the project `options.project` names or a new one. The bytes * cross the automation channel in one message; a large local file goes in through the Add * files dialog's `input[data-file-picker]` with the automation's own file upload * (Playwright's `setInputFiles`), which the page then reads in ranges, never whole. A `.zip` * adds the SBE schema XML files inside it at their paths, as an archive tool unpacks it: the * one folder (or file) every entry sits in, else a folder of the archive's name without * `.zip`. Its other entries are not added, and the notice names them. */ addFiles(files: readonly FileSource[], options: AddFilesOptions): Promise>; /** * Runs a statement in the project's (or the file's) SQL console, as the Run button does, and * answers its result. An error the engine answers is `sql_error`, its message DuckDB's text * (`Parser Error: syntax error at or near "SELEC"`, and the line it points into). */ sql(query: string, options: SqlOptions): Promise>; /** A capture of the whole app, as Copy state writes one: for a bug report, or to restore elsewhere. */ export(kind?: CaptureKind): Promise>; /** Restores a capture (`.pvc` bytes or base64) and its actions up to `stopAt` (all when absent); runs no SQL. */ restore(capture: string | ArrayBuffer | Uint8Array, options?: { stopAt?: number }): Promise>; /** Moves a restored capture to action `seq`, applying its actions again from its base when going back. */ replay(seq: number): Promise>; /** Shows the app as it was right after action `seq`, as the Timeline does, without changing it; `now` shows the live app again. */ seek(seq: number | "now"): Promise>; /** Continues from the state right after action `seq` (the Timeline's Continue from here): recorded as `history.rewind`. */ rewind(seq: number, options?: CallOptions): Promise>; /** The kept action log, oldest first. */ actions(): Promise; /** The page's I/O trace: every op it did, tied to the ingress that caused it, as far back as its ring reaches. */ trace(): Promise; /** Everything the page counted since it loaded; answers at once, without a promise. */ metrics(): MetricsSnapshot; }; /** `window.Structure`: a namespace other Structure tools may add members to. */ export type StructureNamespace = { marketDataVisualizer?: MarketDataVisualizer }; declare global { interface Window { /** Structure's namespace on the page; `marketDataVisualizer` is the Market Data Visualizer's API. */ Structure?: StructureNamespace; } } // ─────────────────── the app's state and intents (web/wire/capture.fbs) ─────────────────── /** Text the app refines to its own values: the reader refuses one it does not have. */ export type ArticleId = string; /** * The Add files dialog: closed, opened by the button or command, or opened by files dragged over * the window, which closes again when the drag leaves the window without a drop. */ export type AddFilesDialog = "closed" | "opened" | "dragging"; /** The direction a branch of the dock lays its children out in: side by side, or stacked. */ export type Axis = "row" | "column"; /** The order block columns on each side of a book pane, which draw each price's orders as bars. */ export type BookBlocks = "shown" | "hidden"; /** * Whether a book pane scrolls on its own: `off`, only when the user scrolls it or re-centres; * `best`, when the best bid or ask would leave the view, with a margin of rows. */ export type BookFollow = "off" | "best"; /** Which book a book pane showed, in captures of schema 0008 and earlier. */ export type BookShown = BookLive | BookFrozen; /** One sample or more of every member: a member without one fails the type check. */ export type BookShown_Samples = { readonly [K in BookShown["kind"]]: readonly Extract[] }; /** A side of an order book. */ export type BookSide = "bid" | "ask"; /** How wide a byte map draws its cells. */ export type ByteWidth = ByteWidthFit | ByteWidthPx; /** One sample or more of every member: a member without one fails the type check. */ export type ByteWidth_Samples = { readonly [K in ByteWidth["kind"]]: readonly Extract[] }; /** Where a pinned card is drawn. */ export type CardPlace = CardBeside | CardMoved; /** One sample or more of every member: a member without one fails the type check. */ export type CardPlace_Samples = { readonly [K in CardPlace["kind"]]: readonly Extract[] }; export type Carry = "move" | "copy"; export type Direction = "outgoing" | "incoming"; /** A display option's value: a toggle, a choice or a number. */ export type DisplayValue = boolean | string | number; /** What the browser holds of a project's file. */ export type FileBytes = FileHeld | FileFooter | FileNameOnly; /** One sample or more of every member: a member without one fails the type check. */ export type FileBytes_Samples = { readonly [K in FileBytes["kind"]]: readonly Extract[] }; /** * How a view's pane draws its rows: as declarations text, or as its symbols, the tree-grid of * the same nodes (an outline, a layout, a table). */ export type Form = "symbols" | "text"; /** * What a file is to the core: an SBE schema, a Parquet file, or a CME MDP 3.0 packet capture, * which the book viewer reads. */ export type FormatKind = "sbe" | "parquet" | "cmeCapture"; /** The faint implied size column on each side of a book pane. */ export type ImpliedColumn = "hidden" | "shown"; /** Every change of the app state: `step(state, intent)` applies one. */ export type Intent = ProjectSet | ProjectActivate | ProjectRenaming | ProjectsSaved | ProjectDeleting | ProjectCollapse | ProjectDeleted | ViewOpen | PanePlaceIntent | ViewToggle | ViewSelect | ViewHover | ViewSelectBits | ViewFollow | ViewLens | ViewColumnLens | ColumnMenuOpen | ColumnMenuClose | DisplayOpen | DisplayClose | DisplaySaveDefault | DisplayReset | ViewProblemShow | ViewTextShow | ViewBytes | ViewDetail | ViewProblems | PaneForm | PaneBytesPerLine | PaneBytesPerCell | PaneBytePx | PaneByteFit | PaneLegend | PaneActivate | PaneClosed | SourceShow | PaletteOpen | PaletteText | PaletteClose | SettingsSet | OffsetsToggle | SqlOpen | SqlText | SidePress | SideShow | SideToggle | AddFilesOpen | AddFilesDrag | AddFilesDragLeft | AddFilesClose | StatusOpen | GuideOpen | GuideHeading | NavTop | NavGo | NavFront | ColumnsWidth | PaneSplit | DockSet | TreeOpIntent | TreeAppliedIntent | TreeUndoIntent | TreeRemoving | PanesReopen | TreeRedoIntent | HistoryRewind | SideWidth | SqlRun | TraceOpen | ViewTop | ReplaySeek | ReplayStep | ReplayAt | ReplayPlayIntent | ReplayPause | ReplaySpeedIntent | BookFreeze | BookThaw | BookRecentre | BookScroll | BookFollowIntent | BookTradeColour | BookImplied | BookOpen | MessageOpen | FeedsOpen | InstrumentsOpen | BookBlocksIntent | ReplayOpen | ReplayLayout | ReplayFocus | BookClosed | ReplayShow | ReplayResize | ReplayPopoverIntent | ReplayCard | ReplayFind | ReplayEvents | BookPinIntent | BookUnpin | BookPinMove | ReplayWindowIntent | ReplayFilter | ReplayFillsIntent | ViewFilter; /** One sample or more of every member: a member without one fails the type check. */ export type Intent_Samples = { readonly [K in Intent["type"]]: readonly Extract[] }; /** Closed set of lenses: data that changes how a value is shown, never the model. */ export type Lens = LensRaw | LensHex | LensScale | LensTimestamp | LensColumns | LensLayout; /** One sample or more of every member: a member without one fails the type check. */ export type Lens_Samples = { readonly [K in Lens["kind"]]: readonly Extract[] }; export type NavEntry = ViewPlace | PanePlace; /** One sample or more of every member: a member without one fails the type check. */ export type NavEntry_Samples = { readonly [K in NavEntry["kind"]]: readonly Extract[] }; export type NodeContent = ContentStored | ContentLinked | ContentUnread; /** One sample or more of every member: a member without one fails the type check. */ export type NodeContent_Samples = { readonly [K in NodeContent["kind"]]: readonly Extract[] }; /** * What the palette lists: everything (go to, commands and settings, jump), only the settings, * only the active pane's display options, or the instruments of the active project's captures. */ export type PaletteScope = "everything" | "settings" | "view" | "instruments"; export type PaneKind = PaneView | PaneBytes | PaneDetail | PaneProblems | PaneSource | PaneSearch | PaneSql | PaneStatus | PaneGuide | PaneTrace | PaneBook | PaneMessage | PaneFeeds | PaneInstruments | PaneReplay; /** One sample or more of every member: a member without one fails the type check. */ export type PaneKind_Samples = { readonly [K in PaneKind["kind"]]: readonly Extract[] }; /** The intent that shows a pane with no view again, as the pane was when the user left it. */ export type PaneShow = GuideOpen | StatusOpen | SqlOpen | SourceShow | TraceOpen | ReplayOpen; /** One sample or more of every member: a member without one fails the type check. */ export type PaneShow_Samples = { readonly [K in PaneShow["type"]]: readonly Extract[] }; /** The block a pinned card is about. */ export type PinnedBlock = PinnedOrder | PinnedBeforeCapture | PinnedFold; /** One sample or more of every member: a member without one fails the type check. */ export type PinnedBlock_Samples = { readonly [K in PinnedBlock["kind"]]: readonly Extract[] }; /** Where a node root is looked at. */ export type Place = PlaceDeclared | PlaceLayout | PlaceText | PlaceBytes | PlaceTable | PlaceStatistics | PlaceFacts | PlaceUses | PlaceProblems; /** One sample or more of every member: a member without one fails the type check. */ export type Place_Samples = { readonly [K in Place["kind"]]: readonly Extract[] }; /** Whether the store kept a project's last change, and why not when it did not. */ export type ProjectSaved = SavedKept | SavedNot; /** One sample or more of every member: a member without one fails the type check. */ export type ProjectSaved_Samples = { readonly [K in ProjectSaved["kind"]]: readonly Extract[] }; /** Open in the core, or only in the browser's store, listed from its manifest until opened. */ export type ProjectState = "open" | "saved"; /** * Which tab of the replay pane's lower card each step brings in front: Fills while paused at a * step that filled resting orders in a book in view and Message otherwise, Fills at every step * (`no fills at this step` when there are none), or Message. A tab pressed stays in front until * the next step; the books above never change size. */ export type ReplayFills = "onFills" | "always" | "never"; /** Whether a project's CME replay reads one of its capture files, or leaves it out. */ export type ReplayInclusion = "in" | "out"; /** * A part of the replay pane that collapses and takes a size: the Message pane along its bottom, * the instruments column along its left edge. */ export type ReplayPart = "message" | "instruments"; /** Whether a project's replay plays. */ export type ReplayPlay = "paused" | "playing"; /** The popover of the replay pane's header: none, or the tables of its files and flows. */ export type ReplayPopover = "closed" | "feeds"; /** * What a replay's rate counts: steps a second, each the replay pane's Step setting, or the * capture's own time (`SendingTime`) times the rate. */ export type ReplayRateUnit = "steps" | "times"; /** * How fast a replay played before the rate was a number: matching events a second (10, 2), or * the capture's own time (`SendingTime`) times a factor (0.1, 1, 10, 100). Captures of schema * 0010 and earlier hold it; `ReplayRate` replaces it. */ export type ReplaySpeed = "events10" | "events2" | "x0.1" | "x1" | "x10" | "x100"; /** How far a step moves a replay: one message, one packet, or to the end of the next matching event. */ export type ReplayUnit = "message" | "packet" | "event"; /** * What a selection scrolls: nothing (a click in the pane that shows the row), the view's other * panes (a click in a linked pane, such as the byte map), or every pane as a jump the history * records (a `:` jump). */ export type Reveal = "none" | "linked" | "jump"; /** A pane's root, by names only. */ export type Root = RootNode | RootProject | RootMapping | RootDiff | RootSearch; /** One sample or more of every member: a member without one fails the type check. */ export type Root_Samples = { readonly [K in Root["kind"]]: readonly Extract[] }; export type SbeFraming = SbeFramingNone | SbeFramingPreset | SbeFramingDeclared; /** One sample or more of every member: a member without one fails the type check. */ export type SbeFraming_Samples = { readonly [K in SbeFraming["kind"]]: readonly Extract[] }; /** SBE layout knobs on a message root. Paths name groups and data by schema identity. */ export type SbeLayoutLens = LayoutVersion | LayoutCount | LayoutLength | LayoutFraming | LayoutBlockLength | LayoutDeclarations; /** One sample or more of every member: a member without one fails the type check. */ export type SbeLayoutLens_Samples = { readonly [K in SbeLayoutLens["kind"]]: readonly Extract[] }; /** * A scroll target as the view holds it. `seq` numbers it among the view's reveals and * selections (`View_nextSeq`), so a pane takes whichever of them came last. */ export type ScrollFollow = FollowBytes | FollowRows; /** One sample or more of every member: a member without one fails the type check. */ export type ScrollFollow_Samples = { readonly [K in ScrollFollow["to"]]: readonly Extract[] }; export type ScrollSyncChoice = "on" | "off"; /** * Where the user's scroll of one of a view's panes asks the others to scroll: byte maps put bit * `bits` on their top line; the symbols or text pane, in `form`, puts display position * `position` at its top. */ export type ScrollTarget = ScrollBytes | ScrollRows; /** One sample or more of every member: a member without one fails the type check. */ export type ScrollTarget_Samples = { readonly [K in ScrollTarget["to"]]: readonly Extract[] }; /** Where a seek moves a replay. */ export type SeekTarget = SeekMessage | SeekTime | SeekNextFor; /** One sample or more of every member: a member without one fails the type check. */ export type SeekTarget_Samples = { readonly [K in SeekTarget["kind"]]: readonly Extract[] }; /** Where a split puts its copy: beside the pane split, to its right or below it. */ export type SplitDirection = "right" | "below"; /** What a SQL console reads: every Parquet file of its project, or exactly one of them. */ export type SqlScope = SqlScopeProject | SqlScopeFile; /** One sample or more of every member: a member without one fails the type check. */ export type SqlScope_Samples = { readonly [K in SqlScope["kind"]]: readonly Extract[] }; export type StepDirection = "forward" | "back"; /** Text view toggles: description comment rows, the FIX tag column, primitives for aliases. */ export type TextShow = "descriptions" | "tags" | "primitives"; export type ThemeChoice = "system" | "light" | "dark"; export type TimeUnit = "millis" | "micros" | "nanos"; /** The tool windows the side panel shows, one at a time, each with its icon in the activity bar. */ export type ToolWindow = "explorer" | "sql" | "guide" | "timeline"; /** How a fill flashes: one trade colour, or the colour of the side that took liquidity. */ export type TradeColour = "single" | "byAggressor"; /** * One file or folder, for its whole life: a rename or a move keeps its id, and a project never * gives a removed node's id to another node. */ export type TreeNode = TreeDir | TreeFile; /** One sample or more of every member: a member without one fails the type check. */ export type TreeNode_Samples = { readonly [K in TreeNode["kind"]]: readonly Extract[] }; export type TreeOp = OpAdd | OpNewFolder | OpRename | OpMove | OpReplace | OpRemove | OpRestore | OpMoveTo | OpCopyTo | OpRenameProject | OpFraming | OpReplayFile; /** One sample or more of every member: a member without one fails the type check. */ export type TreeOp_Samples = { readonly [K in TreeOp["kind"]]: readonly Extract[] }; /** * What a tree change does to the undo and redo stacks: `push` starts an undo entry and empties * the redo stack, `join` adds to the newest undo entry (the changes of one drop of a folder are * one step), `none` adds nothing. An undo's changes say `redo`: each adds to the redo entry * `tree.undo` started. A redo's changes say `redone` (the first, which starts an undo entry and * keeps the redo stack) and `join` (the rest). */ export type TreeUndo = "push" | "join" | "none" | "redo" | "redone"; export type UsageStatisticsChoice = "send" | "off"; /** * A venue protocol whose SBE schemas are public, as the core recognises a schema by its * `package` and `id`. Values are appended, never renumbered. */ export type Venue = "cme_mdp3" | "cme_ilink3" | "b3_umdf" | "binance_spot" | "deribit_starbase" | "okx" | "iex_options" | "b3_entrypoint" | "euronext_optiq"; export type Visibility = "shown" | "hidden"; /** * One applied intent. * * The log is ordered by `seq` alone; `time_ms` is informational and never orders anything. * `dispatch` assigns `seq` when it applies the intent, from 1 on each page load, one more for * each action, so a capture's `base_seq` and its actions run on with no gap and no repeat, and a * reader refuses a capture where they do not. A `seq` compares only within one page load, which * `Capture.load_id` names. * * An effect that finishes later (a core answer, a store read or write, a SQL result) enters the * log as its own intent at the `seq` it is dispatched at, the order the reducer saw it in, and * carries in `cause_seq` the `seq` of the action that started the effect, so a report shows * which action a late answer belongs to. */ export type Action = { /** A `uint64`: a page load never runs out of numbers, and every value is exact as a `number`. */ seq: number; /** The page's clock (`performance.now()`) when the intent was applied. */ timeMs: number; intent: Intent; causeSeq: number | undefined; }; /** Closes the Add files dialog. */ export type AddFilesClose = { type: "addFiles.close"; }; /** Files are dragged over the window: the dialog opens to take them, unless the user opened it. */ export type AddFilesDrag = { type: "addFiles.drag"; }; /** The drag left the window without a drop: a dialog it opened closes. */ export type AddFilesDragLeft = { type: "addFiles.dragLeft"; }; /** Opens the Add files dialog. */ export type AddFilesOpen = { type: "addFiles.open"; }; export type AppState = { projects: ProjectEntry[]; activeProject: string | undefined; /** The project or node whose name the explorer edits in place. */ renaming: TreeTarget | undefined; /** The project the explorer asks to confirm deleting. */ deleting: string | undefined; /** * Explorer rows (`ExplorerKey_project`, `ExplorerKey_file` of a folder) listed without what * they hold; the rest show it. */ collapsed: readonly string[]; /** In the order they were opened: lookups that take the first match go through them in that order. */ views: Record; panes: Record; activePane: string | undefined; palette: PaletteState; side: SidePanel; addFiles: AddFilesDialog; settings: Settings; /** Text view settings: start and size gutter, FIX tags column. */ offsets: boolean; /** Source of new view and pane ids; ids never repeat within a session. */ nextId: number; /** * Column widths the user set, per grid of a root (`ColumnWidths_key`): kept by root rather * than by view, so a pane closed and opened again keeps them; never saved across reloads. */ columnWidths: Readonly>>>; /** The places the user jumped to, for Go back and Go forward. */ nav: NavHistory; /** The data column whose lens menu is open, if any. */ columnMenu: ColumnMenuState | undefined; /** The pane whose display options popover is open, if any. */ display: DisplayPopover | undefined; /** What new panes of each kind start from, as the user saved it; kinds without one start from the code defaults. */ displayDefaults: DisplayDefaults; /** How the dock lays out the panes: every pane is a tab of one group of it. */ dock: Dock; /** The node the explorer asks to confirm removing: a folder with files, a file with open panes or kept data. */ removing: TreeTarget | undefined; /** Tree changes that can be undone, the newest last; at most `ACTION_LOG_MAX`. */ undo: readonly UndoEntry[]; /** Undone tree changes that can be done again, the newest last; at most `ACTION_LOG_MAX`. */ redo: readonly UndoEntry[]; /** The replay of each project with CME captures, by project. */ replays: Record; }; /** The pane a split pane was split from, and on which side of it. */ export type Beside = { pane: string; direction: SplitDirection; }; /** Book pane `pane` shows or hides its order block columns. */ export type BookBlocksIntent = { type: "book.blocks"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; blocks: BookBlocks; }; /** Closes book pane `pane`; its replay pane stays. */ export type BookClosed = { type: "book.closed"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; }; /** Book pane `pane` scrolls on its own to keep the best price in view (`best`), or only when the user moves it (`off`). */ export type BookFollowIntent = { type: "book.follow"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; follow: BookFollow; }; /** * Book pane `pane` held its book as it was at message `at` while the others played. Captures of * schema 0008 and earlier hold it; it changes nothing. */ export type BookFreeze = { type: "book.freeze"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; at: number; }; /** * The book as it was at message `at` of the project's merged stream, which captures of schema * 0008 and earlier hold for a frozen book pane; a book pane always shows the live book since. */ export type BookFrozen = { kind: "frozen"; at: number; }; /** Book pane `pane` shows or hides its implied size columns. */ export type BookImplied = { type: "book.implied"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; implied: ImpliedColumn; }; /** The book at the replay position. */ export type BookLive = { kind: "live"; }; /** * Opens instrument `security` of `project`'s captures in a new book pane of the project's replay * pane, beside its focused book, or (`pane` set) in that book pane instead of its instrument, * with price `top` at the first row; `top` null: centred on the first book that quotes both * sides. The replay pane opens, or comes forward, with the book focused. A new pane takes * `follow`, `trade_colour`, `implied` and `blocks`; a duplicate carries those of its source. */ export type BookOpen = { type: "book.open"; /** A project's key (`state().projects[].key`). */ project: string; /** The instrument's SecurityID: `instruments({ project })` lists them. */ security: number; /** The price at the first row, in ticks; `null`: centred on the first book that quotes both sides. */ top: number | null; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string | undefined; /** The pane's title: the instrument's symbol, or its SecurityID without a definition. */ title: string; follow: BookFollow; tradeColour: TradeColour; implied: ImpliedColumn; blocks: BookBlocks; }; /** The card a click pinned in book pane `pane`: `block` on `side`, drawn at `place`. */ export type BookPin = { pane: string; side: BookSide; block: PinnedBlock; place: CardPlace; }; /** * Book pane `pane` pins the card of `block` on `side`, beside the block, in place of any card * pinned in the replay's books; the card pinned already, pinned again, stays where it is. */ export type BookPinIntent = { type: "book.pin"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; side: BookSide; block: PinnedBlock; }; /** * The user moved the card book pane `pane` pinned so its top-left corner is at (`x`, `y`) in * CSS pixels of the window: it stays there, no longer beside its block. */ export type BookPinMove = { type: "book.pinMove"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** The card's left edge in CSS pixels of the window. */ x: number; /** The card's top edge in CSS pixels of the window. */ y: number; }; /** * Book pane `pane` puts price `top` at its first row once, as Re-centre computed it from the best * bid and ask. */ export type BookRecentre = { type: "book.recentre"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** The price at the first row, in ticks. */ top: number; }; /** The user scrolled book pane `pane` to price `top` at its first row; Follow turns off. */ export type BookScroll = { type: "book.scroll"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** The price at the first row, in ticks. */ top: number; }; /** * Book pane `pane` followed the replay again. Captures of schema 0008 and earlier hold it; it * changes nothing. */ export type BookThaw = { type: "book.thaw"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; }; /** Book pane `pane` flashes fills in one trade colour, or in the colour of the side that took liquidity. */ export type BookTradeColour = { type: "book.tradeColour"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; colour: TradeColour; }; /** Book pane `pane` closes the card it pinned. */ export type BookUnpin = { type: "book.unpin"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; }; /** The cells fill the pane. */ export type ByteWidthFit = { kind: "fit"; }; /** Cells of a width the user set, in CSS pixels. */ export type ByteWidthPx = { kind: "px"; px: number; }; export type Capture = { /** * Raised only for a change the rules at the top cannot express; a reader refuses a number it * does not know and names both. * 2: files are named by node id (`FileRef`); format 1 named them by path. The default stays 1, * so a capture of format 1, which leaves the field out, still reads as 1 and is refused. */ format: number; /** The commit the writing page was built from. */ build: string; /** Wall clock when the capture was written, milliseconds since the Unix epoch. */ writtenUnixMs: number; /** Wall clock of the page's time origin, so `time_ms` of the actions can be dated. */ originUnixMs: number; files: CaptureFile[]; /** The state after action `base_seq` (0: before the first action of the load). */ baseSeq: number; base: AppState; /** * The actions after `base_seq`, oldest first, with no gaps. A reader stops at the first action * of an intent its build lacks. */ actions: Action[]; /** * The state after the last action, as the writer had it: what replaying `actions` over `base` * is compared to. Absent when there are no actions. */ head: AppState | undefined; /** * The page load the actions' `seq` belong to: drawn at random once per load, so two tabs or * two loads of one tab never share one, and captures of different loads are never merged by * `seq`. 53 random bits, as many as a `number` holds exactly. */ loadId: number; }; /** * A file the state reads. A ref is resolved through the trees in the same capture: the node it * points at holds the file's name, size and content hash, the one place they are written. A node * id means nothing on another machine, so `just open` finds a local copy by that hash, else by * the name and size. Format 1 wrote a size and a link hash here, beside a path. */ export type CaptureFile = { file: FileRef; }; /** The card stays where it opened, beside its block. */ export type CardBeside = { kind: "beside"; }; /** * The user moved the card: its top-left corner at (`x`, `y`) in CSS pixels of the window, kept * inside the window as it is drawn. */ export type CardMoved = { kind: "moved"; x: number; y: number; }; /** Panes a tree change closed (with the views only they showed), which undoing the change opens again. */ export type ClosedPanes = { panes: PaneState[]; views: ViewState[]; }; /** Closes the column lens menu. */ export type ColumnMenuClose = { type: "columnMenu.close"; }; /** Opens the lens menu of data column `path` in pane `pane`. */ export type ColumnMenuOpen = { type: "columnMenu.open"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** The column's name. */ path: string; }; /** A data column's lens menu, open on the header of leaf `path` in pane `pane`. */ export type ColumnMenuState = { pane: string; path: string; }; export type ColumnWidth = { column: number; px: number; }; /** The width the user dragged column `column` of the grids keyed `key` to, in CSS pixels. */ export type ColumnsWidth = { type: "columns.width"; /** The grids the width is kept for: a grid's kind and what it shows. */ key: string; /** The column's index, from 0. */ column: number; /** The column's width in CSS pixels. */ width: number; }; export type ContentLinked = { kind: "linked"; hash: string; size: number; footer: boolean; format: FormatKind; }; /** * Where a file's bytes are. `stored`: the store holds them under their SHA-256 (64 lower-case * hex digits). `linked`: a data file picked by the user and read in place; `hash` is its link * hash (`file-hash.ts`, length and footer), `footer` whether the store kept the ranges read to * open it, `format` what it was found to be when picked, so it is named while it cannot be read. * `unread`: past `source_bytes_max`, never read nor stored. */ export type ContentStored = { kind: "stored"; hash: string; size: number; }; export type ContentUnread = { kind: "unread"; size: number; }; /** Closes the display options popover. */ export type DisplayClose = { type: "display.close"; }; /** The saved default of each pane kind; a kind without one starts from the code defaults. */ export type DisplayDefaults = { readonly symbols?: DisplaySaved; readonly text?: DisplaySaved; readonly bytes?: DisplaySaved; /** A book pane's options: Follow, order blocks, implied columns, trade colour. */ readonly book?: DisplaySaved; }; export type DisplayNumber = { number: number; }; export type DisplayOn = { on: boolean; }; /** Opens the display options popover of pane `pane`, closing any other. */ export type DisplayOpen = { type: "display.open"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; }; /** The pane whose display options popover is open. */ export type DisplayPopover = { pane: string; }; /** A pane's display options return to its kind's saved default, or to the code defaults. */ export type DisplayReset = { type: "display.reset"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; }; /** The values of a pane's display options become what new panes of its kind start from. */ export type DisplaySaveDefault = { type: "display.saveDefault"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; }; /** A pane kind's display options as the user saved them. */ export type DisplaySaved = { values: Readonly>; lenses: readonly (Lens)[]; }; export type DisplayText = { text: string; }; export type DisplayValueEntry = { option: string; value: DisplayValue; }; /** * The dock's layout: the root's children lie along `axis` and each level below takes the other * axis. `active_group` is the group that holds the active pane. */ export type Dock = { axis: Axis; root: DockNode | undefined; activeGroup: string | undefined; }; /** A group of tabs in the dock: the panes it holds, in tab order, and the one in front. */ export type DockGroup = { id: string; tabs: string[]; active: string; }; /** * A node of the dock's tree: a leaf holds a group, a branch two children or more. `share` is the * part of its parent's length along the parent's axis that it takes; siblings' shares sum to 1. * Shares rather than pixels, so a layout fits a window of another size. */ export type DockNode = { share: number; group: DockGroup | undefined; children: DockNode[]; }; /** The layout the user made in the dock by dragging tabs and sashes; panes it leaves out close. */ export type DockSet = { type: "dock.set"; dock: Dock; }; /** * Opens `project`'s replay pane, or brings it forward, with the tables of its files and flows * open under its header. */ export type FeedsOpen = { type: "feeds.open"; /** A project's key (`state().projects[].key`). */ project: string; }; /** * What the core found a file of a project's tree to be: the format of the schema it roots * (null for none), the venue of a public SBE schema it roots (null for any other file), whether * a schema's include reaches it, the code of the project problem about it (why no format reads * it) and that problem's facts, and what the browser holds of it. */ export type FileFacts = { node: number; format: FormatKind | null; included: boolean; problem: string | null; bytes: FileBytes; venue: Venue | null; problemFacts: FileProblem | null; }; /** A linked data file whose picked file is gone: its length and the footer the core read. */ export type FileFooter = { kind: "footer"; size: number; }; /** A file read whole, held by the browser. */ export type FileHeld = { kind: "held"; }; /** A linked data file of which only the name is kept. */ export type FileNameOnly = { kind: "name"; }; /** * Why no format reads a file, past its code: the problem in one line as the problems rows say * it, the limit it passed by name with the limit's value and the file's (null for other * problems), and its first bytes in hex (empty when the core kept none). */ export type FileProblem = { text: string; limit: string | null; max: number | null; value: number | null; head: string; }; /** * A file of a project, wherever the state names one: the project's key and the file's node id, * which renames and moves keep. Every file reference goes through this table. */ export type FileRef = { project: string; node: number; }; export type FollowBytes = { to: "bytes"; bits: number; seq: number; }; export type FollowRows = { to: "rows"; form: Form; position: number; seq: number; }; /** A project's framing settings, per format. */ export type Framing = { sbe: SbeFraming; }; /** The widths the user set in one grid of a root, by the key `ColumnWidths_key` makes. */ export type GridWidths = { key: string; widths: Readonly>; }; /** The Guide pane `pane` shows the heading `heading` at its top after a scroll, `undefined` the article's start. */ export type GuideHeading = { type: "guide.heading"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** The heading's anchor; `undefined`: the article's start. */ heading: string | undefined; }; /** Shows an article in the Guide pane, opening the pane when none is open; `anchor`: a heading of it. */ export type GuideOpen = { type: "guide.open"; /** The article's id, as the guide names it (`replay-cme-order-books`). */ article: ArticleId; /** A heading's anchor in the article; `undefined`: its start. */ anchor: string | undefined; }; /** * The app goes back to the state it had after action `to`, which `state` holds whole: the base * of the log with the actions up to `to` applied. The state rides along so a capture replays it * when action `to` has left the log, and so the log is never cut. */ export type HistoryRewind = { type: "history.rewind"; /** The action to go back to. */ to: number; /** The state right after action `to`. */ state: AppState; }; /** * Opens `project`'s replay pane, or brings it forward, with its instruments column shown and * (`security` set) that instrument's card open, or every card closed. */ export type InstrumentsOpen = { type: "instruments.open"; /** A project's key (`state().projects[].key`). */ project: string; /** The instrument whose card opens (`instruments({ project })` lists SecurityIDs); `null` closes every card. */ security: number | null; }; /** The block length an older-version sender puts on the wire. */ export type LayoutBlockLength = { kind: "blockLength"; owner: string; n: number; }; export type LayoutCount = { kind: "count"; group: string; n: number; }; /** * The text view: each group once, as its type; `count` lenses are ignored. `show` lists what it * writes besides names and types; what is not listed is off. */ export type LayoutDeclarations = { kind: "declarations"; show: TextShow[]; }; /** A framing stack by name; `null` is no framing. */ export type LayoutFraming = { kind: "framing"; stack: string | null; }; export type LayoutLength = { kind: "length"; data: string; n: number; }; export type LayoutVersion = { kind: "version"; version: number; }; /** Which leaves a table row shows, in which order. */ export type LensColumns = { kind: "columns"; leaves: string[]; }; /** Integers and bytes in hexadecimal, for the node and its subtree. */ export type LensHex = { kind: "hex"; }; export type LensLayout = { kind: "layout"; layout: SbeLayoutLens; }; /** Stored values: drops format defaults and project lenses for the node and its subtree. */ export type LensRaw = { kind: "raw"; }; /** Value × 10^exponent. */ export type LensScale = { kind: "scale"; exponent: number; }; /** An integer counts `unit`s since the Unix epoch, printed in UTC. */ export type LensTimestamp = { kind: "timestamp"; unit: TimeUnit; }; /** * Shows the Message pane of `project`'s replay pane, opening the replay pane when it is closed; * `message` pins one message, `null` follows the replay. */ export type MessageOpen = { type: "message.open"; /** A project's key (`state().projects[].key`). */ project: string; /** The message to pin, numbered from 0 in the merged stream; `null` follows the replay. */ message: number | null; }; /** The pane in front stayed there (`UiConfig.tabPlaceMs`): it becomes a place, unless it is the current one. */ export type NavFront = { type: "nav.front"; }; /** Back or forward to the kept entry `seq` of the history. */ export type NavGo = { type: "nav.go"; /** The history entry to go to. */ seq: number; }; export type NavHistory = { /** The entry of sequence `seq` is at `seq % NAV_HISTORY_CAPACITY` while it is kept. */ slots: readonly (NavEntry)[]; /** Sequence of the oldest kept entry. */ oldest: number; /** Sequence of the newest entry; below `oldest` while there is none. */ newest: number; /** Sequence of the current entry; -1 while there is none. */ cursor: number; }; /** The current place's pane shows display position `line` at its top. */ export type NavTop = { type: "nav.top"; /** The display position at the pane's top. */ line: number; }; /** A node's id in the project it left, and in the one it reached. */ export type NodeIdPair = { from: number; to: number; }; /** Shows or hides the start and size gutter of the text form. */ export type OffsetsToggle = { type: "offsets.toggle"; }; /** * One change to projects' trees, the only way a tree changes. `add` names the file by its * content, never its bytes. `moveTo` takes a node to another project under ids that project * gives (`ids` empty), or under `ids` (parents first) when undoing a move; `copyTo` copies under * new ids. */ export type OpAdd = { kind: "add"; parent: number | null; name: string; content: NodeContent; }; export type OpCopyTo = { kind: "copyTo"; node: number; /** A project's key (`state().projects[].key`). */ project: string; parent: number | null; }; /** How the project's SBE schemas are framed on the wire. */ export type OpFraming = { kind: "framing"; framing: Framing; }; export type OpMove = { kind: "move"; node: number; parent: number | null; }; export type OpMoveTo = { kind: "moveTo"; node: number; /** A project's key (`state().projects[].key`). */ project: string; parent: number | null; ids: number[]; }; export type OpNewFolder = { kind: "newFolder"; parent: number | null; name: string; }; export type OpRemove = { kind: "remove"; node: number; }; export type OpRename = { kind: "rename"; node: number; name: string; }; export type OpRenameProject = { kind: "renameProject"; name: string; }; export type OpReplace = { kind: "replace"; node: number; content: NodeContent; }; /** Whether the project's CME replay reads capture file `node`, or leaves it out. */ export type OpReplayFile = { kind: "replayFile"; node: number; inclusion: ReplayInclusion; }; export type OpRestore = { kind: "restore"; nodes: (TreeNode)[]; }; /** Closes the palette. */ export type PaletteClose = { type: "palette.close"; }; /** Opens the palette with `text` typed, listing what `scope` names. */ export type PaletteOpen = { type: "palette.open"; /** The text in the palette's field. */ text: string; scope: PaletteScope; }; export type PaletteState = { open: boolean; text: string; scope: PaletteScope; }; /** What the user typed in the palette. */ export type PaletteText = { type: "palette.text"; /** The text in the palette's field. */ text: string; }; /** Makes pane `pane` the active one, as a click in it does; `undefined` for none. */ export type PaneActivate = { type: "pane.activate"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string | undefined; }; /** * One instrument's ladder over the CME captures of `project`: `security` its SecurityID, `top` * the price at the first row in ticks of the instrument; `null` until the replay places it, centred * on the first book that quotes both sides. A book pane lives in its project's replay pane * (`ReplayState.books`); a capture of schema 0007 or earlier holds it as a pane of the dock. */ export type PaneBook = { kind: "book"; /** A project's key (`state().projects[].key`). */ project: string; security: number; top: number | null; follow: BookFollow; tradeColour: TradeColour; implied: ImpliedColumn; blocks: BookBlocks; }; /** The cells of a byte map fill its pane again, following it as it resizes. */ export type PaneByteFit = { type: "pane.byteFit"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; }; /** The width of one cell of a byte map, in CSS pixels, already within the config's bounds; the map stops following its pane. */ export type PaneBytePx = { type: "pane.bytePx"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** One cell's width in CSS pixels. */ px: number; }; /** * `bytesPerCell` undefined: the cell size that fits the whole layout (see `ByteMap_fitCell`). * `byteWidth`: the cells fill the pane, or a width the user set (see `ByteWidth_px`). * `legend`: the line of column offsets over the cells. */ export type PaneBytes = { kind: "bytes"; /** A view's id (`state().panes[].view`). */ view: string; bytesPerLine: number; bytesPerCell: number | undefined; byteWidth: ByteWidth; legend: boolean; }; /** How many bytes one cell of byte map `pane` stands for; `null` for the size that fits the whole layout. */ export type PaneBytesPerCell = { type: "pane.bytesPerCell"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** Bytes one cell stands for; `null` for the size that fits the whole layout. */ bytesPerCell: number | undefined; }; /** How many bytes a line of byte map `pane` holds. */ export type PaneBytesPerLine = { type: "pane.bytesPerLine"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** Bytes a line of the map holds. */ bytesPerLine: number; }; /** Closes pane `pane`, and the views no other pane shows. */ export type PaneClosed = { type: "pane.closed"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; }; /** Facts of the selection of `follows`, or of a fixed node. */ export type PaneDetail = { kind: "detail"; follows: string; }; /** * The files and flows of `project`'s captures as a pane of the dock, which captures of schema * 0007 and earlier hold; the replay pane's header holds them since. */ export type PaneFeeds = { kind: "feeds"; /** A project's key (`state().projects[].key`). */ project: string; }; /** Shows pane `pane` in `form`: its symbols, or its declarations text. */ export type PaneForm = { type: "pane.form"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; form: Form; }; /** * An article of the guide; `anchor` is the heading scrolled to on each `seq`, `undefined` the * top. `heading` is the heading at the pane's top as the user last scrolled or jumped, which * the pane's link names. */ export type PaneGuide = { kind: "guide"; article: ArticleId; anchor: string | undefined; seq: number; heading: string | undefined; }; /** * The instruments of `project`'s captures, or (`security` set) one instrument's card, as a pane * of the dock, which captures of schema 0007 and earlier hold; the replay pane's instruments * column holds them since. */ export type PaneInstruments = { kind: "instruments"; /** A project's key (`state().projects[].key`). */ project: string; security: number | null; }; /** Shows (`on`) or hides the line of column offsets over byte map `pane`. */ export type PaneLegend = { type: "pane.legend"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** `true` shows the line, `false` hides it. */ on: boolean; }; /** A pane-scope lens, by node path under the root's schema; sent with each query. */ export type PaneLens = { path: string; lens: Lens; }; /** * The Message pane of `project`'s captures as a pane of the dock, which captures of schema 0007 * and earlier hold; the replay pane holds it since (`ReplayState.pinned`). */ export type PaneMessage = { kind: "message"; /** A project's key (`state().projects[].key`). */ project: string; message: number | null; }; /** A place in a pane that shows no view: an article of the guide, the Status pane, a console, a schema source, a capture's replay. */ export type PanePlace = { kind: "pane"; /** The pane while it is open; `show` opens it again once closed. */ pane: string; front: string; title: string; show: PaneShow; }; /** The pane's view shows `root` instead, a place of its own in the history. */ export type PanePlaceIntent = { type: "pane.place"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; root: Root; /** The tab's title. */ title: string; form: Form; }; export type PaneProblems = { kind: "problems"; /** A view's id (`state().panes[].view`). */ view: string; }; /** * The replay pane of `project`'s CME captures: the play bar, the instruments column, the book * panes and the Message pane, as the project's replay (`AppState.replays`) lays them out. A * project has one; closing it keeps the layout for the next time it opens. */ export type PaneReplay = { kind: "replay"; /** A project's key (`state().projects[].key`). */ project: string; }; export type PaneSearch = { kind: "search"; /** A view's id (`state().panes[].view`). */ view: string; }; /** A schema source; `mark` bytes are shown on each `seq`; hover cards use the settings of `view`. */ export type PaneSource = { kind: "source"; file: FileRef; mark: SourceMark | undefined; seq: number; /** A view's id (`state().panes[].view`). */ view: string | undefined; }; /** A copy of a symbols or text pane beside it: a new view of the same root, form and lenses. */ export type PaneSplit = { type: "pane.split"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; direction: SplitDirection; }; /** A SQL console over the Parquet files of a project, or over one of them; `text` is its query. */ export type PaneSql = { kind: "sql"; /** A project's key (`state().projects[].key`). */ project: string; scope: SqlScope; text: string; }; export type PaneState = { id: string; title: string; pane: PaneKind; }; /** What the app knows about itself: the core, the SQL engine, storage, projects, the browser. */ export type PaneStatus = { kind: "status"; }; /** What the page did, by the ingress that caused it: the ops of its trace ring. */ export type PaneTrace = { kind: "trace"; }; export type PaneView = { kind: "view"; /** A view's id (`state().panes[].view`). */ view: string; form: Form; }; /** Panes a tree change closed open again, as its undo brings their nodes back. */ export type PanesReopen = { type: "panes.reopen"; closed: ClosedPanes; }; /** The block of the orders at price `price` that rested before the capture began. */ export type PinnedBeforeCapture = { kind: "beforeCapture"; price: number; }; /** The folded back of the queue at price `price`. */ export type PinnedFold = { kind: "folded"; price: number; }; /** * One order, by its OrderID in decimal: an OrderID is a `uint64`, past what a `number` holds * exactly. */ export type PinnedOrder = { kind: "order"; order: string; }; export type PlaceBytes = { kind: "bytes"; }; export type PlaceDeclared = { kind: "declared"; }; export type PlaceFacts = { kind: "facts"; }; export type PlaceLayout = { kind: "layout"; }; export type PlaceProblems = { kind: "problems"; }; export type PlaceStatistics = { kind: "statistics"; }; export type PlaceTable = { kind: "table"; }; /** The declarations text of an SBE schema or of one of its types. */ export type PlaceText = { kind: "text"; }; export type PlaceUses = { kind: "uses"; direction: Direction; }; /** * Makes `project` the one files go to and commands act on, as a click on it in the explorer * does; the page's API opens a saved project first, as that click does. */ export type ProjectActivate = { type: "project.activate"; /** A project's key (`state().projects[].key`). */ project: string; }; /** * The explorer hides (`collapsed`) or shows what a project or folder row (`key`) holds; panes * showing it stay open. */ export type ProjectCollapse = { type: "project.collapse"; /** The explorer row: `[""]` for a project, `["", ]` for a folder. */ key: string; /** Whether the row's contents are hidden. */ collapsed: boolean; }; /** A project gone from the store and the core: its entry, views, panes and undo steps go too. */ export type ProjectDeleted = { type: "project.deleted"; /** A project's key (`state().projects[].key`). */ project: string; }; /** Starts (a project) or ends (`undefined`) asking to confirm deleting a project. */ export type ProjectDeleting = { type: "project.deleting"; /** A project's key (`state().projects[].key`). */ project: string | undefined; }; /** * A project: its listing (a saved project's as its manifest records it), `problem` why a saved * one's manifest could not be read, `unsaved` why the browser's store could not keep its last * change (`undefined` once it did). */ export type ProjectEntry = { listing: ProjectListing; state: ProjectState; problem: string | undefined; unsaved: string | undefined; }; /** * A project as the explorer lists it: its key, name, tree, facts per file and framing (left out * by captures made before projects had one: no framing). */ export type ProjectListing = { project: string; name: string; tree: ProjectTree; files: FileFacts[]; framing?: Framing; /** * The capture files the project's CME replay leaves out: its session opens over the others. * Left out by captures made before a replay could leave a file out: every file in. */ replayExcluded: number[]; }; /** Starts (a project or node) or ends (`undefined`) editing a name in place. */ export type ProjectRenaming = { type: "project.renaming"; target: TreeTarget | undefined; }; /** A project as listed now: it replaces the entry of its key, which keeps its place, or joins last. */ export type ProjectSet = { type: "project.set"; entry: ProjectEntry; }; /** * Every node of a project in id order, and the id the next new node takes: the ids a tree change * gives depend only on this, so replaying the changes gives the same ids. */ export type ProjectTree = { nodes: (TreeNode)[]; nextId: number; }; /** The projects of the store, listed from their manifests: they join as saved, after the open ones. */ export type ProjectsSaved = { type: "project.saved"; projects: ProjectEntry[]; }; /** Nodes that reached another project under ids it gave, parents first. */ export type Renumbered = { from: string; to: string; ids: NodeIdPair[]; carry: Carry; }; /** The core moved `project`'s replay to message `message`, answering a seek or a step. */ export type ReplayAt = { type: "replay.at"; /** A project's key (`state().projects[].key`). */ project: string; /** The message the replay landed on, numbered from 0 in the merged stream. */ message: number; }; /** * The instruments column of `project`'s replay pane opens instrument `security`'s card under * its row, or (`null`) closes the card it has. */ export type ReplayCard = { type: "replay.card"; /** A project's key (`state().projects[].key`). */ project: string; /** The instrument whose card opens; `null` closes the card. */ security: number | null; }; /** * File `node` of `project` is its events file, written from the captures `from` names (as * `ReplayState.eventsFrom`): the events pass's answer, which the page dispatches once it wrote * the file; a program writes the file with `eventsTable({ project })`. */ export type ReplayEvents = { type: "replay.events"; /** A project's key (`state().projects[].key`). */ project: string; /** The events file: a Parquet file of the project. */ node: number; /** * The content hashes of the project's capture files the file was written from, joined by * commas: `ReplayState.eventsFrom` once the file is current. */ from: string; }; /** The lower card of `project`'s replay pane brings in front at each step the tab `fills` names. */ export type ReplayFillsIntent = { type: "replay.fills"; /** A project's key (`state().projects[].key`). */ project: string; fills: ReplayFills; }; /** * The Filter of `project`'s replay pane is `filter`, a WHERE clause over its events (as * `ReplayState.filter`); `""` filters nothing. */ export type ReplayFilter = { type: "replay.filter"; /** A project's key (`state().projects[].key`). */ project: string; /** The clause, as the Filter field takes it (`symbol = ESZ6 and kind = trade`); `""` filters nothing. */ filter: string; }; /** * The Find field of `project`'s replay pane held `query`. Captures of schema 0009 and earlier hold * it; it changes nothing. */ export type ReplayFind = { type: "replay.find"; /** A project's key (`state().projects[].key`). */ project: string; query: string; }; /** * Book pane `pane` of `project`'s replay pane comes to the front of its group and takes the * focus: the book the replay pane's Display and the book commands act on. */ export type ReplayFocus = { type: "replay.focus"; /** A project's key (`state().projects[].key`). */ project: string; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; }; /** The user rearranged the books area of `project`'s replay pane: a tab dragged, a sash moved. */ export type ReplayLayout = { type: "replay.layout"; /** A project's key (`state().projects[].key`). */ project: string; layout: Dock; }; /** Opens the replay pane of `project`'s captures as it was last laid out, or brings it forward. */ export type ReplayOpen = { type: "replay.open"; /** A project's key (`state().projects[].key`). */ project: string; }; /** Stops `project`'s replay at message `message`, where play had reached. */ export type ReplayPause = { type: "replay.pause"; /** A project's key (`state().projects[].key`). */ project: string; /** Where play had reached: the message the replay stops on. */ message: number; }; /** * Starts playing `project`'s replay at its speed. While it plays, the position moves as a signal * of the page, not as actions. */ export type ReplayPlayIntent = { type: "replay.play"; /** A project's key (`state().projects[].key`). */ project: string; }; /** The header of `project`'s replay pane opens `popover`, or closes the one it has. */ export type ReplayPopoverIntent = { type: "replay.popover"; /** A project's key (`state().projects[].key`). */ project: string; popover: ReplayPopover; }; /** How fast a replay plays: `value` of `unit`, such as 10 steps a second or 2.5 times real time. */ export type ReplayRate = { value: number; unit: ReplayRateUnit; }; /** * `part` of `project`'s replay pane takes `size`: the Message pane a share of the height under * the play bar, the instruments column a width in CSS pixels. */ export type ReplayResize = { type: "replay.resize"; /** A project's key (`state().projects[].key`). */ project: string; part: ReplayPart; /** The Message pane's share of the height (0 to 1), or the instruments column's width in CSS pixels. */ size: number; }; /** Moves `project`'s replay to `target`; where it landed comes as `replay.at`. */ export type ReplaySeek = { type: "replay.seek"; /** A project's key (`state().projects[].key`). */ project: string; target: SeekTarget; }; /** `part` of `project`'s replay pane shows, or collapses to its bar. */ export type ReplayShow = { type: "replay.show"; /** A project's key (`state().projects[].key`). */ project: string; part: ReplayPart; /** `shown` shows the part, `hidden` collapses it to its bar. */ shown: Visibility; }; /** `project`'s replay plays at `rate` from then on. */ export type ReplaySpeedIntent = { type: "replay.speed"; /** A project's key (`state().projects[].key`). */ project: string; rate: ReplayRate; }; /** * One project's replay: the message every live book pane of it shows, as the last seek, step or * pause left it, whether it plays and how fast; and how its replay pane lays out its parts. */ export type ReplayState = { project: string; message: number; play: ReplayPlay; /** * The book panes of the project's replay pane, each a pane of kind `book`: kept while the * replay pane is closed, so it opens again as it was. */ books: Record; /** * How the replay pane's books area lays out its book panes, as `AppState.dock` lays out panes. * A capture of an earlier schema may hold the Fills pane's tab (`fills`) here, which the books * area leaves out. */ layout: Dock; /** * The message the Message pane pins, picked from an order or a level; `null` while it follows * the replay. */ pinned: number | null; /** * Whether the lower card (the Message and Fills panes) shows along the replay pane's bottom, or * only its bar. */ messageShown: Visibility; /** * The Message pane's share of the height under the replay pane's play bar: a third leaves the * books most of the pane and the message tree about ten rows on a laptop's screen. */ messageShare: number; /** Whether the instruments column shows along the replay pane's left edge, or only its bar. */ instrumentsShown: Visibility; /** The instruments column's width in CSS pixels: room for a symbol, its id and its expiry. */ instrumentsPx: number; popover: ReplayPopover; /** The instrument whose card the instruments column shows under its row; `null`: none. */ card: number | null; /** * The project's events file: the Parquet file of every event of its captures, written when * asked, which the explorer lists; `null` before one was written. */ events: number | null; /** * The capture files the events file was written from, their content hashes in `FileIx` * order joined by commas: once the captures differ, the file is stale. */ eventsFrom: string; /** * The card pinned in one of the replay's book panes, open until it is unpinned or its book * closes; none while no card is pinned. */ pin: BookPin | undefined; /** * The stretch of the captures' time the timeline's detail strip shows, which the overview * strip frames; none: the whole captures, as the overview shows them. */ window: ReplayWindow | undefined; /** * The replay pane's Filter as a WHERE clause over its events, in the one form the Filter writes * it (`symbol in (ESZ6, NQZ6) and kind = trade`): its chips are the clause's top-level * conjuncts, and the messages it matches are marked on the timeline. `""`: no filter. */ filter: string; /** Which tab of the lower card, Message or Fills, each step brings in front. */ fills: ReplayFills; /** How fast the replay plays. Captures of schema 0010 and earlier play at 10 steps a second. */ rate: ReplayRate; }; /** Moves `project`'s replay one `unit` forward or back; where it landed comes as `replay.at`. */ export type ReplayStep = { type: "replay.step"; /** A project's key (`state().projects[].key`). */ project: string; unit: ReplayUnit; /** `forward` or `back`. */ direction: StepDirection; }; /** * A stretch of sending time, from `from_seconds` plus `from_nanos` since the Unix epoch up to * `to_seconds` plus `to_nanos`, split as `SeekTime` splits a time. */ export type ReplayWindow = { fromSeconds: number; fromNanos: number; toSeconds: number; toNanos: number; }; /** * The timeline of `project`'s replay pane shows `window` in its detail strip; none: the whole * capture. */ export type ReplayWindowIntent = { type: "replay.window"; /** A project's key (`state().projects[].key`). */ project: string; window: ReplayWindow | undefined; }; export type RootDiff = { kind: "diff"; /** A project's key (`state().projects[].key`). */ project: string; left: SchemaKey; right: SchemaKey; }; export type RootMapping = { kind: "mapping"; /** A project's key (`state().projects[].key`). */ project: string; name: string; }; export type RootNode = { kind: "node"; at: StableKey; place: Place; }; export type RootProject = { kind: "project"; /** A project's key (`state().projects[].key`). */ project: string; }; /** The palette's "go to" matches across open projects. */ export type RootSearch = { kind: "search"; text: string; }; /** The store kept a project's last change. */ export type SavedKept = { kind: "saved"; }; /** It did not, and why. */ export type SavedNot = { kind: "notSaved"; reason: string; }; export type SbeFramingDeclared = { kind: "declared"; stackName: string; }; /** * How a project's SBE schemas are framed on the wire, as the core names it: no framing, one of * the core's framing presets by name, or a framing stack the schema declares by its name. */ export type SbeFramingNone = { kind: "none"; }; export type SbeFramingPreset = { kind: "preset"; name: string; }; /** A schema, by the node of its root file in its project's tree. */ export type SchemaKey = { format: FormatKind; root: number; }; export type ScrollBytes = { to: "bytes"; bits: number; }; export type ScrollRows = { to: "rows"; form: Form; position: number; }; /** Message `message` of the merged stream, from 0. */ export type SeekMessage = { kind: "message"; message: number; }; /** The next message after the position that changes instrument `security`'s book. */ export type SeekNextFor = { kind: "nextFor"; security: number; }; /** * The last message sent at or before `seconds` plus `nanos` since the Unix epoch (`SendingTime` * counts nanoseconds, past what a `number` holds exactly). */ export type SeekTime = { kind: "time"; seconds: number; nanos: number; }; /** The value of every setting; each one is a choice of its entry in `SETTINGS`. */ export type Settings = { theme: ThemeChoice; scrollSync: ScrollSyncChoice; usageStatistics: UsageStatisticsChoice; }; /** Every setting at once, as the palette's settings rows write them. */ export type SettingsSet = { type: "settings.set"; settings: Settings; }; /** * The side panel and its tool window; a hidden panel keeps its tool, so showing it again brings that one back. * `width`: the panel's width in CSS pixels as the user dragged it; undefined is the config's default. */ export type SidePanel = { tool: ToolWindow; visibility: Visibility; width: number | undefined; }; /** The activity bar's press: shows `tool`, or hides the side panel when it shows `tool` already. */ export type SidePress = { type: "side.press"; tool: ToolWindow; }; /** Shows tool window `tool` in the side panel, showing the panel when it is hidden. */ export type SideShow = { type: "side.show"; tool: ToolWindow; }; /** Hides the side panel, or shows it again with its tool window. */ export type SideToggle = { type: "side.toggle"; }; /** The width the user dragged or keyed the side panel's edge to, within the config's bounds; undefined is the default. */ export type SideWidth = { type: "side.width"; /** The width in CSS pixels; `undefined` for the default. */ width: number | undefined; }; /** Bytes `start..end` of a source to mark. */ export type SourceMark = { start: number; end: number; }; /** Bytes of one schema source file: a row's declaration. */ export type SourcePlace = { file: FileRef; mark: SourceMark; }; /** * Shows schema file `file` in a source pane, or brings its pane forward, with bytes `mark` * marked; hover cards use the settings of view `view`. */ export type SourceShow = { type: "source.show"; file: FileRef; mark: SourceMark | undefined; /** A view's id (`state().panes[].view`). */ view: string | undefined; }; /** Brings forward the console of `project` over `scope`, or opens it with `text` as its query. */ export type SqlOpen = { type: "sql.open"; /** A project's key (`state().projects[].key`). */ project: string; scope: SqlScope; /** The query a new console starts with; a console open already keeps its own. */ text: string; }; /** * Runs the query of console `pane`: its Run button, Mod+Enter, or a program through the page's * API. The engine keeps at most `rows_max` rows of the result; the console shows its own first * rows of them. A restore applies it without running anything: results are never replayed. */ export type SqlRun = { type: "sql.run"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** Most rows the engine keeps of the result. */ rowsMax: number; }; export type SqlScopeFile = { kind: "file"; file: FileRef; }; export type SqlScopeProject = { kind: "project"; }; /** What the user typed in a console. */ export type SqlText = { type: "sql.text"; /** A pane's id (`state().panes[].id`; a book pane's: `state().state.replays[project].books`). */ pane: string; /** The console's whole query text. */ text: string; }; /** A node by names only, so it survives reloads and restarts. */ export type StableKey = { project: string; schema: SchemaKey; path: string; }; /** Opens the Status pane, or brings it forward. */ export type StatusOpen = { type: "status.open"; }; /** Shows the Trace pane, opening it when none is open. */ export type TraceOpen = { type: "trace.open"; }; /** * A tree change as the worker applied it: the change, each project it touched as listed after it * (the one it landed in first), and whether the store kept them. */ export type TreeApplied = { change: TreeChange; listings: ProjectListing[]; saved: ProjectSaved; }; /** * The core applied a tree change: listings, panes and views follow it, and `undo` says what the * undo stack takes. */ export type TreeAppliedIntent = { type: "tree.applied"; applied: TreeApplied; undo: TreeUndo; }; /** * What a tree change did: the project it landed in, the node it made or changed there (null for * a project rename), its undo, and the nodes it renumbered. */ export type TreeChange = { project: string; node: number | null; inverse: Undo; renumbered: Renumbered | null; }; /** A folder of a project's tree; `parent` null at the project's top. */ export type TreeDir = { kind: "dir"; id: number; parent: number | null; name: string; }; /** A file of a project's tree; `parent` null at the project's top. */ export type TreeFile = { kind: "file"; id: number; parent: number | null; name: string; content: NodeContent; }; /** * A change to a project's tree, the only way one changes: its effect asks the core to apply it * (`ticket` names the ask), and `tree.applied` brings the answer. */ export type TreeOpIntent = { type: "tree.op"; /** A project's key (`state().projects[].key`). */ project: string; /** The change: a node added, renamed, moved, replaced or removed, a folder made, the project renamed, and the rest `hello().types.TreeOp` lists. */ op: TreeOp; undo: TreeUndo; /** The page's number of this ask, which `tree.applied` answers; the page's API writes it. */ ticket: number; }; /** * The newest redo step is taken off the stack; its changes follow as `tree.op`s whose answers * push an undo step again. */ export type TreeRedoIntent = { type: "tree.redo"; }; /** Starts (a node) or ends (`undefined`) asking to confirm removing a node. */ export type TreeRemoving = { type: "tree.removing"; target: TreeTarget | undefined; }; /** A node of a project's tree, or (`node` null) the project itself: what the explorer renames or removes. */ export type TreeTarget = { project: string; node: number | null; }; /** * The newest undo step moves to the redo stack as an empty redo step; its changes follow as * `tree.op`s whose answers fill that redo step. */ export type TreeUndoIntent = { type: "tree.undo"; }; /** A change and the project to apply it to: what undoes a change. */ export type Undo = { project: string; op: TreeOp; }; /** One step of the undo stack: the changes that undo it, applied last first, and the panes it closed. */ export type UndoEntry = { undos: Undo[]; closed: ClosedPanes; }; /** * Opens a byte map of view `view` with `bytesPerLine` bytes a line, or brings its open one * forward: what Open byte map does. */ export type ViewBytes = { type: "view.bytes"; /** A view's id (`state().panes[].view`). */ view: string; /** Bytes a line of the map holds. */ bytesPerLine: number; }; /** * A data column shows its values through `lens` alone; `undefined` shows them as the file has * them. Only a value lens (raw, hex, scale, timestamp) is ever written here. */ export type ViewColumnLens = { type: "view.columnLens"; /** A view's id (`state().panes[].view`). */ view: string; /** The column's name. */ path: string; lens: Lens | undefined; }; /** Opens the detail pane of view `view`, the facts of its selection, or brings it forward. */ export type ViewDetail = { type: "view.detail"; /** A view's id (`state().panes[].view`). */ view: string; }; /** * The Filter of view `view`, a Parquet file's table, is `filter` (as `ViewState.filter`); `""` * filters nothing. */ export type ViewFilter = { type: "view.filter"; /** A view's id (`state().panes[].view`). */ view: string; /** The clause, as the Filter field takes it; `""` filters nothing. */ filter: string; }; /** The user scrolled one of the view's panes; with scrolling synced, the others follow (`ScrollFollow`). */ export type ViewFollow = { type: "view.follow"; /** A view's id (`state().panes[].view`). */ view: string; target: ScrollTarget; }; /** The pointer is over row `key` of view `view`, or over none (`undefined`); linked panes mark it. */ export type ViewHover = { type: "view.hover"; /** A view's id (`state().panes[].view`). */ view: string; /** The row's key, as `rows()` answers it (`VisualizerRow.key`); `undefined`: the pointer is over no row. */ key: string | undefined; }; /** * Puts `lens` on node `path` of view `view` in its `slot`, or takes it off (`undefined`), as the * lens menu does. */ export type ViewLens = { type: "view.lens"; /** A view's id (`state().panes[].view`). */ view: string; /** The schema node path the lens goes on (`VisualizerRow.path`, `m46/f3`). */ path: string; /** Which of the node's lenses: the lens's kind (`scale`, `hex`), or `layout.` for a layout lens. */ slot: string; lens: Lens | undefined; }; /** * Opens a pane that shows `root` in `form`, titled `title`; a root a pane shows already brings * that pane forward. A place of its own in the history. */ export type ViewOpen = { type: "view.open"; root: Root; /** The tab's title. */ title: string; form: Form; }; /** * A place in a view: the view, the row selected there, the line at the top of its pane, and the * pane in front, its own or one that follows it (a byte map, a detail pane). */ export type ViewPlace = { kind: "view"; /** The view shown; when its pane was closed, `root`, `title` and `form` open it again. */ view: string; root: Root; title: string; form: Form; /** The selected row as `view.select` set it; `key` undefined when nothing was selected. */ key: string | undefined; path: string | undefined; bits: number | undefined; position: number | undefined; /** Display position of the line at the top of the pane when the user left the place. */ top: number | undefined; /** The pane in front, which going back brings forward again while it is open. */ pane: string; /** `Pane_placeKey` of that pane: two places with the same key and selection are one. */ front: string; }; /** * The problem stepped to or picked in the problems pane: its row key and position in the * `Problems` root, and a sequence bumped on each step so the pane scrolls to it. */ export type ViewProblem = { key: string; position: number; seq: number; }; /** * Steps to the problem in row `key`, at display position `position`, of view `view`'s problems: * the Diagnostics pane scrolls to it. */ export type ViewProblemShow = { type: "view.problem"; /** A view's id (`state().panes[].view`). */ view: string; /** The problem row's key, as `rows()` answers it on the Diagnostics pane. */ key: string; /** The problem row's display position. */ position: number; }; /** Opens the Diagnostics pane of view `view`, the problems of its schema or file, or brings it forward. */ export type ViewProblems = { type: "view.problems"; /** A view's id (`state().panes[].view`). */ view: string; }; /** * Selects row `key` of view `view`, as a click on it does: `path` its schema node, `bits` its start * bit, `position` its display position; `reveal` says which panes scroll to it. */ export type ViewSelect = { type: "view.select"; /** A view's id (`state().panes[].view`). */ view: string; /** The row's key, as `rows()` answers it (`VisualizerRow.key`). */ key: string; /** The row's schema node path (`VisualizerRow.path`, `m46/f3`). */ path: string | undefined; /** The row's start bit in the layout. */ bits: number | undefined; /** The row's display position (`VisualizerRow.position`). */ position: number | undefined; /** Where the row is declared: source panes of that file mark it and scroll to it. */ source: SourcePlace | undefined; reveal: Reveal; }; /** * The layout's start bit of a selection made in the text form, whose ranges are offsets * inside their blocks: byte maps show the selection once it comes. */ export type ViewSelectBits = { type: "view.selectBits"; /** A view's id (`state().panes[].view`). */ view: string; /** The row's key. */ key: string; /** The selection's start bit in the layout. */ bits: number; }; /** * One subject seen by linked panes (a symbols or text pane, a byte map, a detail pane): they * share what is open, the lenses and the selection, so selecting a block selects its row. */ export type ViewState = { id: string; root: Root; title: string; /** Keys the user opened and closed; both forms read them, so a fold holds across forms. */ opened: string[]; closed: string[]; lenses: PaneLens[]; selected: string | undefined; /** Start bit of the selection when it has one, so a byte map can scroll to it. */ selectedBits: number | undefined; /** Schema node of the selection, as the core names it; detail, lenses and usages read it. */ selectedPath: string | undefined; /** Display position of the selection in the tree, so other forms of the view can scroll to it. */ selectedPosition: number | undefined; hovered: string | undefined; /** Bumped when a selection should scroll into view in the other panes. */ revealSeq: number; /** Bumped on every selection, wherever it was made: byte maps show each new one. */ selectSeq: number; /** Where the user's last scroll of one of the view's panes asks the others to scroll. */ follow: ScrollFollow | undefined; /** * Display position to put at the top on that scroll, when going back or forward restores a * place; `undefined` brings the selection into view instead. */ revealTop: number | undefined; problem: ViewProblem | undefined; /** What the text form writes besides names and types (descriptions, tags, primitives). */ textShow: TextShow[]; /** Changed whenever a query of this view would answer differently. */ version: number; /** * The WHERE clause of a Parquet file's table, which then shows only the rows it matches, in * the replay Filter's language; `""` filters nothing. */ filter: string; }; /** * Turns `show`, one of what the text form of view `view` writes besides names and types, on * (`on`) or off. */ export type ViewTextShow = { type: "view.textShow"; /** A view's id (`state().panes[].view`). */ view: string; show: TextShow; /** `true` writes it, `false` leaves it out. */ on: boolean; }; /** Opens (`open`) or closes row `key` of view `view`, as a click on its arrow does. */ export type ViewToggle = { type: "view.toggle"; /** A view's id (`state().panes[].view`). */ view: string; /** The row's key, as `rows()` answers it (`VisualizerRow.key`). */ key: string; /** `true` opens the row, `false` closes it. */ open: boolean; }; /** * Every pane of view `view` shows the view's first row at its top, as a link to its place * shows it: a pane brought forward drops where the user had scrolled it. */ export type ViewTop = { type: "view.top"; /** A view's id (`state().panes[].view`). */ view: string; };