import VersionManager from "@arcgis/core/versionManagement/VersionManager.js";const VersionManager = await $arcgis.import("@arcgis/core/versionManagement/VersionManager.js");- Inheritance:
- VersionManager→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This class allows you to manage versions from a variety of feature services.
The VersionManager allows you to alter, create, delete versions etc. provided that a featureServiceUrl is provided for these operations.
Example
const webMap = new WebMap({ portalItem: { id: "webmapID" }});
const view = new MapView({ map: webMap});
featureLayer = new FeatureLayer({ url: "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0",});
webMap.layers.add(featureLayer);
const versionManager = new VersionManager({ view });await whenOnce(() => versionManager.state === "ready");Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
declaredClass readonly inherited | ||
executionError readonly | | |
| | ||
loadError readonly | | |
| | ||
| | ||
state readonly | | |
| | ||
| | ||
| | ||
| | ||
| |
executionError
- Type
- VersionManagerExecutionError | null | undefined
Displays execution errors.
featureServiceLookup
A key-value pair of FeatureServiceResourcesBundle.
loadError
- Type
- VersionManagerLoadError | null | undefined
Displays an error if loading fails.
serviceNameLookup
Map of Service URLs and service names. Keeps track of all the FeatureService instances in the VersionManagementService class instance.
versioningStateLookup
- Type
- Map<string, VersioningState>
This property contains metadata about the versioning state.
Methods
| Method | Signature | Class |
|---|---|---|
alterVersion(parameters: AlterVersionParameters): Promise<boolean> | | |
changeVersion(featureServerUrl: string, toVersionName: string, toVersionGuid: string): Promise<Map<VersionAdapter, ServiceResult>> | | |
createVersion(parameters: CreateVersionParameters): Promise<VersionInfoExtendedJSON> | | |
deleteVersion(featureServerUrl: string, versionName: string, versionGuid: string): Promise<boolean> | | |
getVersionInfos(featureServerUrl: string): Promise<VersionInfo[]> | |
alterVersion
- Signature
-
alterVersion (parameters: AlterVersionParameters): Promise<boolean>
The alter operation allows you to change the geodatabase version's name, description, owner, and access permissions.
License
This method requires the feature service and version management service to be published with ArcGIS Enterprise version 11.2 or higher.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| parameters | Parameters used to alter a version. | |
Example
await versionManager.alterVersion({ featureServiceUrl: "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0", versionIdentifier: { guid: myVersion.versionIdentifier.guid, name: myVersion.versionIdentifier.name,}, versionName: "updatedVersionName"}); changeVersion
- Signature
-
changeVersion (featureServerUrl: string, toVersionName: string, toVersionGuid: string): Promise<Map<VersionAdapter, ServiceResult>>
Method used to change a version using a featureServerUrl, name, and guid of a version.
Parameters
- Returns
- Promise<Map<VersionAdapter, ServiceResult>>
When resolved, returns a map of version adapter to result.
Example
await versionManager.changeVersion( "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0", "incomingVersionName", "incomingVersionGuid" ) createVersion
- Signature
-
createVersion (parameters: CreateVersionParameters): Promise<VersionInfoExtendedJSON>
Creates a new version given the following parameters.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| parameters | Parameters used to create a new version. | |
- Returns
- Promise<VersionInfoExtendedJSON>
When the promise is resolved, the VersionInfoExtendedJSON will be returned once the create operation is successfully completed.
Example
await versionManager.createVersion({ featureServerUrl: "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0", versionName: "NewVersionName", description: "New Version Description", access: "public",}); deleteVersion
- Signature
-
deleteVersion (featureServerUrl: string, versionName: string, versionGuid: string): Promise<boolean>
Deletes a version given the following parameters.
License
This method requires the feature service and version management service to be published with ArcGIS Enterprise version 11.2 or higher.
Parameters
Example
await versionManager.deleteVersion( "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0", "versionName", "{45A4CF5B-69FB-4D94-96F7-25F92EB4C0EC}"); getVersionInfos
- Signature
-
getVersionInfos (featureServerUrl: string): Promise<VersionInfo[]>
Returns all versions accessible to the currently logged-in user.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| featureServerUrl | The url of a feature service. | |
- Returns
- Promise<VersionInfo[]>
When resolved, returns an array of
VersionInfo.
Example
const versionInfos = await versionManager.getVersionInfos("https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0");Type definitions
VersionManagerExecutionError
- Type
- "no-feature-service-found" | "no-valid-enterprise-version" | "no-valid-version-name" | "no-version-management-service-found" | undefined
VersionManagerLoadError
- Type
- "no-feature-services" | "no-layers-property" | undefined