/** * Fan-out writes for a base↔satellite pair (#591, Task 6): a joined `put` * splits the record across both collections and writes base-then-satellite; * a pair `delete` removes satellite-then-base. Either function reverts every * already-executed leg (best-effort, raw adapter writes) and compensates * each reverted collection's cache/dirty-tracking/change-stream on failure. * * Both legs are driven through `Collection.put`/`.delete` (encryption, * ledger, history, cache, sync-dirty, change-emit all fire normally); only * the REVERT writes go straight to the raw adapter, via the shared * `bestEffortRevert` helper (`kernel/best-effort-revert.ts`) also used by * `revertExecuted` (`with-commit/tx/transaction.ts`) — a neutral kernel-level * home so this always-on satellite path can share the revert shape without * depending on with-commit, a gated service. * * `deps.base()`/`deps.satellite()` may return either a raw `Collection` or * one of this package's proxies (`makeSatelliteProxy` / `makeBaseProxy`) — * every handle is unwrapped via `RAW_TARGET` before use so fan-out never * re-enters a proxy's own `put`/`delete` override. Re-entering would either * deadlock (the satellite proxy's `put` takes the same non-reentrant * `registry.withPairLock` this module already holds) or recurse forever * (the base proxy's `delete` calls straight back into `pairDelete`). */ import type { NoydbStore } from '../../kernel/types.js'; import type { SatelliteSpec } from './types.js'; import type { SatelliteRegistry } from './registry.js'; export interface FanoutDeps { readonly spec: SatelliteSpec; readonly base: () => unknown; readonly satellite: () => unknown; readonly adapter: NoydbStore; readonly vaultName: string; readonly registry: SatelliteRegistry; } /** Split `record` across the pair by `spec.fields`, base leg first, satellite leg second. */ export declare function joinedPut(deps: FanoutDeps, id: string, record: Record): Promise; /** Remove both legs of the pair, satellite first, base second. */ export declare function pairDelete(deps: FanoutDeps, id: string): Promise;