@nuucognition/mesh-adapter-fs
v1.0.0
Published
Filesystem adapter for Mesh SDK with operations-first write support and optional transaction journaling.
Downloads
122
Readme
@nuucognition/mesh-adapter-fs
Filesystem adapter for Mesh SDK with operations-first write support and optional transaction journaling.
Core capabilities
- Scan and load markdown mesh state from disk.
- Read content and blobs through
MeshReadAdapterAPIs. - Persist canonical
MeshOperation[]batches throughapplyOperations(). - Optionally journal transactions in
.mesh/journal.jsonlwith object-backed snapshots. - Provide inferred diff, undo, redo, and transaction GC utilities.
Quick start
import { createFilesystemAdapter, loadMeshFromFs } from "@nuucognition/mesh-adapter-fs"
const { mesh } = await loadMeshFromFs({ rootPath: "/path/to/mesh" })
const adapter = createFilesystemAdapter({
rootPath: "/path/to/mesh",
scanPaths: ["Mesh", "Media"],
ensureIds: true,
writeBackIds: true,
enableTransactions: true,
})Options
rootPath: absolute mesh root.extensions: document extensions. Default.mdand.ncm.ignorePaths: ignored path patterns.scanPaths: optional scan roots (for exampleMesh,Media).ensureIds: ensure IDs during index load.writeBackIds: persist ensured IDs.enableTransactions: enable or disable transaction journaling. Defaults tofalse.transactionAuthor: default observed transaction author.transactionIntent: default observed transaction intent.
Operations-first write path
createFilesystemAdapter() exposes:
applyOperations(operations, options?)applyTransaction(transaction)
When transactions are enabled, applied operations are appended to the journal as one transaction batch.
Transaction helpers
getTransactionsStatusdiffTransactionsgetTransactionsLoggetTransactionsForDocumentundoLastTransactionredoLastTransactiongarbageCollectTransactionObjects
Rename helpers
renameDocumentFsrenameMediaFs
These helpers now construct operations through @nuucognition/mesh-ops and persist them through adapter operation application.
Related packages
@nuucognition/mesh-core@nuucognition/mesh-ops
