@nzelajs/node-auto
v0.1.0
Published
Generic state and auto node handlers for the Nzela engine (conditional routing, SLA timers). Vendor-free.
Maintainers
Readme
@nzelajs/node-auto
English below · Version francaise plus bas.
The two generic node behaviors of the Nzela engine, packaged as opt-in NodeHandlers: state
(resting step with entry effects and SLA timers) and auto (conditional routing). A generic
lifecycle app registers only these two; approval/subprocess/wait are separate packages.
English
Install
npm add @nzelajs/node-auto @nzelajs/coreWhat it provides
stateNodeHandler: on entry, executes the node's effects and schedules its SLA timers (remind/escalate/expire, ISO-8601 durations), then the instance rests until an explicit, permissioned action leaves the node. Astatenode never takes auto transitions.autoNodeHandler: on entry, executes the node's effects then takes the FIRST auto transition (declared order) whose guards pass; an unguarded exit acts as the default and should be declared last. No exit passing: the instance rests on the node (a scheduler tick viaadvanceCasere-evaluates time-based guards later).registerGenericHandlers(registry): registers both on aNodeHandlerRegistry.
Example
import { InMemoryNodeHandlerRegistry } from "@nzelajs/core";
import { registerGenericHandlers } from "@nzelajs/node-auto";
const handlers = new InMemoryNodeHandlerRegistry();
registerGenericHandlers(handlers);Note: spawnChild inside node-entry effects is available when the handler runs under the core
engine (which provides the full effect context); outside of it, the fallback context rejects
spawnChild (fail-closed).
Francais
Installation
npm add @nzelajs/node-auto @nzelajs/coreCe que ca fournit
stateNodeHandler: a l'entree, execute les effets du noeud et planifie ses timers SLA (remind/escalate/expire, durees ISO-8601), puis l'instance se repose jusqu'a une action explicite et permissionnee. Un noeudstatene prend jamais de transition auto.autoNodeHandler: a l'entree, execute les effets du noeud puis prend la PREMIERE transition auto (ordre declare) dont les gardes passent ; une sortie sans garde sert de defaut et se declare en dernier. Aucune sortie ne passe : l'instance reste sur le noeud (un tick planificateur viaadvanceCasereevalue plus tard les gardes temporelles).registerGenericHandlers(registry): enregistre les deux sur unNodeHandlerRegistry.
Note : spawnChild dans les effets d'entree de noeud n'est disponible que sous le moteur coeur
(qui fournit le contexte d'effet complet) ; hors de ce contexte, le fallback rejette spawnChild
(fail-closed).
License
Apache-2.0
