Skip to content

@sebasoft/neuron-js


Defined in: Synapse.ts:13

The Synapse class is the core execution engine of the rules system. It processes logic defined in scripts by coordinating between the Registry (Neuron) and the state (ExecutionContext).

Constructors

Constructor

new Synapse(_neuron, _hookEmitter?): Synapse

Defined in: Synapse.ts:20

Initializes a new execution engine.

Parameters

_neuron

Neuron

The registry containing all element definitions.

_hookEmitter?

HookEmitter

Optional global lifecycle hook emitter.

Returns

Synapse

Methods

execute()

execute(script, context, runtimeHookEmitter?): ExecutionResult<number>

Defined in: Synapse.ts:33

Executes a script logic against a provided context.

Parameters

script

ScriptInterface

The serializable script defining the logic rules.

context

ExecutionContext

The shared state object to pass through the execution.

runtimeHookEmitter?

HookEmitter

Optional one-time hook emitter for this specific execution.

Returns

ExecutionResult<number>

An ExecutionResult containing the final context and the number of successfully executed rules.