Skip to content

@xtandard/flags/core

Admin core — the operations layer the API and CLI sit on top of.

Owns the distinction between source storage (canonical drafts, full snapshot history, audit) and runtime storage (the published snapshots that application runtimes read). Publishing compiles the draft and writes the new snapshot to both stores, then flips active_version in both; rollback re-points active_version. The runtime provider therefore only ever needs runtimeStorage.

import { … } from "@xtandard/flags/core";
Name Summary
createFlagsCore Construct the admin core over the configured storage.
Name Summary
FlagValidationError Thrown by FlagsCore.upsertFlag when a flag fails validation.
NotFoundError Thrown when a referenced project/environment/flag/snapshot does not exist.
ReadonlyError Thrown by mutating operations when the core is in readonly mode.
SegmentValidationError Thrown by FlagsCore.upsertSegment when a segment fails validation.
SnapshotProtectedError Thrown by FlagsCore.deleteSnapshot when the target is protected: the active version (the runtime serves it) or the latest version (deleting it would let nextVersion mint the same version string again).
Name Summary
DraftDiff The unpublished changes in a draft (see FlagsCore.diffDraft).
DraftDiffEntry One field-level change between the published draft and the current draft.
EvaluateInput Input to FlagsCore.evaluate.
FlagEvaluationResult One flag’s outcome from FlagsCore.evaluate.
FlagsCore The admin core surface.
FlagsCoreOptions Options for createFlagsCore.
RetentionOptions Retention policy for FlagsCoreOptions.retention.
RetentionRule One retention rule set. When both fields are set, an item is kept if either rule keeps it (union of keeps — the same semantics as backup tools): pruned only when it is outside the keepLast most recent AND older than maxAge.
SnapshotSummary A snapshot version with its publish metadata, for history views.