Saving a Process
Every process model on the canvas can be saved to the cloud as a versioned file. The save system collects all elements, packs them into a compressed archive, and uploads it โ preserving the full hierarchy, microelements, environment, flow, and all properties.
What Gets Saved
The save pipeline collects four categories of data:
Process Items
All Products, Operations, Steps, and Actions on the canvas โ including:
- Core properties (ID, type, step type, parameters)
- Combined hierarchy (parent-child relationships)
- Control plan data attached to operations
- Tags assigned to each element
Microelements (Natives)
All BES microelements โ including:
- Group and extension identification
- Base time value
- Quality factors and numerical factors
- Tag assignments (mechanisation, target, carrier, stream)
Environment Elements
All workplaces, equipment, staff, professions, and other environment items โ including:
- Type and hierarchy
- Multiplier and variation coefficients
- Domain flags and codes
Flow Data
All flow nodes and edges โ including:
- Node types, ports, and quality levels
- Edge connections and logic (time cost, cost records, quality impact)
- Attachment bindings to operations
The Save Pipeline
Step 1 โ Collect
The system walks the element tree starting from the highest-level elements. For each element, it:
- Checks if it's a process item, microelement, or environment element
- Deduplicates by ID (each element is packed exactly once)
- Packs the element into its portable format
After collecting all three categories, the system also collects flow data for all collected process items.
Step 2 โ Pack
Elements are serialized to JSON โ a portable format that strips runtime-only properties (DOM references, drag controllers, reactive wrappers) and keeps only the data needed to reconstruct them.
Step 3 โ Compress
The JSON data is compressed into a ZIP archive using the fflate library. The archive contains:
- A data file with the serialized elements
- A metadata file with version information
Step 4 โ Upload
The compressed archive is sent to the server via the `sendToCloud` Socket.IO event. The server:
- Verifies the user's session and quota
- Stores the data in the data MongoDB collection
- Creates or updates a record in the meta MongoDB collection
- Returns a confirmation with the file ID
When Saving Happens
- Manual save โ triggered by the user via keyboard shortcut or UI button
- Save is always a full snapshot โ there are no incremental or partial saves
- Each save creates a new version of the file
File Format
The saved file is a ZIP archive containing JSON data. This format:
- Is compact (compressed binary)
- Can be stored and transmitted efficiently
- Contains all information needed to fully reconstruct the canvas state
The save format is self-contained. A saved file can be loaded on any instance of the application without external dependencies.
Quota
Each user has a storage quota. If a save would exceed the quota, the server rejects the upload with a `QUOTA_EXCEEDED` error, reporting the current usage and limit. Manage quota by deleting old versions or unnecessary files.