@cnstra/persist
v0.2.0
Published
Persistence layer for CNStra: name<->object registry, resumable checkpoint (resume) serialization, and checkpoint repositories. Core-free (depends only on @cnstra/types).
Maintainers
Readme
@cnstra/persist
⚠️ Experimental: API and on-the-wire/stored shapes may change in future versions.
The resumable-execution engine for CNStra — the write side and storage seams behind
resume, queue integrations, and the DevTools run/attempt/task view. Core-free (depends only
on @cnstra/types + @cnstra/persist-dto); topology is referenced by name everywhere
and never persisted (code is its source of truth).
What's in it
CNSProgressSerializer— serialize a live stimulation's frontier + context to/from the name-basedTCNSProgress.CNSStimulationPersistor— record the full Stimulation → Attempt → Task model (onResponse→ anICNSStimulationRepository). The recorder the queue workers and DevTools share.CNSProgressRecorder— the narrower, frontier-only sibling (writes a checkpoint blob to anICNSProgressRepository).- Storage seams —
ICNSStimulationWriter/ICNSStimulationReader/ICNSStimulationRepository(run/attempt/task) andICNSProgressRepository(frontier). CNSInMemoryStimulationRepository/CNSInMemoryProgressRepository— in-memory reference stores. Bound the stimulation store (maxStimulations/ttlMs/deleteOnComplete) soobserve-style use does not leak.CNSPersistOptionsRegistry(+CNSPersistOptionsRegistryFactory) — the name ⇄ object bridge every serialize/hydrate resolves through.
Postgres adapter: @cnstra/persist-postgres.
Docs
See the full guide: Resumable execution
(the model, resume vs observe, stores & bounds) and
Persistence & Resume.
License
MIT
