omnystore_cli library
The omnystore command set, exposed as a library.
The CLI is a library first and an executable second: runOmnyStoreCli
takes its arguments, environment and output sinks as parameters, so the
whole command surface can be driven in-process — by a test, by a build
script, or by an application embedding the commands in its own tool.
final out = StringBuffer();
final code = await runOmnyStoreCli(
['release', 'latest', '--package', 'omnyagent'],
environment: {'OMNYSTORE_URL': 'https://store.example.com'},
out: out,
);
The executables bin/omnystore.dart and bin/omnystore_server.dart are
thin wrappers over it.
Classes
- AllowAllAuthorizer
- Allows every request. The default — authorization is opt-in.
- AnonymousAuthenticator
-
An authenticator that treats every caller as anonymous (returns
null). The default — authentication is opt-in. - AnonymousAuthProvider
- An AuthProvider that sends no credentials.
- ApiErrors
- Renders OmnyStore's typed failures into the REST API's JSON error envelope.
- ArgResultsSource
- The global options a long-running command reads.
- Asset
- A downloadable file attached to a Release — a tarball, an installer, a checksum file, a signature.
- AssetCommand
-
omnystore asset— artifact management. - AssetDownload
- An open read of an asset's bytes, whichever provider ended up serving them.
- AssetKinds
- The conventional values of Asset.kind, and the rules that read them.
- AssetLocation
- Records that one provider holds the bytes of one asset.
- AssetLocationRepository
- Stores AssetLocation placement records — which provider holds which asset's bytes.
- AssetRepository
- Stores Asset records, keyed by id and by (release, name).
- Authenticator
- Establishes the Principal behind a request.
- Authorizer
- Decides whether an (already authenticated) caller may proceed with a request — a coarse, hub-wide policy gate.
- AuthProvider
- Supplies the credentials a client attaches to each request.
- AwsCredentials
- A set of AWS credentials.
- AwsCredentialsProvider
- Supplies AWS credentials, refreshing them when they expire.
- BasicAuthAuthenticator
-
Authenticates
Authorization: Basic base64(user:pass)requests. - BearerTokenAuthenticator
-
Authenticates
Authorization: Bearer <token>requests. - ByteRange
-
A half-open-at-the-end byte range, in HTTP
Rangesemantics: start and end are both inclusive, andend == nullmeans "to the end of the object". - ChecksumResult
- The size and digest of a byte stream, computed while it was being consumed.
- Checksums
- SHA-256 helpers used wherever OmnyStore hands bytes across a trust boundary: uploads into object storage, downloads onto a client's disk, and replication between providers.
- ChecksumStream
- A stream transformer that hashes and counts bytes as they flow through, leaving the data itself untouched.
- CheckUpdateCommand
-
omnystore check-update— ask whether a newer version exists. - CliContext
- Where the CLI's global options come from, and how they resolve to a store.
- Clock
-
Time source used throughout OmnyHub so tests can fix
now. - CompositeAuthenticator
- Tries several authenticators in order, returning the first Principal one produces.
- CompositeAuthProvider
- An AuthProvider that merges several providers' headers.
- DenyAllAuthorizer
- Denies every request.
- Domain
-
A
LetsEncryptdomain. - DownloadCommand
-
omnystore download— fetch an artifact, verified. - DownloadManager
- Downloads artifacts to disk or into memory, with resume and mandatory checksum verification.
- DownloadProgress
- Progress of an in-flight download.
- DownloadRecord
- One recorded download of an Asset.
- DownloadRepository
- Stores DownloadRecords — append-only, and the highest-volume table in the system by a wide margin.
- DownloadResult
- The outcome of a completed download.
- DownloadStats
- Aggregated download counts, as returned by the downloads API.
- DownloadTarget
- Where a client should go to fetch an asset.
- EnvironmentAwsCredentialsProvider
- An AwsCredentialsProvider reading the standard AWS environment variables.
- Eq
- Structural equality helpers for the immutable models.
- ErrorCodes
- The error codes used by OmnyStore.
- GcpAccessToken
- An OAuth 2.0 access token for the Google Cloud Storage API.
- GcpCredentialsProvider
- Supplies access tokens for Google Cloud APIs, and — when it can — the RSA key material needed to sign download URLs.
- GcpMetadataServerCredentials
- A GcpCredentialsProvider reading the ambient identity from the GCP metadata server.
- GcpServiceAccountCredentials
-
A GcpCredentialsProvider backed by a service account key — the standard
JSON file
gcloud iam service-accounts keys createproduces. - GcpStaticCredentials
-
A GcpCredentialsProvider wrapping a token obtained elsewhere — by
gcloud auth print-access-token, bypackage:googleapis_auth, or by an application's own OAuth flow. - GcsObjectStorage
- An ObjectStorage backed by a Google Cloud Storage bucket.
- HandlerService
-
A
Servicebacked by closures — the quickest way to host request/response (and optionally WebSocket) logic without declaring a class. - HttpDates
-
Parsing for the
Last-ModifiedandDateheaders the object-storage backends read. - HttpTransport
-
A
Transportbuilt onshelf+shelf_web_socket. - HubRequest
- A protocol-agnostic inbound request.
- HubResponse
- A protocol-agnostic outbound response.
- IdGenerator
- Generates unique identifiers for connections, nodes and requests.
- Json
-
Manual JSON read helpers for the hand-written decode paths that
json_serializabledoes not cover — API request bodies, error envelopes and the free-formmetadatamaps. - JsonFileRepositories
- Metadata repositories persisted as JSON files in a directory.
- LetsEncryptTls
-
A TlsProvider that provisions and renews certificates automatically via
Let's Encrypt (ACME HTTP-01), backed by
package:shelf_letsencrypt. - LocalObjectStorage
- An ObjectStorage backed by a directory on the local filesystem.
- LocalStoreProvider
- A StoreProvider backed by an in-process OmnyStore.
- Logger
- Structured logging port.
- MemoryAssetLocationRepository
- An in-memory AssetLocationRepository.
- MemoryAssetRepository
- An in-memory AssetRepository.
- MemoryDownloadRepository
- An in-memory DownloadRepository.
- MemoryObjectStorage
- An ObjectStorage holding every object in the heap.
- MemoryOrganizationRepository
- An in-memory OrganizationRepository.
- MemoryPackageRepository
- An in-memory PackageRepository.
- MemoryProjectRepository
- An in-memory ProjectRepository.
- MemoryReleaseRepository
- An in-memory ReleaseRepository.
- MemoryRepositories
- A complete in-memory StoreRepositories bundle.
- Names
- Validation for the human-typed, URL-addressable names OmnyStore uses as secondary keys: organization, project and package names.
- NodeCommand
-
omnystore node— run a storage node that serves organizations through a hub. - NodeId
-
A validated node identifier (slug-like: letters, digits,
.,_,-). - NoopLogger
- A Logger that discards everything. The default throughout the framework.
- NullableVersionConverter
- Serialises a nullable Version.
- ObjectReader
- An open read over a stored object: its metadata plus the byte stream.
- ObjectStorage
- The pluggable binary backend: where asset bytes actually live.
- OmnyHub
-
The framework facade: binds one or more
Transports, hosts a set ofServices on them, and runs every request through a middleware pipeline. - OmnyStore
- The registry, backed by local repositories and one object store.
- OmnyStoreApi
- The registry's complete operation surface, implemented three times over.
- OmnyStoreClient
- The client SDK: an OmnyStoreApi backed by a remote OmnyStore server.
- OmnyStoreCliRunner
-
The
omnystorecommand-line interface. - OmnyStoreHub
- The discovery point: one OmnyStoreApi federated across many providers.
- OmnyStoreNode
- A storage node: an OmnyStore that dials a hub and serves its organizations' releases through it.
- OmnyStoreServer
-
The HTTP REST server: an OmnyHub hosting the
/api/v1surface and, when the store is a federating hub, the control endpoint storage nodes dial. - Organization
- The top-level tenant: a company, a team, or an open-source org that owns projects.
- OrganizationRepository
- Stores Organization records, keyed by id and by unique name.
- OrgCommand
-
omnystore org— organization management. - Package
- A distributable artifact line within a Project — the thing that has versions.
- PackageCommand
-
omnystore package— package management. - PackageRepository
- Stores Package records, keyed by id and by (project, name).
- ParsedGlobals
-
An ArgResultsSource reading from parsed
ArgResults. - PathRule
- Matches on the request path.
- Platforms
-
The
os-archplatform tokens OmnyStore tags artifacts with, and how to work out which one the current process is. - PredicateAuthorizer
- An authorizer backed by a predicate.
- Principal
- An authenticated identity attached to a request or a node connection.
- Project
- A product or repository within an Organization, grouping the packages released together.
- ProjectCommand
-
omnystore project— project management. - ProjectRepository
- Stores Project records, keyed by id and by (organization, name).
- ProviderDescriptor
- The public description of a storage provider: who it is, which organizations it serves, how its bytes are reached, and how much room it has left.
- ProviderEvent
- A change to the set of providers a hub knows about.
- ProviderRegistry
- The hub's directory of storage providers, and the routing table that maps organizations onto them.
- ProvidersCommand
-
omnystore providers— show the storage providers behind the registry. - RandomIdGenerator
- The default IdGenerator: a per-process monotonic counter combined with random entropy, so ids are unique within a process and unpredictable across processes without requiring an external dependency.
- ReconnectPolicy
- Exponential backoff with jitter for reconnection.
- RedirectDownload
- The client should follow url — a presigned bucket URL, or a signed URL at the node that holds the bytes.
- RefreshingAuthProvider
- An AuthProvider that fetches a token on demand and refreshes it when the server rejects it.
- RefreshingAwsCredentialsProvider
- An AwsCredentialsProvider that caches what fetch returns until it is close to expiring, then fetches again.
- Release
- A published version of a Package, with its notes and its Assets.
- ReleaseCommand
-
omnystore release— publishing and inspecting releases. - ReleaseQuery
- Filters and paging for a release listing.
- ReleaseRepository
- Stores Release records, keyed by id and by (package, version).
- ReloadableFileTls
- A TlsProvider backed by certificate/key files that are reloaded when their contents change on disk — for externally-managed certificates (a cert-manager, certbot, a mounted secret) without restarting the hub.
- RemoteNodeStoreProvider
- The hub-side face of a connected storage node: an OmnyStoreApi whose every call is forwarded over the node's control channel.
- RoleBasedAuthorizer
- Requires authentication and (optionally) that the caller hold one of a set of roles.
- RouterService
-
A
Servicethat dispatches to sub-routes by HTTP method and aPathPattern, exposing captured path parameters — the intra-service equivalent ofshelf_router, without leaving theHubRequest/HubResponsemodel. - S3ObjectStorage
- An ObjectStorage backed by an AWS S3 bucket, or any S3-compatible service (MinIO, Cloudflare R2, Backblaze B2, Ceph, DigitalOcean Spaces).
- ScopedIdGenerator
- An IdGenerator that stamps a scope into every identifier it produces.
- ServerCommand
-
omnystore server— run the REST API server. - Sha256Accumulator
- An incremental SHA-256 accumulator.
- SigV4
-
AWS Signature Version 4 signing, in both the forms S3 needs:
Authorizationheaders for requests this process makes, and query-string presigning for URLs handed to a client so it can fetch an artifact straight from the bucket. - StaticAwsCredentialsProvider
- An AwsCredentialsProvider returning a fixed credential set.
- StaticGlobals
- An ArgResultsSource backed by a literal map, for tests.
- StaticTls
- A TlsProvider backed by a fixed certificate and key.
- StorageKeys
- Builds and parses the storage keys OmnyStore assigns to asset bytes.
- StoreApiService
-
Builds the
/api/v1REST surface over any OmnyStoreApi. - StoreCommand
- A command that needs a resolved CliContext.
- StoredObject
- Metadata about a stored object, as the backend reports it.
- StoreNodeGateway
- The hub-side endpoint storage nodes connect to.
- StoreProtocol
- The wire contract between a hub and its storage nodes.
- StoreProvider
- A participant that holds and serves releases for one or more organizations.
- StoreRepositories
-
The full set of metadata repositories, injected into
OmnyStoreas one unit. - StoreRpcServer
- Answers StoreProtocol RPCs against a local OmnyStoreApi.
- StreamedDownload
-
No URL could be issued, so the caller must stream the bytes itself through
OmnyStoreApi.openAsset. - StructuredLogger
- A Logger that writes one JSON object per line to an IOSink (stderr by default), filtering records below minLevel.
- SystemClock
- The default Clock, backed by the system wall clock (UTC).
- TlsProvider
-
Supplies TLS material to an HTTPS/WSS
Transport, and (for ACME providers) the challenge middleware and provisioning/renewal hooks. - TokenAuthProvider
- An AuthProvider sending a fixed bearer token.
- UpdateChecker
- The client-side update service: "am I running the newest build, and what should I download if not?".
- UpdateInfo
- The answer to "is there a newer version for me?".
- UpdateResolver
-
The decision logic behind every update check, kept in one pure function so
the embedded store, the hub, the REST endpoint and the standalone
UpdateCheckercannot drift apart on the question that matters most: should this client be told to update? - Version
- A parsed semantic version number.
- VersionConstraint
- A VersionConstraint is a predicate that can determine whether a given version is valid or not.
- VersionConstraintConverter
-
Serialises a VersionConstraint as its string form (
'^1.2.0','any'). - VersionConverter
- Serialises a Version as its canonical string form.
- Versions
-
Version helpers that fail with OmnyStore's own typed exceptions instead of
pub_semver's FormatException.
Enums
- DataPlaneMode
- How a provider's bytes reach a client.
- LogLevel
- Severity levels for Logger.
- NodeState
-
The lifecycle state of a
NodeRuntime. - ProviderEventKind
- How a provider's membership changed.
- ProviderKind
- What kind of participant a storage provider is.
- ProviderStatus
- The liveness of a provider, as tracked by the hub.
- ReleaseChannel
- The distribution channel a release belongs to.
- ReplicaState
- Where a replica of an asset's bytes stands.
Extensions
- AssetResponseHeaders on Asset
- Convenience for the tests and for callers building a response themselves.
Constants
- omnyStoreApiVersion → const String
-
The REST API version segment served by the API server (
/api/v1). - omnyStoreVersion → const String
-
The canonical OmnyStore package version (kept in sync with
pubspec.yaml).
Functions
-
cors(
{Iterable< String> allowedOrigins = const [], OriginPredicate? allowOrigin, bool allowAnyOrigin = false, Iterable<String> allowedMethods = const ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], Iterable<String> allowedHeaders = const ['accept', 'authorization', 'content-type', 'x-omny-principal', 'x-requested-with'], bool reflectRequestHeaders = false, Iterable<String> exposedHeaders = const [], bool allowCredentials = false, Duration maxAge = const Duration(hours: 24)}) → Middleware - Cross-Origin Resource Sharing: lets a browser app served from another origin call this hub.
-
omnyStoreExceptionForCode(
String code, String message, {int statusCode = 500, Uri? url, Map< String, Object?> details = const {}}) → OmnyStoreException -
Reconstructs an OmnyStoreException from the
code/messagecarried on a JSON error envelope — the inverse of the mapping the API server uses to render a thrown exception. -
runOmnyStoreCli(
List< String> arguments, {Map<String, String> ? environment, StringSink? out, StringSink? err}) → Future<int> -
Runs the CLI with
argumentsand returns the exit code.
Typedefs
- Middleware = HubRequestHandler Function(HubRequestHandler inner)
-
Wraps a
HubRequestHandler, returning a new one — the composition primitive for the request pipeline (authentication, logging, CORS, ACME challenge, error mapping, ...). -
NodeAdmissionPolicy
= FutureOr<
Set< Function(String nodeId, Set<String> >String> declared, Principal? principal) - Decides whether a storage node may join the federation, and which organizations it is allowed to serve.
-
NodeInvoker
= Future<
Map< Function(String action, Map<String, dynamic> >String, dynamic> payload) -
Invokes
actionon a node and returns its response payload. -
RepositoryChanged
= Future<
void> Function() - Called after a repository mutates, so a persistence layer can flush.
Exceptions / Errors
- ApiException
- The REST API answered with a status or body the client could not accept.
- AssetNotFoundException
- The referenced asset does not exist.
- ChecksumMismatchException
- Downloaded bytes did not match the checksum recorded for the asset.
- CliException
- The CLI was invoked incorrectly, or a command could not complete.
- ConflictException
- A resource with the same unique key already exists — a second organization with one name, a re-published version, an asset filename used twice within one release.
- DownloadFailedException
- A download could not be completed: the transport failed, the server answered with an error status, or the stream ended short of the expected length.
- ForbiddenException
- The caller is authenticated but not permitted to perform the operation.
- InvalidJsonException
- A payload could not be parsed as the expected JSON shape.
- NotFoundException
- A referenced resource does not exist.
- OmnyStoreException
- Base type for every expected failure raised by OmnyStore.
- OmnyStoreTimeoutException
- An operation exceeded its deadline.
- OrganizationNotFoundException
- The referenced organization does not exist.
- PackageNotFoundException
- The referenced package does not exist.
- ProjectNotFoundException
- The referenced project does not exist.
- ReleaseNotFoundException
- The referenced release does not exist.
- StorageException
- The object storage backend failed (unreachable bucket, denied credentials, an I/O error writing the local directory, ...).
- The caller is not authenticated (missing or invalid credentials).
- UnsupportedOperationException
- The configured backend does not support the requested operation — asking a local-directory store for a presigned URL, for instance.
- ValidationException
- Invalid input: a malformed name, an unparsable version, a negative size, a channel that does not match the version's pre-release tag, and so on.