@nzelajs/persistence-memory
v0.1.0
Published
Nzela in-memory adapter: tenant-scoped unit of work, repositories, simulation runners and HMAC outbox signer.
Maintainers
Readme
@nzelajs/persistence-memory
English below · Version francaise plus bas.
The in-memory adapter of the Nzela engine: a tenant-scoped UnitOfWork with every repository port,
plus the simulation runners (recording effects, registry guards) and an HMAC outbox signer. This is
how you run the engine with zero infrastructure: tests, dry-runs, what-if simulation.
English
Install
npm add @nzelajs/persistence-memoryWhat it provides
InMemoryBackend(UnitOfWork): one isolated data space PER TENANT (fail-closed: an instance of tenant A does not exist insidewithTenant("B")). ImplementsWorkflowInstanceRepo(optimistic locking: a stalefromVersionthrowsConcurrencyConflictError), an append-onlyEventLog,TimerStore,ExternalWaitStore,DependencyStore,OutboxRepository, and aBlueprintInstallStorewhosepublishvalidates the graph (parseBlueprint) BEFORE writing, auto-increments the version, archives the previous ACTIVE and freezes the snapshot (immutable). Inspection helpers:listOutbox,listTimers.SimpleBlueprintProvider: resolves an instance's blueprint by its pinnedinstallId, else by the ACTIVE version of its request type (fail-closed when neither resolves).SimpleGuardRunner: named predicate registry; unregistered guards andcel:refs FAIL CLOSED (the CEL expression adapter is a separate package).RecordingEffectRunner: records every executed ref (publicexecutedarray) and invokes optional callbacks registered per base name ("notify:manager"callsnotifywith"manager").HmacOutboxSigner: HMAC-SHA256 signing with constant-time verification.- Approval companions (present by default in the registry):
MemoryApprovalTaskStore(claim/reassign/group listing),MemoryDeskRuleStore(decreasing-specificityfindForQueue),MemoryTenantSettingsStore(settablereturnRoutingoverrides),MemoryOrgStore(units, primary attachments, deprovisioning) andMemoryDirectoryStore(display names). Seed them viadeskRuleStore(tenantId),tenantSettingsStore(tenantId),orgStore(tenantId),directoryStore(tenantId).
Not for production: no durability, no real transactions (no rollback), no encryption of sensitive fields. It is the reference simulation backend.
Francais
Installation
npm add @nzelajs/persistence-memoryCe que ca fournit
InMemoryBackend(UnitOfWork) : un espace de donnees isole PAR TENANT (fail-closed : une instance du tenant A n'existe pas danswithTenant("B")). ImplementeWorkflowInstanceRepo(verrou optimiste : unfromVersionperime leveConcurrencyConflictError), unEventLogappend-only,TimerStore,ExternalWaitStore,DependencyStore,OutboxRepository, et unBlueprintInstallStoredontpublishvalide le graphe (parseBlueprint) AVANT d'ecrire, auto-incremente la version, archive l'ACTIVE precedente et gele l'instantane (immuable). Inspection :listOutbox,listTimers.SimpleBlueprintProvider: resout le blueprint d'une instance par soninstallIdepingle, sinon par la version ACTIVE de son type de demande (fail-closed si rien ne resout).SimpleGuardRunner: registre de predicats nommes ; gardes non enregistrees et refscel:echouent FERMEES (l'adapter d'expressions CEL est un paquet a part).RecordingEffectRunner: enregistre chaque ref executee (tableau publicexecuted) et invoque les callbacks optionnels enregistres par nom de base.HmacOutboxSigner: signature HMAC-SHA256, verification en temps constant.- Compagnons d'approbation (presents par defaut dans le registre) :
MemoryApprovalTaskStore(claim/reassign/listes par groupe),MemoryDeskRuleStore(findForQueuepar specificite decroissante),MemoryTenantSettingsStore(overridesreturnRoutingsettables),MemoryOrgStore(unites, rattachements primaires, deprovisionnement) etMemoryDirectoryStore(noms affiches). Amorcage viadeskRuleStore(tenantId),tenantSettingsStore(tenantId),orgStore(tenantId),directoryStore(tenantId).
Pas pour la production : pas de durabilite, pas de vraies transactions (pas de rollback), pas de chiffrement des champs sensibles. C'est le backend de simulation de reference.
License
Apache-2.0
