Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/core / statementFromRows

Function: statementFromRows()

ts
function statementFromRows(input): ProviderStatement;

Defined in: packages/core/src/engine/reconcile-statement.ts:970

Normalizes raw keyed rows (a parsed CSV, a JSON export) into a ProviderStatement under one explicit StatementColumnMap (RV1703). Fail-closed at the cell: a mapped column whose value cannot be evidence (a non-numeric dollar figure, a fractional or negative token count, an empty response id, an unknown component name) refuses typed with the row index and column name instead of flowing a NaN or a guess into the reconciliation. Absent cells (missing key, null, empty string) mean "the export does not carry this figure" and simply omit the field; a requests row that ends up carrying no dollars, no component split, and no usage at all is refused, because a row without evidence cannot reconcile anything.

Parameters

ParameterType
input{ kind: "requests" | "categories"; map: StatementColumnMap; rows: readonly Record<string, unknown>[]; }
input.kind"requests" | "categories"
input.mapStatementColumnMap
input.rowsreadonly Record<string, unknown>[]

Returns

ProviderStatement