Metakit / @doeixd/metakit/operation

expandDerived

function · packages/metakit/src/operationDerived.ts:286

function expandDerived<Env, A>(
  expr: Expr<Env, A>,
  ops: ReadonlyArray<AnyDerivedOperation>,
  options?: {
    readonly maxNodes?: number
  },
): Expr<Env, A>

Symbolically expand calls to any DerivedOperation in ops using their guarded Fn definitions, preserving contracts and strict null propagation for SQL and proof readers. Calls stay unexpanded when a check cannot be stated or discharged, or when the body ignores an argument that may refuse. Detects cyclic expansions and enforces maxNodes.