Skip to content

VaultMD / UpdateOp

Type Alias: UpdateOp

UpdateOp = { editByMatch: { new: string; old: string; }; } | { append: string; } | { prepend: string; } | { setBody: string; }

Defined in: src/notes/models/update-op.ts:5

Describes a mutation to apply to a note's body via NotesApi.updateNote. Exactly one variant must be set per call.

Union Members

Type Literal

{ editByMatch: { new: string; old: string; }; }

editByMatch

editByMatch: object

Find-and-replace a unique substring in the note body. The frontmatter block is excluded from the search and left untouched (use NotesApi.editFrontmatter for that). The old text must match exactly once within the body — zero matches throw NO_MATCH, multiple matches throw AMBIGUOUS_MATCH.

editByMatch.new

new: string

Replacement text for the matched substring.

editByMatch.old

old: string

Exact substring to locate in the note body.


Type Literal

{ append: string; }

append

append: string

Text to append verbatim to the end of the note body, with a newline inserted first when the existing content does not end in one. Creates the note when it does not exist.


Type Literal

{ prepend: string; }

prepend

prepend: string

Text to insert at the START of the note body — after the frontmatter block, never before it — with a newline inserted between it and the existing body when it does not already end in one. Creates the note when it does not exist.


Type Literal

{ setBody: string; }

setBody

setBody: string

Replacement for the whole note body; the frontmatter block is preserved verbatim. Does NOT create a missing note (throws REFUSE_CREATE) — use NotesApi.createNote for that.