Destroy the client, aborting all in-flight and future requests.
After calling destroy(), all pending requests will reject and any
new requests will fail immediately.
Execute a single SQL write statement.
Optionalparams: SqlValue[]Optionaloptions: ExecuteOptionsExecute multiple SQL write statements in a single request.
Optionaloptions: ExecuteOptionsSend a GET request and parse the JSON response.
Optionalparams: Record<string, string>Optionalsignal: AbortSignalList all nodes in the rqlite cluster.
Calls the /nodes endpoint and returns typed node information including
leader status and reachability.
Optionaloptions: { nonvoters?: boolean; signal?: AbortSignal }Send a POST request with a JSON body and parse the response.
Optionalparams: Record<string, string>Optionalsignal: AbortSignalExecute a single SQL query (read).
Optionalparams: SqlValue[]Optionaloptions: QueryOptionsExecute multiple SQL queries in a single request.
Optionaloptions: QueryOptionsExecute a paginated query, yielding one page at a time.
Appends LIMIT and OFFSET clauses to the user SQL. Each page fetches
pageSize + 1 rows; if the extra row is present, hasMore is true
and only pageSize rows are returned.
Optionalparams: SqlValue[]Optionaloptions: PaginationOptions & QueryOptionsCheck if the connected rqlite node is ready to accept requests.
Calls the /readyz endpoint which returns HTTP 200 if the node is ready,
or HTTP 503 if not. The noleader query parameter allows checking readiness
without requiring a leader.
Optionaloptions: { noleader?: boolean; signal?: AbortSignal }Execute mixed read/write SQL statements in a single HTTP call.
Uses the rqlite /db/request endpoint which accepts both SELECT and
write statements. Each result is tagged with type: "query" or
type: "execute" based on the statement.
Optionaloptions: RequestOptionsconst results = await client.requestBatch([
["INSERT INTO foo VALUES(?, ?)", 1, "bar"],
["SELECT * FROM foo"],
], { transaction: true })
if (results.ok) {
for (const r of results.value) {
if (r.type === "execute") console.log(r.rowsAffected)
if (r.type === "query") console.log(r.columns, r.values)
}
}
Get the rqlite server version string.
Extracts the build.version field from the /status endpoint.
Returns undefined if the version field is not present.
Get the status of the connected rqlite node.
Returns the full status object from the /status endpoint. The structure
varies by rqlite version; fields are not strictly typed.
rqlite HTTP client with connection management and authentication.