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,EAAE,oBAAoB,EAC1C,YAAY,EAAE,YAAY;CAGzC","file":"active-connection.d.ts","sourcesContent":["import { CimConnection } from '../data/cim-connection';\r\nimport { FileTransfer } from '../data/file-transfer';\r\nimport { PowerShellConnection } from '../data/powershell-connection';\r\nimport { EnvironmentConnectionTypeInfo, EnvironmentModule } from '../manifest/environment-modules';\r\nimport { Connection, ConnectionUtility } from './connection';\r\nimport { ConnectionManager } from './connection-manager';\r\n\r\n/**\r\n * Provides a shortcut to accessing common information about the active connection.\r\n */\r\nexport class ActiveConnection {\r\n    /**\r\n     * map data of connection type information.\r\n     */\r\n    private map: { [name: string]: EnvironmentConnectionTypeInfo } = null;\r\n\r\n    /**\r\n     * Gets the active connection\r\n     */\r\n    public get value(): Connection {\r\n        return this.connectionManager.activeConnection;\r\n    }\r\n\r\n    /**\r\n     * Sets the active connection\r\n     */\r\n    public set value(value: Connection) {\r\n        this.connectionManager.activeConnection = value;\r\n    }\r\n\r\n    /**\r\n     * Indicates if the active connection is to a server\r\n     */\r\n    public get isServer(): boolean {\r\n        return ConnectionUtility.isServer(this.value);\r\n    }\r\n\r\n    /**\r\n     * Indicates if the active connection is to a cluster\r\n     */\r\n    public get isCluster(): boolean {\r\n        return ConnectionUtility.isCluster(this.value);\r\n    }\r\n\r\n    /**\r\n     * Indicates if the active connection is to a node (cluster or server)\r\n     */\r\n    public get isNode(): boolean {\r\n        return ConnectionUtility.isNode(this.value);\r\n    }\r\n\r\n    /**\r\n     * Indicates if the active connection is to a failover cluster\r\n     * @deprecated since 09/16/19. Please use isBritannicEnabled from ClusterInventoryCache instead\r\n     */\r\n    public get isFailoverCluster(): boolean {\r\n        return ConnectionUtility.isFailoverCluster(this.value);\r\n    }\r\n\r\n    /**\r\n     * Indicates if the active connection is to a windows client\r\n     */\r\n    public get isWindowsClient(): boolean {\r\n        return ConnectionUtility.isWindowsClient(this.value);\r\n    }\r\n\r\n    /**\r\n     * Indicates if the active connection is to an EFLOW device\r\n     */\r\n    public get isEflowDevice(): boolean {\r\n        return ConnectionUtility.isEflowDevice(this.value);\r\n    }\r\n\r\n    /**\r\n     * If the active connection is a cluster, the cluster node names. Otherwise, an empty array\r\n     */\r\n    public get clusterNodes(): string[] {\r\n        return ConnectionUtility.getClusterNodes(this.value);\r\n    }\r\n\r\n    /**\r\n     * If the active connection is a node (cluster or server), the node name. Otherwise, null.\r\n     */\r\n    public get nodeName(): string {\r\n        return ConnectionUtility.getNodeName(this.value);\r\n    }\r\n\r\n    /**\r\n     * If the active connection is a node (cluster or server), the valid node name (may be alias). Otherwise, null.\r\n     */\r\n    public get validNodeName(): string {\r\n        return ConnectionUtility.getValidNodeName(this.value);\r\n    }\r\n\r\n    /**\r\n     * Gets the connection type info for the active connection\r\n     */\r\n    public get connectionTypeInfo(): EnvironmentConnectionTypeInfo {\r\n        if (!this.map) {\r\n            // create once.\r\n            this.map = EnvironmentModule.getConnectionMap();\r\n        }\r\n\r\n        return this.value ? this.map[this.value.type] : null;\r\n    }\r\n\r\n    /**\r\n     * Constructor for the active connection class\r\n     */\r\n    constructor(\r\n        private connectionManager: ConnectionManager,\r\n        private cimConnection: CimConnection,\r\n        private powerShellConnection: PowerShellConnection,\r\n        private fileTransfer: FileTransfer\r\n    ) {\r\n    }\r\n}\r\n"]}