VersioningState

AMD: require(["esri/versionManagement/VersioningState"], (VersioningState) => { /* code goes here */ });
ESM: import VersioningState from "@arcgis/core/versionManagement/VersioningState.js";
Class: esri/versionManagement/VersioningState
Since: ArcGIS Maps SDK for JavaScript 4.30

This class provides functionality for managing versions in a versioned geodatabase. It includes methods for starting and stopping editing, changing versions, undoing and redoing edits, and retrieving version information.

See also
Example
require(["esri/versionManagement/versionAdapters/utils", "esri/WebMap"], function (utils, WebMap)
{
  const webmap = new WebMap({
    portalItem: { // autocasts as new PortalItem()
      id: "e691172598f04ea8881cd2a4adaa45ba"
    }
  });
  const versioningStates = await utils.createVersioningStates(webmap, false);
}

Constructors

VersioningState

Constructor
new VersioningState(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Name Type Summary Class

The current version.

VersioningState

Contains information on the current version.

VersioningState

Contains the default version's name and guid.

VersioningState

The absolute URL of the REST endpoint for the feature service housing the version management service.

VersioningState

If true, current version is the default version.

VersioningState

The Error object returned if an error occurred while loading.

VersioningState

Represents the status of a load operation.

VersioningState

Indicates whether the instance has loaded.

VersioningState

The state of the current version.

VersioningState

The absolute URL of the REST endpoint for the version management service.

VersioningState

If the set to true, the current version will have a read lock.

VersioningState

Contains list of all available versions.

VersioningState

Contains metadata about the version management service.

VersioningState

Contains a collection of all versionable in the versioning state class.

VersioningState

Property Details

currentVersion

Property
currentVersion VersionIdentifier |Date

The current version.

currentVersionInfo

Property
currentVersionInfo VersionInfo

Contains information on the current version.

defaultVersionIdentifier

Property
defaultVersionIdentifier VersionIdentifierreadonly

Contains the default version's name and guid.

featureServiceUrl

Property
featureServiceUrl String

The absolute URL of the REST endpoint for the feature service housing the version management service. The URL may either point to a resource on ArcGIS Enterprise or ArcGIS Online.

isDefault

Property
isDefault Booleanreadonly

If true, current version is the default version.

loadError

Property
loadError Error |nullreadonly

The Error object returned if an error occurred while loading.

Default Value:null

loadStatus

Property
loadStatus Stringreadonly

Represents the status of a load operation.

Value Description
not-loaded The object's resources have not loaded.
loading The object's resources are currently loading.
loaded The object's resources have loaded without errors.
failed The object's resources failed to load. See loadError for more details.

Possible Values:"not-loaded" |"loading" |"failed" |"loaded"

Default Value:"not-loaded"

loaded

Property
loaded Booleanreadonly

Indicates whether the instance has loaded. When true, the properties of the object can be accessed. A WebMap is considered loaded when its layers and basemap are created, but not yet loaded.

Default Value:false

state

Property
state String

The state of the current version.

Possible Values:"lock-none" |"lock-read" |"lock-write"

url

Property
url String

The absolute URL of the REST endpoint for the version management service. The URL may either point to a resource on ArcGIS Enterprise or ArcGIS Online.

usePersistentReadSessions

Property
usePersistentReadSessions Boolean

If the set to true, the current version will have a read lock. Additionally, when switching versions, the new current version will also have a read lock.

versionInfos

Property
versionInfos VersionInfo[]

Contains list of all available versions.

versionManagementService

Property
versionManagementService VersionManagementService

Contains metadata about the version management service.

versionableItems

Property
versionableItems Collection<VersionAdapter>

Contains a collection of all versionable in the versioning state class.

Method Overview

Name Return Type Summary Class
Promise<Boolean>

The alter operation allows you to change the geodatabase version's name, description, owner, and access permissions.

VersioningState

Method used to change a layer's version/moment or network's version/moment.

VersioningState
Promise<Boolean>

Deletes a version given the following parameters.

VersioningState

Method used to get extended information about a version.

VersioningState
Promise<VersionInfo[]>

Method used to get a list of versions.

VersioningState
Promise

Triggers the loading of the version management service instance.

VersioningState
Promise<ServiceResult>

This method redos the last edit made while in an edit session.

VersioningState
Promise<ServiceResult>

Using the specified session ID an exclusive lock is obtained for the session on the version.

VersioningState
Promise<ServiceResult>

Using the specified session id, the exclusive lock for the version is downgraded to a shared lock.

VersioningState
Promise<ServiceResult>

This method undos the last edit made while in an edit session.

VersioningState

Method Details

alterVersion

Method
alterVersion(versionIdentifier, props){Promise<Boolean>}

The alter operation allows you to change the geodatabase version's name, description, owner, and access permissions.

License

Parameters
Specification
versionIdentifier VersionIdentifier

Identifier for a version.

props Object

Contains properties that will be altered.

Specification
ownerName String
optional

The new owner name of the version.

versionName String
optional

The new name for the version.

description String
optional

The new description for the version.

access String
optional

The new access permissions of the version.

Possible Values:"hidden"|"private"|"protected"|"public"

Returns
Type Description
Promise<Boolean>
  • Returns true if version was altered successfully.
Example
const result = await versioningState.alterVersion(
  { name: "newVersion", guid: "{49C6AC87-CDA8-46D4-A79B-449105981209}" },
  {
    versionName: "versionName",
    ownerName: "newOwner",
    description: "newDescription",
    access: "public"
  }
 );

changeVersion

Method
changeVersion(toVersion){Promise<Map<VersionAdapter, ServiceResult>>}

Method used to change a layer's version/moment or network's version/moment. Method allows changing version from named version to named version, or from default version to a moment and vice versa.

Parameter

Incoming Version or Date.

Returns
Type Description
Promise<Map<VersionAdapter, ServiceResult>>
  • Returns a map of VersionAdapter and ServiceResult.
Example
await versioningState.changeVersion(
  { name: "admin.version", guid: "{422D1B63-D795-4478-A4B1-AD6109377074}"}
);

deleteVersion

Method
deleteVersion(versionIdentifier){Promise<Boolean>}

Deletes a version given the following parameters.

License

Parameter
versionIdentifier VersionIdentifier

Identifier for a version.

Returns
Type Description
Promise<Boolean>
  • Specifies if the selected version was deleted.
Example
versioningState.deleteVersion({
  name: "versionName",
  guid: "{422D1B63-D795-4478-A4B1-AD6109377075}"
});

getVersionInfoExtended

Method
getVersionInfoExtended(){Promise<VersionInfoExtendedJSON>}

Method used to get extended information about a version.

Returns
Type Description
Promise<VersionInfoExtendedJSON>
  • Contains extended info about given version.

getVersionInfos

Method
getVersionInfos(refresh){Promise<VersionInfo[]>}

Method used to get a list of versions.

Parameter
refresh Boolean

If refresh is true, a new REST call will be made to the server to get the available versions.

Returns
Type Description
Promise<VersionInfo[]>
  • Contains extended info about given version.

load

Method
load(){Promise}

Triggers the loading of the version management service instance.

Fully loads the Version Management Service definition.

Returns
Type Description
Promise Resolves when the Feature Service is loaded.

redo

Method
redo(){Promise<ServiceResult>}

This method redos the last edit made while in an edit session.

Returns
Type Description
Promise<ServiceResult>
  • Specifies if redo was successful.

startEditing

Method
startEditing(){Promise<ServiceResult>}

Using the specified session ID an exclusive lock is obtained for the session on the version. The exclusive lock can only be obtained if no other shared or exclusive locks are present and the session currently holds a shared lock. The exclusive lock ensures read and write isolation for the session holding the lock. The exclusive lock is downgraded to a shared lock by using the stopEditing operation.

Returns
Type Description
Promise<ServiceResult>
  • Specifies if start editing was successful.
Example
await versioningState.startEditing();

stopEditing

Method
stopEditing(saveEdits){Promise<ServiceResult>}

Using the specified session id, the exclusive lock for the version is downgraded to a shared lock. The saveEdits parameter specifies if the edits for the session should be saved (true) or discarded (false).

Parameter
saveEdits Boolean

If set to true edits will be saved, if false edits will not be saved.

Returns
Type Description
Promise<ServiceResult>
  • Specifies if stop editing was successful.
Example
await versioningState.stopEditing(true);

undo

Method
undo(){Promise<ServiceResult>}

This method undos the last edit made while in an edit session.

Returns
Type Description
Promise<ServiceResult>
  • Specifies if undo was successful.

Type Definitions

VersionInfo

Type Definition
VersionInfo Object

This contains basic information about a given version.

Properties
versionIdentifier Object

The identifier of a version.

Specification
name String

The name of the version.

guid String

The guid of a version.

description String
optional

Description of the version.

access String
optional

Access type accepts values of private, public, hidden, and protected.

versionId String
optional

The id of the version that was edited.

creationDate Number
optional

The date the version was created on.

modifiedDate Number
optional

The date when the version was last modified or changed.

reconcileDate Number
optional

The date when the version was last reconciled with the parent version or the default version.

evaluationDate Number
optional

The date when the version was last evaluated for conflicts or discrepancies during the reconciliation process.

previousAncestorDate Number
optional

The date of the most recent ancestor version, if applicable.

commonAncestorDate Number
optional

The date of the common ancestor version, which is the shared ancestor between two or more versions during the reconciliation process.

VersionInfoExtendedJSON

Type Definition
VersionInfoExtendedJSON Object

This contains extended information about a given version.

Properties
versionIdentifier Object

The identifier of a version.

Specification
name String

The name of the version.

guid String

The guid of a version.

description String
optional

Description of the version.

access String
optional

The access type permissions of the version.

Possible Values:"hidden"|"private"|"protected"|"public"

versionId String
optional

The id of the version that was edited.

creationDate Number
optional

The date the version was created on.

modifiedDate Number
optional

The date when the version was last modified or changed.

reconcileDate Number
optional

The date when the version was last reconciled with the parent version or the default version.

evaluationDate Number
optional

The date when the version was last evaluated for conflicts or discrepancies during the reconciliation process.

previousAncestorDate Number
optional

The date of the most recent ancestor version, if applicable.

commonAncestorDate Number
optional

The date of the common ancestor version, which is the shared ancestor between two or more versions during the reconciliation process.

isBeingEdited Boolean
optional

Specifies if the version is currently being edited.

isBeingRead Boolean
optional

Specifies if the version is currently being read.

hasConflicts Boolean
optional

Specifies if the version is has conflicts.

hasUninspectedConflicts Boolean
optional

Specifies if the version has UninspectedConflicts.

isLocked Boolean
optional

Specifies if the version currently has a lock.

lockOwner String
optional

Specifies which user is the current lock owner.

lockDate Number
optional

Specifies the date at which the version was locked.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.