Documentation
¶
Overview ¶
Package api is Veritix's HTTP interface: the REST and SSE surface the web UI is built on, and the same surface a script or a CI job can drive.
It does not reimplement any part of the audit. Every run goes through audit.Run, and every report served here is the document report.Build produces, so the web interface and the JSON report cannot disagree about what was found.
The contract is internal/api/openapi.yaml, served at /api/v1/openapi.yaml. Settle a change there before changing a handler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
// Seq numbers the run's progress from 1. The terminal event has no
// sequence number: it is read from the store rather than replayed from the
// stream, so it is not at any position in it.
Seq int `json:"seq,omitempty"`
Type string `json:"type"`
Time time.Time `json:"time"`
Message string `json:"message,omitempty"`
Fields map[string]any `json:"fields,omitempty"`
// Run is set on the terminal event, so a client that only cares about the
// outcome can ignore everything before it.
Run *runJSON `json:"run,omitempty"`
}
Event is one item on a run's stream.
It carries the same class of information as the server's diagnostic log — stages, table names, counts — and no cell values. The one endpoint that serves those is the per-finding rows endpoint, deliberately and alone.
type Options ¶
type Options struct {
// Store is the run history. Required.
Store *store.Store
// Config carries the server and engine settings a run needs.
Config config.Config
// Version is reported by /health and recorded on every run.
Version string
// Log receives diagnostics. Request logs go here, run progress goes to
// the run's event stream as well.
Log *slog.Logger
// Web is the built web interface, normally web.FS(). It is injected rather
// than imported so that this package's tests can drive the API without a
// front-end build, and can serve a stub one when they are testing how it is
// served. A nil Web serves the JSON 404 that predates the interface.
Web fs.FS
}
Options configures a server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the API's state: the store, the settings a run needs, and the registry of runs currently executing.