Metakit / API

@doeixd/metakit/operation

Typed custom operations with checked algebraic claims (@doeixd/metakit/operation).

An operation is declared once with Operation.define: its id, version, argument and result Schemas, null rule and claims. The declaration is a callable function that builds Expr nodes and carries its ForeignOp descriptor. Evaluation checks arguments and results against the declared Schemas so every claim's domain is enforced at run time.

Functions

compareCompare two operation descriptions of one id@version. Returns Option.none() when they match, or the first difference (args, result, nulls, claims).
defineDeclare a typed custom operation with Schemas and algebraic claims.
derivedGive a function with a return Schema a versioned operation name. Select every parameter once in args to set the positional order; version is 1 when omitted.…
describeBuild a serializable description of op for comparing client and server declarations.
expandDerivedSymbolically expand calls to any DerivedOperation in ops using their guarded Fn definitions, preserving contracts and strict null propagation for SQL and…
implementBind a JavaScript implementation to op. Strict operations receive non-null arguments; nulls: 'own' operations receive T | null. Throw to refuse. For a…
implementationsCollect implementations under a name (used in reports and obligation names). Refuses two implementations for the same id@version. A derived operation's…
implementationsMetaRead the name and entries from an OperationImplementations table.

Values

IMPLEMENTATIONS_METAMetadata symbol carried on a table built by implementations.

Interfaces

AnyDerivedOperationAny DerivedOperation, regardless of its concrete signature.
DerivedOperationA named, versioned Operation whose canonical meaning is a Fn definition. Preserves operation identity in Expr / Artifact / Language, derives a canonical JS…
ImplementationOne typed implementation binding an Operation to its JavaScript function.
ImplementationsMeta
OperationA declared custom operation: callable to build Expr calls, plus its ForeignOp descriptor.
OperationDescriptionPortable JSON-compatible description of a declared operation for cross-boundary comparison.

Types

AnyOperationAny declared Operation, regardless of id, version, arity, null rule or claims.
ClaimsAlgebraic claims typed by the operation's signature. A claim that does not fit the signature resolves to a human-readable sentence rather than never.
EnvOfAllIntersects the environments of each argument left to right; literals add none.
NotCoreRejects ids starting with any core operator prefix (bool., num., …).
NullOfAllnull when any argument in Args may be null, else never.
OperationImplementationsA named table of custom operation implementations with explicitly bound keys K.
OrderedParamSchemasPositional argument Schema tuple derived from P and Order.
RunArgsArgument tuple for implement, adding null only when N is 'own'.