Oko/Docs

Command reference

oko database request

Sends one PostgREST request as the signed-in member and writes the answer's bytes as they came; with --body, the request body is read from standard input. Row security scopes what the member may read and write.

Invocation#

Command
oko database request --method VERB --path PATH [--prefer TEXT] [--body]

Inputs and options#

  • --method and --path are required; --prefer sets the Prefer header; --body reads standard input to its end.
  • `node --env-file=<fixture.env> tests/database/ledger/row-schema.mjs` exercises the real signed-in database through this CLI. The fixture file declares OKO_BIN, OKO_TEST_SOURCE_REVISION, OKO_TEST_SCHEMA_REPOSITORY, OKO_TEST_SCHEMA_REVISION, OKO_TEST_SCHEMA_TASK, OKO_TEST_FIXTURE_SESSION and OKO_TEST_SUCCESS_EXIT (the process success status). Select a dedicated real task with retained evidence, never operator work. The journey repeats its genuine evidence write, then submits an unknown column, an empty row and a non-object row; each refusal must name its table and actual cause and leave the stored evidence unchanged. Source and schema revisions, binary digest, commands, bodies, exits and readbacks are retained under .build/database/row-schema.
  • The same journey checks the import boundary: writing an already retained row with replacement disabled returns false and leaves its persisted values unchanged. A skipped row must not be counted as an inserted row.

Output and state effect#

  • Writes the raw answer to standard output; a write request changes what the path names.

Refusals and safe exits#

  • `oko database request requires --method <text>`, `oko database request requires --path <text>` (exit 2); `the request body on standard input is not readable: <error>`; `the answer could not be written: <error>`; the session refusals of `check` and the database's own HTTP refusal.
  • Task-row writes reject columns absent from the installed schema rather than silently dropping them. The refusal names the actual table and unrecognized columns, and the transaction records nothing. Empty rows and non-object rows have distinct causes. These shared-database failures propagate to the task CLI and the native API used by Desktop; a client cannot report a successful write of data its schema cannot retain. Schema delivery includes 20261010140000_oko_task_row_schema_refusal; this validation does not by itself bind a verdict atomically to inspected evidence and contract revisions.

CLI reference#