Module: utils/serialization

Conversion between the editor's in-memory graph state and the persisted workflow JSON format. `serializeWorkflow` writes editor state to workflow JSON; `deserializeWorkflow` rebuilds editor state from workflow JSON.
Source:

Methods

(static) deserializeWorkflow(workflow, componentsMap) → {Object}

Rebuild editor graph state from workflow JSON, recreating control nodes and protocol component nodes (with parameter defaults merged from the matching protocol) and reconstructing connections for links whose endpoints exist.
Parameters:
Name Type Description
workflow Object Workflow JSON with `start`, `end`, `filters`, `components` and `links`.
componentsMap Object Map of protocol category to arrays of protocol definitions, keyed by `uuid`.
Source:
Returns:
Editor state `{ nodes, connections }`.
Type
Object

(static) serializeWorkflow(state) → {Object}

Serialize editor graph state into the persisted workflow JSON structure, splitting nodes into start/end/filter control nodes and protocol components and mapping connections to links.
Parameters:
Name Type Description
state Object Editor state with `nodes` and `connections` arrays.
Source:
Returns:
Workflow JSON with `name`, `description`, `start`, `end`, `filters`, `components` and `links`.
Type
Object