{"version":3,"sources":["../../../packages/core/security/connection-manager-settings/common-connection-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE7G,MAAM,WAAW,uBAAwB,SAAQ,UAAU;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,eAAe;IACzD,OAAO,CAAC,MAAM,CAAC,aAAa,CAG1B;IAEF,IAAW,SAAS,IAAI,uBAAuB,CAE9C;IAED,IAAW,SAAS,CAAC,KAAK,EAAE,uBAAuB,EAElD;IAED;;OAEG;IACH,IAAW,aAAa,IAAI,MAAM,CAEjC;gBAEW,aAAa,EAAE,oBAAoB,EAAE,QAAQ,EAAE,uBAAuB;IAIlF;;;;OAIG;IACH,SAAS,CAAC,OAAO;CAepB","file":"common-connection-settings.d.ts","sourcesContent":["import { JsonObject } from '../../base/json';\r\nimport { PlainVersionedObject, VersionedObject, VersionedObjectHandlers } from '../../base/versioned-object';\r\n\r\nexport interface AzureConnectionSettings extends JsonObject {\r\n    tenantId: string;\r\n    subscriptionId: string;\r\n    resourceGroup: string;\r\n    virtualMachine: string;\r\n}\r\n\r\n/**\r\n * Defines the common connection settings object that is shared throughout the connection's tools.\r\n */\r\nexport class CommonConnectionSettings extends VersionedObject {\r\n    private static propertyNames = {\r\n        // TODO: add properties when needed\r\n        azureInfo: 'azureInfo'\r\n    };\r\n\r\n    public get azureInfo(): AzureConnectionSettings {\r\n        return <AzureConnectionSettings>this.getProperty(CommonConnectionSettings.propertyNames.azureInfo);\r\n    }\r\n\r\n    public set azureInfo(value: AzureConnectionSettings) {\r\n        this.setProperty(CommonConnectionSettings.propertyNames.azureInfo, value);\r\n    }\r\n\r\n    /**\r\n     * Getter for the latest version of the common application settings\r\n     */\r\n    public get latestVersion(): number {\r\n        return 1;\r\n    }\r\n\r\n    constructor(objectWrapper: PlainVersionedObject, handlers: VersionedObjectHandlers) {\r\n        super(objectWrapper, handlers);\r\n    }\r\n\r\n    /**\r\n     * Attempts to upgrade the current version of the object at least one version toward the latest version.\r\n     * if this.currentVersion is null or undefined, then the upgrade should initialize to the latest version\r\n     * this is called iteratively until the current version is equal to the latest version\r\n     */\r\n    protected upgrade() {\r\n        // For now, we dont need to do anything but initialize to the latest version.\r\n        // NOTE: When latestVersion is updated, then we need to add logic here to upgrade old application settings objects.\r\n        // In this case, we ALWAYS must maintain backwards and forwards compatibility. This object is shared back and forth be\r\n        if (MsftSme.isNullOrUndefined(this.currentVersion)) {\r\n            this.clear();\r\n            this.azureInfo = null;\r\n            this.currentVersion = this.latestVersion;\r\n            return;\r\n        } else if (this.currentVersion < this.latestVersion) {\r\n            this.currentVersion = this.latestVersion;\r\n        } else {\r\n            // current version is newer than the version we know about. TODO: there may need to be handling here in the future.\r\n        }\r\n    }\r\n}\r\n"]}