API Overview
Public Surface
- TypeScript
- JSON
import {
CSDBDatabase,
openCSDB,
saveCSDB,
parseCSDB,
serializeCSDB,
parseSQL,
CSDBError,
SQLError,
ValidationError
} from "@csvdatabase/csdb";
POST /v1/commands
Content-Type: application/json
{
"database": "payroll",
"command": {
"kind": "select",
"table": "workers",
"columns": "*",
"joins": [],
"orderBy": [],
"output": "objects"
}
}
Main Objects
CSDBDatabaseowns a parsed CSDB document and executes queries.TableQueryis returned bydb.table(name)and builds fluent table operations.QueryPlanis the shared internal representation used by SQL and direct execution.Rowis a language-native key/value object for one table record.TableSchemadescribes columns, keys, constraints, indexes, relationships, computed fields, and comments.- A JSON command envelope names a server-managed database and carries a query plan or database operation.
Common Flow
- TypeScript
- JSON
const db = await openCSDB("payroll.csdb");
db.table("workers").insert({ id: "w_001", name: "Ada", email: "ada@example.com" });
db.validate();
await saveCSDB(db, "payroll.csdb");
{
"database": "payroll",
"command": {
"kind": "insert",
"table": "workers",
"rows": [
{ "id": "w_001", "name": "Ada", "email": "ada@example.com" }
]
}
}
The server validates and atomically persists a successful mutation before it returns the response.
See CSDB Server for the endpoint envelope, response shapes, expression trees, and persistence behavior.