/** * The experiments view's inline create/edit form helpers: the metrics * key/value row editor's pure rules. Rows are the form's editable * representation (both fields stay text); `metricsFromRows` folds them back * into the record's `Record` — empty keys drop, and * a value that fully parses as a finite number is stored as a number. * DOM-free so every rule is unit-testable. * @module dsh-client-ui-mimir/client/experiment-form */ import type { MetricDirection } from 'dsh-mimir/types'; /** One editable metrics row: key and value stay raw text while editing. */ export interface MetricRow { readonly key: string; readonly value: string; /** Preference direction of the metric (#220); `none` = unordered. */ readonly direction: MetricDirection; } /** * Expand a record's metrics into editable rows (values stringified), each * row carrying the metric's stored direction (absent reads as `none`, #220). * @param metrics - the stored metrics map. * @param directions - the stored per-metric directions, when the record has any. * @returns one row per entry, in insertion order. */ export declare function metricRowsFromMetrics(metrics: Record, directions?: Record | undefined): MetricRow[]; /** * Fold the editor's rows into a metrics map: rows whose key trims to empty * drop; values are trimmed, and a trimmed value that parses fully as a * finite number (`Number`) is stored as a number, otherwise as the trimmed * string. Later rows with the same trimmed key win. * @param rows - the editor's rows. * @returns the metrics map for the upsert payload. */ export declare function metricsFromRows(rows: readonly MetricRow[]): Record; /** * Fold the editor's rows into a metric-directions map (#220): keys follow * the same trim/dedupe rules as {@link metricsFromRows}, and `none` entries * are omitted so the stored map only carries real preferences. * @param rows - the editor's rows. * @returns the directions map for the upsert payload. */ export declare function directionsFromRows(rows: readonly MetricRow[]): Record; //# sourceMappingURL=experiment-form.d.ts.map