import { ViaGraph, type FieldRef, type EdgeKind, type Grain } from '../../kernel/via/graph.js'; import type { DerivationStrategy } from './types.js'; interface RegisteredStrategy { spec: DerivationStrategy; strategyHash: string; } /** * Vault-internal registry of derivation strategies. Owned by `Vault`; * not exported. * * @internal */ export declare class DerivationRegistry { private readonly _bySource; private readonly _byOutput; register(spec: DerivationStrategy): Promise; strategiesForSource(source: string): ReadonlyArray; strategiesProducingOutput(collection: string): ReadonlyArray; /** * All registered strategies as a flat, deduplicated array. * Each strategy is indexed once per source (not once per output key), * so iterating `_bySource.values()` naturally yields each strategy * exactly once per source — deduplication is handled by flattening * the per-source arrays and collecting into a Set by identity. * * Used by `dumpSchema()` / `describeDerivations()` in the introspection * walker to populate the derivations map. */ all(): ReadonlyArray; /** * Graph edges for #638 Task 2: one `'derivation'`/`'record'` edge per * (non-self-write) output key — target = the output collection (a * `WHOLE_RECORD` artifact node), sources = every collection that can * trigger this strategy (`source`, `sources[]`, `triggerBy[].collection`, * and — for a rollup — `rollup.from`), mirroring EXACTLY the trigger keys * `register()` indexes under `_bySource`. The self-write reverse-denorm * output (`output.collection === source` with `denorm` declared) is * skipped — the SAME condition the old local DFS used; it is not a cycle * (see the comment `validate()` used to carry, now on this skip). * Rollups ADDITIONALLY get a dedicated `'rollup'`/`'aggregate'` edge * targeting the real `rollup.field` on the parent (`source`) — the * self-write output above only covers the cycle-DFS skip, not * dispatch/taint (Tasks 3/4/6), which need the real field. */ edges(): ReadonlyArray<{ readonly target: FieldRef; readonly sources: readonly FieldRef[]; readonly kind: EdgeKind; readonly grain: Grain; }>; /** * Cycle detection, delegated to `ViaGraph.assertAcyclic()` (#638 Task 2 — * retires the local DFS). Call after all `register()` calls complete (i.e. * at vault open). Throws `DerivationCycleError` on the first cycle found — * SAME class/timing as before; the message/path is byte-identical to the * pre-#638 shape for a pure record-shape derivation cycle (the * `WHOLE_RECORD` artifact suffix is stripped back to a bare collection * name before re-throwing). * * `graph` is the caller's shared per-vault graph, ALREADY carrying this * registry's `edges()` (the caller registers them — see `Vault._initDerivations`) * — omit it (e.g. this registry's own unit tests) to validate this * registry's edges in isolation against a throwaway graph. */ validate(graph?: ViaGraph): void; } export {};