/** * Determinism helpers for the runtime graph. * * `architecture/runtime-dependencies.json` is COMMITTED and compared byte-for-byte by * `validate-runtime-architecture`, so every collection that reaches it must come out in a stable * order regardless of the order projects happened to be scanned in. These are the pure functions * that guarantee that — sorting, and de-duplicating where one node can legitimately absorb the same * relation twice. * * Split out of runtime-graph.ts, which owns the DERIVATION (what the graph means). These own only * the SHAPE of the output (what order it is written in). They are leaf functions over the model * types with no knowledge of the deriver, which is also why they can be imported without a cycle. */ import type { ApiRef } from './api-usage/api-relations'; import type { RuntimeQueue, RuntimeUnresolved } from './runtime-graph-model'; /** Drop duplicate api refs, keeping the first — needed after a node absorbs the same api from both * its own relations and an embedded lib's. Keyed by api AND target service: the same contract aimed * at two different services is two distinct relations (two distinct edges), not a duplicate. Input * is pre-sorted, so output stays deterministic. */ export declare function dedupApiRefs(refs: ApiRef[]): ApiRef[]; /** Queues as a key-sorted object, with each producer/consumer list sorted, for a deterministic file. */ export declare function sortedQueues(queues: Map): Record; /** Sort a Map into a plain object with sorted keys, so the committed JSON is deterministic. */ export declare function sortedRecord(map: Map): Record; /** Sort AND de-duplicate: one api used against two targets must not be reported unresolved twice. */ export declare function sortUnresolved(unresolved: RuntimeUnresolved[]): RuntimeUnresolved[];