VersionManager

Manages automatic and manual version snapshots for a server project. Owned by Workspace — instantiated when a server project loads, destroyed on unload.

Constructor

new VersionManager(projectId, server, project, options)

Parameters:
NameTypeDescription
projectIdstringID of the server project to version.
serverobjectServer instance with createVersion()
projectobjectActive Project instance
optionsobjectConfiguration options.
Properties
NameTypeAttributesDefaultDescription
autoVersionLimitnumber<optional>
50Max auto-versions to keep (from user preferences)
onVersionSavedfunction<optional>
Called with the new version entry after a save

Classes

VersionManager

Methods

(async) _saveVersion(label) → {Promise.<object>}

Parameters:
NameTypeDescription
labelstring | nullVersion label, or null for an auto-version.
Returns:
The created version index entry.
Type: 
Promise.<object>

_triggerAutoVersion()

Fires an auto-save if one is not already in progress.

destroy()

Cleans up timers when the workspace unloads the project.

onHistoryPush(stackSize)

Called by workspace._updateUndoRedoButtons() after every history.push().
Parameters:
NameTypeDescription
stackSizenumbercurrent undo stack depth (unused, for future use)

onProjectSaved()

Call after a successful server save to reset the pending-changes flag.

(async) saveNamedVersion(label) → {Promise.<object>}

Creates a named version snapshot.
Parameters:
NameTypeDescription
labelstring | nullVersion label, or null for unlabelled named version.
Returns:
The created version index entry.
Type: 
Promise.<object>