import { TextMutationReceipt, SDMutationReceipt } from '../types/index.js'; import { InsertInput } from '../insert/insert.js'; import { ReplaceInput } from '../replace/replace.js'; import { StoryLocator } from '../types/story.types.js'; export type ChangeMode = 'direct' | 'tracked'; /** * Subset of MutationOptions that provides only revision guarding. * * Used by operations that don't participate in the plan engine (comments, * clearContent, trackChanges.decide) where changeMode and dryRun are not * applicable. */ export interface RevisionGuardOptions { /** When provided, the engine rejects with REVISION_MISMATCH if the document has advanced past this revision. */ expectedRevision?: string; } export interface MutationOptions extends RevisionGuardOptions { /** * Controls whether mutation applies directly or as a tracked change. * Defaults to `direct`. */ changeMode?: ChangeMode; /** * When true, adapters validate and resolve the operation but must not mutate state. * Defaults to `false`. */ dryRun?: boolean; } /** * Text insertion request: target-less insert at document end. * * Targeted inserts now route through `SelectionMutationAdapter`. This * request type only handles the no-target fallback (append to document end). */ export type InsertWriteRequest = { kind: 'insert'; text: string; /** Target a specific document story (body, header, footer, footnote, endnote). */ in?: StoryLocator; }; /** * Alias for `InsertWriteRequest`. Retained because super-editor adapter-utils * and plan-wrappers still reference this name. */ export type WriteRequest = InsertWriteRequest; /** * Adapter interface for write operations. After the selection-first delete * cutover, only `insert` routes through `write()`. Delete and replace use * `SelectionMutationAdapter` instead. */ export interface WriteAdapter { write(request: InsertWriteRequest, options?: MutationOptions): TextMutationReceipt; /** Structured insert for SDFragment or markdown/html content. Returns SDMutationReceipt. */ insertStructured(input: InsertInput, options?: MutationOptions): SDMutationReceipt; /** Structured replace for SDFragment content. Returns SDMutationReceipt. */ replaceStructured(input: ReplaceInput, options?: MutationOptions): SDMutationReceipt; } export declare function normalizeMutationOptions(options?: MutationOptions): MutationOptions; export declare function executeWrite(adapter: WriteAdapter, request: InsertWriteRequest, options?: MutationOptions): TextMutationReceipt; //# sourceMappingURL=write.d.ts.map