@nuucognition/mesh-ops
v1.0.0
Published
Operations-first mutation layer for Mesh SDK.
Keywords
Readme
@nuucognition/mesh-ops
Operations-first mutation layer for Mesh SDK.
mesh-ops builds canonical MeshOperation[] batches for CRUD, rename, media rename, and ID backfill flows. It does not persist writes directly. Persistence happens through adapter applyOperations().
Quick start
import {
applyOperations,
buildRenameDocumentOperationsByTitle,
buildRenameMediaOperations,
buildEnsureIdsOperations,
} from "@nuucognition/mesh-ops"
const rename = await buildRenameDocumentOperationsByTitle(adapter, mesh, "Old", "New")
await applyOperations(adapter, rename.operations)
const mediaRename = await buildRenameMediaOperations(adapter, mesh, {
oldMediaTitle: "old.png",
newMediaTitle: "new.webp",
})
await applyOperations(adapter, mediaRename.operations)
const ensure = await buildEnsureIdsOperations(adapter, mesh)
await applyOperations(adapter, ensure.operations)API groups
updateWikiReferencesandupdateWikiReferencesWithReportupdateWikiEmbedReferencesandupdateWikiEmbedReferencesWithReportbuildCreateDocumentOperationsbuildUpdateDocumentOperationsbuildDeleteDocumentOperationsbuildCreateBlobOperationsbuildDeleteBlobOperationsbuildRenameDocumentOperationsbuildRenameDocumentOperationsByTitlebuildRenameMediaOperationsbuildEnsureIdsOperationsapplyOperations
Compatibility wrappers
For existing callers, wrappers still exist:
renameDocumentrenameDocumentByTitleensureIds
These wrappers now use the same operation-builder path under the hood.
Behavior notes
- Alias mutation is intentionally not part of the operations-first rename path.
- Frontmatter-only and body edits are represented uniformly as
type: "update"operations. - Builders may use
MeshReadAdapterreads to capture reversible before/after snapshots.
Adapter expectations
MeshReadAdapterfor operation construction.MeshWriteAdapter.applyOperationsfor persistence.
Related packages
@nuucognition/mesh-corefor core contracts and transaction helpers.@nuucognition/mesh-adapter-fsfor filesystem persistence and optional journaling.
