Metakit / @doeixd/metakit

Subpaths by where code runs

ImportRuns inPurpose
@doeixd/metakitBrowser / serverPath, Expr, Transition, Verdict, the 50-op core (Bool, Eq, Null, Ord, Num, Str, Arr + derived helpers), the folds over a list (Arr.any, Arr.sum, …), what each op, fold and way of writing keeps (opProperties, foldProperties, writeProperties). A path to an Option field reads as its value or null.
@doeixd/metakit/abstractBrowser / serverThe synchronous interval and zone checker (Abstract, with its Interval and Zone domains): it answers True, False or Unknown from the bounds of each field, with no Z3 boot.
@doeixd/metakit/relationBrowser / serverQuestions asked of the rows of another kind pointing at a row (Relation.any, every, count, sum, min, max, reduce), with Relation.withRows for typed in-memory evaluation; SQL writes each as a correlated subquery.
@doeixd/metakit/fnBrowser / serverFn.make and Fn.params define callable expression functions with optional input and output rules.
@doeixd/metakit/operationBrowser / serverDeclare a custom operation with Operation.define and bind JavaScript with Operation.implement. Use Operation.derived to name a checked function built with Fn. Define a custom operation.
@doeixd/metakit/operation/sqlServerDialect-specific SQL & aggregate lowerings (lowering, lowerings, piece) for custom operations.
@doeixd/metakit/languageBrowser / serverGroups custom operations. Language.compose(a, b) merges two vocabularies and throws on a conflict. Language.complete checks that a JavaScript table implements every operation. Language.readiness(expr, target) returns a report of what the target supports.
@doeixd/metakit/language/sqlServerChecks that every operation in a language has a lowering for the chosen SQL dialect.
@doeixd/metakit/syntaxBrowser / serverPipeable calls (dual, dualLanguage) and checks (testLanguage).
@doeixd/metakit/artifactBrowser / serverencodeExpr and decodeExpr round-trip portable expressions. fingerprint hashes them, with the Schema each path reads, through Hash, whose rules Content hashes writes out so you can recompute a hash elsewhere.
@doeixd/metakit/toolingDev / buildIndex named definitions (SemanticIndex). manifest lists them by hash; semanticDiff of two manifests shows renames, changes and what they affect.
@doeixd/metakit/domainBrowser / serverCurrency-safe Money, fixed-scale Decimal (Decimal.mul and Money.mul round half-even in integers; evaluation, SQL on SQLite and Postgres, the checkers and Rows.sum read them, and a product past the safe range is refused), timezone-free CalendarDay, OrderedEnum, Text (text holding no NUL, which the checkers can prove rules over), and Domain.domainOf.
@doeixd/metakit/aggregatesBrowser / serverRows.sum (of integers) and Rows.count, kept by O(1) deltas, and Rows.min, Rows.max, Rows.every, Rows.any, which rescan on a delete of the extreme. Imports no SQL.
@doeixd/metakit/aggregates/sqlServerRowsSql.toSql(aggregate, options): an aggregate as SQL, its value and whether evaluate refuses.
@doeixd/metakit/machineBrowser / serverDeclarative state machine (dispatch, TEA update, which returns the records a step emits, and footprints); Machine.intent(machine.transitions.Withdraw).can(partial) and Machine.affordances(machine, state) ask what a partial state allows; lift and compose build a parent machine from child machines. Machine.phases(State, state => state.phase) names the values of a string-literal field, or the variants of a union of Schema.TaggedStructs, as phases (phase.Editing); from(phase.Editing).to(phase.Closed) and .choose([...]) build the transitions between them, a variant entered with its fields given as with and written whole, its own fields reached through variant, and within(phase.Confirming, …) scopes a rule to one phase; and Machine.diagram, Machine.reachability and Machine.phaseTable draw the state diagram, list the phases the start cannot reach or never leaves, and say what each message does in each phase.
@doeixd/metakit/interpreterBrowser / serverInterpreter runs evalExpr and step in Effect. withForeign supplies custom implementations.
@doeixd/metakit/inspectBrowser / serverForm fieldSpecs and an enriched toJsonSchema, read straight off the Schema.
@doeixd/metakit/graphBuild / SSR / plannerStatic Graph.analyze (affectedBy, deadBindings), SSR Graph.pruneStatic, and Graph.queryReadiness.
@doeixd/metakit/graph/matchBrowser / serverpathsOverlap compares paths. affectedTags names transitions whose writes can affect a reader.
@doeixd/metakit/graph/pruneServerpruneStatic splits fixed values from live bindings and tracks the paths needed to resume.
@doeixd/metakit/graph/readinessBrowser / serverqueryReadiness fills in known parameters and checks if the remaining filter can be prepared.
@doeixd/metakit/policyBrowser / serverNamed rules over a row and a principal (Policy.make), and the synchronous checkImplication and checkConsistent.
@doeixd/metakit/storeServerWhat a store guarantees of concurrent writes (StoreCapabilities), and Store.mount, which throws where a store is set up to hold a rule it cannot.
@doeixd/metakit/store/checkDev / CI onlycheckStore and checkStoreEffect race writers to test a store's declared isolation and locks.
@doeixd/metakit/temporalDev / CI onlyTemporal.requirements (what each rule needs of its store), Temporal.obligations (the pairs of transitions whose order a proof leaves open), and Temporal.walk, which runs a scenario's steps in seeded orders.
@doeixd/metakit/pairsDev / CI onlyPairs.pairs (each pair of transitions whose footprints overlap, with Pairs.commutes' answer and the rule behind a True), Pairs.walkPair (both orders from generated states, compared), and Pairs.settle, which walks every pair and returns the result as evidence; Temporal.report(evidence) lists what is open, discharged and decided.
@doeixd/metakit/sqlServerSql.toCheck, Sql.toWhere, Sql.toUpdate as text for Postgres and SQLite. A predicate selects the rows Expr.eval holds true, null included; rows related to a row are read from the tables you give as relations, and a list in a column is refused by name.
@doeixd/metakit/sql/storedServer / buildtoCheck, toWhere, toValue and toUpdate of /sql, kept in an Artifact.EvidenceStore: a statement compiled before for an unchanged definition, dialect, options and compiler is read back instead of compiled.
@doeixd/metakit/drizzleServer (optional drizzle-orm)Drizzle.toCheck, Drizzle.toWhere, Drizzle.toUpdate: the same lowering as Drizzle SQL over a Drizzle table.
@doeixd/metakit/proveDev / CI only (optional z3-solver)Prove.invariant, Prove.transition, Prove.policy, Prove.machine (pinning, allowUnknown, replayed counterexamples), and with an Artifact.EvidenceStore provided, only what changed is proved again.
@doeixd/metakit/conformanceDev / CI onlycheckOpSoundness holds each of the 50 operators to one answer from evaluation, partial evaluation, Expr.judge and the Tier 3 checker over null, absent keys, NaN, the ends of the safe integer range and text holding a NUL; checkOpLowerings holds the Postgres and SQLite lowerings and the Z3 solver to the same answers through runners you pass; checkAllProperties, checkAllFoldProperties and checkAllWriteProperties check what the property tables declare against the evaluator; checkResidualizeSoundness does the same for an expression of yours over values sampled from its Schema; bundleVectors records, for a bundle and environments of its rule's Schemas, the answer a reader of the bundle must give for each call.
@doeixd/metakit/buildBrowser / serverThe functions over nodes (wrap, toNode, call, evalNode, residualizeNode, judgeNode, readsOfNode), for a language that builds its own constructors on metakit.

When to use something else

  • Time, concurrency, retries, and I/O: use Effect directly. Transition is strictly single-step and synchronous; it returns records describing Commands (emits) rather than running effects.
  • Bidirectional URL or cookie codecs: use effect/Schema transformations; Expr is one-way.
  • UI trees, layout, and styling: keep DOM/CSS structure in your UI layer and embed Expr / Transition where you need derived values or disabled states.