silo_client library

A typed client for silo's HTTP API. The transport stays internal: a route this client does not cover is a client change.

Classes

CacheOptions
Whether entry reads are cached, and the ttl and bound a read does not state itself. Off unless asked for: a cached read can carry a stale rev.
CacheStatistics
A snapshot across every store in one cache. Clearing keeps the counters.
CancellationSignal
Cancels every request holding it, now and later. One-way and idempotent.
CollectionDefinition
A collection with its schema, silo:// refs already resolved.
CollectionHandle<F>
One collection, its fields read as F.
Collections
CollectionSchema
One collection's schema. Deleting it deletes the collection.
CollectionSummary
A collection as the listing answers it, without its schema.
DeclareVariableOptions
environment is where the initial value lands.
DeleteOptions
force overrides the server's "not empty" or "still referenced" refusal.
Entry<F>
One entry: silo's envelope beside your fields. A plain value with no transport, so it logs as its own contents. Writes go through the collection.
EntryListQuery
Everything list accepts. sort takes a SortTerm or a raw string.
EntryPage<F>
One page of entries, navigated by the window the server answered.
EntryPageStream<F>
What pages() answers: whole pages, stopping on the first short one.
EntryReadOptions
Reads resolve by default. EntryReadOptions.raw answers the stored templates, which is what an editor must read.
EntryStream<F>
What all() answers: entries one at a time, across every page.
Environment
An environment record. id never changes; name is what paths address.
EnvironmentHandle
One environment by name. Immutable, like ProjectHandle.
Environments
EnvironmentVariables
This environment's values.
Filter
Builds filters. each('tags').notEquals('x') is "some tag is not x"; not(each('tags').equals('x')) is "no tag is". A misspelled field matches nothing rather than failing to compile.
FilterExpression
A built filter. Combining answers a new expression and never mutates this one.
FilterField
One path awaiting an operator.
FilterNode
One node of the filter AST: a leaf tests path against value, a group combines args.
HealthReport
Media
The media library: how you find or add an asset. MediaAsset is what you do to one.
MediaAsset
A catalogued asset, live. A mutating call adopts the server's answer in place and returns this.
MediaAssetRecord
Everything an asset is, as a value.
MediaDeleteFailure
One id a bulk delete could not remove. The counts and referrers are set only for media_in_use.
MediaDeleteReport
Every id's outcome in a bulk delete. A partial success is a value, not a throw.
MediaFolderDeleteOptions
recursive takes the folder's contents with it; force only matters with it.
MediaFolderMoveOptions
merge joins an existing destination instead of refusing.
MediaFolders
The folder tree. A folder is a record, so it can exist while empty.
MediaPage
One page of Media.list, navigated by the window the server answered.
MediaPageStream
What Media.pages answers: whole pages until one reports no more.
MediaQuery
What Media.list accepts.
MediaReference
The silo://media/<id> an entry field holds. Only the scheme form is recognised, so a stored asset.url is never mistaken for one.
MediaReplace
New bytes for an existing asset. filename must keep the current extension.
MediaStream
What Media.all answers: assets one at a time, across every page.
MediaUpload
One file on its way into the library. The server reads the extension off filename. folder unset means the library root.
MediaUsage
One entry's reference to an asset.
MediaUsagePage
One page of an asset's referrers. total is the true count; paging follows visible, what this key may read. The wire echoes no window.
MediaUsageQuery
Page<Row>
One page of results. truncated marks a total that counts what a scan examined: pageCount is then null and hasMore means "this page is full".
PageWindow
The limit and offset a page answered, as the server clamped them.
Project
A project record. id never changes; name is what paths address.
ProjectHandle
One project by name. Immutable: after a rename it still addresses the old name, so build a new handle.
Projects
ProjectVariables
Declarations, project-wide. Values live on EnvironmentVariables.
RenameOptions
expectedId binds the rename to the record a caller already read.
RenameReport
What a rename did or would do. Pass id as expectedId to turn a dry run into the real call.
RequestOptions
The deadline and cancellation every call accepts last.
ResponseCache
The JSON one client holds, in one store per ttl and bound in force. A store is insertion-ordered, so its oldest entry is both next to expire and next to evict. Time comes from package:clock, so tests use withClock.
RouteInventory
Every route this client reaches, and every route it leaves out on purpose. Held to the TypeScript client's lists by a test.
RowStream<Row>
Rows one at a time across every page, loaded lazily. Advances by the echoed window and stops on the first short page. Not a snapshot of data being written.
SearchHit
One result, with its location. The entry's templates are resolved, so read it again raw before editing.
SearchPage
SearchQuery
Everything a search accepts. text is the wire's q; without sort, results rank by relevance.
SearchSnippet
Where a match was found: the fragment is before + match + after.
Silo
One silo instance: silo.project('acme').environment('prod').collection('posts').
SiloOptions
Everything Silo accepts. Only url is required: anonymous reads are legal.
Sort
Builds sorts. No each: a sort path selects at most one node.
ValidationDetail
One rejected field: a JSON Pointer and the validator's message.
Variable
One {{NAME}} as one environment sees it. value is null when this environment has set nothing; '' is a value.
VariableEnvironmentOptions
environment picks whose value comes back. Unset, the server assumes prod, which is a 404 in a project without one.

Enums

FilterOperator
The filter AST's operators: nine leaves and three groups.
MediaState
SearchEngine
The engine that answered: SQLite FTS5, or the portable scan.
SortDirection
VariableResolution
Whether a read answers {{NAME}} templates resolved or as stored.

Extension Types

SortTerm
One sort key, represented as the sort parameter's own string, so a raw String is accepted wherever a term is.

Typedefs

JsonSchema = Map<String, Object?>
A JSON Schema document, passed to silo exactly as given.
RowLoader<Row> = Future<({List<Row> rows, PageWindow window})> Function(PageWindow window)
Loads the page at a window, and answers the window the server used.

Exceptions / Errors

ConflictException
A 409, usually a stale revision.
ForbiddenException
A 403: the key lacks the claim this call needs.
InternalException
A 500 with no more specific code.
InvalidResponseException
A 2xx whose body is not the JSON its route promises.
MediaDeleteStalledException
A 500: the asset was staged for deletion and the blob store kept its bytes.
MediaInUseException
A 409 refusing to delete an asset entries still reference.
NetworkException
The request never reached the server. Not a SiloException: nothing answered, so a write may still have landed. Reconcile before retrying.
NotFoundException
A 404.
RequestAbortedException
The caller's CancellationSignal fired.
RequestTimeoutException
The deadline passed before an answer came back.
SiloException
Something silo answered and refused. status and code are the wire's.
UnauthorizedException
A 401: no key, or one the server does not recognise.
ValidationFailedException
A 400, with one detail per rejected field.