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
compare | Compare two operation descriptions of one id@version. Returns Option.none() when they match, or the first difference (args, result, nulls, claims). |
define | Declare a typed custom operation with Schemas and algebraic claims. |
derived | Give 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.… |
describe | Build a serializable description of op for comparing client and server declarations. |
expandDerived | Symbolically expand calls to any DerivedOperation in ops using their guarded Fn definitions, preserving contracts and strict null propagation for SQL and… |
implement | Bind a JavaScript implementation to op. Strict operations receive non-null arguments; nulls: 'own' operations receive T | null. Throw to refuse. For a… |
implementations | Collect implementations under a name (used in reports and obligation names). Refuses two implementations for the same id@version. A derived operation's… |
implementationsMeta | Read the name and entries from an OperationImplementations table. |
Values
Interfaces
AnyDerivedOperation | Any DerivedOperation, regardless of its concrete signature. |
DerivedOperation | A named, versioned Operation whose canonical meaning is a Fn definition. Preserves operation identity in Expr / Artifact / Language, derives a canonical JS… |
Implementation | One typed implementation binding an Operation to its JavaScript function. |
ImplementationsMeta | |
Operation | A declared custom operation: callable to build Expr calls, plus its ForeignOp descriptor. |
OperationDescription | Portable JSON-compatible description of a declared operation for cross-boundary comparison. |
Types
AnyOperation | Any declared Operation, regardless of id, version, arity, null rule or claims. |
Claims | Algebraic claims typed by the operation's signature. A claim that does not fit the signature resolves to a human-readable sentence rather than never. |
EnvOfAll | Intersects the environments of each argument left to right; literals add none. |
NotCore | Rejects ids starting with any core operator prefix (bool., num., …). |
NullOfAll | null when any argument in Args may be null, else never. |
OperationImplementations | A named table of custom operation implementations with explicitly bound keys K. |
OrderedParamSchemas | Positional argument Schema tuple derived from P and Order. |
RunArgs | Argument tuple for implement, adding null only when N is 'own'. |