@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
50 lines (48 loc) • 2.03 kB
JavaScript
import { VersionedObject } from '../../base/versioned-object';
/**
* Defines the common connection settings object that is shared throughout the connection's tools.
*/
export class CommonConnectionSettings extends VersionedObject {
static propertyNames = {
// TODO: add properties when needed
azureInfo: 'azureInfo'
};
get azureInfo() {
return this.getProperty(CommonConnectionSettings.propertyNames.azureInfo);
}
set azureInfo(value) {
this.setProperty(CommonConnectionSettings.propertyNames.azureInfo, value);
}
/**
* Getter for the latest version of the common application settings
*/
get latestVersion() {
return 1;
}
constructor(objectWrapper, handlers) {
super(objectWrapper, handlers);
}
/**
* Attempts to upgrade the current version of the object at least one version toward the latest version.
* if this.currentVersion is null or undefined, then the upgrade should initialize to the latest version
* this is called iteratively until the current version is equal to the latest version
*/
upgrade() {
// For now, we dont need to do anything but initialize to the latest version.
// NOTE: When latestVersion is updated, then we need to add logic here to upgrade old application settings objects.
// In this case, we ALWAYS must maintain backwards and forwards compatibility. This object is shared back and forth be
if (MsftSme.isNullOrUndefined(this.currentVersion)) {
this.clear();
this.azureInfo = null;
this.currentVersion = this.latestVersion;
return;
}
else if (this.currentVersion < this.latestVersion) {
this.currentVersion = this.latestVersion;
}
else {
// current version is newer than the version we know about. TODO: there may need to be handling here in the future.
}
}
}
//# sourceMappingURL=common-connection-settings.js.map