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AAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAyCtE;;;;;;;;OAQG;IACI,mBAAmB,CACtB,kBAAkB,EAAE,MAAM,EAC1B,sBAAsB,EAAE,MAAM,EAC9B,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,EACtB,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAiB5D","file":"shell-navigation-connection.d.ts","sourcesContent":["import { Logging } from '../diagnostics/logging';\r\nimport { Rpc } from '../rpc/rpc';\r\nimport { RpcShellNavigateClient } from '../rpc/shell-navigate/rpc-shell-navigate-client';\r\nimport { RpcShellNavigateResult } from '../rpc/shell-navigate/rpc-shell-navigate-model';\r\n\r\nexport class ShellNavigationConnection {\r\n    /**\r\n     * Initializes a new instance of the ShellNavigationConnection class.\r\n     *\r\n     * @param rpc the rpc object.\r\n     */\r\n    constructor(private rpc: Rpc) {\r\n    }\r\n\r\n    /**\r\n     * Navigate to the shell home page.\r\n     *\r\n     * @return Promise<RpcShellNavigateResult> the navigation result.\r\n     */\r\n    public navigateHome(): Promise<RpcShellNavigateResult> {\r\n        return RpcShellNavigateClient.shellNavigate(this.rpc, {});\r\n    }\r\n\r\n    /**\r\n     * Reload the shell.\r\n     *\r\n     * @return Promise<RpcShellNavigateResult> the navigation result.\r\n     */\r\n    public navigateReload(): Promise<RpcShellNavigateResult> {\r\n        return RpcShellNavigateClient.shellNavigate(this.rpc, { reload: true });\r\n    }\r\n\r\n    /**\r\n     * Navigate to a settings of gateway.\r\n     *\r\n     * @param name the name of setting of gateway.\r\n     * @param nestedUrlAndOptions the nested URL and Options on the setting of gateway.\r\n     * @return Promise<RpcShellNavigateResult> the navigation result.\r\n     */\r\n    public navigateSettings(name: string, nestedUrlAndOptions?: string): Promise<RpcShellNavigateResult> {\r\n        return RpcShellNavigateClient.shellNavigate(\r\n            this.rpc,\r\n            {\r\n                settings: {\r\n                    name,\r\n                    nestedUrlAndOptions: nestedUrlAndOptions\r\n                }\r\n            });\r\n    }\r\n\r\n    /**\r\n     * Navigate to URL.\r\n     *\r\n     * @return Promise<RpcShellNavigateResult> the navigation result.\r\n     */\r\n    public navigateUrl(url: string): Promise<RpcShellNavigateResult> {\r\n        return RpcShellNavigateClient.shellNavigate(this.rpc, { navigateNext: url });\r\n    }\r\n\r\n    /**\r\n     * Navigate a view by the shell.\r\n     *\r\n     * @param solution the solution - module name and entry point name.\r\n     * @param tool the tool - module name and entry point name.\r\n     * @param connection the connection - name and type.\r\n     * @param connectionSettings the setting tab name, omit tabUrlName if goes to the first item.\r\n     * @param reserved (deprecated - use tool parameters such as toolUrl, toolQueryParams and toolFragment)\r\n     * @param settings the settings on the shell/gateway.\r\n     * @param navigateNext the navigate next url.\r\n     * @param reload the reload shell.\r\n     * @param popoutOptions options indicating how to popout the navigation.\r\n     * @return Promise<RpcShellNavigateResult> the navigation result.\r\n     */\r\n    public navigate(\r\n        solution?: {\r\n            moduleName: string,\r\n            entryPointName?: string\r\n        },\r\n        tool?: {\r\n            moduleName: string,\r\n            entryPointName?: string,\r\n            toolUrl?: string;\r\n            toolQueryParams?: string;\r\n            toolFragment?: string;\r\n        },\r\n        connection?: {\r\n            name: string,\r\n            type: string\r\n        },\r\n        connectionSettings?: {\r\n            tabUrlName?: string\r\n        },\r\n        reserved?: string,\r\n        settings?: {\r\n            name: string,\r\n            nestedUrlAndOptions?: string\r\n        },\r\n        navigateNext?: string,\r\n        reload?: boolean,\r\n        popoutOptions?: {\r\n            configuration?: MsftSme.EnvironmentConfiguration;\r\n        }\r\n    ): Promise<RpcShellNavigateResult> {\r\n        return RpcShellNavigateClient.shellNavigate(\r\n            this.rpc,\r\n            {\r\n                solution: solution,\r\n                tool: tool,\r\n                connection: connection,\r\n                connectionSettings: connectionSettings,\r\n                settings: settings,\r\n                toolNestedUrlAndOptions: reserved,\r\n                navigateNext: navigateNext,\r\n                reload: reload,\r\n                popoutOptions: popoutOptions\r\n            });\r\n    }\r\n\r\n    /**\r\n     * Navigate to a tool.\r\n     *\r\n     * @param solutionModuleName the solution module name.\r\n     * @param solutionEntryPointName the solution entry point name.\r\n     * @param toolModuleName the tool module name.\r\n     * @param toolEntryPointName the tool entry point name.\r\n     * @param connectionName the connection name.\r\n     * @param connectionType the connection type.\r\n     * @param toolUrl the nested url within the tool.\r\n     * @param toolQueryParams the tool query parameters.\r\n     * @param toolFragment the tool fragment.\r\n     * @return Promise<RpcShellNavigateResult> the navigation result.\r\n     */\r\n    public navigateTool(\r\n        solutionModuleName: string,\r\n        solutionEntryPointName: string,\r\n        toolModuleName: string,\r\n        toolEntryPointName: string,\r\n        connectionName: string,\r\n        connectionType: string,\r\n        toolUrl?: string,\r\n        toolQueryParams?: { [key: string]: any },\r\n        toolFragment?: string): Promise<RpcShellNavigateResult>;\r\n\r\n    /**\r\n     * @deprecated\r\n     * Navigate to a tool.\r\n     *\r\n     * @param solutionModuleName the solution module name.\r\n     * @param solutionEntryPointName the solution entry point name.\r\n     * @param toolModuleName the tool module name.\r\n     * @param toolEntryPointName the tool entry point name.\r\n     * @param connectionName the connection name.\r\n     * @param connectionType the connection type.\r\n     * @param toolNestedUrlAndOptions the nested url within the tool.\r\n     * @return Promise<RpcShellNavigateResult> the navigation result.\r\n     */\r\n    public navigateTool(\r\n        solutionModuleName: string,\r\n        solutionEntryPointName: string,\r\n        toolModuleName: string,\r\n        toolEntryPointName: string,\r\n        connectionName: string,\r\n        connectionType: string,\r\n        toolNestedUrlAndOptions?: string): Promise<RpcShellNavigateResult>;\r\n\r\n    public navigateTool(\r\n        solutionModuleName: string,\r\n        solutionEntryPointName: string,\r\n        toolModuleName: string,\r\n        toolEntryPointName: string,\r\n        connectionName: string,\r\n        connectionType: string,\r\n        toolUrlOrToolNestedUrlAndOptions?: string,\r\n        toolQueryParams?: { [key: string]: string },\r\n        toolFragment?: string): Promise<RpcShellNavigateResult> {\r\n\r\n        let toolUrl = toolUrlOrToolNestedUrlAndOptions;\r\n        if (toolUrlOrToolNestedUrlAndOptions) {\r\n            toolUrl = MsftSme.trimStart(toolUrlOrToolNestedUrlAndOptions, '/');\r\n            try {\r\n                const url = new URL('http://fake/' + toolUrl);\r\n                toolUrl = url.pathname;\r\n                toolFragment = url.hash.length > 0 ? MsftSme.trimStart(url.hash, '#') : null;\r\n                toolQueryParams = {};\r\n                url.searchParams.forEach((value, key) => toolQueryParams[key] = value);\r\n            } catch {\r\n                // skip if parsing caused an error of URL object.\r\n                Logging.logWarning('navigation', 'Couldn\\'t parse toolNestedUrlAndOptions.');\r\n            }\r\n        }\r\n\r\n        return RpcShellNavigateClient.shellNavigate(\r\n        this.rpc,\r\n        {\r\n            solution: {\r\n                moduleName: solutionModuleName,\r\n                entryPointName: solutionEntryPointName\r\n            },\r\n            tool: {\r\n                moduleName: toolModuleName,\r\n                entryPointName: toolEntryPointName,\r\n                nestedUrl: toolUrl,\r\n                fragment: toolFragment,\r\n                queryParams: toolQueryParams\r\n            },\r\n            connection: {\r\n                name: connectionName,\r\n                type: connectionType\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Navigate to a solution tool.\r\n     *\r\n     * @param solutionModuleName the solution module name.\r\n     * @param solutionEntryPointName the solution entry point name.\r\n     * @param toolModuleName the tool module name.\r\n     * @param toolEntryPointName the tool entry point name.\r\n     * @param toolUrl the nested url within the tool.\r\n     * @param toolQueryParams the tool query parameters.\r\n     * @param toolFragment the tool fragment.\r\n     * @return Promise<RpcShellNavigateResult> the navigation result.\r\n     */\r\n    public navigateSolutionTool(\r\n        solutionModuleName: string,\r\n        solutionEntryPointName: string,\r\n        toolModuleName: string,\r\n        toolEntryPointName: string,\r\n        toolUrl?: string,\r\n        toolQueryParams?: { [key: string]: string },\r\n        toolFragment?: string): Promise<RpcShellNavigateResult>;\r\n\r\n    /**\r\n     * Navigate to a solution tool.\r\n     *\r\n     * @param solutionModuleName the solution module name.\r\n     * @param solutionEntryPointName the solution entry point name.\r\n     * @param toolModuleName the tool module name.\r\n     * @param toolEntryPointName the tool entry point name.\r\n     * @param toolNestedUrlAndOptions the nested url within the tool.\r\n     * @return Promise<RpcShellNavigateResult> the navigation result.\r\n     */\r\n    public navigateSolutionTool(\r\n        solutionModuleName: string,\r\n        solutionEntryPointName: string,\r\n        toolModuleName: string,\r\n        toolEntryPointName: string,\r\n        toolNestedUrlAndOptions?: string): Promise<RpcShellNavigateResult>;\r\n\r\n    public navigateSolutionTool(\r\n        solutionModuleName: string,\r\n        solutionEntryPointName: string,\r\n        toolModuleName: string,\r\n        toolEntryPointName: string,\r\n        toolUrlOrToolNestedUrlAndOptions?: string,\r\n        toolQueryParams?: { [key: string]: string },\r\n        toolFragment?: string): Promise<RpcShellNavigateResult> {\r\n            let toolUrl = toolUrlOrToolNestedUrlAndOptions;\r\n            if (toolUrlOrToolNestedUrlAndOptions) {\r\n                toolUrl = MsftSme.trimStart(toolUrlOrToolNestedUrlAndOptions, '/');\r\n                try {\r\n                    const url = new URL('http://fake/' + toolUrl);\r\n                    toolUrl = url.pathname;\r\n                    toolFragment = url.hash.length > 0 ? MsftSme.trimStart(url.hash, '#') : null;\r\n                    toolQueryParams = {};\r\n                    url.searchParams.forEach((value, key) => toolQueryParams[key] = value);\r\n                } catch {\r\n                    // skip if parsing caused an error of URL object.\r\n                    Logging.logWarning('navigation', 'Couldn\\'t parse toolNestedUrlAndOptions.');\r\n                }\r\n            }\r\n        return RpcShellNavigateClient.shellNavigate(\r\n            this.rpc,\r\n            {\r\n                solution: {\r\n                    moduleName: solutionModuleName,\r\n                    entryPointName: solutionEntryPointName\r\n                },\r\n                tool: {\r\n                    moduleName: toolModuleName,\r\n                    entryPointName: toolEntryPointName,\r\n                    nestedUrl: toolUrl,\r\n                    queryParams: toolQueryParams,\r\n                    fragment: toolFragment\r\n                }\r\n            });\r\n    }\r\n\r\n    /**\r\n     * Navigate to a setting of a tool.\r\n     *\r\n     * @param solutionModuleName the solution module name.\r\n     * @param solutionEntryPointName the solution entry point name.\r\n     * @param connectionName the connection name.\r\n     * @param connectionType the connection type.\r\n     * @param tabUrlName the setting tab name, omit tabUrlName goes to the default setting item.\r\n     */\r\n    public navigateToolSetting(\r\n        solutionModuleName: string,\r\n        solutionEntryPointName: string,\r\n        connectionName: string,\r\n        connectionType: string,\r\n        tabUrlName?: string): Promise<RpcShellNavigateResult> {\r\n        return RpcShellNavigateClient.shellNavigate(\r\n            this.rpc,\r\n            {\r\n                solution: {\r\n                    moduleName: solutionModuleName,\r\n                    entryPointName: solutionEntryPointName\r\n                },\r\n                connection: {\r\n                    name: connectionName,\r\n                    type: connectionType\r\n                },\r\n                connectionSettings: {\r\n                    tabUrlName: tabUrlName\r\n                }\r\n            });\r\n    }\r\n}\r\n"]}