/** * Active transactions strategy. Only reachable via `@noy-db/hub/tx`. */ import type { TxStrategy } from './strategy.js'; import type { TransactionInvariant } from './invariants.js'; /** * Options for {@link withTransactions}. Currently only commit-time * changeset `invariants` (see {@link TransactionInvariant}). */ export interface TransactionStrategyOptions { /** * Commit-time set-level invariants run over the changeset on every * commit (ordinary AND amendment). See {@link TransactionInvariant}. */ invariants?: ReadonlyArray; } /** * Build the default transactions strategy. Pass into * `createNoydb({ txStrategy: withTransactions() })` to enable * `db.transaction(fn)` (and `db.transaction({ dryRun: true }, fn)`). * * Supply `{ invariants }` to register commit-time changeset invariants — * set-level constraints that fire after the writes commit and revert the * transaction on a throw. Unlike `amendment.invariant`, these run for * ordinary `db.transaction(fn)` calls (and amendments) with no role gate. */ export declare function withTransactions(opts?: TransactionStrategyOptions): TxStrategy;