Content-addressable storage, item tracking, dependency management, and writeback engine.
npm install @systemoperator/depothashContent(string),hashBytes(ArrayBuffer)- SHA-256 hashing via Web CryptoputCAS(bucket, content),getCAS(bucket, hash),hasCAS(bucket, hash)- content-addressable storage for R2storeRawAndMaterialized(bucket, rawData, materializedContent, hashFn)- store raw API response + materialized contentItem,Space,ItemDependency- core type interfacesDependencyStoreinterface + helpers:recordDependencies,getDependencies,getReverseDependencies,markDependentsStale,clearDependencies,finalizeMaterialization
Path helpers for PostgreSQL ltree columns:
buildPath(parentPath, id)- create child pathparsePath(path)- split into ID arraygetDepth(path)- count levelsgetParentPath(path)- parent path or null for rootsgetRootId(path)- first segmentrebasePath(path, oldPrefix, newPrefix)- rewrite paths on move
Bidirectional sync engine: parse edited content, diff against base, map to API actions.
parseConnectorMarkdown(content, schema)- parse markdown with YAML frontmatterdiffDocuments(base, current, schema)- semantic diff between two parsed documentsmapChangesToActions(diff, schema, resolver, transforms)- convert changes to API actionsSchemaRegistryclass - register and query connector schemasWritebackEngineclass - full pipeline with store interfaces- built-in schemas: linear-issue, linear-document, notion-page, confluence-page
import { hashContent, putCAS, buildPath } from '@systemoperator/depot';
import { WritebackEngine, createDefaultRegistry } from '@systemoperator/depot/writeback';Consumers implement store interfaces (DependencyStore, ItemStore, ContentStore, WritebackExecutor) for their own DB layer.
npm test # run tests
npm run build # compile TypeScriptMIT