From 8045b68f4e2c46ed8277352035e911da71ccfe4d Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 20 Oct 2023 14:29:16 -0700 Subject: [PATCH 01/21] Update README with more description and clarity --- README.md | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7534c26..f1a03fb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,19 @@ +# Description + +This repo is for the `dataprotocol-client` package, which is used by Azure Data Studio extensions wishing to implement certain core features, such as a Query Provider. + +This is done through an implementation on top of the VS Code [Language Client](https://code.visualstudio.com/api/language-extensions/language-server-extension-guide). This package is used to set up the features and messages that will then be implemented by the backing language server (such as [SQL Tools Service](https://github.com/Microsoft/sqltoolsservice)). You can see further descriptions of the messages defined [here](https://github.com/microsoft/sqltoolsservice/blob/main/docs/guide/jsonrpc_protocol.md) + +Currently, this package is NOT published to npm or any other package manager. Instead, extensions will reference the Github releases directly. These releases point to commits out of the [release](https://github.com/microsoft/sqlops-dataprotocolclient/tree/release) branch, which contains the compiled +JS sources that extensions will be using at runtime. + +To reference this package, add an entry like this to your package.json dependencies : + +`github:Microsoft/sqlops-dataprotocolclient#1.3.8` + +replacing the version with the version of the release you wish to use. + # Build and Run From Source ```bash @@ -9,11 +24,24 @@ yarn run watch ``` # Create a release -New releases need to be created off the release branch, the release branch contains the lib folder. -1. make the changes in the main branch -1. cherry-pick the changes to release branch and build it, lib folder will be updated -1. commit the changes to release branch -1. create a release: https://github.com/microsoft/sqlops-dataprotocolclient/releases, the source will be included automatically. + +New releases need to be created off the [release](https://github.com/microsoft/sqlops-dataprotocolclient/tree/release) branch, the release branch contains the lib folder. + +1. Make the changes in the main branch (including a version bump) +2. Create a new branch off of the [release](https://github.com/microsoft/sqlops-dataprotocolclient/tree/release) branch +3. Merge the changes to your new branch + * You can also cherry-pick changes over if desired, although generally we should always be releasing everything from main +4. Run `yarn compile` locally to build the sources, you should see changes in the lib folder +5. Commit the changes to your branch +6. Open a PR to merge these changes into the release branch and once approved merge it in + * IMPORTANT : This should be done with a merge commit, NOT a squash merge +7. Create a release: https://github.com/microsoft/sqlops-dataprotocolclient/releases + +Now you can reference the new release in your extension with an entry in the dependencies section like this + +`github:Microsoft/sqlops-dataprotocolclient#1.3.8` + +replacing the version with whatever the latest released version you just made is. # Contributing From df92b533819e00122ab3c1a45a1653efdd077b17 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 20 Oct 2023 14:31:31 -0700 Subject: [PATCH 02/21] Point to wiki --- README.md | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index f1a03fb..86e1e7e 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,7 @@ This is done through an implementation on top of the VS Code [Language Client](h Currently, this package is NOT published to npm or any other package manager. Instead, extensions will reference the Github releases directly. These releases point to commits out of the [release](https://github.com/microsoft/sqlops-dataprotocolclient/tree/release) branch, which contains the compiled JS sources that extensions will be using at runtime. -To reference this package, add an entry like this to your package.json dependencies : - -`github:Microsoft/sqlops-dataprotocolclient#1.3.8` - -replacing the version with the version of the release you wish to use. +See [the wiki](https://github.com/microsoft/sqlops-dataprotocolclient/wiki/Releasing-Changes#using-this-package) for more information. # Build and Run From Source @@ -25,23 +21,7 @@ yarn run watch # Create a release -New releases need to be created off the [release](https://github.com/microsoft/sqlops-dataprotocolclient/tree/release) branch, the release branch contains the lib folder. - -1. Make the changes in the main branch (including a version bump) -2. Create a new branch off of the [release](https://github.com/microsoft/sqlops-dataprotocolclient/tree/release) branch -3. Merge the changes to your new branch - * You can also cherry-pick changes over if desired, although generally we should always be releasing everything from main -4. Run `yarn compile` locally to build the sources, you should see changes in the lib folder -5. Commit the changes to your branch -6. Open a PR to merge these changes into the release branch and once approved merge it in - * IMPORTANT : This should be done with a merge commit, NOT a squash merge -7. Create a release: https://github.com/microsoft/sqlops-dataprotocolclient/releases - -Now you can reference the new release in your extension with an entry in the dependencies section like this - -`github:Microsoft/sqlops-dataprotocolclient#1.3.8` - -replacing the version with whatever the latest released version you just made is. +See [the wiki](https://github.com/microsoft/sqlops-dataprotocolclient/wiki/Releasing-Changes) for instructions on making and releasing new changes. # Contributing From e9ce2248fc141014af12e6a4c39c7370c9bd013d Mon Sep 17 00:00:00 2001 From: Alex Ma Date: Wed, 15 Nov 2023 12:19:36 -0800 Subject: [PATCH 03/21] Add SPID to ConnectionInfoSummary (#97) * added SPID to azdata.proposed * use lowercase * moved spid to connectioninfosummary * added SPID to QueryExecuteCompleteNotificationResult * added conversion to string * added proposed changes --- src/azdata.proposed.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 3e5553f..251aafd 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -510,6 +510,20 @@ declare module 'azdata' { export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; } + export interface ConnectionInfoSummary { + /** + * ID used to identify the connection on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + export interface QueryExecuteCompleteNotificationResult { + /** + * ID used to identify the connection used to run the query on the server, if available. + */ + serverConnectionId?: string | undefined; + } + /* * Add optional per-OS default value. */ From eb3c23d52d4be30353189c3863abb6e78ffbb2d4 Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Tue, 20 Aug 2024 19:18:02 -0700 Subject: [PATCH 04/21] Add copy results to clipboard notification --- src/azdata.proposed.d.ts | 4 ++++ src/main.ts | 9 ++++++++- src/protocol.ts | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 251aafd..2fb2c0e 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -906,6 +906,10 @@ declare module 'azdata' { * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. */ copyResults?(requestParams: CopyResultsRequestParams): Thenable; + /** + * Copy the selected data to the clipboard. + */ + copyResultsToClipboard?(requestParams: CopyResultsRequestParams): Thenable; } export enum DataProviderType { diff --git a/src/main.ts b/src/main.ts index d111e90..8392de0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -362,6 +362,7 @@ export class QueryFeature extends SqlOpsFeature { protocol.SaveResultsAsExcelRequest.type, protocol.SaveResultsAsXmlRequest.type, protocol.CopyResultsRequest.type, + protocol.CopyResultsToClipboardNotification.type, protocol.EditCommitRequest.type, protocol.EditCreateRowRequest.type, protocol.EditDeleteRowRequest.type, @@ -597,6 +598,11 @@ export class QueryFeature extends SqlOpsFeature { ); }; + let copyResultsToClipboard = (params: azdata.CopyResultsRequestParams): Thenable => { + client.sendNotification(protocol.CopyResultsToClipboardNotification.type, params); + return Promise.resolve(); + }; + // Edit Data Requests let commitEdit = (ownerUri: string): Thenable => { let params: azdata.EditCommitParams = { ownerUri }; @@ -738,7 +744,8 @@ export class QueryFeature extends SqlOpsFeature { runQueryString, saveResults, updateCell, - copyResults + copyResults, + copyResultsToClipboard }); } } diff --git a/src/protocol.ts b/src/protocol.ts index f47e512..8d37f98 100644 --- a/src/protocol.ts +++ b/src/protocol.ts @@ -473,6 +473,13 @@ export namespace CopyResultsRequest { } // --------------------------------- ------------------------------------------ +// --------------------------------- < Copy Results To Clipboard Notification > ------------------------------------------ +// copy results to clipboard +export namespace CopyResultsToClipboardNotification { + export const type = new NotificationType('query/copyToClipboard'); +} +// --------------------------------- ------------------------------------------ + // ------------------------------- < T-SQL Syntax Parse > ----------------------------------- export namespace SyntaxParseRequest { export const type = new RequestType('query/syntaxparse'); From 390158dfe0f7a06a0411cd68394556304ac087d5 Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Wed, 21 Aug 2024 10:58:15 -0700 Subject: [PATCH 05/21] Revert "Add copy results to clipboard notification" This reverts commit eb3c23d52d4be30353189c3863abb6e78ffbb2d4. --- src/azdata.proposed.d.ts | 4 ---- src/main.ts | 9 +-------- src/protocol.ts | 7 ------- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 2fb2c0e..251aafd 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -906,10 +906,6 @@ declare module 'azdata' { * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. */ copyResults?(requestParams: CopyResultsRequestParams): Thenable; - /** - * Copy the selected data to the clipboard. - */ - copyResultsToClipboard?(requestParams: CopyResultsRequestParams): Thenable; } export enum DataProviderType { diff --git a/src/main.ts b/src/main.ts index 8392de0..d111e90 100644 --- a/src/main.ts +++ b/src/main.ts @@ -362,7 +362,6 @@ export class QueryFeature extends SqlOpsFeature { protocol.SaveResultsAsExcelRequest.type, protocol.SaveResultsAsXmlRequest.type, protocol.CopyResultsRequest.type, - protocol.CopyResultsToClipboardNotification.type, protocol.EditCommitRequest.type, protocol.EditCreateRowRequest.type, protocol.EditDeleteRowRequest.type, @@ -598,11 +597,6 @@ export class QueryFeature extends SqlOpsFeature { ); }; - let copyResultsToClipboard = (params: azdata.CopyResultsRequestParams): Thenable => { - client.sendNotification(protocol.CopyResultsToClipboardNotification.type, params); - return Promise.resolve(); - }; - // Edit Data Requests let commitEdit = (ownerUri: string): Thenable => { let params: azdata.EditCommitParams = { ownerUri }; @@ -744,8 +738,7 @@ export class QueryFeature extends SqlOpsFeature { runQueryString, saveResults, updateCell, - copyResults, - copyResultsToClipboard + copyResults }); } } diff --git a/src/protocol.ts b/src/protocol.ts index 8d37f98..f47e512 100644 --- a/src/protocol.ts +++ b/src/protocol.ts @@ -473,13 +473,6 @@ export namespace CopyResultsRequest { } // --------------------------------- ------------------------------------------ -// --------------------------------- < Copy Results To Clipboard Notification > ------------------------------------------ -// copy results to clipboard -export namespace CopyResultsToClipboardNotification { - export const type = new NotificationType('query/copyToClipboard'); -} -// --------------------------------- ------------------------------------------ - // ------------------------------- < T-SQL Syntax Parse > ----------------------------------- export namespace SyntaxParseRequest { export const type = new RequestType('query/syntaxparse'); From 2b2dff4c3fc8f206086920e6f8dcc5bd4c348a6e Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Wed, 21 Aug 2024 11:02:36 -0700 Subject: [PATCH 06/21] Add copy to clipboard flag --- src/azdata.proposed.d.ts | 4240 +++++++++++++++++++------------------- 1 file changed, 2122 insertions(+), 2118 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 251aafd..d0db626 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -1,2118 +1,2122 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// This is the place for API experiments and proposal. - -import * as vscode from 'vscode'; - -declare module 'azdata' { - - export namespace nb { - export interface NotebookDocument { - /** - * Sets the trust mode for the notebook document. - */ - setTrusted(state: boolean): void; - } - - export interface ISessionOptions { - /** - * The spec for the kernel being used to create this session. - */ - kernelSpec?: IKernelSpec; - } - - export interface IKernelSpec { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages?: string[]; - } - - export interface IStandardKernel { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages: string[]; - readonly blockedOnSAW?: boolean; - } - - export interface IKernelChangedArgs { - nbKernelAlias?: string - } - - export interface ICellOutput { - /** - * Unique identifier for this cell output. - */ - id?: string; - } - - export interface IExecuteResult { - data: any; - } - - export interface IExecuteResultUpdate { - output_type: string; - resultSet: ResultSetSummary; - data: any; - } - - export interface IExecuteRequest { - /** - * The language of the notebook document that is executing this request. - */ - language: string; - } - - export interface INotebookMetadata { - connection_name?: string; - multi_connection_mode?: boolean; - } - - export interface ICellMetadata { - connection_name?: string; - } - - export interface ICellContents { - attachments?: ICellAttachments; - } - - export type ICellAttachments = { [key: string]: ICellAttachment }; - export type ICellAttachment = { [key: string]: string }; - - export interface SessionManager { - /** - * Shutdown all sessions. - */ - shutdownAll(): Thenable; - /** - * Disposes the session manager. - */ - dispose(): void; - } - - /** - * An event that is emitted when a {@link NotebookDocument} is closed. - */ - export const onDidCloseNotebookDocument: vscode.Event; - - export interface IKernel { - - /** - * Restart a kernel. - * - * #### Notes - * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). - * - * The promise is fulfilled on a valid response and rejected otherwise. - * - * It is assumed that the API call does not mutate the kernel id or name. - * - * The promise will be rejected if the kernel status is `Dead` or if the - * request fails or the response is invalid. - */ - restart(): Thenable; - } - } - - export interface LoadingComponentBase { - /** - * When true, the component will display a loading spinner. - */ - loading?: boolean; - - /** - * This sets the alert text which gets announced when the loading spinner is shown. - */ - loadingText?: string; - - /** - * The text to display while loading is set to false. Will also be announced through screen readers - * once loading is completed. - */ - loadingCompletedText?: string; - } - - /** - * The column information of a data set. - */ - export interface SimpleColumnInfo { - /** - * The column name. - */ - name: string; - /** - * The data type of the column. - */ - dataTypeName: string; - } - - /** - * The parameters for start data serialization request. - */ - export interface SerializeDataStartRequestParams { - /** - * 'csv', 'json', 'excel', 'xml' - */ - saveFormat: string; - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch of the data set to be serialized. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - /** - * The columns of the data set. - */ - columns: SimpleColumnInfo[]; - /** - * Whether to include column headers to the target file. - */ - includeHeaders?: boolean; - /** - * The delimiter to seperate the cells. - */ - delimiter?: string; - /** - * The line seperator. - */ - lineSeperator?: string; - /** - * Character used for enclosing text fields when saving results as CSV. - */ - textIdentifier?: string; - /** - * File encoding used when saving results as CSV. - */ - encoding?: string; - /** - * When true, XML output will be formatted when saving results as XML. - */ - formatted?: boolean; - } - - /** - * The parameters for continue data serialization request. - */ - export interface SerializeDataContinueRequestParams { - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - } - - /** - * The result of data serialization data request. - */ - export interface SerializeDataResult { - /** - * The output message. - */ - messages?: string; - /** - * Whether the serialization is succeeded. - */ - succeeded: boolean; - } - - /** - * The serialization provider. - */ - export interface SerializationProvider extends DataProvider { - /** - * Start the data serialization. - * @param requestParams the request parameters. - */ - startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; - /** - * Continue the data serialization. - * @param requestParams the request parameters. - */ - continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; - } - - export namespace dataprotocol { - /** - * Registers a SerializationProvider. - * @param provider The data serialization provider. - */ - export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; - export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; - /** - * Registers a DataGridProvider which is used to provide lists of items to a data grid - * @param provider The provider implementation - */ - export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; - } - - export enum DataProviderType { - DataGridProvider = 'DataGridProvider' - } - - /** - * The type of the DataGrid column - */ - export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; - - /** - * A column in a data grid - */ - export interface DataGridColumn { - /** - * The text to display on the column heading. - */ - name: string; - - /** - * The property name in the DataGridItem - */ - field: string; - - /** - * A unique identifier for the column within the grid. - */ - id: string; - - /** - * The type of column this is. This is used to determine how to render the contents. - */ - type: DataGridColumnType; - - /** - * Whether this column is sortable. - */ - sortable?: boolean; - - /** - * Whether this column is filterable - */ - filterable?: boolean; - - /** - * If false, column can no longer be resized. - */ - resizable?: boolean; - - /** - * If set to a non-empty string, a tooltip will appear on hover containing the string. - */ - tooltip?: string; - - /** - * Width of the column in pixels. - */ - width?: number - } - - /** - * Info for a command to execute - */ - export interface ExecuteCommandInfo { - /** - * The ID of the command to execute - */ - id: string; - /** - * The text to display for the action - */ - displayText?: string; - /** - * The optional args to pass to the command - */ - args?: any[]; - } - - /** - * Info for displaying a hyperlink value in a Data Grid table - */ - export interface DataGridHyperlinkInfo { - /** - * The text to display for the link - */ - displayText: string; - /** - * The URL to open or command to execute - */ - linkOrCommand: string | ExecuteCommandInfo; - } - - /** - * An item for displaying in a data grid - */ - export interface DataGridItem { - /** - * A unique identifier for this item - */ - id: string; - - /** - * The other properties that will be displayed in the grid columns - */ - [key: string]: string | DataGridHyperlinkInfo; - } - - /** - * A data provider that provides lists of resource items for a data grid - */ - export interface DataGridProvider extends DataProvider { - /** - * Gets the list of data grid items for this provider - */ - getDataGridItems(): Thenable; - /** - * Gets the list of data grid columns for this provider - */ - getDataGridColumns(): Thenable; - - /** - * The user visible string to use for the title of the grid - */ - title: string; - } - - export interface ConnectionProvider extends DataProvider { - /** - * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) - */ - changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; - } - - // Password Change Request ---------------------------------------------------------------------- - export interface PasswordChangeResult { - /** - * Whether the password change was successful - */ - result: boolean; - /** - * Error message if the password change was unsuccessful - */ - errorMessage?: string; - } - - export interface IConnectionProfile extends ConnectionInfo { - azureAccount?: string; - azureResourceId?: string; - azurePortalEndpoint?: string; - } - - export interface PromptFailedResult extends ProviderError { } - - export interface ProviderError { - /** - * Error name - */ - name?: string; - - /** - * Error code - */ - errorCode?: string; - - /** - * Error message - */ - errorMessage?: string; - } - - - export namespace diagnostics { - /** - * Represents a diagnostics provider of accounts. - */ - export interface ErrorDiagnosticsProviderMetadata { - /** - * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. - * Note: only ONE diagnostic provider per id/name at a time. - */ - targetProviderId: string; - } - - export interface ConnectionDiagnosticsResult { - /** - * Whether the error was handled or not. - */ - handled: boolean, - /** - * Whether reconnect should be attempted. - */ - reconnect?: boolean, - /** - * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. - */ - options?: { [name: string]: any }; - } - - /** - * Provides error information - */ - export interface IErrorInformation { - /** - * Error code - */ - errorCode: number, - /** - * Error Message - */ - errorMessage: string, - /** - * Stack trace of error - */ - messageDetails: string - } - - /** - * Diagnostics object for handling errors for a provider. - */ - export interface ErrorDiagnosticsProvider { - /** - * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. - * @param errorInfo The error information of the connection error. - * @param connection The connection profile that caused the error. - * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. - */ - handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; - } - - /** - * Registers provider with instance of Diagnostic Provider implementation. - * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. - * @param providerMetadata Additional data used to register the provider - * @param errorDiagnostics The provider's diagnostic object that handles errors. - * @returns A disposable that when disposed will unregister the provider - */ - export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; - } - - export namespace connection { - - /** - * Opens the change password dialog. - * @param profile The connection profile to change the password for. - * @returns The new password that is returned from the operation or undefined if unsuccessful. - */ - export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; - } - - export interface ConnectionInfoSummary { - /** - * ID used to identify the connection on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - export interface QueryExecuteCompleteNotificationResult { - /** - * ID used to identify the connection used to run the query on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - /* - * Add optional per-OS default value. - */ - export interface DefaultValueOsOverride { - os: string; - - defaultValueOverride: string; - } - - export interface ConnectionOption { - defaultValueOsOverrides?: DefaultValueOsOverride[]; - - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * When set to true, the respective connection option will be rendered on the main connection dialog - * and not the Advanced Options window. - */ - showOnConnectionDialog?: boolean; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - - export interface ServiceOption { - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - /** - * This change event defines actions - */ - export interface SelectionChangeEvent { - /** - * Values that affect actions defined in this event. - */ - values: string[]; - - /** - * Action to be taken on another option when selected value matches to the list of values provided. - */ - dependentOptionActions: DependentOptionAction[]; - } - - export interface DependentOptionAction { - /** - * Name of option affected by defined action. - */ - optionName: string, - - /** - * Action to be taken, Supported values: 'show', 'hide'. - */ - action: string; - - /** - * Whether or not the option should be set to required when visible. Defaults to false. - * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. - * When set to true, providers must handle property validation. - */ - required?: boolean; - } - - // Object Explorer interfaces -------------------------------- - export interface ObjectExplorerSession { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - } - - export interface ExpandNodeInfo { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - - /** - * Filters to apply to the child nodes being returned - */ - filters?: NodeFilter[]; - } - // End Object Explorer interfaces ---------------------------- - - export interface TaskInfo { - targetLocation?: string; - } - - export interface ButtonColumnOption { - icon?: IconPath; - } - - export namespace sqlAssessment { - - export enum SqlAssessmentTargetType { - Server = 1, - Database = 2 - } - - export enum SqlAssessmentResultItemKind { - RealResult = 0, - Warning = 1, - Error = 2 - } - } - // Assessment interfaces - - export interface SqlAssessmentResultItem { - rulesetVersion: string; - rulesetName: string; - targetType: sqlAssessment.SqlAssessmentTargetType; - targetName: string; - checkId: string; - tags: string[]; - displayName: string; - description: string; - message: string; - helpLink: string; - level: string; - timestamp: string; - kind: sqlAssessment.SqlAssessmentResultItemKind; - } - - export interface SqlAssessmentResult extends ResultStatus { - items: SqlAssessmentResultItem[]; - apiVersion: string; - } - - export interface SqlAssessmentServicesProvider extends DataProvider { - assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; - } - - export interface TreeItem2 extends vscode.TreeItem { - payload?: IConnectionProfile; - childProvider?: string; - type?: ExtensionNodeType; - } - - export interface Component extends vscode.Disposable { } - - export namespace workspace { - /** - * Creates and enters a workspace at the specified location - */ - export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; - - /** - * Enters the workspace with the provided path - * @param workspaceFile - */ - export function enterWorkspace(workspaceFile: vscode.Uri): Promise; - - /** - * Saves and enters the workspace with the provided path - * @param workspaceFile - */ - export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; - } - - export interface TableComponentProperties { - /** - * Specifies whether to use headerFilter plugin - */ - headerFilter?: boolean, - } - - export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; - - export interface ExecutionPlanComponentProperties extends ComponentProperties { - /** - * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs - */ - data?: ExecutionPlanData; - } - - /** - * Defines the executionPlan component - */ - export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { - } - - export interface ModelBuilder { - executionPlan(): ComponentBuilder; - } - - export interface ListViewOption { - /** - * The optional accessibility label for the column. Default is the label for the list view option. - */ - ariaLabel?: string; - /** - * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. - */ - icon?: IconPath; - } - - export interface IconColumnCellValue { - /** - * The icon to be displayed. - */ - icon: IconPath; - /** - * The title of the icon. - */ - title: string; - } - - export interface ButtonColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the button. - */ - title?: string; - } - - export interface HyperlinkColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the hyperlink. - */ - title?: string; - - /** - * The url to open. - */ - url?: string; - /** - * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. - */ - role?: 'button' | 'link'; - } - - export interface ContextMenuColumnCellValue { - /** - * The title of the hyperlink. By default, the title is 'Show Actions' - */ - title?: string; - /** - * commands for the menu. Use an array for a group and menu separators will be added. - */ - commands: (string | string[])[]; - /** - * context that will be passed to the commands. - */ - context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined - } - - export enum ColumnType { - icon = 3, - hyperlink = 4, - contextMenu = 5 - } - - export interface TableColumn { - /** - * The text to display on the column heading. 'value' property will be used, if not specified - */ - name?: string; - - /** - * whether the column is resizable. Default value is true. - */ - resizable?: boolean; - } - - export interface IconColumnOptions { - /** - * The icon to use for all the cells in this column. - */ - icon?: IconPath; - } - - export interface ButtonColumn extends IconColumnOptions, TableColumn { - /** - * Whether to show the text, default value is false. - */ - showText?: boolean; - } - - export interface HyperlinkColumn extends IconColumnOptions, TableColumn { - } - - export interface CheckboxColumn extends TableColumn { - action: ActionOnCellCheckboxCheck; - } - - export interface ContextMenuColumn extends TableColumn { - } - - export interface QueryExecuteResultSetNotificationParams { - /** - * Contains execution plans returned by the database in ResultSets. - */ - executionPlans: executionPlan.ExecutionPlanGraph[]; - } - - export interface ObjectMetadata { - /* - * Parent object name for subobjects such as triggers, indexes, etc. - */ - parentName?: string; - - /* - * Parent object type name, such as Table, View, etc. - */ - parentTypeName?: string; - } - - /** - * Represents a selected range in the result grid. - */ - export interface SelectionRange { - fromRow: number; - toRow: number; - fromColumn: number; - toColumn: number; - } - - /** - * Parameters for the copy results request. - */ - export interface CopyResultsRequestParams { - /** - * URI of the editor. - */ - ownerUri: string; - /** - * Index of the batch. - */ - batchIndex: number; - /** - * Index of the result set. - */ - resultSetIndex: number; - /** - * Whether to include the column headers. - */ - includeHeaders: boolean - /** - * The selected ranges to be copied. - */ - selections: SelectionRange[]; - } - - export interface CopyResultsRequestResult { - /** - * Result string from copy operation - */ - results: string; - } - - export interface QueryProvider { - /** - * Notify clients that the URI for a connection has been changed. - */ - connectionUriChanged?(newUri: string, oldUri: string): Thenable; - /** - * Copy the selected data to the clipboard. - * This is introduced to address the performance issue of large amount of data to ADS side. - * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. - * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. - */ - copyResults?(requestParams: CopyResultsRequestParams): Thenable; - } - - export enum DataProviderType { - TableDesignerProvider = 'TableDesignerProvider', - ExecutionPlanProvider = 'ExecutionPlanProvider', - ServerContextualizationProvider = 'ServerContextualizationProvider' - } - - export namespace dataprotocol { - export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; - export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; - /** - * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub - * Copilot for improved suggestions. - * @param provider The provider to register - */ - export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; - } - - export namespace designers { - /** - * Open a table designer window. - * @param providerId The table designer provider Id. - * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. - * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry - * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited - */ - export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; - - /** - * Definition for the table designer provider. - */ - export interface TableDesignerProvider extends DataProvider { - /** - * Initialize the table designer for the specified table. - * @param table the table information. - */ - initializeTableDesigner(table: TableInfo): Thenable; - - /** - * Process the table change. - * @param table the table information - * @param tableChangeInfo the information about the change user made through the UI. - */ - processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; - - /** - * Publish the changes. - * @param table the table information - */ - publishChanges(table: TableInfo): Thenable; - - /** - * Generate script for the changes. - * @param table the table information - */ - generateScript(table: TableInfo): Thenable; - - /** - * Generate preview report describing the changes to be made. - * @param table the table information - */ - generatePreviewReport(table: TableInfo): Thenable; - - /** - * Notify the provider that the table designer has been closed. - * @param table the table information - */ - disposeTableDesigner(table: TableInfo): Thenable; - } - - /** - * The information of the table. - */ - export interface TableInfo { - /** - * Used as the table designer editor's tab header text. - */ - title: string; - /** - * Used as the table designer editor's tab header hover text. - */ - tooltip: string; - /** - * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. - */ - id: string; - /** - * A boolean value indicates whether a new table is being designed. - */ - isNewTable: boolean; - /** - * Extension can store additional information that the provider needs to uniquely identify a table. - */ - [key: string]: any; - /** - * Table icon type that's shown in the editor tab. Default is the basic - * table icon. - */ - tableIcon?: TableIcon; - } - - /** - * The information to populate the table designer UI. - */ - export interface TableDesignerInfo { - /** - * The view definition. - */ - view: TableDesignerView; - /** - * The initial state of the designer. - */ - viewModel: DesignerViewModel; - /** - * The new table info after initialization. - */ - tableInfo: TableInfo; - /** - * The issues. - */ - issues?: DesignerIssue[]; - } - - /** - * Table icon that's shown on the editor tab - */ - export enum TableIcon { - Basic = 'Basic', - Temporal = 'Temporal', - GraphNode = 'GraphNode', - GraphEdge = 'GraphEdge' - } - - /** - * Name of the common table properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableProperty { - Columns = 'columns', - Description = 'description', - Name = 'name', - Schema = 'schema', - Script = 'script', - ForeignKeys = 'foreignKeys', - CheckConstraints = 'checkConstraints', - Indexes = 'indexes', - PrimaryKey = 'primaryKey', - PrimaryKeyName = 'primaryKeyName', - PrimaryKeyDescription = 'primaryKeyDescription', - PrimaryKeyColumns = 'primaryKeyColumns' - } - /** - * Name of the common table column properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableColumnProperty { - AllowNulls = 'allowNulls', - DefaultValue = 'defaultValue', - Length = 'length', - Name = 'name', - Description = 'description', - Type = 'type', - AdvancedType = 'advancedType', - IsPrimaryKey = 'isPrimaryKey', - Precision = 'precision', - Scale = 'scale' - } - - /** - * Name of the common foreign key constraint properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableForeignKeyProperty { - Name = 'name', - Description = 'description', - ForeignTable = 'foreignTable', - OnDeleteAction = 'onDeleteAction', - OnUpdateAction = 'onUpdateAction', - Columns = 'columns' - } - - /** - * Name of the columns mapping properties for foreign key. - */ - export enum ForeignKeyColumnMappingProperty { - Column = 'column', - ForeignColumn = 'foreignColumn' - } - - /** - * Name of the common check constraint properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableCheckConstraintProperty { - Name = 'name', - Description = 'description', - Expression = 'expression' - } - - /** - * Name of the common index properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableIndexProperty { - Name = 'name', - Description = 'description', - Columns = 'columns' - } - - /** - * Name of the common properties of table index column specification. - */ - export enum TableIndexColumnSpecificationProperty { - Column = 'column' - } - - /** - * The table designer view definition. - */ - export interface TableDesignerView { - /** - * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} - */ - additionalTableProperties?: DesignerDataPropertyInfo[]; - /** - * Additional tabs. - */ - additionalTabs?: DesignerTab[]; - /** - * Columns table options. - * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. - * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. - */ - columnTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign keys table options. - * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. - * Default columns to display values are: Name, PrimaryKeyTable. - */ - foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign key column mapping table options. - * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. - * Default columns to display values are: Column, ForeignColumn. - */ - foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Check constraints table options. - * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} - * Default columns to display values are: Name, Expression. - */ - checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Indexes table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} - * Default columns to display values are: Name. - */ - indexTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Index column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Primary column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. - */ - additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; - /** - * Components to be placed under the pre-defined tabs. - */ - additionalComponents?: DesignerDataPropertyWithTabInfo[]; - /** - * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. - */ - useAdvancedSaveMode: boolean; - } - - export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { - /** - * Whether to show the table. Default value is false. - */ - showTable?: boolean; - /** - * Properties to be displayed in the table, other properties can be accessed in the properties view. - */ - propertiesToDisplay?: string[]; - /** - * Additional properties for the entity. - */ - additionalProperties?: DesignerDataPropertyInfo[]; - } - - /** - * The view model of the designer. - */ - export interface DesignerViewModel { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of a designer tab. - */ - export interface DesignerTab { - /** - * The title of the tab. - */ - title: string; - /** - * the components to be displayed in this tab. - */ - components: DesignerDataPropertyInfo[]; - } - - /** - * The definition of the property in the designer. - */ - export interface DesignerDataPropertyInfo { - /** - * The property name. - */ - propertyName: string; - /** - * The description of the property. - */ - description?: string; - /** - * The component type. - */ - componentType: DesignerComponentTypeName; - /** - * The group name, properties with the same group name will be displayed under the same group on the UI. - */ - group?: string; - /** - * Whether the property should be displayed in the properties view. The default value is true. - */ - showInPropertiesView?: boolean; - /** - * The properties of the component. - */ - componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of the property in the designer with tab info. - */ - export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { - /** - * The tab info where this property belongs to. - */ - tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; - } - - /** - * The child component types supported by designer. - */ - export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; - - export interface DesignerTablePropertiesBase { - /** - * Whether user can add new rows to the table. The default value is true. - */ - canAddRows?: boolean; - /** - * Whether user can remove rows from the table. The default value is true. - */ - canRemoveRows?: boolean; - /** - * Whether user can move rows from one index to another. The default value is true. - */ - canMoveRows?: boolean; - /** - * Whether user can insert rows at a given index to the table. The default value is true. - */ - canInsertRows?: boolean; - /** - * Whether to show confirmation when user removes a row. The default value is false. - */ - showRemoveRowConfirmation?: boolean; - /** - * The confirmation message to be displayed when user removes a row. - */ - removeRowConfirmationMessage?: string; - /** - * Whether to show the item detail in properties view. The default value is true. - */ - showItemDetailInPropertiesView?: boolean; - /** - * The label of the add new button. The default value is 'Add New'. - */ - labelForAddNewButton?: string; - } - - /** - * The properties for the table component in the designer. - */ - export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { - /** - * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. - */ - columns?: string[]; - /** - * The display name of the object type. - */ - objectTypeDisplayName: string; - /** - * the properties of the table data item. - */ - itemProperties?: DesignerDataPropertyInfo[]; - /** - * The data to be displayed. - */ - data?: DesignerTableComponentDataItem[]; - } - - /** - * The data item of the designer's table component. - */ - export interface DesignerTableComponentDataItem { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; - /** - * Whether the row can be deleted. The default value is true. - */ - canBeDeleted?: boolean; - } - - /** - * Type of the edit originated from the designer UI. - */ - export enum DesignerEditType { - /** - * Add a row to a table. - */ - Add = 0, - /** - * Remove a row from a table. - */ - Remove = 1, - /** - * Update a property. - */ - Update = 2, - /** - * Change the position of an item in the collection. - */ - Move = 3 - } - - /** - * Information of the edit originated from the designer UI. - */ - export interface DesignerEdit { - /** - * The edit type. - */ - type: DesignerEditType; - /** - * the path of the edit target. - */ - path: DesignerPropertyPath; - /** - * the new value. - */ - value?: any; - } - - /** - * The path of the property. - * Below are the 3 scenarios and their expected path. - * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. - * 1. 'Add' scenario - * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. - * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. - * 2. 'Update' scenario - * a. ['propertyName1']. Example: update the name of the table: ['name']. - * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. - * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. - * 3. 'Remove' scenario - * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. - * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. - */ - export type DesignerPropertyPath = (string | number)[]; - - /** - * Severity of the messages returned by the provider after processing an edit. - * 'error': The issue must be fixed in order to commit the changes. - * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. - * 'information': Informational message. - */ - export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; - - /** - * Represents the issue in the designer - */ - export interface DesignerIssue { - /** - * Severity of the issue. - */ - severity: DesignerIssueSeverity, - /** - * Path of the property that is associated with the issue. - */ - propertyPath?: DesignerPropertyPath, - /** - * Description of the issue. - */ - description: string, - /** - * Url to a web page that has the explaination of the issue. - */ - moreInfoLink?: string; - } - - /** - * The result returned by the table designer provider after handling an edit request. - */ - export interface DesignerEditResult { - /** - * The new view information if the view needs to be refreshed. - */ - view?: T; - /** - * The view model object. - */ - viewModel: DesignerViewModel; - /** - * Whether the current state is valid. - */ - isValid: boolean; - /** - * Issues of current state. - */ - issues?: DesignerIssue[]; - /** - * The input validation error. - */ - inputValidationError?: string; - /** - * Metadata related to the table - */ - metadata?: { [key: string]: string }; - } - - /** - * The result returned by the table designer provider after handling the publish changes request. - */ - export interface PublishChangesResult { - /** - * The new table information after the changes are published. - */ - newTableInfo: TableInfo; - /** - * The new view model. - */ - viewModel: DesignerViewModel; - /** - * The new view. - */ - view: TableDesignerView; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - - export interface GeneratePreviewReportResult { - /** - * Report generated for generate preview - */ - report: string; - /** - * Format (mimeType) of the report - */ - mimeType: string; - /** - * Whether user confirmation is required, the default value is false. - */ - requireConfirmation?: boolean; - /** - * The confirmation text. - */ - confirmationText?: string; - /** - * The table schema validation error. - */ - schemaValidationError?: string; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - } - - export namespace executionPlan { - export interface ExecutionPlanGraph { - /** - * Root of the execution plan tree - */ - root: ExecutionPlanNode; - /** - * Underlying query for the execution plan graph. - */ - query: string; - /** - * String representation of graph - */ - graphFile: ExecutionPlanGraphInfo; - /** - * Query recommendations for optimizing performance - */ - recommendations: ExecutionPlanRecommendations[]; - } - - export interface ExecutionPlanNode { - /** - * Unique id given to node by the provider - */ - id: string; - /** - * Type of the node. This property determines the icon that is displayed for it - */ - type: string; - /** - * Cost associated with the node - */ - cost: number; - /** - * Cost of the node subtree - */ - subTreeCost: number; - /** - * Relative cost of the node compared to its siblings. - */ - relativeCost: number; - /** - * Time take by the node operation in milliseconds - */ - elapsedTimeInMs: number; - /** - * CPU time taken by the node operation in milliseconds - */ - elapsedCpuTimeInMs: number; - /** - * Node properties to be shown in the tooltip - */ - properties: ExecutionPlanGraphElementProperty[]; - /** - * Display name for the node - */ - name: string; - /** - * Description associated with the node. - */ - description: string; - /** - * Subtext displayed under the node name - */ - subtext: string[]; - /** - * Direct children of the nodes. - */ - children: ExecutionPlanNode[]; - /** - * Edges corresponding to the children. - */ - edges: ExecutionPlanEdge[]; - /** - * Warning/parallelism badges applicable to the current node - */ - badges: ExecutionPlanBadge[]; - /** - * Data to show in top operations table for the node. - */ - topOperationsData: TopOperationsDataItem[]; - /** - * Output row count associated with the node - */ - rowCountDisplayString: string; - /** - * Cost string for the node - */ - costDisplayString: string; - /** - * Cost metrics for the node - */ - costMetrics: CostMetric[]; - } - - export interface CostMetric { - /** - * Name of the cost metric. - */ - name: string; - /** - * The value of the cost metric - */ - value: number | undefined; - } - - export interface ExecutionPlanBadge { - /** - * Type of the node overlay. This determines the icon that is displayed for it - */ - type: BadgeType; - /** - * Text to display for the overlay tooltip - */ - tooltip: string; - } - - export enum BadgeType { - Warning = 0, - CriticalWarning = 1, - Parallelism = 2 - } - - export interface ExecutionPlanEdge { - /** - * Count of the rows returned by the subtree of the edge. - */ - rowCount: number; - /** - * Size of the rows returned by the subtree of the edge. - */ - rowSize: number; - /** - * Edge properties to be shown in the tooltip. - */ - properties: ExecutionPlanGraphElementProperty[] - } - - export interface ExecutionPlanGraphElementProperty { - /** - * Name of the property - */ - name: string; - /** - * value for the property - */ - value: string | ExecutionPlanGraphElementProperty[]; - /** - * Flag to show/hide props in tooltip - */ - showInTooltip: boolean; - /** - * Display order of property - */ - displayOrder: number; - /** - * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip - */ - positionAtBottom: boolean; - /** - * Display value of property to show in tooltip and other UI element. - */ - displayValue: string; - /** - * Data type of the property value - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Indicates which value is better when 2 similar properties are compared. - */ - betterValue: ExecutionPlanGraphElementPropertyBetterValue; - } - - export enum ExecutionPlanGraphElementPropertyDataType { - Number = 0, - String = 1, - Boolean = 2, - Nested = 3 - } - - export enum ExecutionPlanGraphElementPropertyBetterValue { - LowerNumber = 0, - HigherNumber = 1, - True = 2, - False = 3, - None = 4 - } - - export interface ExecutionPlanRecommendations { - /** - * Text displayed in the show plan graph control description - */ - displayString: string; - /** - * Query that is recommended to the user - */ - queryText: string; - /** - * Query that will be opened in a new file once the user click on the recommendation - */ - queryWithDescription: string; - } - - export interface ExecutionPlanGraphInfo { - /** - * File contents - */ - graphFileContent: string; - /** - * File type for execution plan. This will be the file type of the editor when the user opens the graph file - */ - graphFileType: string; - /** - * Index of the execution plan in the file content - */ - planIndexInFile?: number; - } - - export interface GetExecutionPlanResult extends ResultStatus { - graphs: ExecutionPlanGraph[] - } - - export interface ExecutionGraphComparisonResult { - /** - * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. - */ - baseNode: ExecutionPlanNode; - /** - * The children of the ExecutionGraphComparisonResult. - */ - children: ExecutionGraphComparisonResult[]; - /** - * The group index of the ExecutionGraphComparisonResult. - */ - groupIndex: number; - /** - * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. - */ - hasMatch: boolean; - /** - * List of matching nodes for the ExecutionGraphComparisonResult. - */ - matchingNodesId: number[]; - /** - * The parent of the ExecutionGraphComparisonResult. - */ - parentNode: ExecutionGraphComparisonResult; - } - - export interface ExecutionPlanComparisonResult extends ResultStatus { - firstComparisonResult: ExecutionGraphComparisonResult; - secondComparisonResult: ExecutionGraphComparisonResult; - } - - export interface IsExecutionPlanResult { - isExecutionPlan: boolean; - queryExecutionPlanFileExtension: string; - } - - export interface ExecutionPlanProvider extends DataProvider { - // execution plan service methods - - /** - * Gets the execution plan graph from the provider for a given plan file - * @param planFile file that contains the execution plan - */ - getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; - /** - * Compares two execution plans and identifies matching regions in both execution plans. - * @param firstPlanFile file that contains the first execution plan. - * @param secondPlanFile file that contains the second execution plan. - */ - compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; - /** - * Determines if the provided value is an execution plan and returns the appropriate file extension. - * @param value String that needs to be checked. - */ - isExecutionPlan(value: string): Thenable; - } - - export interface TopOperationsDataItem { - /** - * Column name for the top operation data item - */ - columnName: string; - /** - * Cell data type for the top operation data item - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Cell value for the top operation data item - */ - displayValue: string | number | boolean; - } - } - - export namespace contextualization { - export interface GetServerContextualizationResult { - /** - * The retrieved server context. - */ - context: string | undefined; - } - - export interface ServerContextualizationProvider extends DataProvider { - /** - * Gets server context, which can be in the form of create scripts but is left up each provider. - * @param ownerUri The URI of the connection to get context for. - */ - getServerContextualization(ownerUri: string): Thenable; - } - } - - /** - * Component to display text with an icon representing the severity - */ - export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { - /** - * An event fired when the InfoBox is clicked - */ - onDidClick: vscode.Event; - /** - * An event fired when the Infobox link is clicked - */ - onLinkClick: vscode.Event; - } - - export interface InfoBoxComponentProperties { - /** - * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. - * Default value is false. - */ - isClickable?: boolean | undefined; - - /** - * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes - */ - clickableButtonAriaLabel?: string; - - /** - * List of links to embed within the text. If links are specified there must be placeholder - * values in the value indicating where the links should be placed, in the format {i} - * - * e.g. "Click {0} for more information!"" - */ - links?: LinkArea[]; - } - - /** - * Event argument for infobox link click event. - */ - export interface InfoBoxLinkClickEventArgs { - /** - * Index of the link selected - */ - index: number; - /** - * Link that is clicked - */ - link: LinkArea; - } - - export interface TextComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface ContainerProperties extends ComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface DropDownProperties { - /** - * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. - */ - strictSelection?: boolean; - } - - export interface NodeInfo { - /** - * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node - * under the database, the nodeType is Folder, the objectType is be Tables. - */ - objectType?: string; - /* - * The path of the parent node. - */ - parentNodePath: string; - /** - * Filterable properties that this node supports - */ - filterableProperties?: NodeFilterProperty[]; - } - - export interface NodeFilterProperty { - /** - * The non-localized name of the filter property - */ - name: string; - /** - * The name of the filter property displayed to the user - */ - displayName: string; - /** - * The type of the filter property - */ - type: NodeFilterPropertyDataType; - /** - * The description of the filter property - */ - description: string; - } - - /** - * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice - */ - export interface NodeFilterChoiceProperty extends NodeFilterProperty { - /** - * The list of choices for the filter property if the type is choice - */ - choices: NodeFilterChoicePropertyValue[]; - } - - export interface NodeFilterChoicePropertyValue { - /** - * The value of the choice - */ - value: string; - /** - * The display name of the choice - * If not specified, the value will be used as the display name - * If specified, the display name will be used in the dropdown - */ - displayName?: string; - } - - export interface NodeFilter { - /** - * The name of the filter property - */ - name: string; - /** - * The operator of the filter property - */ - operator: NodeFilterOperator; - /** - * The applied values of the filter property - */ - value: string | string[] | number | number[] | boolean | undefined; - } - - export enum NodeFilterPropertyDataType { - String = 0, - Number = 1, - Boolean = 2, - Date = 3, - Choice = 4 - } - - export enum NodeFilterOperator { - Equals = 0, - NotEquals = 1, - LessThan = 2, - LessThanOrEquals = 3, - GreaterThan = 4, - GreaterThanOrEquals = 5, - Between = 6, - NotBetween = 7, - Contains = 8, - NotContains = 9, - StartsWith = 10, - NotStartsWith = 11, - EndsWith = 12, - NotEndsWith = 13 - } - - export interface ModelView extends vscode.Disposable { } - - export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } - - export namespace window { - export interface Wizard extends LoadingComponentBase { } - - export interface Dialog extends LoadingComponentBase, vscode.Disposable { } - - export interface ModelViewPanel extends vscode.Disposable { } - - export interface ModelViewDashboard extends vscode.Disposable { } - - /** - * Opens the error dialog with customization options provided. - * @param options Dialog options to customize error dialog. - * @returns Id of action button clicked by user, e.g. ok, cancel - */ - export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; - - /** - * Provides dialog options to customize modal dialog content and layout - */ - export interface IErrorDialogOptions { - /** - * Severity Level to identify icon of modal dialog. - */ - severity: MessageLevel; - /** - * Title of modal dialog header. - */ - headerTitle: string; - /** - * Message text to show on dialog. - */ - message: string; - /** - * (Optional) Detailed message, e.g stack trace of error. - */ - messageDetails?: string; - /** - * Telemetry View to be used for emitting telemetry events. - */ - telemetryView?: string, - /** - * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. - * If custom 'actions' are not provided, 'OK' button will be shown by default. - */ - actions?: IDialogAction[]; - /** - * (Optional) If provided, instruction text is shown in bold below message. - */ - instructionText?: string; - /** - * (Optional) If provided, appends read more link after instruction text. - */ - readMoreLink?: string; - } - - /** - * An action that will be rendered as a button on the dialog. - */ - export interface IDialogAction { - /** - * Identifier of action. - */ - id: string; - /** - * Label of Action button. - */ - label: string; - /** - * Defines if button styling and focus should be based on primary action. - */ - isPrimary: boolean; - } - - export interface FileFilters { - /** - * The label to display in the file filter field next to the list of filters. - */ - label: string; - /** - * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). - */ - filters: string[]; - } - - /** - * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local - * files without any connection is opened via vscode.window.showOpenDialog. - * @param connectionUri The URI of the connection to the target server - * @param targetPath The file path on the server machine to open by default in the dialog - * @param fileFilters The filters used to limit which files are displayed in the file browser - * @param showFoldersOnly Optional argument to specify whether the browser should only show folders - * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. - */ - export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; - } - - export interface FileBrowserProvider extends DataProvider { - openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; - } - - export interface TableComponent { - /** - * Set active cell. - */ - setActiveCell(row: number, column: number): void; - } - - export interface ProfilerProvider { - startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; - } - - export enum ProfilingSessionType { - RemoteSession = 0, - LocalFile = 1 - } - - export interface SplitViewLayout extends FlexLayout { - /** - * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal - * If undefined, the size of the model view container is used - */ - splitViewSize?: number | string | undefined; - } -} +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// This is the place for API experiments and proposal. + +import * as vscode from 'vscode'; + +declare module 'azdata' { + + export namespace nb { + export interface NotebookDocument { + /** + * Sets the trust mode for the notebook document. + */ + setTrusted(state: boolean): void; + } + + export interface ISessionOptions { + /** + * The spec for the kernel being used to create this session. + */ + kernelSpec?: IKernelSpec; + } + + export interface IKernelSpec { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages?: string[]; + } + + export interface IStandardKernel { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages: string[]; + readonly blockedOnSAW?: boolean; + } + + export interface IKernelChangedArgs { + nbKernelAlias?: string + } + + export interface ICellOutput { + /** + * Unique identifier for this cell output. + */ + id?: string; + } + + export interface IExecuteResult { + data: any; + } + + export interface IExecuteResultUpdate { + output_type: string; + resultSet: ResultSetSummary; + data: any; + } + + export interface IExecuteRequest { + /** + * The language of the notebook document that is executing this request. + */ + language: string; + } + + export interface INotebookMetadata { + connection_name?: string; + multi_connection_mode?: boolean; + } + + export interface ICellMetadata { + connection_name?: string; + } + + export interface ICellContents { + attachments?: ICellAttachments; + } + + export type ICellAttachments = { [key: string]: ICellAttachment }; + export type ICellAttachment = { [key: string]: string }; + + export interface SessionManager { + /** + * Shutdown all sessions. + */ + shutdownAll(): Thenable; + /** + * Disposes the session manager. + */ + dispose(): void; + } + + /** + * An event that is emitted when a {@link NotebookDocument} is closed. + */ + export const onDidCloseNotebookDocument: vscode.Event; + + export interface IKernel { + + /** + * Restart a kernel. + * + * #### Notes + * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). + * + * The promise is fulfilled on a valid response and rejected otherwise. + * + * It is assumed that the API call does not mutate the kernel id or name. + * + * The promise will be rejected if the kernel status is `Dead` or if the + * request fails or the response is invalid. + */ + restart(): Thenable; + } + } + + export interface LoadingComponentBase { + /** + * When true, the component will display a loading spinner. + */ + loading?: boolean; + + /** + * This sets the alert text which gets announced when the loading spinner is shown. + */ + loadingText?: string; + + /** + * The text to display while loading is set to false. Will also be announced through screen readers + * once loading is completed. + */ + loadingCompletedText?: string; + } + + /** + * The column information of a data set. + */ + export interface SimpleColumnInfo { + /** + * The column name. + */ + name: string; + /** + * The data type of the column. + */ + dataTypeName: string; + } + + /** + * The parameters for start data serialization request. + */ + export interface SerializeDataStartRequestParams { + /** + * 'csv', 'json', 'excel', 'xml' + */ + saveFormat: string; + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch of the data set to be serialized. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + /** + * The columns of the data set. + */ + columns: SimpleColumnInfo[]; + /** + * Whether to include column headers to the target file. + */ + includeHeaders?: boolean; + /** + * The delimiter to seperate the cells. + */ + delimiter?: string; + /** + * The line seperator. + */ + lineSeperator?: string; + /** + * Character used for enclosing text fields when saving results as CSV. + */ + textIdentifier?: string; + /** + * File encoding used when saving results as CSV. + */ + encoding?: string; + /** + * When true, XML output will be formatted when saving results as XML. + */ + formatted?: boolean; + } + + /** + * The parameters for continue data serialization request. + */ + export interface SerializeDataContinueRequestParams { + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + } + + /** + * The result of data serialization data request. + */ + export interface SerializeDataResult { + /** + * The output message. + */ + messages?: string; + /** + * Whether the serialization is succeeded. + */ + succeeded: boolean; + } + + /** + * The serialization provider. + */ + export interface SerializationProvider extends DataProvider { + /** + * Start the data serialization. + * @param requestParams the request parameters. + */ + startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; + /** + * Continue the data serialization. + * @param requestParams the request parameters. + */ + continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; + } + + export namespace dataprotocol { + /** + * Registers a SerializationProvider. + * @param provider The data serialization provider. + */ + export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; + export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; + /** + * Registers a DataGridProvider which is used to provide lists of items to a data grid + * @param provider The provider implementation + */ + export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; + } + + export enum DataProviderType { + DataGridProvider = 'DataGridProvider' + } + + /** + * The type of the DataGrid column + */ + export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; + + /** + * A column in a data grid + */ + export interface DataGridColumn { + /** + * The text to display on the column heading. + */ + name: string; + + /** + * The property name in the DataGridItem + */ + field: string; + + /** + * A unique identifier for the column within the grid. + */ + id: string; + + /** + * The type of column this is. This is used to determine how to render the contents. + */ + type: DataGridColumnType; + + /** + * Whether this column is sortable. + */ + sortable?: boolean; + + /** + * Whether this column is filterable + */ + filterable?: boolean; + + /** + * If false, column can no longer be resized. + */ + resizable?: boolean; + + /** + * If set to a non-empty string, a tooltip will appear on hover containing the string. + */ + tooltip?: string; + + /** + * Width of the column in pixels. + */ + width?: number + } + + /** + * Info for a command to execute + */ + export interface ExecuteCommandInfo { + /** + * The ID of the command to execute + */ + id: string; + /** + * The text to display for the action + */ + displayText?: string; + /** + * The optional args to pass to the command + */ + args?: any[]; + } + + /** + * Info for displaying a hyperlink value in a Data Grid table + */ + export interface DataGridHyperlinkInfo { + /** + * The text to display for the link + */ + displayText: string; + /** + * The URL to open or command to execute + */ + linkOrCommand: string | ExecuteCommandInfo; + } + + /** + * An item for displaying in a data grid + */ + export interface DataGridItem { + /** + * A unique identifier for this item + */ + id: string; + + /** + * The other properties that will be displayed in the grid columns + */ + [key: string]: string | DataGridHyperlinkInfo; + } + + /** + * A data provider that provides lists of resource items for a data grid + */ + export interface DataGridProvider extends DataProvider { + /** + * Gets the list of data grid items for this provider + */ + getDataGridItems(): Thenable; + /** + * Gets the list of data grid columns for this provider + */ + getDataGridColumns(): Thenable; + + /** + * The user visible string to use for the title of the grid + */ + title: string; + } + + export interface ConnectionProvider extends DataProvider { + /** + * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) + */ + changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; + } + + // Password Change Request ---------------------------------------------------------------------- + export interface PasswordChangeResult { + /** + * Whether the password change was successful + */ + result: boolean; + /** + * Error message if the password change was unsuccessful + */ + errorMessage?: string; + } + + export interface IConnectionProfile extends ConnectionInfo { + azureAccount?: string; + azureResourceId?: string; + azurePortalEndpoint?: string; + } + + export interface PromptFailedResult extends ProviderError { } + + export interface ProviderError { + /** + * Error name + */ + name?: string; + + /** + * Error code + */ + errorCode?: string; + + /** + * Error message + */ + errorMessage?: string; + } + + + export namespace diagnostics { + /** + * Represents a diagnostics provider of accounts. + */ + export interface ErrorDiagnosticsProviderMetadata { + /** + * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. + * Note: only ONE diagnostic provider per id/name at a time. + */ + targetProviderId: string; + } + + export interface ConnectionDiagnosticsResult { + /** + * Whether the error was handled or not. + */ + handled: boolean, + /** + * Whether reconnect should be attempted. + */ + reconnect?: boolean, + /** + * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. + */ + options?: { [name: string]: any }; + } + + /** + * Provides error information + */ + export interface IErrorInformation { + /** + * Error code + */ + errorCode: number, + /** + * Error Message + */ + errorMessage: string, + /** + * Stack trace of error + */ + messageDetails: string + } + + /** + * Diagnostics object for handling errors for a provider. + */ + export interface ErrorDiagnosticsProvider { + /** + * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. + * @param errorInfo The error information of the connection error. + * @param connection The connection profile that caused the error. + * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. + */ + handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; + } + + /** + * Registers provider with instance of Diagnostic Provider implementation. + * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. + * @param providerMetadata Additional data used to register the provider + * @param errorDiagnostics The provider's diagnostic object that handles errors. + * @returns A disposable that when disposed will unregister the provider + */ + export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; + } + + export namespace connection { + + /** + * Opens the change password dialog. + * @param profile The connection profile to change the password for. + * @returns The new password that is returned from the operation or undefined if unsuccessful. + */ + export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; + } + + export interface ConnectionInfoSummary { + /** + * ID used to identify the connection on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + export interface QueryExecuteCompleteNotificationResult { + /** + * ID used to identify the connection used to run the query on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + /* + * Add optional per-OS default value. + */ + export interface DefaultValueOsOverride { + os: string; + + defaultValueOverride: string; + } + + export interface ConnectionOption { + defaultValueOsOverrides?: DefaultValueOsOverride[]; + + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * When set to true, the respective connection option will be rendered on the main connection dialog + * and not the Advanced Options window. + */ + showOnConnectionDialog?: boolean; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + + export interface ServiceOption { + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + /** + * This change event defines actions + */ + export interface SelectionChangeEvent { + /** + * Values that affect actions defined in this event. + */ + values: string[]; + + /** + * Action to be taken on another option when selected value matches to the list of values provided. + */ + dependentOptionActions: DependentOptionAction[]; + } + + export interface DependentOptionAction { + /** + * Name of option affected by defined action. + */ + optionName: string, + + /** + * Action to be taken, Supported values: 'show', 'hide'. + */ + action: string; + + /** + * Whether or not the option should be set to required when visible. Defaults to false. + * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. + * When set to true, providers must handle property validation. + */ + required?: boolean; + } + + // Object Explorer interfaces -------------------------------- + export interface ObjectExplorerSession { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + } + + export interface ExpandNodeInfo { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + + /** + * Filters to apply to the child nodes being returned + */ + filters?: NodeFilter[]; + } + // End Object Explorer interfaces ---------------------------- + + export interface TaskInfo { + targetLocation?: string; + } + + export interface ButtonColumnOption { + icon?: IconPath; + } + + export namespace sqlAssessment { + + export enum SqlAssessmentTargetType { + Server = 1, + Database = 2 + } + + export enum SqlAssessmentResultItemKind { + RealResult = 0, + Warning = 1, + Error = 2 + } + } + // Assessment interfaces + + export interface SqlAssessmentResultItem { + rulesetVersion: string; + rulesetName: string; + targetType: sqlAssessment.SqlAssessmentTargetType; + targetName: string; + checkId: string; + tags: string[]; + displayName: string; + description: string; + message: string; + helpLink: string; + level: string; + timestamp: string; + kind: sqlAssessment.SqlAssessmentResultItemKind; + } + + export interface SqlAssessmentResult extends ResultStatus { + items: SqlAssessmentResultItem[]; + apiVersion: string; + } + + export interface SqlAssessmentServicesProvider extends DataProvider { + assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; + } + + export interface TreeItem2 extends vscode.TreeItem { + payload?: IConnectionProfile; + childProvider?: string; + type?: ExtensionNodeType; + } + + export interface Component extends vscode.Disposable { } + + export namespace workspace { + /** + * Creates and enters a workspace at the specified location + */ + export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; + + /** + * Enters the workspace with the provided path + * @param workspaceFile + */ + export function enterWorkspace(workspaceFile: vscode.Uri): Promise; + + /** + * Saves and enters the workspace with the provided path + * @param workspaceFile + */ + export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; + } + + export interface TableComponentProperties { + /** + * Specifies whether to use headerFilter plugin + */ + headerFilter?: boolean, + } + + export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; + + export interface ExecutionPlanComponentProperties extends ComponentProperties { + /** + * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs + */ + data?: ExecutionPlanData; + } + + /** + * Defines the executionPlan component + */ + export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { + } + + export interface ModelBuilder { + executionPlan(): ComponentBuilder; + } + + export interface ListViewOption { + /** + * The optional accessibility label for the column. Default is the label for the list view option. + */ + ariaLabel?: string; + /** + * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. + */ + icon?: IconPath; + } + + export interface IconColumnCellValue { + /** + * The icon to be displayed. + */ + icon: IconPath; + /** + * The title of the icon. + */ + title: string; + } + + export interface ButtonColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the button. + */ + title?: string; + } + + export interface HyperlinkColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the hyperlink. + */ + title?: string; + + /** + * The url to open. + */ + url?: string; + /** + * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. + */ + role?: 'button' | 'link'; + } + + export interface ContextMenuColumnCellValue { + /** + * The title of the hyperlink. By default, the title is 'Show Actions' + */ + title?: string; + /** + * commands for the menu. Use an array for a group and menu separators will be added. + */ + commands: (string | string[])[]; + /** + * context that will be passed to the commands. + */ + context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined + } + + export enum ColumnType { + icon = 3, + hyperlink = 4, + contextMenu = 5 + } + + export interface TableColumn { + /** + * The text to display on the column heading. 'value' property will be used, if not specified + */ + name?: string; + + /** + * whether the column is resizable. Default value is true. + */ + resizable?: boolean; + } + + export interface IconColumnOptions { + /** + * The icon to use for all the cells in this column. + */ + icon?: IconPath; + } + + export interface ButtonColumn extends IconColumnOptions, TableColumn { + /** + * Whether to show the text, default value is false. + */ + showText?: boolean; + } + + export interface HyperlinkColumn extends IconColumnOptions, TableColumn { + } + + export interface CheckboxColumn extends TableColumn { + action: ActionOnCellCheckboxCheck; + } + + export interface ContextMenuColumn extends TableColumn { + } + + export interface QueryExecuteResultSetNotificationParams { + /** + * Contains execution plans returned by the database in ResultSets. + */ + executionPlans: executionPlan.ExecutionPlanGraph[]; + } + + export interface ObjectMetadata { + /* + * Parent object name for subobjects such as triggers, indexes, etc. + */ + parentName?: string; + + /* + * Parent object type name, such as Table, View, etc. + */ + parentTypeName?: string; + } + + /** + * Represents a selected range in the result grid. + */ + export interface SelectionRange { + fromRow: number; + toRow: number; + fromColumn: number; + toColumn: number; + } + + /** + * Parameters for the copy results request. + */ + export interface CopyResultsRequestParams { + /** + * URI of the editor. + */ + ownerUri: string; + /** + * Index of the batch. + */ + batchIndex: number; + /** + * Index of the result set. + */ + resultSetIndex: number; + /** + * Whether to include the column headers. + */ + includeHeaders: boolean + /** + * The selected ranges to be copied. + */ + selections: SelectionRange[]; + /** + * Whether to copy the results directly to the clipboard from STS. + */ + CopyDirectlyToClipboard: boolean; + } + + export interface CopyResultsRequestResult { + /** + * Result string from copy operation + */ + results: string; + } + + export interface QueryProvider { + /** + * Notify clients that the URI for a connection has been changed. + */ + connectionUriChanged?(newUri: string, oldUri: string): Thenable; + /** + * Copy the selected data to the clipboard. + * This is introduced to address the performance issue of large amount of data to ADS side. + * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. + * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. + */ + copyResults?(requestParams: CopyResultsRequestParams): Thenable; + } + + export enum DataProviderType { + TableDesignerProvider = 'TableDesignerProvider', + ExecutionPlanProvider = 'ExecutionPlanProvider', + ServerContextualizationProvider = 'ServerContextualizationProvider' + } + + export namespace dataprotocol { + export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; + export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; + /** + * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub + * Copilot for improved suggestions. + * @param provider The provider to register + */ + export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; + } + + export namespace designers { + /** + * Open a table designer window. + * @param providerId The table designer provider Id. + * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. + * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry + * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited + */ + export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; + + /** + * Definition for the table designer provider. + */ + export interface TableDesignerProvider extends DataProvider { + /** + * Initialize the table designer for the specified table. + * @param table the table information. + */ + initializeTableDesigner(table: TableInfo): Thenable; + + /** + * Process the table change. + * @param table the table information + * @param tableChangeInfo the information about the change user made through the UI. + */ + processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; + + /** + * Publish the changes. + * @param table the table information + */ + publishChanges(table: TableInfo): Thenable; + + /** + * Generate script for the changes. + * @param table the table information + */ + generateScript(table: TableInfo): Thenable; + + /** + * Generate preview report describing the changes to be made. + * @param table the table information + */ + generatePreviewReport(table: TableInfo): Thenable; + + /** + * Notify the provider that the table designer has been closed. + * @param table the table information + */ + disposeTableDesigner(table: TableInfo): Thenable; + } + + /** + * The information of the table. + */ + export interface TableInfo { + /** + * Used as the table designer editor's tab header text. + */ + title: string; + /** + * Used as the table designer editor's tab header hover text. + */ + tooltip: string; + /** + * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. + */ + id: string; + /** + * A boolean value indicates whether a new table is being designed. + */ + isNewTable: boolean; + /** + * Extension can store additional information that the provider needs to uniquely identify a table. + */ + [key: string]: any; + /** + * Table icon type that's shown in the editor tab. Default is the basic + * table icon. + */ + tableIcon?: TableIcon; + } + + /** + * The information to populate the table designer UI. + */ + export interface TableDesignerInfo { + /** + * The view definition. + */ + view: TableDesignerView; + /** + * The initial state of the designer. + */ + viewModel: DesignerViewModel; + /** + * The new table info after initialization. + */ + tableInfo: TableInfo; + /** + * The issues. + */ + issues?: DesignerIssue[]; + } + + /** + * Table icon that's shown on the editor tab + */ + export enum TableIcon { + Basic = 'Basic', + Temporal = 'Temporal', + GraphNode = 'GraphNode', + GraphEdge = 'GraphEdge' + } + + /** + * Name of the common table properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableProperty { + Columns = 'columns', + Description = 'description', + Name = 'name', + Schema = 'schema', + Script = 'script', + ForeignKeys = 'foreignKeys', + CheckConstraints = 'checkConstraints', + Indexes = 'indexes', + PrimaryKey = 'primaryKey', + PrimaryKeyName = 'primaryKeyName', + PrimaryKeyDescription = 'primaryKeyDescription', + PrimaryKeyColumns = 'primaryKeyColumns' + } + /** + * Name of the common table column properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableColumnProperty { + AllowNulls = 'allowNulls', + DefaultValue = 'defaultValue', + Length = 'length', + Name = 'name', + Description = 'description', + Type = 'type', + AdvancedType = 'advancedType', + IsPrimaryKey = 'isPrimaryKey', + Precision = 'precision', + Scale = 'scale' + } + + /** + * Name of the common foreign key constraint properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableForeignKeyProperty { + Name = 'name', + Description = 'description', + ForeignTable = 'foreignTable', + OnDeleteAction = 'onDeleteAction', + OnUpdateAction = 'onUpdateAction', + Columns = 'columns' + } + + /** + * Name of the columns mapping properties for foreign key. + */ + export enum ForeignKeyColumnMappingProperty { + Column = 'column', + ForeignColumn = 'foreignColumn' + } + + /** + * Name of the common check constraint properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableCheckConstraintProperty { + Name = 'name', + Description = 'description', + Expression = 'expression' + } + + /** + * Name of the common index properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableIndexProperty { + Name = 'name', + Description = 'description', + Columns = 'columns' + } + + /** + * Name of the common properties of table index column specification. + */ + export enum TableIndexColumnSpecificationProperty { + Column = 'column' + } + + /** + * The table designer view definition. + */ + export interface TableDesignerView { + /** + * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} + */ + additionalTableProperties?: DesignerDataPropertyInfo[]; + /** + * Additional tabs. + */ + additionalTabs?: DesignerTab[]; + /** + * Columns table options. + * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. + * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. + */ + columnTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign keys table options. + * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. + * Default columns to display values are: Name, PrimaryKeyTable. + */ + foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign key column mapping table options. + * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. + * Default columns to display values are: Column, ForeignColumn. + */ + foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Check constraints table options. + * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} + * Default columns to display values are: Name, Expression. + */ + checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Indexes table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} + * Default columns to display values are: Name. + */ + indexTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Index column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Primary column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. + */ + additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; + /** + * Components to be placed under the pre-defined tabs. + */ + additionalComponents?: DesignerDataPropertyWithTabInfo[]; + /** + * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. + */ + useAdvancedSaveMode: boolean; + } + + export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { + /** + * Whether to show the table. Default value is false. + */ + showTable?: boolean; + /** + * Properties to be displayed in the table, other properties can be accessed in the properties view. + */ + propertiesToDisplay?: string[]; + /** + * Additional properties for the entity. + */ + additionalProperties?: DesignerDataPropertyInfo[]; + } + + /** + * The view model of the designer. + */ + export interface DesignerViewModel { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of a designer tab. + */ + export interface DesignerTab { + /** + * The title of the tab. + */ + title: string; + /** + * the components to be displayed in this tab. + */ + components: DesignerDataPropertyInfo[]; + } + + /** + * The definition of the property in the designer. + */ + export interface DesignerDataPropertyInfo { + /** + * The property name. + */ + propertyName: string; + /** + * The description of the property. + */ + description?: string; + /** + * The component type. + */ + componentType: DesignerComponentTypeName; + /** + * The group name, properties with the same group name will be displayed under the same group on the UI. + */ + group?: string; + /** + * Whether the property should be displayed in the properties view. The default value is true. + */ + showInPropertiesView?: boolean; + /** + * The properties of the component. + */ + componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of the property in the designer with tab info. + */ + export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { + /** + * The tab info where this property belongs to. + */ + tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; + } + + /** + * The child component types supported by designer. + */ + export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; + + export interface DesignerTablePropertiesBase { + /** + * Whether user can add new rows to the table. The default value is true. + */ + canAddRows?: boolean; + /** + * Whether user can remove rows from the table. The default value is true. + */ + canRemoveRows?: boolean; + /** + * Whether user can move rows from one index to another. The default value is true. + */ + canMoveRows?: boolean; + /** + * Whether user can insert rows at a given index to the table. The default value is true. + */ + canInsertRows?: boolean; + /** + * Whether to show confirmation when user removes a row. The default value is false. + */ + showRemoveRowConfirmation?: boolean; + /** + * The confirmation message to be displayed when user removes a row. + */ + removeRowConfirmationMessage?: string; + /** + * Whether to show the item detail in properties view. The default value is true. + */ + showItemDetailInPropertiesView?: boolean; + /** + * The label of the add new button. The default value is 'Add New'. + */ + labelForAddNewButton?: string; + } + + /** + * The properties for the table component in the designer. + */ + export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { + /** + * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. + */ + columns?: string[]; + /** + * The display name of the object type. + */ + objectTypeDisplayName: string; + /** + * the properties of the table data item. + */ + itemProperties?: DesignerDataPropertyInfo[]; + /** + * The data to be displayed. + */ + data?: DesignerTableComponentDataItem[]; + } + + /** + * The data item of the designer's table component. + */ + export interface DesignerTableComponentDataItem { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; + /** + * Whether the row can be deleted. The default value is true. + */ + canBeDeleted?: boolean; + } + + /** + * Type of the edit originated from the designer UI. + */ + export enum DesignerEditType { + /** + * Add a row to a table. + */ + Add = 0, + /** + * Remove a row from a table. + */ + Remove = 1, + /** + * Update a property. + */ + Update = 2, + /** + * Change the position of an item in the collection. + */ + Move = 3 + } + + /** + * Information of the edit originated from the designer UI. + */ + export interface DesignerEdit { + /** + * The edit type. + */ + type: DesignerEditType; + /** + * the path of the edit target. + */ + path: DesignerPropertyPath; + /** + * the new value. + */ + value?: any; + } + + /** + * The path of the property. + * Below are the 3 scenarios and their expected path. + * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. + * 1. 'Add' scenario + * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. + * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. + * 2. 'Update' scenario + * a. ['propertyName1']. Example: update the name of the table: ['name']. + * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. + * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. + * 3. 'Remove' scenario + * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. + * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. + */ + export type DesignerPropertyPath = (string | number)[]; + + /** + * Severity of the messages returned by the provider after processing an edit. + * 'error': The issue must be fixed in order to commit the changes. + * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. + * 'information': Informational message. + */ + export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; + + /** + * Represents the issue in the designer + */ + export interface DesignerIssue { + /** + * Severity of the issue. + */ + severity: DesignerIssueSeverity, + /** + * Path of the property that is associated with the issue. + */ + propertyPath?: DesignerPropertyPath, + /** + * Description of the issue. + */ + description: string, + /** + * Url to a web page that has the explaination of the issue. + */ + moreInfoLink?: string; + } + + /** + * The result returned by the table designer provider after handling an edit request. + */ + export interface DesignerEditResult { + /** + * The new view information if the view needs to be refreshed. + */ + view?: T; + /** + * The view model object. + */ + viewModel: DesignerViewModel; + /** + * Whether the current state is valid. + */ + isValid: boolean; + /** + * Issues of current state. + */ + issues?: DesignerIssue[]; + /** + * The input validation error. + */ + inputValidationError?: string; + /** + * Metadata related to the table + */ + metadata?: { [key: string]: string }; + } + + /** + * The result returned by the table designer provider after handling the publish changes request. + */ + export interface PublishChangesResult { + /** + * The new table information after the changes are published. + */ + newTableInfo: TableInfo; + /** + * The new view model. + */ + viewModel: DesignerViewModel; + /** + * The new view. + */ + view: TableDesignerView; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + + export interface GeneratePreviewReportResult { + /** + * Report generated for generate preview + */ + report: string; + /** + * Format (mimeType) of the report + */ + mimeType: string; + /** + * Whether user confirmation is required, the default value is false. + */ + requireConfirmation?: boolean; + /** + * The confirmation text. + */ + confirmationText?: string; + /** + * The table schema validation error. + */ + schemaValidationError?: string; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + } + + export namespace executionPlan { + export interface ExecutionPlanGraph { + /** + * Root of the execution plan tree + */ + root: ExecutionPlanNode; + /** + * Underlying query for the execution plan graph. + */ + query: string; + /** + * String representation of graph + */ + graphFile: ExecutionPlanGraphInfo; + /** + * Query recommendations for optimizing performance + */ + recommendations: ExecutionPlanRecommendations[]; + } + + export interface ExecutionPlanNode { + /** + * Unique id given to node by the provider + */ + id: string; + /** + * Type of the node. This property determines the icon that is displayed for it + */ + type: string; + /** + * Cost associated with the node + */ + cost: number; + /** + * Cost of the node subtree + */ + subTreeCost: number; + /** + * Relative cost of the node compared to its siblings. + */ + relativeCost: number; + /** + * Time take by the node operation in milliseconds + */ + elapsedTimeInMs: number; + /** + * CPU time taken by the node operation in milliseconds + */ + elapsedCpuTimeInMs: number; + /** + * Node properties to be shown in the tooltip + */ + properties: ExecutionPlanGraphElementProperty[]; + /** + * Display name for the node + */ + name: string; + /** + * Description associated with the node. + */ + description: string; + /** + * Subtext displayed under the node name + */ + subtext: string[]; + /** + * Direct children of the nodes. + */ + children: ExecutionPlanNode[]; + /** + * Edges corresponding to the children. + */ + edges: ExecutionPlanEdge[]; + /** + * Warning/parallelism badges applicable to the current node + */ + badges: ExecutionPlanBadge[]; + /** + * Data to show in top operations table for the node. + */ + topOperationsData: TopOperationsDataItem[]; + /** + * Output row count associated with the node + */ + rowCountDisplayString: string; + /** + * Cost string for the node + */ + costDisplayString: string; + /** + * Cost metrics for the node + */ + costMetrics: CostMetric[]; + } + + export interface CostMetric { + /** + * Name of the cost metric. + */ + name: string; + /** + * The value of the cost metric + */ + value: number | undefined; + } + + export interface ExecutionPlanBadge { + /** + * Type of the node overlay. This determines the icon that is displayed for it + */ + type: BadgeType; + /** + * Text to display for the overlay tooltip + */ + tooltip: string; + } + + export enum BadgeType { + Warning = 0, + CriticalWarning = 1, + Parallelism = 2 + } + + export interface ExecutionPlanEdge { + /** + * Count of the rows returned by the subtree of the edge. + */ + rowCount: number; + /** + * Size of the rows returned by the subtree of the edge. + */ + rowSize: number; + /** + * Edge properties to be shown in the tooltip. + */ + properties: ExecutionPlanGraphElementProperty[] + } + + export interface ExecutionPlanGraphElementProperty { + /** + * Name of the property + */ + name: string; + /** + * value for the property + */ + value: string | ExecutionPlanGraphElementProperty[]; + /** + * Flag to show/hide props in tooltip + */ + showInTooltip: boolean; + /** + * Display order of property + */ + displayOrder: number; + /** + * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip + */ + positionAtBottom: boolean; + /** + * Display value of property to show in tooltip and other UI element. + */ + displayValue: string; + /** + * Data type of the property value + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Indicates which value is better when 2 similar properties are compared. + */ + betterValue: ExecutionPlanGraphElementPropertyBetterValue; + } + + export enum ExecutionPlanGraphElementPropertyDataType { + Number = 0, + String = 1, + Boolean = 2, + Nested = 3 + } + + export enum ExecutionPlanGraphElementPropertyBetterValue { + LowerNumber = 0, + HigherNumber = 1, + True = 2, + False = 3, + None = 4 + } + + export interface ExecutionPlanRecommendations { + /** + * Text displayed in the show plan graph control description + */ + displayString: string; + /** + * Query that is recommended to the user + */ + queryText: string; + /** + * Query that will be opened in a new file once the user click on the recommendation + */ + queryWithDescription: string; + } + + export interface ExecutionPlanGraphInfo { + /** + * File contents + */ + graphFileContent: string; + /** + * File type for execution plan. This will be the file type of the editor when the user opens the graph file + */ + graphFileType: string; + /** + * Index of the execution plan in the file content + */ + planIndexInFile?: number; + } + + export interface GetExecutionPlanResult extends ResultStatus { + graphs: ExecutionPlanGraph[] + } + + export interface ExecutionGraphComparisonResult { + /** + * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. + */ + baseNode: ExecutionPlanNode; + /** + * The children of the ExecutionGraphComparisonResult. + */ + children: ExecutionGraphComparisonResult[]; + /** + * The group index of the ExecutionGraphComparisonResult. + */ + groupIndex: number; + /** + * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. + */ + hasMatch: boolean; + /** + * List of matching nodes for the ExecutionGraphComparisonResult. + */ + matchingNodesId: number[]; + /** + * The parent of the ExecutionGraphComparisonResult. + */ + parentNode: ExecutionGraphComparisonResult; + } + + export interface ExecutionPlanComparisonResult extends ResultStatus { + firstComparisonResult: ExecutionGraphComparisonResult; + secondComparisonResult: ExecutionGraphComparisonResult; + } + + export interface IsExecutionPlanResult { + isExecutionPlan: boolean; + queryExecutionPlanFileExtension: string; + } + + export interface ExecutionPlanProvider extends DataProvider { + // execution plan service methods + + /** + * Gets the execution plan graph from the provider for a given plan file + * @param planFile file that contains the execution plan + */ + getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; + /** + * Compares two execution plans and identifies matching regions in both execution plans. + * @param firstPlanFile file that contains the first execution plan. + * @param secondPlanFile file that contains the second execution plan. + */ + compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; + /** + * Determines if the provided value is an execution plan and returns the appropriate file extension. + * @param value String that needs to be checked. + */ + isExecutionPlan(value: string): Thenable; + } + + export interface TopOperationsDataItem { + /** + * Column name for the top operation data item + */ + columnName: string; + /** + * Cell data type for the top operation data item + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Cell value for the top operation data item + */ + displayValue: string | number | boolean; + } + } + + export namespace contextualization { + export interface GetServerContextualizationResult { + /** + * The retrieved server context. + */ + context: string | undefined; + } + + export interface ServerContextualizationProvider extends DataProvider { + /** + * Gets server context, which can be in the form of create scripts but is left up each provider. + * @param ownerUri The URI of the connection to get context for. + */ + getServerContextualization(ownerUri: string): Thenable; + } + } + + /** + * Component to display text with an icon representing the severity + */ + export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { + /** + * An event fired when the InfoBox is clicked + */ + onDidClick: vscode.Event; + /** + * An event fired when the Infobox link is clicked + */ + onLinkClick: vscode.Event; + } + + export interface InfoBoxComponentProperties { + /** + * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. + * Default value is false. + */ + isClickable?: boolean | undefined; + + /** + * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes + */ + clickableButtonAriaLabel?: string; + + /** + * List of links to embed within the text. If links are specified there must be placeholder + * values in the value indicating where the links should be placed, in the format {i} + * + * e.g. "Click {0} for more information!"" + */ + links?: LinkArea[]; + } + + /** + * Event argument for infobox link click event. + */ + export interface InfoBoxLinkClickEventArgs { + /** + * Index of the link selected + */ + index: number; + /** + * Link that is clicked + */ + link: LinkArea; + } + + export interface TextComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface ContainerProperties extends ComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface DropDownProperties { + /** + * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. + */ + strictSelection?: boolean; + } + + export interface NodeInfo { + /** + * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node + * under the database, the nodeType is Folder, the objectType is be Tables. + */ + objectType?: string; + /* + * The path of the parent node. + */ + parentNodePath: string; + /** + * Filterable properties that this node supports + */ + filterableProperties?: NodeFilterProperty[]; + } + + export interface NodeFilterProperty { + /** + * The non-localized name of the filter property + */ + name: string; + /** + * The name of the filter property displayed to the user + */ + displayName: string; + /** + * The type of the filter property + */ + type: NodeFilterPropertyDataType; + /** + * The description of the filter property + */ + description: string; + } + + /** + * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice + */ + export interface NodeFilterChoiceProperty extends NodeFilterProperty { + /** + * The list of choices for the filter property if the type is choice + */ + choices: NodeFilterChoicePropertyValue[]; + } + + export interface NodeFilterChoicePropertyValue { + /** + * The value of the choice + */ + value: string; + /** + * The display name of the choice + * If not specified, the value will be used as the display name + * If specified, the display name will be used in the dropdown + */ + displayName?: string; + } + + export interface NodeFilter { + /** + * The name of the filter property + */ + name: string; + /** + * The operator of the filter property + */ + operator: NodeFilterOperator; + /** + * The applied values of the filter property + */ + value: string | string[] | number | number[] | boolean | undefined; + } + + export enum NodeFilterPropertyDataType { + String = 0, + Number = 1, + Boolean = 2, + Date = 3, + Choice = 4 + } + + export enum NodeFilterOperator { + Equals = 0, + NotEquals = 1, + LessThan = 2, + LessThanOrEquals = 3, + GreaterThan = 4, + GreaterThanOrEquals = 5, + Between = 6, + NotBetween = 7, + Contains = 8, + NotContains = 9, + StartsWith = 10, + NotStartsWith = 11, + EndsWith = 12, + NotEndsWith = 13 + } + + export interface ModelView extends vscode.Disposable { } + + export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } + + export namespace window { + export interface Wizard extends LoadingComponentBase { } + + export interface Dialog extends LoadingComponentBase, vscode.Disposable { } + + export interface ModelViewPanel extends vscode.Disposable { } + + export interface ModelViewDashboard extends vscode.Disposable { } + + /** + * Opens the error dialog with customization options provided. + * @param options Dialog options to customize error dialog. + * @returns Id of action button clicked by user, e.g. ok, cancel + */ + export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; + + /** + * Provides dialog options to customize modal dialog content and layout + */ + export interface IErrorDialogOptions { + /** + * Severity Level to identify icon of modal dialog. + */ + severity: MessageLevel; + /** + * Title of modal dialog header. + */ + headerTitle: string; + /** + * Message text to show on dialog. + */ + message: string; + /** + * (Optional) Detailed message, e.g stack trace of error. + */ + messageDetails?: string; + /** + * Telemetry View to be used for emitting telemetry events. + */ + telemetryView?: string, + /** + * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. + * If custom 'actions' are not provided, 'OK' button will be shown by default. + */ + actions?: IDialogAction[]; + /** + * (Optional) If provided, instruction text is shown in bold below message. + */ + instructionText?: string; + /** + * (Optional) If provided, appends read more link after instruction text. + */ + readMoreLink?: string; + } + + /** + * An action that will be rendered as a button on the dialog. + */ + export interface IDialogAction { + /** + * Identifier of action. + */ + id: string; + /** + * Label of Action button. + */ + label: string; + /** + * Defines if button styling and focus should be based on primary action. + */ + isPrimary: boolean; + } + + export interface FileFilters { + /** + * The label to display in the file filter field next to the list of filters. + */ + label: string; + /** + * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). + */ + filters: string[]; + } + + /** + * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local + * files without any connection is opened via vscode.window.showOpenDialog. + * @param connectionUri The URI of the connection to the target server + * @param targetPath The file path on the server machine to open by default in the dialog + * @param fileFilters The filters used to limit which files are displayed in the file browser + * @param showFoldersOnly Optional argument to specify whether the browser should only show folders + * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. + */ + export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; + } + + export interface FileBrowserProvider extends DataProvider { + openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; + } + + export interface TableComponent { + /** + * Set active cell. + */ + setActiveCell(row: number, column: number): void; + } + + export interface ProfilerProvider { + startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; + } + + export enum ProfilingSessionType { + RemoteSession = 0, + LocalFile = 1 + } + + export interface SplitViewLayout extends FlexLayout { + /** + * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal + * If undefined, the size of the model view container is used + */ + splitViewSize?: number | string | undefined; + } +} From 13588a51f96d785f0dd3bff2796ba933478e2a1c Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Wed, 21 Aug 2024 11:15:11 -0700 Subject: [PATCH 07/21] Rename request prop to copy in backend --- src/azdata.proposed.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index d0db626..720ed09 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -886,9 +886,9 @@ declare module 'azdata' { */ selections: SelectionRange[]; /** - * Whether to copy the results directly to the clipboard from STS. + * * Whether to copy the results directly from the backend. */ - CopyDirectlyToClipboard: boolean; + copyInBackend: boolean; } export interface CopyResultsRequestResult { From 1b7949f409f3c18d8f64adf28787b9ec1f5e374f Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Mon, 26 Aug 2024 13:25:12 -0700 Subject: [PATCH 08/21] Fix indentation --- src/azdata.proposed.d.ts | 4220 +++++++++++++++++++------------------- 1 file changed, 2110 insertions(+), 2110 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 720ed09..8a5b6d9 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -9,2114 +9,2114 @@ import * as vscode from 'vscode'; declare module 'azdata' { - export namespace nb { - export interface NotebookDocument { - /** - * Sets the trust mode for the notebook document. - */ - setTrusted(state: boolean): void; - } - - export interface ISessionOptions { - /** - * The spec for the kernel being used to create this session. - */ - kernelSpec?: IKernelSpec; - } - - export interface IKernelSpec { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages?: string[]; - } - - export interface IStandardKernel { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages: string[]; - readonly blockedOnSAW?: boolean; - } - - export interface IKernelChangedArgs { - nbKernelAlias?: string - } - - export interface ICellOutput { - /** - * Unique identifier for this cell output. - */ - id?: string; - } - - export interface IExecuteResult { - data: any; - } - - export interface IExecuteResultUpdate { - output_type: string; - resultSet: ResultSetSummary; - data: any; - } - - export interface IExecuteRequest { - /** - * The language of the notebook document that is executing this request. - */ - language: string; - } - - export interface INotebookMetadata { - connection_name?: string; - multi_connection_mode?: boolean; - } - - export interface ICellMetadata { - connection_name?: string; - } - - export interface ICellContents { - attachments?: ICellAttachments; - } - - export type ICellAttachments = { [key: string]: ICellAttachment }; - export type ICellAttachment = { [key: string]: string }; - - export interface SessionManager { - /** - * Shutdown all sessions. - */ - shutdownAll(): Thenable; - /** - * Disposes the session manager. - */ - dispose(): void; - } - - /** - * An event that is emitted when a {@link NotebookDocument} is closed. - */ - export const onDidCloseNotebookDocument: vscode.Event; - - export interface IKernel { - - /** - * Restart a kernel. - * - * #### Notes - * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). - * - * The promise is fulfilled on a valid response and rejected otherwise. - * - * It is assumed that the API call does not mutate the kernel id or name. - * - * The promise will be rejected if the kernel status is `Dead` or if the - * request fails or the response is invalid. - */ - restart(): Thenable; - } - } - - export interface LoadingComponentBase { - /** - * When true, the component will display a loading spinner. - */ - loading?: boolean; - - /** - * This sets the alert text which gets announced when the loading spinner is shown. - */ - loadingText?: string; - - /** - * The text to display while loading is set to false. Will also be announced through screen readers - * once loading is completed. - */ - loadingCompletedText?: string; - } - - /** - * The column information of a data set. - */ - export interface SimpleColumnInfo { - /** - * The column name. - */ - name: string; - /** - * The data type of the column. - */ - dataTypeName: string; - } - - /** - * The parameters for start data serialization request. - */ - export interface SerializeDataStartRequestParams { - /** - * 'csv', 'json', 'excel', 'xml' - */ - saveFormat: string; - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch of the data set to be serialized. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - /** - * The columns of the data set. - */ - columns: SimpleColumnInfo[]; - /** - * Whether to include column headers to the target file. - */ - includeHeaders?: boolean; - /** - * The delimiter to seperate the cells. - */ - delimiter?: string; - /** - * The line seperator. - */ - lineSeperator?: string; - /** - * Character used for enclosing text fields when saving results as CSV. - */ - textIdentifier?: string; - /** - * File encoding used when saving results as CSV. - */ - encoding?: string; - /** - * When true, XML output will be formatted when saving results as XML. - */ - formatted?: boolean; - } - - /** - * The parameters for continue data serialization request. - */ - export interface SerializeDataContinueRequestParams { - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - } - - /** - * The result of data serialization data request. - */ - export interface SerializeDataResult { - /** - * The output message. - */ - messages?: string; - /** - * Whether the serialization is succeeded. - */ - succeeded: boolean; - } - - /** - * The serialization provider. - */ - export interface SerializationProvider extends DataProvider { - /** - * Start the data serialization. - * @param requestParams the request parameters. - */ - startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; - /** - * Continue the data serialization. - * @param requestParams the request parameters. - */ - continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; - } - - export namespace dataprotocol { - /** - * Registers a SerializationProvider. - * @param provider The data serialization provider. - */ - export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; - export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; - /** - * Registers a DataGridProvider which is used to provide lists of items to a data grid - * @param provider The provider implementation - */ - export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; - } - - export enum DataProviderType { - DataGridProvider = 'DataGridProvider' - } - - /** - * The type of the DataGrid column - */ - export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; - - /** - * A column in a data grid - */ - export interface DataGridColumn { - /** - * The text to display on the column heading. - */ - name: string; - - /** - * The property name in the DataGridItem - */ - field: string; - - /** - * A unique identifier for the column within the grid. - */ - id: string; - - /** - * The type of column this is. This is used to determine how to render the contents. - */ - type: DataGridColumnType; - - /** - * Whether this column is sortable. - */ - sortable?: boolean; - - /** - * Whether this column is filterable - */ - filterable?: boolean; - - /** - * If false, column can no longer be resized. - */ - resizable?: boolean; - - /** - * If set to a non-empty string, a tooltip will appear on hover containing the string. - */ - tooltip?: string; - - /** - * Width of the column in pixels. - */ - width?: number - } - - /** - * Info for a command to execute - */ - export interface ExecuteCommandInfo { - /** - * The ID of the command to execute - */ - id: string; - /** - * The text to display for the action - */ - displayText?: string; - /** - * The optional args to pass to the command - */ - args?: any[]; - } - - /** - * Info for displaying a hyperlink value in a Data Grid table - */ - export interface DataGridHyperlinkInfo { - /** - * The text to display for the link - */ - displayText: string; - /** - * The URL to open or command to execute - */ - linkOrCommand: string | ExecuteCommandInfo; - } - - /** - * An item for displaying in a data grid - */ - export interface DataGridItem { - /** - * A unique identifier for this item - */ - id: string; - - /** - * The other properties that will be displayed in the grid columns - */ - [key: string]: string | DataGridHyperlinkInfo; - } - - /** - * A data provider that provides lists of resource items for a data grid - */ - export interface DataGridProvider extends DataProvider { - /** - * Gets the list of data grid items for this provider - */ - getDataGridItems(): Thenable; - /** - * Gets the list of data grid columns for this provider - */ - getDataGridColumns(): Thenable; - - /** - * The user visible string to use for the title of the grid - */ - title: string; - } - - export interface ConnectionProvider extends DataProvider { - /** - * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) - */ - changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; - } - - // Password Change Request ---------------------------------------------------------------------- - export interface PasswordChangeResult { - /** - * Whether the password change was successful - */ - result: boolean; - /** - * Error message if the password change was unsuccessful - */ - errorMessage?: string; - } - - export interface IConnectionProfile extends ConnectionInfo { - azureAccount?: string; - azureResourceId?: string; - azurePortalEndpoint?: string; - } - - export interface PromptFailedResult extends ProviderError { } - - export interface ProviderError { - /** - * Error name - */ - name?: string; - - /** - * Error code - */ - errorCode?: string; - - /** - * Error message - */ - errorMessage?: string; - } - - - export namespace diagnostics { - /** - * Represents a diagnostics provider of accounts. - */ - export interface ErrorDiagnosticsProviderMetadata { - /** - * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. - * Note: only ONE diagnostic provider per id/name at a time. - */ - targetProviderId: string; - } - - export interface ConnectionDiagnosticsResult { - /** - * Whether the error was handled or not. - */ - handled: boolean, - /** - * Whether reconnect should be attempted. - */ - reconnect?: boolean, - /** - * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. - */ - options?: { [name: string]: any }; - } - - /** - * Provides error information - */ - export interface IErrorInformation { - /** - * Error code - */ - errorCode: number, - /** - * Error Message - */ - errorMessage: string, - /** - * Stack trace of error - */ - messageDetails: string - } - - /** - * Diagnostics object for handling errors for a provider. - */ - export interface ErrorDiagnosticsProvider { - /** - * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. - * @param errorInfo The error information of the connection error. - * @param connection The connection profile that caused the error. - * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. - */ - handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; - } - - /** - * Registers provider with instance of Diagnostic Provider implementation. - * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. - * @param providerMetadata Additional data used to register the provider - * @param errorDiagnostics The provider's diagnostic object that handles errors. - * @returns A disposable that when disposed will unregister the provider - */ - export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; - } - - export namespace connection { - - /** - * Opens the change password dialog. - * @param profile The connection profile to change the password for. - * @returns The new password that is returned from the operation or undefined if unsuccessful. - */ - export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; - } - - export interface ConnectionInfoSummary { - /** - * ID used to identify the connection on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - export interface QueryExecuteCompleteNotificationResult { - /** - * ID used to identify the connection used to run the query on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - /* - * Add optional per-OS default value. - */ - export interface DefaultValueOsOverride { - os: string; - - defaultValueOverride: string; - } - - export interface ConnectionOption { - defaultValueOsOverrides?: DefaultValueOsOverride[]; - - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * When set to true, the respective connection option will be rendered on the main connection dialog - * and not the Advanced Options window. - */ - showOnConnectionDialog?: boolean; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - - export interface ServiceOption { - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - /** - * This change event defines actions - */ - export interface SelectionChangeEvent { - /** - * Values that affect actions defined in this event. - */ - values: string[]; - - /** - * Action to be taken on another option when selected value matches to the list of values provided. - */ - dependentOptionActions: DependentOptionAction[]; - } - - export interface DependentOptionAction { - /** - * Name of option affected by defined action. - */ - optionName: string, - - /** - * Action to be taken, Supported values: 'show', 'hide'. - */ - action: string; - - /** - * Whether or not the option should be set to required when visible. Defaults to false. - * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. - * When set to true, providers must handle property validation. - */ - required?: boolean; - } - - // Object Explorer interfaces -------------------------------- - export interface ObjectExplorerSession { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - } - - export interface ExpandNodeInfo { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - - /** - * Filters to apply to the child nodes being returned - */ - filters?: NodeFilter[]; - } - // End Object Explorer interfaces ---------------------------- - - export interface TaskInfo { - targetLocation?: string; - } - - export interface ButtonColumnOption { - icon?: IconPath; - } - - export namespace sqlAssessment { - - export enum SqlAssessmentTargetType { - Server = 1, - Database = 2 - } - - export enum SqlAssessmentResultItemKind { - RealResult = 0, - Warning = 1, - Error = 2 - } - } - // Assessment interfaces - - export interface SqlAssessmentResultItem { - rulesetVersion: string; - rulesetName: string; - targetType: sqlAssessment.SqlAssessmentTargetType; - targetName: string; - checkId: string; - tags: string[]; - displayName: string; - description: string; - message: string; - helpLink: string; - level: string; - timestamp: string; - kind: sqlAssessment.SqlAssessmentResultItemKind; - } - - export interface SqlAssessmentResult extends ResultStatus { - items: SqlAssessmentResultItem[]; - apiVersion: string; - } - - export interface SqlAssessmentServicesProvider extends DataProvider { - assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; - } - - export interface TreeItem2 extends vscode.TreeItem { - payload?: IConnectionProfile; - childProvider?: string; - type?: ExtensionNodeType; - } - - export interface Component extends vscode.Disposable { } - - export namespace workspace { - /** - * Creates and enters a workspace at the specified location - */ - export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; - - /** - * Enters the workspace with the provided path - * @param workspaceFile - */ - export function enterWorkspace(workspaceFile: vscode.Uri): Promise; - - /** - * Saves and enters the workspace with the provided path - * @param workspaceFile - */ - export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; - } - - export interface TableComponentProperties { - /** - * Specifies whether to use headerFilter plugin - */ - headerFilter?: boolean, - } - - export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; - - export interface ExecutionPlanComponentProperties extends ComponentProperties { - /** - * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs - */ - data?: ExecutionPlanData; - } - - /** - * Defines the executionPlan component - */ - export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { - } - - export interface ModelBuilder { - executionPlan(): ComponentBuilder; - } - - export interface ListViewOption { - /** - * The optional accessibility label for the column. Default is the label for the list view option. - */ - ariaLabel?: string; - /** - * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. - */ - icon?: IconPath; - } - - export interface IconColumnCellValue { - /** - * The icon to be displayed. - */ - icon: IconPath; - /** - * The title of the icon. - */ - title: string; - } - - export interface ButtonColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the button. - */ - title?: string; - } - - export interface HyperlinkColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the hyperlink. - */ - title?: string; - - /** - * The url to open. - */ - url?: string; - /** - * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. - */ - role?: 'button' | 'link'; - } - - export interface ContextMenuColumnCellValue { - /** - * The title of the hyperlink. By default, the title is 'Show Actions' - */ - title?: string; - /** - * commands for the menu. Use an array for a group and menu separators will be added. - */ - commands: (string | string[])[]; - /** - * context that will be passed to the commands. - */ - context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined - } - - export enum ColumnType { - icon = 3, - hyperlink = 4, - contextMenu = 5 - } - - export interface TableColumn { - /** - * The text to display on the column heading. 'value' property will be used, if not specified - */ - name?: string; - - /** - * whether the column is resizable. Default value is true. - */ - resizable?: boolean; - } - - export interface IconColumnOptions { - /** - * The icon to use for all the cells in this column. - */ - icon?: IconPath; - } - - export interface ButtonColumn extends IconColumnOptions, TableColumn { - /** - * Whether to show the text, default value is false. - */ - showText?: boolean; - } - - export interface HyperlinkColumn extends IconColumnOptions, TableColumn { - } - - export interface CheckboxColumn extends TableColumn { - action: ActionOnCellCheckboxCheck; - } - - export interface ContextMenuColumn extends TableColumn { - } - - export interface QueryExecuteResultSetNotificationParams { - /** - * Contains execution plans returned by the database in ResultSets. - */ - executionPlans: executionPlan.ExecutionPlanGraph[]; - } - - export interface ObjectMetadata { - /* - * Parent object name for subobjects such as triggers, indexes, etc. - */ - parentName?: string; - - /* - * Parent object type name, such as Table, View, etc. - */ - parentTypeName?: string; - } - - /** - * Represents a selected range in the result grid. - */ - export interface SelectionRange { - fromRow: number; - toRow: number; - fromColumn: number; - toColumn: number; - } - - /** - * Parameters for the copy results request. - */ - export interface CopyResultsRequestParams { - /** - * URI of the editor. - */ - ownerUri: string; - /** - * Index of the batch. - */ - batchIndex: number; - /** - * Index of the result set. - */ - resultSetIndex: number; - /** - * Whether to include the column headers. - */ - includeHeaders: boolean - /** - * The selected ranges to be copied. - */ - selections: SelectionRange[]; - /** - * * Whether to copy the results directly from the backend. - */ - copyInBackend: boolean; - } - - export interface CopyResultsRequestResult { - /** - * Result string from copy operation - */ - results: string; - } - - export interface QueryProvider { - /** - * Notify clients that the URI for a connection has been changed. - */ - connectionUriChanged?(newUri: string, oldUri: string): Thenable; - /** - * Copy the selected data to the clipboard. - * This is introduced to address the performance issue of large amount of data to ADS side. - * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. - * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. - */ - copyResults?(requestParams: CopyResultsRequestParams): Thenable; - } - - export enum DataProviderType { - TableDesignerProvider = 'TableDesignerProvider', - ExecutionPlanProvider = 'ExecutionPlanProvider', - ServerContextualizationProvider = 'ServerContextualizationProvider' - } - - export namespace dataprotocol { - export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; - export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; - /** - * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub - * Copilot for improved suggestions. - * @param provider The provider to register - */ - export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; - } - - export namespace designers { - /** - * Open a table designer window. - * @param providerId The table designer provider Id. - * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. - * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry - * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited - */ - export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; - - /** - * Definition for the table designer provider. - */ - export interface TableDesignerProvider extends DataProvider { - /** - * Initialize the table designer for the specified table. - * @param table the table information. - */ - initializeTableDesigner(table: TableInfo): Thenable; - - /** - * Process the table change. - * @param table the table information - * @param tableChangeInfo the information about the change user made through the UI. - */ - processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; - - /** - * Publish the changes. - * @param table the table information - */ - publishChanges(table: TableInfo): Thenable; - - /** - * Generate script for the changes. - * @param table the table information - */ - generateScript(table: TableInfo): Thenable; - - /** - * Generate preview report describing the changes to be made. - * @param table the table information - */ - generatePreviewReport(table: TableInfo): Thenable; - - /** - * Notify the provider that the table designer has been closed. - * @param table the table information - */ - disposeTableDesigner(table: TableInfo): Thenable; - } - - /** - * The information of the table. - */ - export interface TableInfo { - /** - * Used as the table designer editor's tab header text. - */ - title: string; - /** - * Used as the table designer editor's tab header hover text. - */ - tooltip: string; - /** - * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. - */ - id: string; - /** - * A boolean value indicates whether a new table is being designed. - */ - isNewTable: boolean; - /** - * Extension can store additional information that the provider needs to uniquely identify a table. - */ - [key: string]: any; - /** - * Table icon type that's shown in the editor tab. Default is the basic - * table icon. - */ - tableIcon?: TableIcon; - } - - /** - * The information to populate the table designer UI. - */ - export interface TableDesignerInfo { - /** - * The view definition. - */ - view: TableDesignerView; - /** - * The initial state of the designer. - */ - viewModel: DesignerViewModel; - /** - * The new table info after initialization. - */ - tableInfo: TableInfo; - /** - * The issues. - */ - issues?: DesignerIssue[]; - } - - /** - * Table icon that's shown on the editor tab - */ - export enum TableIcon { - Basic = 'Basic', - Temporal = 'Temporal', - GraphNode = 'GraphNode', - GraphEdge = 'GraphEdge' - } - - /** - * Name of the common table properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableProperty { - Columns = 'columns', - Description = 'description', - Name = 'name', - Schema = 'schema', - Script = 'script', - ForeignKeys = 'foreignKeys', - CheckConstraints = 'checkConstraints', - Indexes = 'indexes', - PrimaryKey = 'primaryKey', - PrimaryKeyName = 'primaryKeyName', - PrimaryKeyDescription = 'primaryKeyDescription', - PrimaryKeyColumns = 'primaryKeyColumns' - } - /** - * Name of the common table column properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableColumnProperty { - AllowNulls = 'allowNulls', - DefaultValue = 'defaultValue', - Length = 'length', - Name = 'name', - Description = 'description', - Type = 'type', - AdvancedType = 'advancedType', - IsPrimaryKey = 'isPrimaryKey', - Precision = 'precision', - Scale = 'scale' - } - - /** - * Name of the common foreign key constraint properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableForeignKeyProperty { - Name = 'name', - Description = 'description', - ForeignTable = 'foreignTable', - OnDeleteAction = 'onDeleteAction', - OnUpdateAction = 'onUpdateAction', - Columns = 'columns' - } - - /** - * Name of the columns mapping properties for foreign key. - */ - export enum ForeignKeyColumnMappingProperty { - Column = 'column', - ForeignColumn = 'foreignColumn' - } - - /** - * Name of the common check constraint properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableCheckConstraintProperty { - Name = 'name', - Description = 'description', - Expression = 'expression' - } - - /** - * Name of the common index properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableIndexProperty { - Name = 'name', - Description = 'description', - Columns = 'columns' - } - - /** - * Name of the common properties of table index column specification. - */ - export enum TableIndexColumnSpecificationProperty { - Column = 'column' - } - - /** - * The table designer view definition. - */ - export interface TableDesignerView { - /** - * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} - */ - additionalTableProperties?: DesignerDataPropertyInfo[]; - /** - * Additional tabs. - */ - additionalTabs?: DesignerTab[]; - /** - * Columns table options. - * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. - * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. - */ - columnTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign keys table options. - * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. - * Default columns to display values are: Name, PrimaryKeyTable. - */ - foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign key column mapping table options. - * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. - * Default columns to display values are: Column, ForeignColumn. - */ - foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Check constraints table options. - * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} - * Default columns to display values are: Name, Expression. - */ - checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Indexes table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} - * Default columns to display values are: Name. - */ - indexTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Index column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Primary column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. - */ - additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; - /** - * Components to be placed under the pre-defined tabs. - */ - additionalComponents?: DesignerDataPropertyWithTabInfo[]; - /** - * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. - */ - useAdvancedSaveMode: boolean; - } - - export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { - /** - * Whether to show the table. Default value is false. - */ - showTable?: boolean; - /** - * Properties to be displayed in the table, other properties can be accessed in the properties view. - */ - propertiesToDisplay?: string[]; - /** - * Additional properties for the entity. - */ - additionalProperties?: DesignerDataPropertyInfo[]; - } - - /** - * The view model of the designer. - */ - export interface DesignerViewModel { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of a designer tab. - */ - export interface DesignerTab { - /** - * The title of the tab. - */ - title: string; - /** - * the components to be displayed in this tab. - */ - components: DesignerDataPropertyInfo[]; - } - - /** - * The definition of the property in the designer. - */ - export interface DesignerDataPropertyInfo { - /** - * The property name. - */ - propertyName: string; - /** - * The description of the property. - */ - description?: string; - /** - * The component type. - */ - componentType: DesignerComponentTypeName; - /** - * The group name, properties with the same group name will be displayed under the same group on the UI. - */ - group?: string; - /** - * Whether the property should be displayed in the properties view. The default value is true. - */ - showInPropertiesView?: boolean; - /** - * The properties of the component. - */ - componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of the property in the designer with tab info. - */ - export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { - /** - * The tab info where this property belongs to. - */ - tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; - } - - /** - * The child component types supported by designer. - */ - export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; - - export interface DesignerTablePropertiesBase { - /** - * Whether user can add new rows to the table. The default value is true. - */ - canAddRows?: boolean; - /** - * Whether user can remove rows from the table. The default value is true. - */ - canRemoveRows?: boolean; - /** - * Whether user can move rows from one index to another. The default value is true. - */ - canMoveRows?: boolean; - /** - * Whether user can insert rows at a given index to the table. The default value is true. - */ - canInsertRows?: boolean; - /** - * Whether to show confirmation when user removes a row. The default value is false. - */ - showRemoveRowConfirmation?: boolean; - /** - * The confirmation message to be displayed when user removes a row. - */ - removeRowConfirmationMessage?: string; - /** - * Whether to show the item detail in properties view. The default value is true. - */ - showItemDetailInPropertiesView?: boolean; - /** - * The label of the add new button. The default value is 'Add New'. - */ - labelForAddNewButton?: string; - } - - /** - * The properties for the table component in the designer. - */ - export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { - /** - * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. - */ - columns?: string[]; - /** - * The display name of the object type. - */ - objectTypeDisplayName: string; - /** - * the properties of the table data item. - */ - itemProperties?: DesignerDataPropertyInfo[]; - /** - * The data to be displayed. - */ - data?: DesignerTableComponentDataItem[]; - } - - /** - * The data item of the designer's table component. - */ - export interface DesignerTableComponentDataItem { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; - /** - * Whether the row can be deleted. The default value is true. - */ - canBeDeleted?: boolean; - } - - /** - * Type of the edit originated from the designer UI. - */ - export enum DesignerEditType { - /** - * Add a row to a table. - */ - Add = 0, - /** - * Remove a row from a table. - */ - Remove = 1, - /** - * Update a property. - */ - Update = 2, - /** - * Change the position of an item in the collection. - */ - Move = 3 - } - - /** - * Information of the edit originated from the designer UI. - */ - export interface DesignerEdit { - /** - * The edit type. - */ - type: DesignerEditType; - /** - * the path of the edit target. - */ - path: DesignerPropertyPath; - /** - * the new value. - */ - value?: any; - } - - /** - * The path of the property. - * Below are the 3 scenarios and their expected path. - * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. - * 1. 'Add' scenario - * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. - * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. - * 2. 'Update' scenario - * a. ['propertyName1']. Example: update the name of the table: ['name']. - * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. - * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. - * 3. 'Remove' scenario - * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. - * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. - */ - export type DesignerPropertyPath = (string | number)[]; - - /** - * Severity of the messages returned by the provider after processing an edit. - * 'error': The issue must be fixed in order to commit the changes. - * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. - * 'information': Informational message. - */ - export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; - - /** - * Represents the issue in the designer - */ - export interface DesignerIssue { - /** - * Severity of the issue. - */ - severity: DesignerIssueSeverity, - /** - * Path of the property that is associated with the issue. - */ - propertyPath?: DesignerPropertyPath, - /** - * Description of the issue. - */ - description: string, - /** - * Url to a web page that has the explaination of the issue. - */ - moreInfoLink?: string; - } - - /** - * The result returned by the table designer provider after handling an edit request. - */ - export interface DesignerEditResult { - /** - * The new view information if the view needs to be refreshed. - */ - view?: T; - /** - * The view model object. - */ - viewModel: DesignerViewModel; - /** - * Whether the current state is valid. - */ - isValid: boolean; - /** - * Issues of current state. - */ - issues?: DesignerIssue[]; - /** - * The input validation error. - */ - inputValidationError?: string; - /** - * Metadata related to the table - */ - metadata?: { [key: string]: string }; - } - - /** - * The result returned by the table designer provider after handling the publish changes request. - */ - export interface PublishChangesResult { - /** - * The new table information after the changes are published. - */ - newTableInfo: TableInfo; - /** - * The new view model. - */ - viewModel: DesignerViewModel; - /** - * The new view. - */ - view: TableDesignerView; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - - export interface GeneratePreviewReportResult { - /** - * Report generated for generate preview - */ - report: string; - /** - * Format (mimeType) of the report - */ - mimeType: string; - /** - * Whether user confirmation is required, the default value is false. - */ - requireConfirmation?: boolean; - /** - * The confirmation text. - */ - confirmationText?: string; - /** - * The table schema validation error. - */ - schemaValidationError?: string; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - } - - export namespace executionPlan { - export interface ExecutionPlanGraph { - /** - * Root of the execution plan tree - */ - root: ExecutionPlanNode; - /** - * Underlying query for the execution plan graph. - */ - query: string; - /** - * String representation of graph - */ - graphFile: ExecutionPlanGraphInfo; - /** - * Query recommendations for optimizing performance - */ - recommendations: ExecutionPlanRecommendations[]; - } - - export interface ExecutionPlanNode { - /** - * Unique id given to node by the provider - */ - id: string; - /** - * Type of the node. This property determines the icon that is displayed for it - */ - type: string; - /** - * Cost associated with the node - */ - cost: number; - /** - * Cost of the node subtree - */ - subTreeCost: number; - /** - * Relative cost of the node compared to its siblings. - */ - relativeCost: number; - /** - * Time take by the node operation in milliseconds - */ - elapsedTimeInMs: number; - /** - * CPU time taken by the node operation in milliseconds - */ - elapsedCpuTimeInMs: number; - /** - * Node properties to be shown in the tooltip - */ - properties: ExecutionPlanGraphElementProperty[]; - /** - * Display name for the node - */ - name: string; - /** - * Description associated with the node. - */ - description: string; - /** - * Subtext displayed under the node name - */ - subtext: string[]; - /** - * Direct children of the nodes. - */ - children: ExecutionPlanNode[]; - /** - * Edges corresponding to the children. - */ - edges: ExecutionPlanEdge[]; - /** - * Warning/parallelism badges applicable to the current node - */ - badges: ExecutionPlanBadge[]; - /** - * Data to show in top operations table for the node. - */ - topOperationsData: TopOperationsDataItem[]; - /** - * Output row count associated with the node - */ - rowCountDisplayString: string; - /** - * Cost string for the node - */ - costDisplayString: string; - /** - * Cost metrics for the node - */ - costMetrics: CostMetric[]; - } - - export interface CostMetric { - /** - * Name of the cost metric. - */ - name: string; - /** - * The value of the cost metric - */ - value: number | undefined; - } - - export interface ExecutionPlanBadge { - /** - * Type of the node overlay. This determines the icon that is displayed for it - */ - type: BadgeType; - /** - * Text to display for the overlay tooltip - */ - tooltip: string; - } - - export enum BadgeType { - Warning = 0, - CriticalWarning = 1, - Parallelism = 2 - } - - export interface ExecutionPlanEdge { - /** - * Count of the rows returned by the subtree of the edge. - */ - rowCount: number; - /** - * Size of the rows returned by the subtree of the edge. - */ - rowSize: number; - /** - * Edge properties to be shown in the tooltip. - */ - properties: ExecutionPlanGraphElementProperty[] - } - - export interface ExecutionPlanGraphElementProperty { - /** - * Name of the property - */ - name: string; - /** - * value for the property - */ - value: string | ExecutionPlanGraphElementProperty[]; - /** - * Flag to show/hide props in tooltip - */ - showInTooltip: boolean; - /** - * Display order of property - */ - displayOrder: number; - /** - * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip - */ - positionAtBottom: boolean; - /** - * Display value of property to show in tooltip and other UI element. - */ - displayValue: string; - /** - * Data type of the property value - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Indicates which value is better when 2 similar properties are compared. - */ - betterValue: ExecutionPlanGraphElementPropertyBetterValue; - } - - export enum ExecutionPlanGraphElementPropertyDataType { - Number = 0, - String = 1, - Boolean = 2, - Nested = 3 - } - - export enum ExecutionPlanGraphElementPropertyBetterValue { - LowerNumber = 0, - HigherNumber = 1, - True = 2, - False = 3, - None = 4 - } - - export interface ExecutionPlanRecommendations { - /** - * Text displayed in the show plan graph control description - */ - displayString: string; - /** - * Query that is recommended to the user - */ - queryText: string; - /** - * Query that will be opened in a new file once the user click on the recommendation - */ - queryWithDescription: string; - } - - export interface ExecutionPlanGraphInfo { - /** - * File contents - */ - graphFileContent: string; - /** - * File type for execution plan. This will be the file type of the editor when the user opens the graph file - */ - graphFileType: string; - /** - * Index of the execution plan in the file content - */ - planIndexInFile?: number; - } - - export interface GetExecutionPlanResult extends ResultStatus { - graphs: ExecutionPlanGraph[] - } - - export interface ExecutionGraphComparisonResult { - /** - * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. - */ - baseNode: ExecutionPlanNode; - /** - * The children of the ExecutionGraphComparisonResult. - */ - children: ExecutionGraphComparisonResult[]; - /** - * The group index of the ExecutionGraphComparisonResult. - */ - groupIndex: number; - /** - * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. - */ - hasMatch: boolean; - /** - * List of matching nodes for the ExecutionGraphComparisonResult. - */ - matchingNodesId: number[]; - /** - * The parent of the ExecutionGraphComparisonResult. - */ - parentNode: ExecutionGraphComparisonResult; - } - - export interface ExecutionPlanComparisonResult extends ResultStatus { - firstComparisonResult: ExecutionGraphComparisonResult; - secondComparisonResult: ExecutionGraphComparisonResult; - } - - export interface IsExecutionPlanResult { - isExecutionPlan: boolean; - queryExecutionPlanFileExtension: string; - } - - export interface ExecutionPlanProvider extends DataProvider { - // execution plan service methods - - /** - * Gets the execution plan graph from the provider for a given plan file - * @param planFile file that contains the execution plan - */ - getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; - /** - * Compares two execution plans and identifies matching regions in both execution plans. - * @param firstPlanFile file that contains the first execution plan. - * @param secondPlanFile file that contains the second execution plan. - */ - compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; - /** - * Determines if the provided value is an execution plan and returns the appropriate file extension. - * @param value String that needs to be checked. - */ - isExecutionPlan(value: string): Thenable; - } - - export interface TopOperationsDataItem { - /** - * Column name for the top operation data item - */ - columnName: string; - /** - * Cell data type for the top operation data item - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Cell value for the top operation data item - */ - displayValue: string | number | boolean; - } - } - - export namespace contextualization { - export interface GetServerContextualizationResult { - /** - * The retrieved server context. - */ - context: string | undefined; - } - - export interface ServerContextualizationProvider extends DataProvider { - /** - * Gets server context, which can be in the form of create scripts but is left up each provider. - * @param ownerUri The URI of the connection to get context for. - */ - getServerContextualization(ownerUri: string): Thenable; - } - } - - /** - * Component to display text with an icon representing the severity - */ - export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { - /** - * An event fired when the InfoBox is clicked - */ - onDidClick: vscode.Event; - /** - * An event fired when the Infobox link is clicked - */ - onLinkClick: vscode.Event; - } - - export interface InfoBoxComponentProperties { - /** - * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. - * Default value is false. - */ - isClickable?: boolean | undefined; - - /** - * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes - */ - clickableButtonAriaLabel?: string; - - /** - * List of links to embed within the text. If links are specified there must be placeholder - * values in the value indicating where the links should be placed, in the format {i} - * - * e.g. "Click {0} for more information!"" - */ - links?: LinkArea[]; - } - - /** - * Event argument for infobox link click event. - */ - export interface InfoBoxLinkClickEventArgs { - /** - * Index of the link selected - */ - index: number; - /** - * Link that is clicked - */ - link: LinkArea; - } - - export interface TextComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface ContainerProperties extends ComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface DropDownProperties { - /** - * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. - */ - strictSelection?: boolean; - } - - export interface NodeInfo { - /** - * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node - * under the database, the nodeType is Folder, the objectType is be Tables. - */ - objectType?: string; - /* - * The path of the parent node. - */ - parentNodePath: string; - /** - * Filterable properties that this node supports - */ - filterableProperties?: NodeFilterProperty[]; - } - - export interface NodeFilterProperty { - /** - * The non-localized name of the filter property - */ - name: string; - /** - * The name of the filter property displayed to the user - */ - displayName: string; - /** - * The type of the filter property - */ - type: NodeFilterPropertyDataType; - /** - * The description of the filter property - */ - description: string; - } - - /** - * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice - */ - export interface NodeFilterChoiceProperty extends NodeFilterProperty { - /** - * The list of choices for the filter property if the type is choice - */ - choices: NodeFilterChoicePropertyValue[]; - } - - export interface NodeFilterChoicePropertyValue { - /** - * The value of the choice - */ - value: string; - /** - * The display name of the choice - * If not specified, the value will be used as the display name - * If specified, the display name will be used in the dropdown - */ - displayName?: string; - } - - export interface NodeFilter { - /** - * The name of the filter property - */ - name: string; - /** - * The operator of the filter property - */ - operator: NodeFilterOperator; - /** - * The applied values of the filter property - */ - value: string | string[] | number | number[] | boolean | undefined; - } - - export enum NodeFilterPropertyDataType { - String = 0, - Number = 1, - Boolean = 2, - Date = 3, - Choice = 4 - } - - export enum NodeFilterOperator { - Equals = 0, - NotEquals = 1, - LessThan = 2, - LessThanOrEquals = 3, - GreaterThan = 4, - GreaterThanOrEquals = 5, - Between = 6, - NotBetween = 7, - Contains = 8, - NotContains = 9, - StartsWith = 10, - NotStartsWith = 11, - EndsWith = 12, - NotEndsWith = 13 - } - - export interface ModelView extends vscode.Disposable { } - - export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } - - export namespace window { - export interface Wizard extends LoadingComponentBase { } - - export interface Dialog extends LoadingComponentBase, vscode.Disposable { } - - export interface ModelViewPanel extends vscode.Disposable { } - - export interface ModelViewDashboard extends vscode.Disposable { } - - /** - * Opens the error dialog with customization options provided. - * @param options Dialog options to customize error dialog. - * @returns Id of action button clicked by user, e.g. ok, cancel - */ - export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; - - /** - * Provides dialog options to customize modal dialog content and layout - */ - export interface IErrorDialogOptions { - /** - * Severity Level to identify icon of modal dialog. - */ - severity: MessageLevel; - /** - * Title of modal dialog header. - */ - headerTitle: string; - /** - * Message text to show on dialog. - */ - message: string; - /** - * (Optional) Detailed message, e.g stack trace of error. - */ - messageDetails?: string; - /** - * Telemetry View to be used for emitting telemetry events. - */ - telemetryView?: string, - /** - * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. - * If custom 'actions' are not provided, 'OK' button will be shown by default. - */ - actions?: IDialogAction[]; - /** - * (Optional) If provided, instruction text is shown in bold below message. - */ - instructionText?: string; - /** - * (Optional) If provided, appends read more link after instruction text. - */ - readMoreLink?: string; - } - - /** - * An action that will be rendered as a button on the dialog. - */ - export interface IDialogAction { - /** - * Identifier of action. - */ - id: string; - /** - * Label of Action button. - */ - label: string; - /** - * Defines if button styling and focus should be based on primary action. - */ - isPrimary: boolean; - } - - export interface FileFilters { - /** - * The label to display in the file filter field next to the list of filters. - */ - label: string; - /** - * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). - */ - filters: string[]; - } - - /** - * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local - * files without any connection is opened via vscode.window.showOpenDialog. - * @param connectionUri The URI of the connection to the target server - * @param targetPath The file path on the server machine to open by default in the dialog - * @param fileFilters The filters used to limit which files are displayed in the file browser - * @param showFoldersOnly Optional argument to specify whether the browser should only show folders - * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. - */ - export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; - } - - export interface FileBrowserProvider extends DataProvider { - openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; - } - - export interface TableComponent { - /** - * Set active cell. - */ - setActiveCell(row: number, column: number): void; - } - - export interface ProfilerProvider { - startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; - } - - export enum ProfilingSessionType { - RemoteSession = 0, - LocalFile = 1 - } - - export interface SplitViewLayout extends FlexLayout { - /** - * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal - * If undefined, the size of the model view container is used - */ - splitViewSize?: number | string | undefined; - } + export namespace nb { + export interface NotebookDocument { + /** + * Sets the trust mode for the notebook document. + */ + setTrusted(state: boolean): void; + } + + export interface ISessionOptions { + /** + * The spec for the kernel being used to create this session. + */ + kernelSpec?: IKernelSpec; + } + + export interface IKernelSpec { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages?: string[]; + } + + export interface IStandardKernel { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages: string[]; + readonly blockedOnSAW?: boolean; + } + + export interface IKernelChangedArgs { + nbKernelAlias?: string + } + + export interface ICellOutput { + /** + * Unique identifier for this cell output. + */ + id?: string; + } + + export interface IExecuteResult { + data: any; + } + + export interface IExecuteResultUpdate { + output_type: string; + resultSet: ResultSetSummary; + data: any; + } + + export interface IExecuteRequest { + /** + * The language of the notebook document that is executing this request. + */ + language: string; + } + + export interface INotebookMetadata { + connection_name?: string; + multi_connection_mode?: boolean; + } + + export interface ICellMetadata { + connection_name?: string; + } + + export interface ICellContents { + attachments?: ICellAttachments; + } + + export type ICellAttachments = { [key: string]: ICellAttachment }; + export type ICellAttachment = { [key: string]: string }; + + export interface SessionManager { + /** + * Shutdown all sessions. + */ + shutdownAll(): Thenable; + /** + * Disposes the session manager. + */ + dispose(): void; + } + + /** + * An event that is emitted when a {@link NotebookDocument} is closed. + */ + export const onDidCloseNotebookDocument: vscode.Event; + + export interface IKernel { + + /** + * Restart a kernel. + * + * #### Notes + * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). + * + * The promise is fulfilled on a valid response and rejected otherwise. + * + * It is assumed that the API call does not mutate the kernel id or name. + * + * The promise will be rejected if the kernel status is `Dead` or if the + * request fails or the response is invalid. + */ + restart(): Thenable; + } + } + + export interface LoadingComponentBase { + /** + * When true, the component will display a loading spinner. + */ + loading?: boolean; + + /** + * This sets the alert text which gets announced when the loading spinner is shown. + */ + loadingText?: string; + + /** + * The text to display while loading is set to false. Will also be announced through screen readers + * once loading is completed. + */ + loadingCompletedText?: string; + } + + /** + * The column information of a data set. + */ + export interface SimpleColumnInfo { + /** + * The column name. + */ + name: string; + /** + * The data type of the column. + */ + dataTypeName: string; + } + + /** + * The parameters for start data serialization request. + */ + export interface SerializeDataStartRequestParams { + /** + * 'csv', 'json', 'excel', 'xml' + */ + saveFormat: string; + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch of the data set to be serialized. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + /** + * The columns of the data set. + */ + columns: SimpleColumnInfo[]; + /** + * Whether to include column headers to the target file. + */ + includeHeaders?: boolean; + /** + * The delimiter to seperate the cells. + */ + delimiter?: string; + /** + * The line seperator. + */ + lineSeperator?: string; + /** + * Character used for enclosing text fields when saving results as CSV. + */ + textIdentifier?: string; + /** + * File encoding used when saving results as CSV. + */ + encoding?: string; + /** + * When true, XML output will be formatted when saving results as XML. + */ + formatted?: boolean; + } + + /** + * The parameters for continue data serialization request. + */ + export interface SerializeDataContinueRequestParams { + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + } + + /** + * The result of data serialization data request. + */ + export interface SerializeDataResult { + /** + * The output message. + */ + messages?: string; + /** + * Whether the serialization is succeeded. + */ + succeeded: boolean; + } + + /** + * The serialization provider. + */ + export interface SerializationProvider extends DataProvider { + /** + * Start the data serialization. + * @param requestParams the request parameters. + */ + startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; + /** + * Continue the data serialization. + * @param requestParams the request parameters. + */ + continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; + } + + export namespace dataprotocol { + /** + * Registers a SerializationProvider. + * @param provider The data serialization provider. + */ + export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; + export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; + /** + * Registers a DataGridProvider which is used to provide lists of items to a data grid + * @param provider The provider implementation + */ + export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; + } + + export enum DataProviderType { + DataGridProvider = 'DataGridProvider' + } + + /** + * The type of the DataGrid column + */ + export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; + + /** + * A column in a data grid + */ + export interface DataGridColumn { + /** + * The text to display on the column heading. + */ + name: string; + + /** + * The property name in the DataGridItem + */ + field: string; + + /** + * A unique identifier for the column within the grid. + */ + id: string; + + /** + * The type of column this is. This is used to determine how to render the contents. + */ + type: DataGridColumnType; + + /** + * Whether this column is sortable. + */ + sortable?: boolean; + + /** + * Whether this column is filterable + */ + filterable?: boolean; + + /** + * If false, column can no longer be resized. + */ + resizable?: boolean; + + /** + * If set to a non-empty string, a tooltip will appear on hover containing the string. + */ + tooltip?: string; + + /** + * Width of the column in pixels. + */ + width?: number + } + + /** + * Info for a command to execute + */ + export interface ExecuteCommandInfo { + /** + * The ID of the command to execute + */ + id: string; + /** + * The text to display for the action + */ + displayText?: string; + /** + * The optional args to pass to the command + */ + args?: any[]; + } + + /** + * Info for displaying a hyperlink value in a Data Grid table + */ + export interface DataGridHyperlinkInfo { + /** + * The text to display for the link + */ + displayText: string; + /** + * The URL to open or command to execute + */ + linkOrCommand: string | ExecuteCommandInfo; + } + + /** + * An item for displaying in a data grid + */ + export interface DataGridItem { + /** + * A unique identifier for this item + */ + id: string; + + /** + * The other properties that will be displayed in the grid columns + */ + [key: string]: string | DataGridHyperlinkInfo; + } + + /** + * A data provider that provides lists of resource items for a data grid + */ + export interface DataGridProvider extends DataProvider { + /** + * Gets the list of data grid items for this provider + */ + getDataGridItems(): Thenable; + /** + * Gets the list of data grid columns for this provider + */ + getDataGridColumns(): Thenable; + + /** + * The user visible string to use for the title of the grid + */ + title: string; + } + + export interface ConnectionProvider extends DataProvider { + /** + * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) + */ + changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; + } + + // Password Change Request ---------------------------------------------------------------------- + export interface PasswordChangeResult { + /** + * Whether the password change was successful + */ + result: boolean; + /** + * Error message if the password change was unsuccessful + */ + errorMessage?: string; + } + + export interface IConnectionProfile extends ConnectionInfo { + azureAccount?: string; + azureResourceId?: string; + azurePortalEndpoint?: string; + } + + export interface PromptFailedResult extends ProviderError { } + + export interface ProviderError { + /** + * Error name + */ + name?: string; + + /** + * Error code + */ + errorCode?: string; + + /** + * Error message + */ + errorMessage?: string; + } + + + export namespace diagnostics { + /** + * Represents a diagnostics provider of accounts. + */ + export interface ErrorDiagnosticsProviderMetadata { + /** + * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. + * Note: only ONE diagnostic provider per id/name at a time. + */ + targetProviderId: string; + } + + export interface ConnectionDiagnosticsResult { + /** + * Whether the error was handled or not. + */ + handled: boolean, + /** + * Whether reconnect should be attempted. + */ + reconnect?: boolean, + /** + * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. + */ + options?: { [name: string]: any }; + } + + /** + * Provides error information + */ + export interface IErrorInformation { + /** + * Error code + */ + errorCode: number, + /** + * Error Message + */ + errorMessage: string, + /** + * Stack trace of error + */ + messageDetails: string + } + + /** + * Diagnostics object for handling errors for a provider. + */ + export interface ErrorDiagnosticsProvider { + /** + * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. + * @param errorInfo The error information of the connection error. + * @param connection The connection profile that caused the error. + * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. + */ + handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; + } + + /** + * Registers provider with instance of Diagnostic Provider implementation. + * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. + * @param providerMetadata Additional data used to register the provider + * @param errorDiagnostics The provider's diagnostic object that handles errors. + * @returns A disposable that when disposed will unregister the provider + */ + export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; + } + + export namespace connection { + + /** + * Opens the change password dialog. + * @param profile The connection profile to change the password for. + * @returns The new password that is returned from the operation or undefined if unsuccessful. + */ + export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; + } + + export interface ConnectionInfoSummary { + /** + * ID used to identify the connection on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + export interface QueryExecuteCompleteNotificationResult { + /** + * ID used to identify the connection used to run the query on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + /* + * Add optional per-OS default value. + */ + export interface DefaultValueOsOverride { + os: string; + + defaultValueOverride: string; + } + + export interface ConnectionOption { + defaultValueOsOverrides?: DefaultValueOsOverride[]; + + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * When set to true, the respective connection option will be rendered on the main connection dialog + * and not the Advanced Options window. + */ + showOnConnectionDialog?: boolean; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + + export interface ServiceOption { + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + /** + * This change event defines actions + */ + export interface SelectionChangeEvent { + /** + * Values that affect actions defined in this event. + */ + values: string[]; + + /** + * Action to be taken on another option when selected value matches to the list of values provided. + */ + dependentOptionActions: DependentOptionAction[]; + } + + export interface DependentOptionAction { + /** + * Name of option affected by defined action. + */ + optionName: string, + + /** + * Action to be taken, Supported values: 'show', 'hide'. + */ + action: string; + + /** + * Whether or not the option should be set to required when visible. Defaults to false. + * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. + * When set to true, providers must handle property validation. + */ + required?: boolean; + } + + // Object Explorer interfaces -------------------------------- + export interface ObjectExplorerSession { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + } + + export interface ExpandNodeInfo { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + + /** + * Filters to apply to the child nodes being returned + */ + filters?: NodeFilter[]; + } + // End Object Explorer interfaces ---------------------------- + + export interface TaskInfo { + targetLocation?: string; + } + + export interface ButtonColumnOption { + icon?: IconPath; + } + + export namespace sqlAssessment { + + export enum SqlAssessmentTargetType { + Server = 1, + Database = 2 + } + + export enum SqlAssessmentResultItemKind { + RealResult = 0, + Warning = 1, + Error = 2 + } + } + // Assessment interfaces + + export interface SqlAssessmentResultItem { + rulesetVersion: string; + rulesetName: string; + targetType: sqlAssessment.SqlAssessmentTargetType; + targetName: string; + checkId: string; + tags: string[]; + displayName: string; + description: string; + message: string; + helpLink: string; + level: string; + timestamp: string; + kind: sqlAssessment.SqlAssessmentResultItemKind; + } + + export interface SqlAssessmentResult extends ResultStatus { + items: SqlAssessmentResultItem[]; + apiVersion: string; + } + + export interface SqlAssessmentServicesProvider extends DataProvider { + assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; + } + + export interface TreeItem2 extends vscode.TreeItem { + payload?: IConnectionProfile; + childProvider?: string; + type?: ExtensionNodeType; + } + + export interface Component extends vscode.Disposable { } + + export namespace workspace { + /** + * Creates and enters a workspace at the specified location + */ + export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; + + /** + * Enters the workspace with the provided path + * @param workspaceFile + */ + export function enterWorkspace(workspaceFile: vscode.Uri): Promise; + + /** + * Saves and enters the workspace with the provided path + * @param workspaceFile + */ + export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; + } + + export interface TableComponentProperties { + /** + * Specifies whether to use headerFilter plugin + */ + headerFilter?: boolean, + } + + export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; + + export interface ExecutionPlanComponentProperties extends ComponentProperties { + /** + * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs + */ + data?: ExecutionPlanData; + } + + /** + * Defines the executionPlan component + */ + export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { + } + + export interface ModelBuilder { + executionPlan(): ComponentBuilder; + } + + export interface ListViewOption { + /** + * The optional accessibility label for the column. Default is the label for the list view option. + */ + ariaLabel?: string; + /** + * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. + */ + icon?: IconPath; + } + + export interface IconColumnCellValue { + /** + * The icon to be displayed. + */ + icon: IconPath; + /** + * The title of the icon. + */ + title: string; + } + + export interface ButtonColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the button. + */ + title?: string; + } + + export interface HyperlinkColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the hyperlink. + */ + title?: string; + + /** + * The url to open. + */ + url?: string; + /** + * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. + */ + role?: 'button' | 'link'; + } + + export interface ContextMenuColumnCellValue { + /** + * The title of the hyperlink. By default, the title is 'Show Actions' + */ + title?: string; + /** + * commands for the menu. Use an array for a group and menu separators will be added. + */ + commands: (string | string[])[]; + /** + * context that will be passed to the commands. + */ + context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined + } + + export enum ColumnType { + icon = 3, + hyperlink = 4, + contextMenu = 5 + } + + export interface TableColumn { + /** + * The text to display on the column heading. 'value' property will be used, if not specified + */ + name?: string; + + /** + * whether the column is resizable. Default value is true. + */ + resizable?: boolean; + } + + export interface IconColumnOptions { + /** + * The icon to use for all the cells in this column. + */ + icon?: IconPath; + } + + export interface ButtonColumn extends IconColumnOptions, TableColumn { + /** + * Whether to show the text, default value is false. + */ + showText?: boolean; + } + + export interface HyperlinkColumn extends IconColumnOptions, TableColumn { + } + + export interface CheckboxColumn extends TableColumn { + action: ActionOnCellCheckboxCheck; + } + + export interface ContextMenuColumn extends TableColumn { + } + + export interface QueryExecuteResultSetNotificationParams { + /** + * Contains execution plans returned by the database in ResultSets. + */ + executionPlans: executionPlan.ExecutionPlanGraph[]; + } + + export interface ObjectMetadata { + /* + * Parent object name for subobjects such as triggers, indexes, etc. + */ + parentName?: string; + + /* + * Parent object type name, such as Table, View, etc. + */ + parentTypeName?: string; + } + + /** + * Represents a selected range in the result grid. + */ + export interface SelectionRange { + fromRow: number; + toRow: number; + fromColumn: number; + toColumn: number; + } + + /** + * Parameters for the copy results request. + */ + export interface CopyResultsRequestParams { + /** + * URI of the editor. + */ + ownerUri: string; + /** + * Index of the batch. + */ + batchIndex: number; + /** + * Index of the result set. + */ + resultSetIndex: number; + /** + * Whether to include the column headers. + */ + includeHeaders: boolean + /** + * The selected ranges to be copied. + */ + selections: SelectionRange[]; + /** + * * Whether to copy the results directly from the backend. + */ + copyInBackend: boolean; + } + + export interface CopyResultsRequestResult { + /** + * Result string from copy operation + */ + results: string; + } + + export interface QueryProvider { + /** + * Notify clients that the URI for a connection has been changed. + */ + connectionUriChanged?(newUri: string, oldUri: string): Thenable; + /** + * Copy the selected data to the clipboard. + * This is introduced to address the performance issue of large amount of data to ADS side. + * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. + * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. + */ + copyResults?(requestParams: CopyResultsRequestParams): Thenable; + } + + export enum DataProviderType { + TableDesignerProvider = 'TableDesignerProvider', + ExecutionPlanProvider = 'ExecutionPlanProvider', + ServerContextualizationProvider = 'ServerContextualizationProvider' + } + + export namespace dataprotocol { + export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; + export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; + /** + * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub + * Copilot for improved suggestions. + * @param provider The provider to register + */ + export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; + } + + export namespace designers { + /** + * Open a table designer window. + * @param providerId The table designer provider Id. + * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. + * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry + * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited + */ + export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; + + /** + * Definition for the table designer provider. + */ + export interface TableDesignerProvider extends DataProvider { + /** + * Initialize the table designer for the specified table. + * @param table the table information. + */ + initializeTableDesigner(table: TableInfo): Thenable; + + /** + * Process the table change. + * @param table the table information + * @param tableChangeInfo the information about the change user made through the UI. + */ + processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; + + /** + * Publish the changes. + * @param table the table information + */ + publishChanges(table: TableInfo): Thenable; + + /** + * Generate script for the changes. + * @param table the table information + */ + generateScript(table: TableInfo): Thenable; + + /** + * Generate preview report describing the changes to be made. + * @param table the table information + */ + generatePreviewReport(table: TableInfo): Thenable; + + /** + * Notify the provider that the table designer has been closed. + * @param table the table information + */ + disposeTableDesigner(table: TableInfo): Thenable; + } + + /** + * The information of the table. + */ + export interface TableInfo { + /** + * Used as the table designer editor's tab header text. + */ + title: string; + /** + * Used as the table designer editor's tab header hover text. + */ + tooltip: string; + /** + * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. + */ + id: string; + /** + * A boolean value indicates whether a new table is being designed. + */ + isNewTable: boolean; + /** + * Extension can store additional information that the provider needs to uniquely identify a table. + */ + [key: string]: any; + /** + * Table icon type that's shown in the editor tab. Default is the basic + * table icon. + */ + tableIcon?: TableIcon; + } + + /** + * The information to populate the table designer UI. + */ + export interface TableDesignerInfo { + /** + * The view definition. + */ + view: TableDesignerView; + /** + * The initial state of the designer. + */ + viewModel: DesignerViewModel; + /** + * The new table info after initialization. + */ + tableInfo: TableInfo; + /** + * The issues. + */ + issues?: DesignerIssue[]; + } + + /** + * Table icon that's shown on the editor tab + */ + export enum TableIcon { + Basic = 'Basic', + Temporal = 'Temporal', + GraphNode = 'GraphNode', + GraphEdge = 'GraphEdge' + } + + /** + * Name of the common table properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableProperty { + Columns = 'columns', + Description = 'description', + Name = 'name', + Schema = 'schema', + Script = 'script', + ForeignKeys = 'foreignKeys', + CheckConstraints = 'checkConstraints', + Indexes = 'indexes', + PrimaryKey = 'primaryKey', + PrimaryKeyName = 'primaryKeyName', + PrimaryKeyDescription = 'primaryKeyDescription', + PrimaryKeyColumns = 'primaryKeyColumns' + } + /** + * Name of the common table column properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableColumnProperty { + AllowNulls = 'allowNulls', + DefaultValue = 'defaultValue', + Length = 'length', + Name = 'name', + Description = 'description', + Type = 'type', + AdvancedType = 'advancedType', + IsPrimaryKey = 'isPrimaryKey', + Precision = 'precision', + Scale = 'scale' + } + + /** + * Name of the common foreign key constraint properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableForeignKeyProperty { + Name = 'name', + Description = 'description', + ForeignTable = 'foreignTable', + OnDeleteAction = 'onDeleteAction', + OnUpdateAction = 'onUpdateAction', + Columns = 'columns' + } + + /** + * Name of the columns mapping properties for foreign key. + */ + export enum ForeignKeyColumnMappingProperty { + Column = 'column', + ForeignColumn = 'foreignColumn' + } + + /** + * Name of the common check constraint properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableCheckConstraintProperty { + Name = 'name', + Description = 'description', + Expression = 'expression' + } + + /** + * Name of the common index properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableIndexProperty { + Name = 'name', + Description = 'description', + Columns = 'columns' + } + + /** + * Name of the common properties of table index column specification. + */ + export enum TableIndexColumnSpecificationProperty { + Column = 'column' + } + + /** + * The table designer view definition. + */ + export interface TableDesignerView { + /** + * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} + */ + additionalTableProperties?: DesignerDataPropertyInfo[]; + /** + * Additional tabs. + */ + additionalTabs?: DesignerTab[]; + /** + * Columns table options. + * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. + * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. + */ + columnTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign keys table options. + * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. + * Default columns to display values are: Name, PrimaryKeyTable. + */ + foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign key column mapping table options. + * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. + * Default columns to display values are: Column, ForeignColumn. + */ + foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Check constraints table options. + * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} + * Default columns to display values are: Name, Expression. + */ + checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Indexes table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} + * Default columns to display values are: Name. + */ + indexTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Index column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Primary column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. + */ + additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; + /** + * Components to be placed under the pre-defined tabs. + */ + additionalComponents?: DesignerDataPropertyWithTabInfo[]; + /** + * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. + */ + useAdvancedSaveMode: boolean; + } + + export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { + /** + * Whether to show the table. Default value is false. + */ + showTable?: boolean; + /** + * Properties to be displayed in the table, other properties can be accessed in the properties view. + */ + propertiesToDisplay?: string[]; + /** + * Additional properties for the entity. + */ + additionalProperties?: DesignerDataPropertyInfo[]; + } + + /** + * The view model of the designer. + */ + export interface DesignerViewModel { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of a designer tab. + */ + export interface DesignerTab { + /** + * The title of the tab. + */ + title: string; + /** + * the components to be displayed in this tab. + */ + components: DesignerDataPropertyInfo[]; + } + + /** + * The definition of the property in the designer. + */ + export interface DesignerDataPropertyInfo { + /** + * The property name. + */ + propertyName: string; + /** + * The description of the property. + */ + description?: string; + /** + * The component type. + */ + componentType: DesignerComponentTypeName; + /** + * The group name, properties with the same group name will be displayed under the same group on the UI. + */ + group?: string; + /** + * Whether the property should be displayed in the properties view. The default value is true. + */ + showInPropertiesView?: boolean; + /** + * The properties of the component. + */ + componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of the property in the designer with tab info. + */ + export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { + /** + * The tab info where this property belongs to. + */ + tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; + } + + /** + * The child component types supported by designer. + */ + export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; + + export interface DesignerTablePropertiesBase { + /** + * Whether user can add new rows to the table. The default value is true. + */ + canAddRows?: boolean; + /** + * Whether user can remove rows from the table. The default value is true. + */ + canRemoveRows?: boolean; + /** + * Whether user can move rows from one index to another. The default value is true. + */ + canMoveRows?: boolean; + /** + * Whether user can insert rows at a given index to the table. The default value is true. + */ + canInsertRows?: boolean; + /** + * Whether to show confirmation when user removes a row. The default value is false. + */ + showRemoveRowConfirmation?: boolean; + /** + * The confirmation message to be displayed when user removes a row. + */ + removeRowConfirmationMessage?: string; + /** + * Whether to show the item detail in properties view. The default value is true. + */ + showItemDetailInPropertiesView?: boolean; + /** + * The label of the add new button. The default value is 'Add New'. + */ + labelForAddNewButton?: string; + } + + /** + * The properties for the table component in the designer. + */ + export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { + /** + * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. + */ + columns?: string[]; + /** + * The display name of the object type. + */ + objectTypeDisplayName: string; + /** + * the properties of the table data item. + */ + itemProperties?: DesignerDataPropertyInfo[]; + /** + * The data to be displayed. + */ + data?: DesignerTableComponentDataItem[]; + } + + /** + * The data item of the designer's table component. + */ + export interface DesignerTableComponentDataItem { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; + /** + * Whether the row can be deleted. The default value is true. + */ + canBeDeleted?: boolean; + } + + /** + * Type of the edit originated from the designer UI. + */ + export enum DesignerEditType { + /** + * Add a row to a table. + */ + Add = 0, + /** + * Remove a row from a table. + */ + Remove = 1, + /** + * Update a property. + */ + Update = 2, + /** + * Change the position of an item in the collection. + */ + Move = 3 + } + + /** + * Information of the edit originated from the designer UI. + */ + export interface DesignerEdit { + /** + * The edit type. + */ + type: DesignerEditType; + /** + * the path of the edit target. + */ + path: DesignerPropertyPath; + /** + * the new value. + */ + value?: any; + } + + /** + * The path of the property. + * Below are the 3 scenarios and their expected path. + * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. + * 1. 'Add' scenario + * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. + * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. + * 2. 'Update' scenario + * a. ['propertyName1']. Example: update the name of the table: ['name']. + * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. + * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. + * 3. 'Remove' scenario + * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. + * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. + */ + export type DesignerPropertyPath = (string | number)[]; + + /** + * Severity of the messages returned by the provider after processing an edit. + * 'error': The issue must be fixed in order to commit the changes. + * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. + * 'information': Informational message. + */ + export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; + + /** + * Represents the issue in the designer + */ + export interface DesignerIssue { + /** + * Severity of the issue. + */ + severity: DesignerIssueSeverity, + /** + * Path of the property that is associated with the issue. + */ + propertyPath?: DesignerPropertyPath, + /** + * Description of the issue. + */ + description: string, + /** + * Url to a web page that has the explaination of the issue. + */ + moreInfoLink?: string; + } + + /** + * The result returned by the table designer provider after handling an edit request. + */ + export interface DesignerEditResult { + /** + * The new view information if the view needs to be refreshed. + */ + view?: T; + /** + * The view model object. + */ + viewModel: DesignerViewModel; + /** + * Whether the current state is valid. + */ + isValid: boolean; + /** + * Issues of current state. + */ + issues?: DesignerIssue[]; + /** + * The input validation error. + */ + inputValidationError?: string; + /** + * Metadata related to the table + */ + metadata?: { [key: string]: string }; + } + + /** + * The result returned by the table designer provider after handling the publish changes request. + */ + export interface PublishChangesResult { + /** + * The new table information after the changes are published. + */ + newTableInfo: TableInfo; + /** + * The new view model. + */ + viewModel: DesignerViewModel; + /** + * The new view. + */ + view: TableDesignerView; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + + export interface GeneratePreviewReportResult { + /** + * Report generated for generate preview + */ + report: string; + /** + * Format (mimeType) of the report + */ + mimeType: string; + /** + * Whether user confirmation is required, the default value is false. + */ + requireConfirmation?: boolean; + /** + * The confirmation text. + */ + confirmationText?: string; + /** + * The table schema validation error. + */ + schemaValidationError?: string; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + } + + export namespace executionPlan { + export interface ExecutionPlanGraph { + /** + * Root of the execution plan tree + */ + root: ExecutionPlanNode; + /** + * Underlying query for the execution plan graph. + */ + query: string; + /** + * String representation of graph + */ + graphFile: ExecutionPlanGraphInfo; + /** + * Query recommendations for optimizing performance + */ + recommendations: ExecutionPlanRecommendations[]; + } + + export interface ExecutionPlanNode { + /** + * Unique id given to node by the provider + */ + id: string; + /** + * Type of the node. This property determines the icon that is displayed for it + */ + type: string; + /** + * Cost associated with the node + */ + cost: number; + /** + * Cost of the node subtree + */ + subTreeCost: number; + /** + * Relative cost of the node compared to its siblings. + */ + relativeCost: number; + /** + * Time take by the node operation in milliseconds + */ + elapsedTimeInMs: number; + /** + * CPU time taken by the node operation in milliseconds + */ + elapsedCpuTimeInMs: number; + /** + * Node properties to be shown in the tooltip + */ + properties: ExecutionPlanGraphElementProperty[]; + /** + * Display name for the node + */ + name: string; + /** + * Description associated with the node. + */ + description: string; + /** + * Subtext displayed under the node name + */ + subtext: string[]; + /** + * Direct children of the nodes. + */ + children: ExecutionPlanNode[]; + /** + * Edges corresponding to the children. + */ + edges: ExecutionPlanEdge[]; + /** + * Warning/parallelism badges applicable to the current node + */ + badges: ExecutionPlanBadge[]; + /** + * Data to show in top operations table for the node. + */ + topOperationsData: TopOperationsDataItem[]; + /** + * Output row count associated with the node + */ + rowCountDisplayString: string; + /** + * Cost string for the node + */ + costDisplayString: string; + /** + * Cost metrics for the node + */ + costMetrics: CostMetric[]; + } + + export interface CostMetric { + /** + * Name of the cost metric. + */ + name: string; + /** + * The value of the cost metric + */ + value: number | undefined; + } + + export interface ExecutionPlanBadge { + /** + * Type of the node overlay. This determines the icon that is displayed for it + */ + type: BadgeType; + /** + * Text to display for the overlay tooltip + */ + tooltip: string; + } + + export enum BadgeType { + Warning = 0, + CriticalWarning = 1, + Parallelism = 2 + } + + export interface ExecutionPlanEdge { + /** + * Count of the rows returned by the subtree of the edge. + */ + rowCount: number; + /** + * Size of the rows returned by the subtree of the edge. + */ + rowSize: number; + /** + * Edge properties to be shown in the tooltip. + */ + properties: ExecutionPlanGraphElementProperty[] + } + + export interface ExecutionPlanGraphElementProperty { + /** + * Name of the property + */ + name: string; + /** + * value for the property + */ + value: string | ExecutionPlanGraphElementProperty[]; + /** + * Flag to show/hide props in tooltip + */ + showInTooltip: boolean; + /** + * Display order of property + */ + displayOrder: number; + /** + * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip + */ + positionAtBottom: boolean; + /** + * Display value of property to show in tooltip and other UI element. + */ + displayValue: string; + /** + * Data type of the property value + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Indicates which value is better when 2 similar properties are compared. + */ + betterValue: ExecutionPlanGraphElementPropertyBetterValue; + } + + export enum ExecutionPlanGraphElementPropertyDataType { + Number = 0, + String = 1, + Boolean = 2, + Nested = 3 + } + + export enum ExecutionPlanGraphElementPropertyBetterValue { + LowerNumber = 0, + HigherNumber = 1, + True = 2, + False = 3, + None = 4 + } + + export interface ExecutionPlanRecommendations { + /** + * Text displayed in the show plan graph control description + */ + displayString: string; + /** + * Query that is recommended to the user + */ + queryText: string; + /** + * Query that will be opened in a new file once the user click on the recommendation + */ + queryWithDescription: string; + } + + export interface ExecutionPlanGraphInfo { + /** + * File contents + */ + graphFileContent: string; + /** + * File type for execution plan. This will be the file type of the editor when the user opens the graph file + */ + graphFileType: string; + /** + * Index of the execution plan in the file content + */ + planIndexInFile?: number; + } + + export interface GetExecutionPlanResult extends ResultStatus { + graphs: ExecutionPlanGraph[] + } + + export interface ExecutionGraphComparisonResult { + /** + * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. + */ + baseNode: ExecutionPlanNode; + /** + * The children of the ExecutionGraphComparisonResult. + */ + children: ExecutionGraphComparisonResult[]; + /** + * The group index of the ExecutionGraphComparisonResult. + */ + groupIndex: number; + /** + * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. + */ + hasMatch: boolean; + /** + * List of matching nodes for the ExecutionGraphComparisonResult. + */ + matchingNodesId: number[]; + /** + * The parent of the ExecutionGraphComparisonResult. + */ + parentNode: ExecutionGraphComparisonResult; + } + + export interface ExecutionPlanComparisonResult extends ResultStatus { + firstComparisonResult: ExecutionGraphComparisonResult; + secondComparisonResult: ExecutionGraphComparisonResult; + } + + export interface IsExecutionPlanResult { + isExecutionPlan: boolean; + queryExecutionPlanFileExtension: string; + } + + export interface ExecutionPlanProvider extends DataProvider { + // execution plan service methods + + /** + * Gets the execution plan graph from the provider for a given plan file + * @param planFile file that contains the execution plan + */ + getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; + /** + * Compares two execution plans and identifies matching regions in both execution plans. + * @param firstPlanFile file that contains the first execution plan. + * @param secondPlanFile file that contains the second execution plan. + */ + compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; + /** + * Determines if the provided value is an execution plan and returns the appropriate file extension. + * @param value String that needs to be checked. + */ + isExecutionPlan(value: string): Thenable; + } + + export interface TopOperationsDataItem { + /** + * Column name for the top operation data item + */ + columnName: string; + /** + * Cell data type for the top operation data item + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Cell value for the top operation data item + */ + displayValue: string | number | boolean; + } + } + + export namespace contextualization { + export interface GetServerContextualizationResult { + /** + * The retrieved server context. + */ + context: string | undefined; + } + + export interface ServerContextualizationProvider extends DataProvider { + /** + * Gets server context, which can be in the form of create scripts but is left up each provider. + * @param ownerUri The URI of the connection to get context for. + */ + getServerContextualization(ownerUri: string): Thenable; + } + } + + /** + * Component to display text with an icon representing the severity + */ + export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { + /** + * An event fired when the InfoBox is clicked + */ + onDidClick: vscode.Event; + /** + * An event fired when the Infobox link is clicked + */ + onLinkClick: vscode.Event; + } + + export interface InfoBoxComponentProperties { + /** + * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. + * Default value is false. + */ + isClickable?: boolean | undefined; + + /** + * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes + */ + clickableButtonAriaLabel?: string; + + /** + * List of links to embed within the text. If links are specified there must be placeholder + * values in the value indicating where the links should be placed, in the format {i} + * + * e.g. "Click {0} for more information!"" + */ + links?: LinkArea[]; + } + + /** + * Event argument for infobox link click event. + */ + export interface InfoBoxLinkClickEventArgs { + /** + * Index of the link selected + */ + index: number; + /** + * Link that is clicked + */ + link: LinkArea; + } + + export interface TextComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface ContainerProperties extends ComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface DropDownProperties { + /** + * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. + */ + strictSelection?: boolean; + } + + export interface NodeInfo { + /** + * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node + * under the database, the nodeType is Folder, the objectType is be Tables. + */ + objectType?: string; + /* + * The path of the parent node. + */ + parentNodePath: string; + /** + * Filterable properties that this node supports + */ + filterableProperties?: NodeFilterProperty[]; + } + + export interface NodeFilterProperty { + /** + * The non-localized name of the filter property + */ + name: string; + /** + * The name of the filter property displayed to the user + */ + displayName: string; + /** + * The type of the filter property + */ + type: NodeFilterPropertyDataType; + /** + * The description of the filter property + */ + description: string; + } + + /** + * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice + */ + export interface NodeFilterChoiceProperty extends NodeFilterProperty { + /** + * The list of choices for the filter property if the type is choice + */ + choices: NodeFilterChoicePropertyValue[]; + } + + export interface NodeFilterChoicePropertyValue { + /** + * The value of the choice + */ + value: string; + /** + * The display name of the choice + * If not specified, the value will be used as the display name + * If specified, the display name will be used in the dropdown + */ + displayName?: string; + } + + export interface NodeFilter { + /** + * The name of the filter property + */ + name: string; + /** + * The operator of the filter property + */ + operator: NodeFilterOperator; + /** + * The applied values of the filter property + */ + value: string | string[] | number | number[] | boolean | undefined; + } + + export enum NodeFilterPropertyDataType { + String = 0, + Number = 1, + Boolean = 2, + Date = 3, + Choice = 4 + } + + export enum NodeFilterOperator { + Equals = 0, + NotEquals = 1, + LessThan = 2, + LessThanOrEquals = 3, + GreaterThan = 4, + GreaterThanOrEquals = 5, + Between = 6, + NotBetween = 7, + Contains = 8, + NotContains = 9, + StartsWith = 10, + NotStartsWith = 11, + EndsWith = 12, + NotEndsWith = 13 + } + + export interface ModelView extends vscode.Disposable { } + + export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } + + export namespace window { + export interface Wizard extends LoadingComponentBase { } + + export interface Dialog extends LoadingComponentBase, vscode.Disposable { } + + export interface ModelViewPanel extends vscode.Disposable { } + + export interface ModelViewDashboard extends vscode.Disposable { } + + /** + * Opens the error dialog with customization options provided. + * @param options Dialog options to customize error dialog. + * @returns Id of action button clicked by user, e.g. ok, cancel + */ + export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; + + /** + * Provides dialog options to customize modal dialog content and layout + */ + export interface IErrorDialogOptions { + /** + * Severity Level to identify icon of modal dialog. + */ + severity: MessageLevel; + /** + * Title of modal dialog header. + */ + headerTitle: string; + /** + * Message text to show on dialog. + */ + message: string; + /** + * (Optional) Detailed message, e.g stack trace of error. + */ + messageDetails?: string; + /** + * Telemetry View to be used for emitting telemetry events. + */ + telemetryView?: string, + /** + * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. + * If custom 'actions' are not provided, 'OK' button will be shown by default. + */ + actions?: IDialogAction[]; + /** + * (Optional) If provided, instruction text is shown in bold below message. + */ + instructionText?: string; + /** + * (Optional) If provided, appends read more link after instruction text. + */ + readMoreLink?: string; + } + + /** + * An action that will be rendered as a button on the dialog. + */ + export interface IDialogAction { + /** + * Identifier of action. + */ + id: string; + /** + * Label of Action button. + */ + label: string; + /** + * Defines if button styling and focus should be based on primary action. + */ + isPrimary: boolean; + } + + export interface FileFilters { + /** + * The label to display in the file filter field next to the list of filters. + */ + label: string; + /** + * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). + */ + filters: string[]; + } + + /** + * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local + * files without any connection is opened via vscode.window.showOpenDialog. + * @param connectionUri The URI of the connection to the target server + * @param targetPath The file path on the server machine to open by default in the dialog + * @param fileFilters The filters used to limit which files are displayed in the file browser + * @param showFoldersOnly Optional argument to specify whether the browser should only show folders + * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. + */ + export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; + } + + export interface FileBrowserProvider extends DataProvider { + openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; + } + + export interface TableComponent { + /** + * Set active cell. + */ + setActiveCell(row: number, column: number): void; + } + + export interface ProfilerProvider { + startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; + } + + export enum ProfilingSessionType { + RemoteSession = 0, + LocalFile = 1 + } + + export interface SplitViewLayout extends FlexLayout { + /** + * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal + * If undefined, the size of the model view container is used + */ + splitViewSize?: number | string | undefined; + } } From 9e242e8e04d45976ffc4a86bd8c5b678b2e3fbda Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Mon, 26 Aug 2024 13:26:35 -0700 Subject: [PATCH 09/21] Indent using tabs --- src/azdata.proposed.d.ts | 4220 +++++++++++++++++++------------------- 1 file changed, 2110 insertions(+), 2110 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 8a5b6d9..720ed09 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -9,2114 +9,2114 @@ import * as vscode from 'vscode'; declare module 'azdata' { - export namespace nb { - export interface NotebookDocument { - /** - * Sets the trust mode for the notebook document. - */ - setTrusted(state: boolean): void; - } - - export interface ISessionOptions { - /** - * The spec for the kernel being used to create this session. - */ - kernelSpec?: IKernelSpec; - } - - export interface IKernelSpec { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages?: string[]; - } - - export interface IStandardKernel { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages: string[]; - readonly blockedOnSAW?: boolean; - } - - export interface IKernelChangedArgs { - nbKernelAlias?: string - } - - export interface ICellOutput { - /** - * Unique identifier for this cell output. - */ - id?: string; - } - - export interface IExecuteResult { - data: any; - } - - export interface IExecuteResultUpdate { - output_type: string; - resultSet: ResultSetSummary; - data: any; - } - - export interface IExecuteRequest { - /** - * The language of the notebook document that is executing this request. - */ - language: string; - } - - export interface INotebookMetadata { - connection_name?: string; - multi_connection_mode?: boolean; - } - - export interface ICellMetadata { - connection_name?: string; - } - - export interface ICellContents { - attachments?: ICellAttachments; - } - - export type ICellAttachments = { [key: string]: ICellAttachment }; - export type ICellAttachment = { [key: string]: string }; - - export interface SessionManager { - /** - * Shutdown all sessions. - */ - shutdownAll(): Thenable; - /** - * Disposes the session manager. - */ - dispose(): void; - } - - /** - * An event that is emitted when a {@link NotebookDocument} is closed. - */ - export const onDidCloseNotebookDocument: vscode.Event; - - export interface IKernel { - - /** - * Restart a kernel. - * - * #### Notes - * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). - * - * The promise is fulfilled on a valid response and rejected otherwise. - * - * It is assumed that the API call does not mutate the kernel id or name. - * - * The promise will be rejected if the kernel status is `Dead` or if the - * request fails or the response is invalid. - */ - restart(): Thenable; - } - } - - export interface LoadingComponentBase { - /** - * When true, the component will display a loading spinner. - */ - loading?: boolean; - - /** - * This sets the alert text which gets announced when the loading spinner is shown. - */ - loadingText?: string; - - /** - * The text to display while loading is set to false. Will also be announced through screen readers - * once loading is completed. - */ - loadingCompletedText?: string; - } - - /** - * The column information of a data set. - */ - export interface SimpleColumnInfo { - /** - * The column name. - */ - name: string; - /** - * The data type of the column. - */ - dataTypeName: string; - } - - /** - * The parameters for start data serialization request. - */ - export interface SerializeDataStartRequestParams { - /** - * 'csv', 'json', 'excel', 'xml' - */ - saveFormat: string; - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch of the data set to be serialized. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - /** - * The columns of the data set. - */ - columns: SimpleColumnInfo[]; - /** - * Whether to include column headers to the target file. - */ - includeHeaders?: boolean; - /** - * The delimiter to seperate the cells. - */ - delimiter?: string; - /** - * The line seperator. - */ - lineSeperator?: string; - /** - * Character used for enclosing text fields when saving results as CSV. - */ - textIdentifier?: string; - /** - * File encoding used when saving results as CSV. - */ - encoding?: string; - /** - * When true, XML output will be formatted when saving results as XML. - */ - formatted?: boolean; - } - - /** - * The parameters for continue data serialization request. - */ - export interface SerializeDataContinueRequestParams { - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - } - - /** - * The result of data serialization data request. - */ - export interface SerializeDataResult { - /** - * The output message. - */ - messages?: string; - /** - * Whether the serialization is succeeded. - */ - succeeded: boolean; - } - - /** - * The serialization provider. - */ - export interface SerializationProvider extends DataProvider { - /** - * Start the data serialization. - * @param requestParams the request parameters. - */ - startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; - /** - * Continue the data serialization. - * @param requestParams the request parameters. - */ - continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; - } - - export namespace dataprotocol { - /** - * Registers a SerializationProvider. - * @param provider The data serialization provider. - */ - export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; - export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; - /** - * Registers a DataGridProvider which is used to provide lists of items to a data grid - * @param provider The provider implementation - */ - export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; - } - - export enum DataProviderType { - DataGridProvider = 'DataGridProvider' - } - - /** - * The type of the DataGrid column - */ - export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; - - /** - * A column in a data grid - */ - export interface DataGridColumn { - /** - * The text to display on the column heading. - */ - name: string; - - /** - * The property name in the DataGridItem - */ - field: string; - - /** - * A unique identifier for the column within the grid. - */ - id: string; - - /** - * The type of column this is. This is used to determine how to render the contents. - */ - type: DataGridColumnType; - - /** - * Whether this column is sortable. - */ - sortable?: boolean; - - /** - * Whether this column is filterable - */ - filterable?: boolean; - - /** - * If false, column can no longer be resized. - */ - resizable?: boolean; - - /** - * If set to a non-empty string, a tooltip will appear on hover containing the string. - */ - tooltip?: string; - - /** - * Width of the column in pixels. - */ - width?: number - } - - /** - * Info for a command to execute - */ - export interface ExecuteCommandInfo { - /** - * The ID of the command to execute - */ - id: string; - /** - * The text to display for the action - */ - displayText?: string; - /** - * The optional args to pass to the command - */ - args?: any[]; - } - - /** - * Info for displaying a hyperlink value in a Data Grid table - */ - export interface DataGridHyperlinkInfo { - /** - * The text to display for the link - */ - displayText: string; - /** - * The URL to open or command to execute - */ - linkOrCommand: string | ExecuteCommandInfo; - } - - /** - * An item for displaying in a data grid - */ - export interface DataGridItem { - /** - * A unique identifier for this item - */ - id: string; - - /** - * The other properties that will be displayed in the grid columns - */ - [key: string]: string | DataGridHyperlinkInfo; - } - - /** - * A data provider that provides lists of resource items for a data grid - */ - export interface DataGridProvider extends DataProvider { - /** - * Gets the list of data grid items for this provider - */ - getDataGridItems(): Thenable; - /** - * Gets the list of data grid columns for this provider - */ - getDataGridColumns(): Thenable; - - /** - * The user visible string to use for the title of the grid - */ - title: string; - } - - export interface ConnectionProvider extends DataProvider { - /** - * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) - */ - changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; - } - - // Password Change Request ---------------------------------------------------------------------- - export interface PasswordChangeResult { - /** - * Whether the password change was successful - */ - result: boolean; - /** - * Error message if the password change was unsuccessful - */ - errorMessage?: string; - } - - export interface IConnectionProfile extends ConnectionInfo { - azureAccount?: string; - azureResourceId?: string; - azurePortalEndpoint?: string; - } - - export interface PromptFailedResult extends ProviderError { } - - export interface ProviderError { - /** - * Error name - */ - name?: string; - - /** - * Error code - */ - errorCode?: string; - - /** - * Error message - */ - errorMessage?: string; - } - - - export namespace diagnostics { - /** - * Represents a diagnostics provider of accounts. - */ - export interface ErrorDiagnosticsProviderMetadata { - /** - * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. - * Note: only ONE diagnostic provider per id/name at a time. - */ - targetProviderId: string; - } - - export interface ConnectionDiagnosticsResult { - /** - * Whether the error was handled or not. - */ - handled: boolean, - /** - * Whether reconnect should be attempted. - */ - reconnect?: boolean, - /** - * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. - */ - options?: { [name: string]: any }; - } - - /** - * Provides error information - */ - export interface IErrorInformation { - /** - * Error code - */ - errorCode: number, - /** - * Error Message - */ - errorMessage: string, - /** - * Stack trace of error - */ - messageDetails: string - } - - /** - * Diagnostics object for handling errors for a provider. - */ - export interface ErrorDiagnosticsProvider { - /** - * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. - * @param errorInfo The error information of the connection error. - * @param connection The connection profile that caused the error. - * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. - */ - handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; - } - - /** - * Registers provider with instance of Diagnostic Provider implementation. - * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. - * @param providerMetadata Additional data used to register the provider - * @param errorDiagnostics The provider's diagnostic object that handles errors. - * @returns A disposable that when disposed will unregister the provider - */ - export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; - } - - export namespace connection { - - /** - * Opens the change password dialog. - * @param profile The connection profile to change the password for. - * @returns The new password that is returned from the operation or undefined if unsuccessful. - */ - export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; - } - - export interface ConnectionInfoSummary { - /** - * ID used to identify the connection on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - export interface QueryExecuteCompleteNotificationResult { - /** - * ID used to identify the connection used to run the query on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - /* - * Add optional per-OS default value. - */ - export interface DefaultValueOsOverride { - os: string; - - defaultValueOverride: string; - } - - export interface ConnectionOption { - defaultValueOsOverrides?: DefaultValueOsOverride[]; - - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * When set to true, the respective connection option will be rendered on the main connection dialog - * and not the Advanced Options window. - */ - showOnConnectionDialog?: boolean; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - - export interface ServiceOption { - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - /** - * This change event defines actions - */ - export interface SelectionChangeEvent { - /** - * Values that affect actions defined in this event. - */ - values: string[]; - - /** - * Action to be taken on another option when selected value matches to the list of values provided. - */ - dependentOptionActions: DependentOptionAction[]; - } - - export interface DependentOptionAction { - /** - * Name of option affected by defined action. - */ - optionName: string, - - /** - * Action to be taken, Supported values: 'show', 'hide'. - */ - action: string; - - /** - * Whether or not the option should be set to required when visible. Defaults to false. - * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. - * When set to true, providers must handle property validation. - */ - required?: boolean; - } - - // Object Explorer interfaces -------------------------------- - export interface ObjectExplorerSession { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - } - - export interface ExpandNodeInfo { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - - /** - * Filters to apply to the child nodes being returned - */ - filters?: NodeFilter[]; - } - // End Object Explorer interfaces ---------------------------- - - export interface TaskInfo { - targetLocation?: string; - } - - export interface ButtonColumnOption { - icon?: IconPath; - } - - export namespace sqlAssessment { - - export enum SqlAssessmentTargetType { - Server = 1, - Database = 2 - } - - export enum SqlAssessmentResultItemKind { - RealResult = 0, - Warning = 1, - Error = 2 - } - } - // Assessment interfaces - - export interface SqlAssessmentResultItem { - rulesetVersion: string; - rulesetName: string; - targetType: sqlAssessment.SqlAssessmentTargetType; - targetName: string; - checkId: string; - tags: string[]; - displayName: string; - description: string; - message: string; - helpLink: string; - level: string; - timestamp: string; - kind: sqlAssessment.SqlAssessmentResultItemKind; - } - - export interface SqlAssessmentResult extends ResultStatus { - items: SqlAssessmentResultItem[]; - apiVersion: string; - } - - export interface SqlAssessmentServicesProvider extends DataProvider { - assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; - } - - export interface TreeItem2 extends vscode.TreeItem { - payload?: IConnectionProfile; - childProvider?: string; - type?: ExtensionNodeType; - } - - export interface Component extends vscode.Disposable { } - - export namespace workspace { - /** - * Creates and enters a workspace at the specified location - */ - export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; - - /** - * Enters the workspace with the provided path - * @param workspaceFile - */ - export function enterWorkspace(workspaceFile: vscode.Uri): Promise; - - /** - * Saves and enters the workspace with the provided path - * @param workspaceFile - */ - export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; - } - - export interface TableComponentProperties { - /** - * Specifies whether to use headerFilter plugin - */ - headerFilter?: boolean, - } - - export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; - - export interface ExecutionPlanComponentProperties extends ComponentProperties { - /** - * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs - */ - data?: ExecutionPlanData; - } - - /** - * Defines the executionPlan component - */ - export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { - } - - export interface ModelBuilder { - executionPlan(): ComponentBuilder; - } - - export interface ListViewOption { - /** - * The optional accessibility label for the column. Default is the label for the list view option. - */ - ariaLabel?: string; - /** - * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. - */ - icon?: IconPath; - } - - export interface IconColumnCellValue { - /** - * The icon to be displayed. - */ - icon: IconPath; - /** - * The title of the icon. - */ - title: string; - } - - export interface ButtonColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the button. - */ - title?: string; - } - - export interface HyperlinkColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the hyperlink. - */ - title?: string; - - /** - * The url to open. - */ - url?: string; - /** - * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. - */ - role?: 'button' | 'link'; - } - - export interface ContextMenuColumnCellValue { - /** - * The title of the hyperlink. By default, the title is 'Show Actions' - */ - title?: string; - /** - * commands for the menu. Use an array for a group and menu separators will be added. - */ - commands: (string | string[])[]; - /** - * context that will be passed to the commands. - */ - context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined - } - - export enum ColumnType { - icon = 3, - hyperlink = 4, - contextMenu = 5 - } - - export interface TableColumn { - /** - * The text to display on the column heading. 'value' property will be used, if not specified - */ - name?: string; - - /** - * whether the column is resizable. Default value is true. - */ - resizable?: boolean; - } - - export interface IconColumnOptions { - /** - * The icon to use for all the cells in this column. - */ - icon?: IconPath; - } - - export interface ButtonColumn extends IconColumnOptions, TableColumn { - /** - * Whether to show the text, default value is false. - */ - showText?: boolean; - } - - export interface HyperlinkColumn extends IconColumnOptions, TableColumn { - } - - export interface CheckboxColumn extends TableColumn { - action: ActionOnCellCheckboxCheck; - } - - export interface ContextMenuColumn extends TableColumn { - } - - export interface QueryExecuteResultSetNotificationParams { - /** - * Contains execution plans returned by the database in ResultSets. - */ - executionPlans: executionPlan.ExecutionPlanGraph[]; - } - - export interface ObjectMetadata { - /* - * Parent object name for subobjects such as triggers, indexes, etc. - */ - parentName?: string; - - /* - * Parent object type name, such as Table, View, etc. - */ - parentTypeName?: string; - } - - /** - * Represents a selected range in the result grid. - */ - export interface SelectionRange { - fromRow: number; - toRow: number; - fromColumn: number; - toColumn: number; - } - - /** - * Parameters for the copy results request. - */ - export interface CopyResultsRequestParams { - /** - * URI of the editor. - */ - ownerUri: string; - /** - * Index of the batch. - */ - batchIndex: number; - /** - * Index of the result set. - */ - resultSetIndex: number; - /** - * Whether to include the column headers. - */ - includeHeaders: boolean - /** - * The selected ranges to be copied. - */ - selections: SelectionRange[]; - /** - * * Whether to copy the results directly from the backend. - */ - copyInBackend: boolean; - } - - export interface CopyResultsRequestResult { - /** - * Result string from copy operation - */ - results: string; - } - - export interface QueryProvider { - /** - * Notify clients that the URI for a connection has been changed. - */ - connectionUriChanged?(newUri: string, oldUri: string): Thenable; - /** - * Copy the selected data to the clipboard. - * This is introduced to address the performance issue of large amount of data to ADS side. - * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. - * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. - */ - copyResults?(requestParams: CopyResultsRequestParams): Thenable; - } - - export enum DataProviderType { - TableDesignerProvider = 'TableDesignerProvider', - ExecutionPlanProvider = 'ExecutionPlanProvider', - ServerContextualizationProvider = 'ServerContextualizationProvider' - } - - export namespace dataprotocol { - export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; - export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; - /** - * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub - * Copilot for improved suggestions. - * @param provider The provider to register - */ - export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; - } - - export namespace designers { - /** - * Open a table designer window. - * @param providerId The table designer provider Id. - * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. - * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry - * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited - */ - export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; - - /** - * Definition for the table designer provider. - */ - export interface TableDesignerProvider extends DataProvider { - /** - * Initialize the table designer for the specified table. - * @param table the table information. - */ - initializeTableDesigner(table: TableInfo): Thenable; - - /** - * Process the table change. - * @param table the table information - * @param tableChangeInfo the information about the change user made through the UI. - */ - processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; - - /** - * Publish the changes. - * @param table the table information - */ - publishChanges(table: TableInfo): Thenable; - - /** - * Generate script for the changes. - * @param table the table information - */ - generateScript(table: TableInfo): Thenable; - - /** - * Generate preview report describing the changes to be made. - * @param table the table information - */ - generatePreviewReport(table: TableInfo): Thenable; - - /** - * Notify the provider that the table designer has been closed. - * @param table the table information - */ - disposeTableDesigner(table: TableInfo): Thenable; - } - - /** - * The information of the table. - */ - export interface TableInfo { - /** - * Used as the table designer editor's tab header text. - */ - title: string; - /** - * Used as the table designer editor's tab header hover text. - */ - tooltip: string; - /** - * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. - */ - id: string; - /** - * A boolean value indicates whether a new table is being designed. - */ - isNewTable: boolean; - /** - * Extension can store additional information that the provider needs to uniquely identify a table. - */ - [key: string]: any; - /** - * Table icon type that's shown in the editor tab. Default is the basic - * table icon. - */ - tableIcon?: TableIcon; - } - - /** - * The information to populate the table designer UI. - */ - export interface TableDesignerInfo { - /** - * The view definition. - */ - view: TableDesignerView; - /** - * The initial state of the designer. - */ - viewModel: DesignerViewModel; - /** - * The new table info after initialization. - */ - tableInfo: TableInfo; - /** - * The issues. - */ - issues?: DesignerIssue[]; - } - - /** - * Table icon that's shown on the editor tab - */ - export enum TableIcon { - Basic = 'Basic', - Temporal = 'Temporal', - GraphNode = 'GraphNode', - GraphEdge = 'GraphEdge' - } - - /** - * Name of the common table properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableProperty { - Columns = 'columns', - Description = 'description', - Name = 'name', - Schema = 'schema', - Script = 'script', - ForeignKeys = 'foreignKeys', - CheckConstraints = 'checkConstraints', - Indexes = 'indexes', - PrimaryKey = 'primaryKey', - PrimaryKeyName = 'primaryKeyName', - PrimaryKeyDescription = 'primaryKeyDescription', - PrimaryKeyColumns = 'primaryKeyColumns' - } - /** - * Name of the common table column properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableColumnProperty { - AllowNulls = 'allowNulls', - DefaultValue = 'defaultValue', - Length = 'length', - Name = 'name', - Description = 'description', - Type = 'type', - AdvancedType = 'advancedType', - IsPrimaryKey = 'isPrimaryKey', - Precision = 'precision', - Scale = 'scale' - } - - /** - * Name of the common foreign key constraint properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableForeignKeyProperty { - Name = 'name', - Description = 'description', - ForeignTable = 'foreignTable', - OnDeleteAction = 'onDeleteAction', - OnUpdateAction = 'onUpdateAction', - Columns = 'columns' - } - - /** - * Name of the columns mapping properties for foreign key. - */ - export enum ForeignKeyColumnMappingProperty { - Column = 'column', - ForeignColumn = 'foreignColumn' - } - - /** - * Name of the common check constraint properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableCheckConstraintProperty { - Name = 'name', - Description = 'description', - Expression = 'expression' - } - - /** - * Name of the common index properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableIndexProperty { - Name = 'name', - Description = 'description', - Columns = 'columns' - } - - /** - * Name of the common properties of table index column specification. - */ - export enum TableIndexColumnSpecificationProperty { - Column = 'column' - } - - /** - * The table designer view definition. - */ - export interface TableDesignerView { - /** - * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} - */ - additionalTableProperties?: DesignerDataPropertyInfo[]; - /** - * Additional tabs. - */ - additionalTabs?: DesignerTab[]; - /** - * Columns table options. - * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. - * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. - */ - columnTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign keys table options. - * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. - * Default columns to display values are: Name, PrimaryKeyTable. - */ - foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign key column mapping table options. - * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. - * Default columns to display values are: Column, ForeignColumn. - */ - foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Check constraints table options. - * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} - * Default columns to display values are: Name, Expression. - */ - checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Indexes table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} - * Default columns to display values are: Name. - */ - indexTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Index column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Primary column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. - */ - additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; - /** - * Components to be placed under the pre-defined tabs. - */ - additionalComponents?: DesignerDataPropertyWithTabInfo[]; - /** - * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. - */ - useAdvancedSaveMode: boolean; - } - - export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { - /** - * Whether to show the table. Default value is false. - */ - showTable?: boolean; - /** - * Properties to be displayed in the table, other properties can be accessed in the properties view. - */ - propertiesToDisplay?: string[]; - /** - * Additional properties for the entity. - */ - additionalProperties?: DesignerDataPropertyInfo[]; - } - - /** - * The view model of the designer. - */ - export interface DesignerViewModel { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of a designer tab. - */ - export interface DesignerTab { - /** - * The title of the tab. - */ - title: string; - /** - * the components to be displayed in this tab. - */ - components: DesignerDataPropertyInfo[]; - } - - /** - * The definition of the property in the designer. - */ - export interface DesignerDataPropertyInfo { - /** - * The property name. - */ - propertyName: string; - /** - * The description of the property. - */ - description?: string; - /** - * The component type. - */ - componentType: DesignerComponentTypeName; - /** - * The group name, properties with the same group name will be displayed under the same group on the UI. - */ - group?: string; - /** - * Whether the property should be displayed in the properties view. The default value is true. - */ - showInPropertiesView?: boolean; - /** - * The properties of the component. - */ - componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of the property in the designer with tab info. - */ - export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { - /** - * The tab info where this property belongs to. - */ - tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; - } - - /** - * The child component types supported by designer. - */ - export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; - - export interface DesignerTablePropertiesBase { - /** - * Whether user can add new rows to the table. The default value is true. - */ - canAddRows?: boolean; - /** - * Whether user can remove rows from the table. The default value is true. - */ - canRemoveRows?: boolean; - /** - * Whether user can move rows from one index to another. The default value is true. - */ - canMoveRows?: boolean; - /** - * Whether user can insert rows at a given index to the table. The default value is true. - */ - canInsertRows?: boolean; - /** - * Whether to show confirmation when user removes a row. The default value is false. - */ - showRemoveRowConfirmation?: boolean; - /** - * The confirmation message to be displayed when user removes a row. - */ - removeRowConfirmationMessage?: string; - /** - * Whether to show the item detail in properties view. The default value is true. - */ - showItemDetailInPropertiesView?: boolean; - /** - * The label of the add new button. The default value is 'Add New'. - */ - labelForAddNewButton?: string; - } - - /** - * The properties for the table component in the designer. - */ - export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { - /** - * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. - */ - columns?: string[]; - /** - * The display name of the object type. - */ - objectTypeDisplayName: string; - /** - * the properties of the table data item. - */ - itemProperties?: DesignerDataPropertyInfo[]; - /** - * The data to be displayed. - */ - data?: DesignerTableComponentDataItem[]; - } - - /** - * The data item of the designer's table component. - */ - export interface DesignerTableComponentDataItem { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; - /** - * Whether the row can be deleted. The default value is true. - */ - canBeDeleted?: boolean; - } - - /** - * Type of the edit originated from the designer UI. - */ - export enum DesignerEditType { - /** - * Add a row to a table. - */ - Add = 0, - /** - * Remove a row from a table. - */ - Remove = 1, - /** - * Update a property. - */ - Update = 2, - /** - * Change the position of an item in the collection. - */ - Move = 3 - } - - /** - * Information of the edit originated from the designer UI. - */ - export interface DesignerEdit { - /** - * The edit type. - */ - type: DesignerEditType; - /** - * the path of the edit target. - */ - path: DesignerPropertyPath; - /** - * the new value. - */ - value?: any; - } - - /** - * The path of the property. - * Below are the 3 scenarios and their expected path. - * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. - * 1. 'Add' scenario - * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. - * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. - * 2. 'Update' scenario - * a. ['propertyName1']. Example: update the name of the table: ['name']. - * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. - * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. - * 3. 'Remove' scenario - * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. - * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. - */ - export type DesignerPropertyPath = (string | number)[]; - - /** - * Severity of the messages returned by the provider after processing an edit. - * 'error': The issue must be fixed in order to commit the changes. - * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. - * 'information': Informational message. - */ - export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; - - /** - * Represents the issue in the designer - */ - export interface DesignerIssue { - /** - * Severity of the issue. - */ - severity: DesignerIssueSeverity, - /** - * Path of the property that is associated with the issue. - */ - propertyPath?: DesignerPropertyPath, - /** - * Description of the issue. - */ - description: string, - /** - * Url to a web page that has the explaination of the issue. - */ - moreInfoLink?: string; - } - - /** - * The result returned by the table designer provider after handling an edit request. - */ - export interface DesignerEditResult { - /** - * The new view information if the view needs to be refreshed. - */ - view?: T; - /** - * The view model object. - */ - viewModel: DesignerViewModel; - /** - * Whether the current state is valid. - */ - isValid: boolean; - /** - * Issues of current state. - */ - issues?: DesignerIssue[]; - /** - * The input validation error. - */ - inputValidationError?: string; - /** - * Metadata related to the table - */ - metadata?: { [key: string]: string }; - } - - /** - * The result returned by the table designer provider after handling the publish changes request. - */ - export interface PublishChangesResult { - /** - * The new table information after the changes are published. - */ - newTableInfo: TableInfo; - /** - * The new view model. - */ - viewModel: DesignerViewModel; - /** - * The new view. - */ - view: TableDesignerView; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - - export interface GeneratePreviewReportResult { - /** - * Report generated for generate preview - */ - report: string; - /** - * Format (mimeType) of the report - */ - mimeType: string; - /** - * Whether user confirmation is required, the default value is false. - */ - requireConfirmation?: boolean; - /** - * The confirmation text. - */ - confirmationText?: string; - /** - * The table schema validation error. - */ - schemaValidationError?: string; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - } - - export namespace executionPlan { - export interface ExecutionPlanGraph { - /** - * Root of the execution plan tree - */ - root: ExecutionPlanNode; - /** - * Underlying query for the execution plan graph. - */ - query: string; - /** - * String representation of graph - */ - graphFile: ExecutionPlanGraphInfo; - /** - * Query recommendations for optimizing performance - */ - recommendations: ExecutionPlanRecommendations[]; - } - - export interface ExecutionPlanNode { - /** - * Unique id given to node by the provider - */ - id: string; - /** - * Type of the node. This property determines the icon that is displayed for it - */ - type: string; - /** - * Cost associated with the node - */ - cost: number; - /** - * Cost of the node subtree - */ - subTreeCost: number; - /** - * Relative cost of the node compared to its siblings. - */ - relativeCost: number; - /** - * Time take by the node operation in milliseconds - */ - elapsedTimeInMs: number; - /** - * CPU time taken by the node operation in milliseconds - */ - elapsedCpuTimeInMs: number; - /** - * Node properties to be shown in the tooltip - */ - properties: ExecutionPlanGraphElementProperty[]; - /** - * Display name for the node - */ - name: string; - /** - * Description associated with the node. - */ - description: string; - /** - * Subtext displayed under the node name - */ - subtext: string[]; - /** - * Direct children of the nodes. - */ - children: ExecutionPlanNode[]; - /** - * Edges corresponding to the children. - */ - edges: ExecutionPlanEdge[]; - /** - * Warning/parallelism badges applicable to the current node - */ - badges: ExecutionPlanBadge[]; - /** - * Data to show in top operations table for the node. - */ - topOperationsData: TopOperationsDataItem[]; - /** - * Output row count associated with the node - */ - rowCountDisplayString: string; - /** - * Cost string for the node - */ - costDisplayString: string; - /** - * Cost metrics for the node - */ - costMetrics: CostMetric[]; - } - - export interface CostMetric { - /** - * Name of the cost metric. - */ - name: string; - /** - * The value of the cost metric - */ - value: number | undefined; - } - - export interface ExecutionPlanBadge { - /** - * Type of the node overlay. This determines the icon that is displayed for it - */ - type: BadgeType; - /** - * Text to display for the overlay tooltip - */ - tooltip: string; - } - - export enum BadgeType { - Warning = 0, - CriticalWarning = 1, - Parallelism = 2 - } - - export interface ExecutionPlanEdge { - /** - * Count of the rows returned by the subtree of the edge. - */ - rowCount: number; - /** - * Size of the rows returned by the subtree of the edge. - */ - rowSize: number; - /** - * Edge properties to be shown in the tooltip. - */ - properties: ExecutionPlanGraphElementProperty[] - } - - export interface ExecutionPlanGraphElementProperty { - /** - * Name of the property - */ - name: string; - /** - * value for the property - */ - value: string | ExecutionPlanGraphElementProperty[]; - /** - * Flag to show/hide props in tooltip - */ - showInTooltip: boolean; - /** - * Display order of property - */ - displayOrder: number; - /** - * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip - */ - positionAtBottom: boolean; - /** - * Display value of property to show in tooltip and other UI element. - */ - displayValue: string; - /** - * Data type of the property value - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Indicates which value is better when 2 similar properties are compared. - */ - betterValue: ExecutionPlanGraphElementPropertyBetterValue; - } - - export enum ExecutionPlanGraphElementPropertyDataType { - Number = 0, - String = 1, - Boolean = 2, - Nested = 3 - } - - export enum ExecutionPlanGraphElementPropertyBetterValue { - LowerNumber = 0, - HigherNumber = 1, - True = 2, - False = 3, - None = 4 - } - - export interface ExecutionPlanRecommendations { - /** - * Text displayed in the show plan graph control description - */ - displayString: string; - /** - * Query that is recommended to the user - */ - queryText: string; - /** - * Query that will be opened in a new file once the user click on the recommendation - */ - queryWithDescription: string; - } - - export interface ExecutionPlanGraphInfo { - /** - * File contents - */ - graphFileContent: string; - /** - * File type for execution plan. This will be the file type of the editor when the user opens the graph file - */ - graphFileType: string; - /** - * Index of the execution plan in the file content - */ - planIndexInFile?: number; - } - - export interface GetExecutionPlanResult extends ResultStatus { - graphs: ExecutionPlanGraph[] - } - - export interface ExecutionGraphComparisonResult { - /** - * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. - */ - baseNode: ExecutionPlanNode; - /** - * The children of the ExecutionGraphComparisonResult. - */ - children: ExecutionGraphComparisonResult[]; - /** - * The group index of the ExecutionGraphComparisonResult. - */ - groupIndex: number; - /** - * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. - */ - hasMatch: boolean; - /** - * List of matching nodes for the ExecutionGraphComparisonResult. - */ - matchingNodesId: number[]; - /** - * The parent of the ExecutionGraphComparisonResult. - */ - parentNode: ExecutionGraphComparisonResult; - } - - export interface ExecutionPlanComparisonResult extends ResultStatus { - firstComparisonResult: ExecutionGraphComparisonResult; - secondComparisonResult: ExecutionGraphComparisonResult; - } - - export interface IsExecutionPlanResult { - isExecutionPlan: boolean; - queryExecutionPlanFileExtension: string; - } - - export interface ExecutionPlanProvider extends DataProvider { - // execution plan service methods - - /** - * Gets the execution plan graph from the provider for a given plan file - * @param planFile file that contains the execution plan - */ - getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; - /** - * Compares two execution plans and identifies matching regions in both execution plans. - * @param firstPlanFile file that contains the first execution plan. - * @param secondPlanFile file that contains the second execution plan. - */ - compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; - /** - * Determines if the provided value is an execution plan and returns the appropriate file extension. - * @param value String that needs to be checked. - */ - isExecutionPlan(value: string): Thenable; - } - - export interface TopOperationsDataItem { - /** - * Column name for the top operation data item - */ - columnName: string; - /** - * Cell data type for the top operation data item - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Cell value for the top operation data item - */ - displayValue: string | number | boolean; - } - } - - export namespace contextualization { - export interface GetServerContextualizationResult { - /** - * The retrieved server context. - */ - context: string | undefined; - } - - export interface ServerContextualizationProvider extends DataProvider { - /** - * Gets server context, which can be in the form of create scripts but is left up each provider. - * @param ownerUri The URI of the connection to get context for. - */ - getServerContextualization(ownerUri: string): Thenable; - } - } - - /** - * Component to display text with an icon representing the severity - */ - export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { - /** - * An event fired when the InfoBox is clicked - */ - onDidClick: vscode.Event; - /** - * An event fired when the Infobox link is clicked - */ - onLinkClick: vscode.Event; - } - - export interface InfoBoxComponentProperties { - /** - * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. - * Default value is false. - */ - isClickable?: boolean | undefined; - - /** - * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes - */ - clickableButtonAriaLabel?: string; - - /** - * List of links to embed within the text. If links are specified there must be placeholder - * values in the value indicating where the links should be placed, in the format {i} - * - * e.g. "Click {0} for more information!"" - */ - links?: LinkArea[]; - } - - /** - * Event argument for infobox link click event. - */ - export interface InfoBoxLinkClickEventArgs { - /** - * Index of the link selected - */ - index: number; - /** - * Link that is clicked - */ - link: LinkArea; - } - - export interface TextComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface ContainerProperties extends ComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface DropDownProperties { - /** - * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. - */ - strictSelection?: boolean; - } - - export interface NodeInfo { - /** - * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node - * under the database, the nodeType is Folder, the objectType is be Tables. - */ - objectType?: string; - /* - * The path of the parent node. - */ - parentNodePath: string; - /** - * Filterable properties that this node supports - */ - filterableProperties?: NodeFilterProperty[]; - } - - export interface NodeFilterProperty { - /** - * The non-localized name of the filter property - */ - name: string; - /** - * The name of the filter property displayed to the user - */ - displayName: string; - /** - * The type of the filter property - */ - type: NodeFilterPropertyDataType; - /** - * The description of the filter property - */ - description: string; - } - - /** - * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice - */ - export interface NodeFilterChoiceProperty extends NodeFilterProperty { - /** - * The list of choices for the filter property if the type is choice - */ - choices: NodeFilterChoicePropertyValue[]; - } - - export interface NodeFilterChoicePropertyValue { - /** - * The value of the choice - */ - value: string; - /** - * The display name of the choice - * If not specified, the value will be used as the display name - * If specified, the display name will be used in the dropdown - */ - displayName?: string; - } - - export interface NodeFilter { - /** - * The name of the filter property - */ - name: string; - /** - * The operator of the filter property - */ - operator: NodeFilterOperator; - /** - * The applied values of the filter property - */ - value: string | string[] | number | number[] | boolean | undefined; - } - - export enum NodeFilterPropertyDataType { - String = 0, - Number = 1, - Boolean = 2, - Date = 3, - Choice = 4 - } - - export enum NodeFilterOperator { - Equals = 0, - NotEquals = 1, - LessThan = 2, - LessThanOrEquals = 3, - GreaterThan = 4, - GreaterThanOrEquals = 5, - Between = 6, - NotBetween = 7, - Contains = 8, - NotContains = 9, - StartsWith = 10, - NotStartsWith = 11, - EndsWith = 12, - NotEndsWith = 13 - } - - export interface ModelView extends vscode.Disposable { } - - export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } - - export namespace window { - export interface Wizard extends LoadingComponentBase { } - - export interface Dialog extends LoadingComponentBase, vscode.Disposable { } - - export interface ModelViewPanel extends vscode.Disposable { } - - export interface ModelViewDashboard extends vscode.Disposable { } - - /** - * Opens the error dialog with customization options provided. - * @param options Dialog options to customize error dialog. - * @returns Id of action button clicked by user, e.g. ok, cancel - */ - export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; - - /** - * Provides dialog options to customize modal dialog content and layout - */ - export interface IErrorDialogOptions { - /** - * Severity Level to identify icon of modal dialog. - */ - severity: MessageLevel; - /** - * Title of modal dialog header. - */ - headerTitle: string; - /** - * Message text to show on dialog. - */ - message: string; - /** - * (Optional) Detailed message, e.g stack trace of error. - */ - messageDetails?: string; - /** - * Telemetry View to be used for emitting telemetry events. - */ - telemetryView?: string, - /** - * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. - * If custom 'actions' are not provided, 'OK' button will be shown by default. - */ - actions?: IDialogAction[]; - /** - * (Optional) If provided, instruction text is shown in bold below message. - */ - instructionText?: string; - /** - * (Optional) If provided, appends read more link after instruction text. - */ - readMoreLink?: string; - } - - /** - * An action that will be rendered as a button on the dialog. - */ - export interface IDialogAction { - /** - * Identifier of action. - */ - id: string; - /** - * Label of Action button. - */ - label: string; - /** - * Defines if button styling and focus should be based on primary action. - */ - isPrimary: boolean; - } - - export interface FileFilters { - /** - * The label to display in the file filter field next to the list of filters. - */ - label: string; - /** - * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). - */ - filters: string[]; - } - - /** - * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local - * files without any connection is opened via vscode.window.showOpenDialog. - * @param connectionUri The URI of the connection to the target server - * @param targetPath The file path on the server machine to open by default in the dialog - * @param fileFilters The filters used to limit which files are displayed in the file browser - * @param showFoldersOnly Optional argument to specify whether the browser should only show folders - * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. - */ - export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; - } - - export interface FileBrowserProvider extends DataProvider { - openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; - } - - export interface TableComponent { - /** - * Set active cell. - */ - setActiveCell(row: number, column: number): void; - } - - export interface ProfilerProvider { - startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; - } - - export enum ProfilingSessionType { - RemoteSession = 0, - LocalFile = 1 - } - - export interface SplitViewLayout extends FlexLayout { - /** - * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal - * If undefined, the size of the model view container is used - */ - splitViewSize?: number | string | undefined; - } + export namespace nb { + export interface NotebookDocument { + /** + * Sets the trust mode for the notebook document. + */ + setTrusted(state: boolean): void; + } + + export interface ISessionOptions { + /** + * The spec for the kernel being used to create this session. + */ + kernelSpec?: IKernelSpec; + } + + export interface IKernelSpec { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages?: string[]; + } + + export interface IStandardKernel { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages: string[]; + readonly blockedOnSAW?: boolean; + } + + export interface IKernelChangedArgs { + nbKernelAlias?: string + } + + export interface ICellOutput { + /** + * Unique identifier for this cell output. + */ + id?: string; + } + + export interface IExecuteResult { + data: any; + } + + export interface IExecuteResultUpdate { + output_type: string; + resultSet: ResultSetSummary; + data: any; + } + + export interface IExecuteRequest { + /** + * The language of the notebook document that is executing this request. + */ + language: string; + } + + export interface INotebookMetadata { + connection_name?: string; + multi_connection_mode?: boolean; + } + + export interface ICellMetadata { + connection_name?: string; + } + + export interface ICellContents { + attachments?: ICellAttachments; + } + + export type ICellAttachments = { [key: string]: ICellAttachment }; + export type ICellAttachment = { [key: string]: string }; + + export interface SessionManager { + /** + * Shutdown all sessions. + */ + shutdownAll(): Thenable; + /** + * Disposes the session manager. + */ + dispose(): void; + } + + /** + * An event that is emitted when a {@link NotebookDocument} is closed. + */ + export const onDidCloseNotebookDocument: vscode.Event; + + export interface IKernel { + + /** + * Restart a kernel. + * + * #### Notes + * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). + * + * The promise is fulfilled on a valid response and rejected otherwise. + * + * It is assumed that the API call does not mutate the kernel id or name. + * + * The promise will be rejected if the kernel status is `Dead` or if the + * request fails or the response is invalid. + */ + restart(): Thenable; + } + } + + export interface LoadingComponentBase { + /** + * When true, the component will display a loading spinner. + */ + loading?: boolean; + + /** + * This sets the alert text which gets announced when the loading spinner is shown. + */ + loadingText?: string; + + /** + * The text to display while loading is set to false. Will also be announced through screen readers + * once loading is completed. + */ + loadingCompletedText?: string; + } + + /** + * The column information of a data set. + */ + export interface SimpleColumnInfo { + /** + * The column name. + */ + name: string; + /** + * The data type of the column. + */ + dataTypeName: string; + } + + /** + * The parameters for start data serialization request. + */ + export interface SerializeDataStartRequestParams { + /** + * 'csv', 'json', 'excel', 'xml' + */ + saveFormat: string; + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch of the data set to be serialized. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + /** + * The columns of the data set. + */ + columns: SimpleColumnInfo[]; + /** + * Whether to include column headers to the target file. + */ + includeHeaders?: boolean; + /** + * The delimiter to seperate the cells. + */ + delimiter?: string; + /** + * The line seperator. + */ + lineSeperator?: string; + /** + * Character used for enclosing text fields when saving results as CSV. + */ + textIdentifier?: string; + /** + * File encoding used when saving results as CSV. + */ + encoding?: string; + /** + * When true, XML output will be formatted when saving results as XML. + */ + formatted?: boolean; + } + + /** + * The parameters for continue data serialization request. + */ + export interface SerializeDataContinueRequestParams { + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + } + + /** + * The result of data serialization data request. + */ + export interface SerializeDataResult { + /** + * The output message. + */ + messages?: string; + /** + * Whether the serialization is succeeded. + */ + succeeded: boolean; + } + + /** + * The serialization provider. + */ + export interface SerializationProvider extends DataProvider { + /** + * Start the data serialization. + * @param requestParams the request parameters. + */ + startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; + /** + * Continue the data serialization. + * @param requestParams the request parameters. + */ + continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; + } + + export namespace dataprotocol { + /** + * Registers a SerializationProvider. + * @param provider The data serialization provider. + */ + export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; + export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; + /** + * Registers a DataGridProvider which is used to provide lists of items to a data grid + * @param provider The provider implementation + */ + export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; + } + + export enum DataProviderType { + DataGridProvider = 'DataGridProvider' + } + + /** + * The type of the DataGrid column + */ + export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; + + /** + * A column in a data grid + */ + export interface DataGridColumn { + /** + * The text to display on the column heading. + */ + name: string; + + /** + * The property name in the DataGridItem + */ + field: string; + + /** + * A unique identifier for the column within the grid. + */ + id: string; + + /** + * The type of column this is. This is used to determine how to render the contents. + */ + type: DataGridColumnType; + + /** + * Whether this column is sortable. + */ + sortable?: boolean; + + /** + * Whether this column is filterable + */ + filterable?: boolean; + + /** + * If false, column can no longer be resized. + */ + resizable?: boolean; + + /** + * If set to a non-empty string, a tooltip will appear on hover containing the string. + */ + tooltip?: string; + + /** + * Width of the column in pixels. + */ + width?: number + } + + /** + * Info for a command to execute + */ + export interface ExecuteCommandInfo { + /** + * The ID of the command to execute + */ + id: string; + /** + * The text to display for the action + */ + displayText?: string; + /** + * The optional args to pass to the command + */ + args?: any[]; + } + + /** + * Info for displaying a hyperlink value in a Data Grid table + */ + export interface DataGridHyperlinkInfo { + /** + * The text to display for the link + */ + displayText: string; + /** + * The URL to open or command to execute + */ + linkOrCommand: string | ExecuteCommandInfo; + } + + /** + * An item for displaying in a data grid + */ + export interface DataGridItem { + /** + * A unique identifier for this item + */ + id: string; + + /** + * The other properties that will be displayed in the grid columns + */ + [key: string]: string | DataGridHyperlinkInfo; + } + + /** + * A data provider that provides lists of resource items for a data grid + */ + export interface DataGridProvider extends DataProvider { + /** + * Gets the list of data grid items for this provider + */ + getDataGridItems(): Thenable; + /** + * Gets the list of data grid columns for this provider + */ + getDataGridColumns(): Thenable; + + /** + * The user visible string to use for the title of the grid + */ + title: string; + } + + export interface ConnectionProvider extends DataProvider { + /** + * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) + */ + changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; + } + + // Password Change Request ---------------------------------------------------------------------- + export interface PasswordChangeResult { + /** + * Whether the password change was successful + */ + result: boolean; + /** + * Error message if the password change was unsuccessful + */ + errorMessage?: string; + } + + export interface IConnectionProfile extends ConnectionInfo { + azureAccount?: string; + azureResourceId?: string; + azurePortalEndpoint?: string; + } + + export interface PromptFailedResult extends ProviderError { } + + export interface ProviderError { + /** + * Error name + */ + name?: string; + + /** + * Error code + */ + errorCode?: string; + + /** + * Error message + */ + errorMessage?: string; + } + + + export namespace diagnostics { + /** + * Represents a diagnostics provider of accounts. + */ + export interface ErrorDiagnosticsProviderMetadata { + /** + * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. + * Note: only ONE diagnostic provider per id/name at a time. + */ + targetProviderId: string; + } + + export interface ConnectionDiagnosticsResult { + /** + * Whether the error was handled or not. + */ + handled: boolean, + /** + * Whether reconnect should be attempted. + */ + reconnect?: boolean, + /** + * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. + */ + options?: { [name: string]: any }; + } + + /** + * Provides error information + */ + export interface IErrorInformation { + /** + * Error code + */ + errorCode: number, + /** + * Error Message + */ + errorMessage: string, + /** + * Stack trace of error + */ + messageDetails: string + } + + /** + * Diagnostics object for handling errors for a provider. + */ + export interface ErrorDiagnosticsProvider { + /** + * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. + * @param errorInfo The error information of the connection error. + * @param connection The connection profile that caused the error. + * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. + */ + handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; + } + + /** + * Registers provider with instance of Diagnostic Provider implementation. + * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. + * @param providerMetadata Additional data used to register the provider + * @param errorDiagnostics The provider's diagnostic object that handles errors. + * @returns A disposable that when disposed will unregister the provider + */ + export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; + } + + export namespace connection { + + /** + * Opens the change password dialog. + * @param profile The connection profile to change the password for. + * @returns The new password that is returned from the operation or undefined if unsuccessful. + */ + export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; + } + + export interface ConnectionInfoSummary { + /** + * ID used to identify the connection on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + export interface QueryExecuteCompleteNotificationResult { + /** + * ID used to identify the connection used to run the query on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + /* + * Add optional per-OS default value. + */ + export interface DefaultValueOsOverride { + os: string; + + defaultValueOverride: string; + } + + export interface ConnectionOption { + defaultValueOsOverrides?: DefaultValueOsOverride[]; + + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * When set to true, the respective connection option will be rendered on the main connection dialog + * and not the Advanced Options window. + */ + showOnConnectionDialog?: boolean; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + + export interface ServiceOption { + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + /** + * This change event defines actions + */ + export interface SelectionChangeEvent { + /** + * Values that affect actions defined in this event. + */ + values: string[]; + + /** + * Action to be taken on another option when selected value matches to the list of values provided. + */ + dependentOptionActions: DependentOptionAction[]; + } + + export interface DependentOptionAction { + /** + * Name of option affected by defined action. + */ + optionName: string, + + /** + * Action to be taken, Supported values: 'show', 'hide'. + */ + action: string; + + /** + * Whether or not the option should be set to required when visible. Defaults to false. + * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. + * When set to true, providers must handle property validation. + */ + required?: boolean; + } + + // Object Explorer interfaces -------------------------------- + export interface ObjectExplorerSession { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + } + + export interface ExpandNodeInfo { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + + /** + * Filters to apply to the child nodes being returned + */ + filters?: NodeFilter[]; + } + // End Object Explorer interfaces ---------------------------- + + export interface TaskInfo { + targetLocation?: string; + } + + export interface ButtonColumnOption { + icon?: IconPath; + } + + export namespace sqlAssessment { + + export enum SqlAssessmentTargetType { + Server = 1, + Database = 2 + } + + export enum SqlAssessmentResultItemKind { + RealResult = 0, + Warning = 1, + Error = 2 + } + } + // Assessment interfaces + + export interface SqlAssessmentResultItem { + rulesetVersion: string; + rulesetName: string; + targetType: sqlAssessment.SqlAssessmentTargetType; + targetName: string; + checkId: string; + tags: string[]; + displayName: string; + description: string; + message: string; + helpLink: string; + level: string; + timestamp: string; + kind: sqlAssessment.SqlAssessmentResultItemKind; + } + + export interface SqlAssessmentResult extends ResultStatus { + items: SqlAssessmentResultItem[]; + apiVersion: string; + } + + export interface SqlAssessmentServicesProvider extends DataProvider { + assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; + } + + export interface TreeItem2 extends vscode.TreeItem { + payload?: IConnectionProfile; + childProvider?: string; + type?: ExtensionNodeType; + } + + export interface Component extends vscode.Disposable { } + + export namespace workspace { + /** + * Creates and enters a workspace at the specified location + */ + export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; + + /** + * Enters the workspace with the provided path + * @param workspaceFile + */ + export function enterWorkspace(workspaceFile: vscode.Uri): Promise; + + /** + * Saves and enters the workspace with the provided path + * @param workspaceFile + */ + export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; + } + + export interface TableComponentProperties { + /** + * Specifies whether to use headerFilter plugin + */ + headerFilter?: boolean, + } + + export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; + + export interface ExecutionPlanComponentProperties extends ComponentProperties { + /** + * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs + */ + data?: ExecutionPlanData; + } + + /** + * Defines the executionPlan component + */ + export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { + } + + export interface ModelBuilder { + executionPlan(): ComponentBuilder; + } + + export interface ListViewOption { + /** + * The optional accessibility label for the column. Default is the label for the list view option. + */ + ariaLabel?: string; + /** + * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. + */ + icon?: IconPath; + } + + export interface IconColumnCellValue { + /** + * The icon to be displayed. + */ + icon: IconPath; + /** + * The title of the icon. + */ + title: string; + } + + export interface ButtonColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the button. + */ + title?: string; + } + + export interface HyperlinkColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the hyperlink. + */ + title?: string; + + /** + * The url to open. + */ + url?: string; + /** + * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. + */ + role?: 'button' | 'link'; + } + + export interface ContextMenuColumnCellValue { + /** + * The title of the hyperlink. By default, the title is 'Show Actions' + */ + title?: string; + /** + * commands for the menu. Use an array for a group and menu separators will be added. + */ + commands: (string | string[])[]; + /** + * context that will be passed to the commands. + */ + context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined + } + + export enum ColumnType { + icon = 3, + hyperlink = 4, + contextMenu = 5 + } + + export interface TableColumn { + /** + * The text to display on the column heading. 'value' property will be used, if not specified + */ + name?: string; + + /** + * whether the column is resizable. Default value is true. + */ + resizable?: boolean; + } + + export interface IconColumnOptions { + /** + * The icon to use for all the cells in this column. + */ + icon?: IconPath; + } + + export interface ButtonColumn extends IconColumnOptions, TableColumn { + /** + * Whether to show the text, default value is false. + */ + showText?: boolean; + } + + export interface HyperlinkColumn extends IconColumnOptions, TableColumn { + } + + export interface CheckboxColumn extends TableColumn { + action: ActionOnCellCheckboxCheck; + } + + export interface ContextMenuColumn extends TableColumn { + } + + export interface QueryExecuteResultSetNotificationParams { + /** + * Contains execution plans returned by the database in ResultSets. + */ + executionPlans: executionPlan.ExecutionPlanGraph[]; + } + + export interface ObjectMetadata { + /* + * Parent object name for subobjects such as triggers, indexes, etc. + */ + parentName?: string; + + /* + * Parent object type name, such as Table, View, etc. + */ + parentTypeName?: string; + } + + /** + * Represents a selected range in the result grid. + */ + export interface SelectionRange { + fromRow: number; + toRow: number; + fromColumn: number; + toColumn: number; + } + + /** + * Parameters for the copy results request. + */ + export interface CopyResultsRequestParams { + /** + * URI of the editor. + */ + ownerUri: string; + /** + * Index of the batch. + */ + batchIndex: number; + /** + * Index of the result set. + */ + resultSetIndex: number; + /** + * Whether to include the column headers. + */ + includeHeaders: boolean + /** + * The selected ranges to be copied. + */ + selections: SelectionRange[]; + /** + * * Whether to copy the results directly from the backend. + */ + copyInBackend: boolean; + } + + export interface CopyResultsRequestResult { + /** + * Result string from copy operation + */ + results: string; + } + + export interface QueryProvider { + /** + * Notify clients that the URI for a connection has been changed. + */ + connectionUriChanged?(newUri: string, oldUri: string): Thenable; + /** + * Copy the selected data to the clipboard. + * This is introduced to address the performance issue of large amount of data to ADS side. + * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. + * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. + */ + copyResults?(requestParams: CopyResultsRequestParams): Thenable; + } + + export enum DataProviderType { + TableDesignerProvider = 'TableDesignerProvider', + ExecutionPlanProvider = 'ExecutionPlanProvider', + ServerContextualizationProvider = 'ServerContextualizationProvider' + } + + export namespace dataprotocol { + export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; + export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; + /** + * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub + * Copilot for improved suggestions. + * @param provider The provider to register + */ + export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; + } + + export namespace designers { + /** + * Open a table designer window. + * @param providerId The table designer provider Id. + * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. + * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry + * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited + */ + export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; + + /** + * Definition for the table designer provider. + */ + export interface TableDesignerProvider extends DataProvider { + /** + * Initialize the table designer for the specified table. + * @param table the table information. + */ + initializeTableDesigner(table: TableInfo): Thenable; + + /** + * Process the table change. + * @param table the table information + * @param tableChangeInfo the information about the change user made through the UI. + */ + processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; + + /** + * Publish the changes. + * @param table the table information + */ + publishChanges(table: TableInfo): Thenable; + + /** + * Generate script for the changes. + * @param table the table information + */ + generateScript(table: TableInfo): Thenable; + + /** + * Generate preview report describing the changes to be made. + * @param table the table information + */ + generatePreviewReport(table: TableInfo): Thenable; + + /** + * Notify the provider that the table designer has been closed. + * @param table the table information + */ + disposeTableDesigner(table: TableInfo): Thenable; + } + + /** + * The information of the table. + */ + export interface TableInfo { + /** + * Used as the table designer editor's tab header text. + */ + title: string; + /** + * Used as the table designer editor's tab header hover text. + */ + tooltip: string; + /** + * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. + */ + id: string; + /** + * A boolean value indicates whether a new table is being designed. + */ + isNewTable: boolean; + /** + * Extension can store additional information that the provider needs to uniquely identify a table. + */ + [key: string]: any; + /** + * Table icon type that's shown in the editor tab. Default is the basic + * table icon. + */ + tableIcon?: TableIcon; + } + + /** + * The information to populate the table designer UI. + */ + export interface TableDesignerInfo { + /** + * The view definition. + */ + view: TableDesignerView; + /** + * The initial state of the designer. + */ + viewModel: DesignerViewModel; + /** + * The new table info after initialization. + */ + tableInfo: TableInfo; + /** + * The issues. + */ + issues?: DesignerIssue[]; + } + + /** + * Table icon that's shown on the editor tab + */ + export enum TableIcon { + Basic = 'Basic', + Temporal = 'Temporal', + GraphNode = 'GraphNode', + GraphEdge = 'GraphEdge' + } + + /** + * Name of the common table properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableProperty { + Columns = 'columns', + Description = 'description', + Name = 'name', + Schema = 'schema', + Script = 'script', + ForeignKeys = 'foreignKeys', + CheckConstraints = 'checkConstraints', + Indexes = 'indexes', + PrimaryKey = 'primaryKey', + PrimaryKeyName = 'primaryKeyName', + PrimaryKeyDescription = 'primaryKeyDescription', + PrimaryKeyColumns = 'primaryKeyColumns' + } + /** + * Name of the common table column properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableColumnProperty { + AllowNulls = 'allowNulls', + DefaultValue = 'defaultValue', + Length = 'length', + Name = 'name', + Description = 'description', + Type = 'type', + AdvancedType = 'advancedType', + IsPrimaryKey = 'isPrimaryKey', + Precision = 'precision', + Scale = 'scale' + } + + /** + * Name of the common foreign key constraint properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableForeignKeyProperty { + Name = 'name', + Description = 'description', + ForeignTable = 'foreignTable', + OnDeleteAction = 'onDeleteAction', + OnUpdateAction = 'onUpdateAction', + Columns = 'columns' + } + + /** + * Name of the columns mapping properties for foreign key. + */ + export enum ForeignKeyColumnMappingProperty { + Column = 'column', + ForeignColumn = 'foreignColumn' + } + + /** + * Name of the common check constraint properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableCheckConstraintProperty { + Name = 'name', + Description = 'description', + Expression = 'expression' + } + + /** + * Name of the common index properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableIndexProperty { + Name = 'name', + Description = 'description', + Columns = 'columns' + } + + /** + * Name of the common properties of table index column specification. + */ + export enum TableIndexColumnSpecificationProperty { + Column = 'column' + } + + /** + * The table designer view definition. + */ + export interface TableDesignerView { + /** + * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} + */ + additionalTableProperties?: DesignerDataPropertyInfo[]; + /** + * Additional tabs. + */ + additionalTabs?: DesignerTab[]; + /** + * Columns table options. + * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. + * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. + */ + columnTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign keys table options. + * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. + * Default columns to display values are: Name, PrimaryKeyTable. + */ + foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign key column mapping table options. + * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. + * Default columns to display values are: Column, ForeignColumn. + */ + foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Check constraints table options. + * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} + * Default columns to display values are: Name, Expression. + */ + checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Indexes table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} + * Default columns to display values are: Name. + */ + indexTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Index column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Primary column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. + */ + additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; + /** + * Components to be placed under the pre-defined tabs. + */ + additionalComponents?: DesignerDataPropertyWithTabInfo[]; + /** + * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. + */ + useAdvancedSaveMode: boolean; + } + + export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { + /** + * Whether to show the table. Default value is false. + */ + showTable?: boolean; + /** + * Properties to be displayed in the table, other properties can be accessed in the properties view. + */ + propertiesToDisplay?: string[]; + /** + * Additional properties for the entity. + */ + additionalProperties?: DesignerDataPropertyInfo[]; + } + + /** + * The view model of the designer. + */ + export interface DesignerViewModel { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of a designer tab. + */ + export interface DesignerTab { + /** + * The title of the tab. + */ + title: string; + /** + * the components to be displayed in this tab. + */ + components: DesignerDataPropertyInfo[]; + } + + /** + * The definition of the property in the designer. + */ + export interface DesignerDataPropertyInfo { + /** + * The property name. + */ + propertyName: string; + /** + * The description of the property. + */ + description?: string; + /** + * The component type. + */ + componentType: DesignerComponentTypeName; + /** + * The group name, properties with the same group name will be displayed under the same group on the UI. + */ + group?: string; + /** + * Whether the property should be displayed in the properties view. The default value is true. + */ + showInPropertiesView?: boolean; + /** + * The properties of the component. + */ + componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of the property in the designer with tab info. + */ + export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { + /** + * The tab info where this property belongs to. + */ + tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; + } + + /** + * The child component types supported by designer. + */ + export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; + + export interface DesignerTablePropertiesBase { + /** + * Whether user can add new rows to the table. The default value is true. + */ + canAddRows?: boolean; + /** + * Whether user can remove rows from the table. The default value is true. + */ + canRemoveRows?: boolean; + /** + * Whether user can move rows from one index to another. The default value is true. + */ + canMoveRows?: boolean; + /** + * Whether user can insert rows at a given index to the table. The default value is true. + */ + canInsertRows?: boolean; + /** + * Whether to show confirmation when user removes a row. The default value is false. + */ + showRemoveRowConfirmation?: boolean; + /** + * The confirmation message to be displayed when user removes a row. + */ + removeRowConfirmationMessage?: string; + /** + * Whether to show the item detail in properties view. The default value is true. + */ + showItemDetailInPropertiesView?: boolean; + /** + * The label of the add new button. The default value is 'Add New'. + */ + labelForAddNewButton?: string; + } + + /** + * The properties for the table component in the designer. + */ + export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { + /** + * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. + */ + columns?: string[]; + /** + * The display name of the object type. + */ + objectTypeDisplayName: string; + /** + * the properties of the table data item. + */ + itemProperties?: DesignerDataPropertyInfo[]; + /** + * The data to be displayed. + */ + data?: DesignerTableComponentDataItem[]; + } + + /** + * The data item of the designer's table component. + */ + export interface DesignerTableComponentDataItem { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; + /** + * Whether the row can be deleted. The default value is true. + */ + canBeDeleted?: boolean; + } + + /** + * Type of the edit originated from the designer UI. + */ + export enum DesignerEditType { + /** + * Add a row to a table. + */ + Add = 0, + /** + * Remove a row from a table. + */ + Remove = 1, + /** + * Update a property. + */ + Update = 2, + /** + * Change the position of an item in the collection. + */ + Move = 3 + } + + /** + * Information of the edit originated from the designer UI. + */ + export interface DesignerEdit { + /** + * The edit type. + */ + type: DesignerEditType; + /** + * the path of the edit target. + */ + path: DesignerPropertyPath; + /** + * the new value. + */ + value?: any; + } + + /** + * The path of the property. + * Below are the 3 scenarios and their expected path. + * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. + * 1. 'Add' scenario + * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. + * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. + * 2. 'Update' scenario + * a. ['propertyName1']. Example: update the name of the table: ['name']. + * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. + * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. + * 3. 'Remove' scenario + * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. + * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. + */ + export type DesignerPropertyPath = (string | number)[]; + + /** + * Severity of the messages returned by the provider after processing an edit. + * 'error': The issue must be fixed in order to commit the changes. + * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. + * 'information': Informational message. + */ + export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; + + /** + * Represents the issue in the designer + */ + export interface DesignerIssue { + /** + * Severity of the issue. + */ + severity: DesignerIssueSeverity, + /** + * Path of the property that is associated with the issue. + */ + propertyPath?: DesignerPropertyPath, + /** + * Description of the issue. + */ + description: string, + /** + * Url to a web page that has the explaination of the issue. + */ + moreInfoLink?: string; + } + + /** + * The result returned by the table designer provider after handling an edit request. + */ + export interface DesignerEditResult { + /** + * The new view information if the view needs to be refreshed. + */ + view?: T; + /** + * The view model object. + */ + viewModel: DesignerViewModel; + /** + * Whether the current state is valid. + */ + isValid: boolean; + /** + * Issues of current state. + */ + issues?: DesignerIssue[]; + /** + * The input validation error. + */ + inputValidationError?: string; + /** + * Metadata related to the table + */ + metadata?: { [key: string]: string }; + } + + /** + * The result returned by the table designer provider after handling the publish changes request. + */ + export interface PublishChangesResult { + /** + * The new table information after the changes are published. + */ + newTableInfo: TableInfo; + /** + * The new view model. + */ + viewModel: DesignerViewModel; + /** + * The new view. + */ + view: TableDesignerView; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + + export interface GeneratePreviewReportResult { + /** + * Report generated for generate preview + */ + report: string; + /** + * Format (mimeType) of the report + */ + mimeType: string; + /** + * Whether user confirmation is required, the default value is false. + */ + requireConfirmation?: boolean; + /** + * The confirmation text. + */ + confirmationText?: string; + /** + * The table schema validation error. + */ + schemaValidationError?: string; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + } + + export namespace executionPlan { + export interface ExecutionPlanGraph { + /** + * Root of the execution plan tree + */ + root: ExecutionPlanNode; + /** + * Underlying query for the execution plan graph. + */ + query: string; + /** + * String representation of graph + */ + graphFile: ExecutionPlanGraphInfo; + /** + * Query recommendations for optimizing performance + */ + recommendations: ExecutionPlanRecommendations[]; + } + + export interface ExecutionPlanNode { + /** + * Unique id given to node by the provider + */ + id: string; + /** + * Type of the node. This property determines the icon that is displayed for it + */ + type: string; + /** + * Cost associated with the node + */ + cost: number; + /** + * Cost of the node subtree + */ + subTreeCost: number; + /** + * Relative cost of the node compared to its siblings. + */ + relativeCost: number; + /** + * Time take by the node operation in milliseconds + */ + elapsedTimeInMs: number; + /** + * CPU time taken by the node operation in milliseconds + */ + elapsedCpuTimeInMs: number; + /** + * Node properties to be shown in the tooltip + */ + properties: ExecutionPlanGraphElementProperty[]; + /** + * Display name for the node + */ + name: string; + /** + * Description associated with the node. + */ + description: string; + /** + * Subtext displayed under the node name + */ + subtext: string[]; + /** + * Direct children of the nodes. + */ + children: ExecutionPlanNode[]; + /** + * Edges corresponding to the children. + */ + edges: ExecutionPlanEdge[]; + /** + * Warning/parallelism badges applicable to the current node + */ + badges: ExecutionPlanBadge[]; + /** + * Data to show in top operations table for the node. + */ + topOperationsData: TopOperationsDataItem[]; + /** + * Output row count associated with the node + */ + rowCountDisplayString: string; + /** + * Cost string for the node + */ + costDisplayString: string; + /** + * Cost metrics for the node + */ + costMetrics: CostMetric[]; + } + + export interface CostMetric { + /** + * Name of the cost metric. + */ + name: string; + /** + * The value of the cost metric + */ + value: number | undefined; + } + + export interface ExecutionPlanBadge { + /** + * Type of the node overlay. This determines the icon that is displayed for it + */ + type: BadgeType; + /** + * Text to display for the overlay tooltip + */ + tooltip: string; + } + + export enum BadgeType { + Warning = 0, + CriticalWarning = 1, + Parallelism = 2 + } + + export interface ExecutionPlanEdge { + /** + * Count of the rows returned by the subtree of the edge. + */ + rowCount: number; + /** + * Size of the rows returned by the subtree of the edge. + */ + rowSize: number; + /** + * Edge properties to be shown in the tooltip. + */ + properties: ExecutionPlanGraphElementProperty[] + } + + export interface ExecutionPlanGraphElementProperty { + /** + * Name of the property + */ + name: string; + /** + * value for the property + */ + value: string | ExecutionPlanGraphElementProperty[]; + /** + * Flag to show/hide props in tooltip + */ + showInTooltip: boolean; + /** + * Display order of property + */ + displayOrder: number; + /** + * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip + */ + positionAtBottom: boolean; + /** + * Display value of property to show in tooltip and other UI element. + */ + displayValue: string; + /** + * Data type of the property value + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Indicates which value is better when 2 similar properties are compared. + */ + betterValue: ExecutionPlanGraphElementPropertyBetterValue; + } + + export enum ExecutionPlanGraphElementPropertyDataType { + Number = 0, + String = 1, + Boolean = 2, + Nested = 3 + } + + export enum ExecutionPlanGraphElementPropertyBetterValue { + LowerNumber = 0, + HigherNumber = 1, + True = 2, + False = 3, + None = 4 + } + + export interface ExecutionPlanRecommendations { + /** + * Text displayed in the show plan graph control description + */ + displayString: string; + /** + * Query that is recommended to the user + */ + queryText: string; + /** + * Query that will be opened in a new file once the user click on the recommendation + */ + queryWithDescription: string; + } + + export interface ExecutionPlanGraphInfo { + /** + * File contents + */ + graphFileContent: string; + /** + * File type for execution plan. This will be the file type of the editor when the user opens the graph file + */ + graphFileType: string; + /** + * Index of the execution plan in the file content + */ + planIndexInFile?: number; + } + + export interface GetExecutionPlanResult extends ResultStatus { + graphs: ExecutionPlanGraph[] + } + + export interface ExecutionGraphComparisonResult { + /** + * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. + */ + baseNode: ExecutionPlanNode; + /** + * The children of the ExecutionGraphComparisonResult. + */ + children: ExecutionGraphComparisonResult[]; + /** + * The group index of the ExecutionGraphComparisonResult. + */ + groupIndex: number; + /** + * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. + */ + hasMatch: boolean; + /** + * List of matching nodes for the ExecutionGraphComparisonResult. + */ + matchingNodesId: number[]; + /** + * The parent of the ExecutionGraphComparisonResult. + */ + parentNode: ExecutionGraphComparisonResult; + } + + export interface ExecutionPlanComparisonResult extends ResultStatus { + firstComparisonResult: ExecutionGraphComparisonResult; + secondComparisonResult: ExecutionGraphComparisonResult; + } + + export interface IsExecutionPlanResult { + isExecutionPlan: boolean; + queryExecutionPlanFileExtension: string; + } + + export interface ExecutionPlanProvider extends DataProvider { + // execution plan service methods + + /** + * Gets the execution plan graph from the provider for a given plan file + * @param planFile file that contains the execution plan + */ + getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; + /** + * Compares two execution plans and identifies matching regions in both execution plans. + * @param firstPlanFile file that contains the first execution plan. + * @param secondPlanFile file that contains the second execution plan. + */ + compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; + /** + * Determines if the provided value is an execution plan and returns the appropriate file extension. + * @param value String that needs to be checked. + */ + isExecutionPlan(value: string): Thenable; + } + + export interface TopOperationsDataItem { + /** + * Column name for the top operation data item + */ + columnName: string; + /** + * Cell data type for the top operation data item + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Cell value for the top operation data item + */ + displayValue: string | number | boolean; + } + } + + export namespace contextualization { + export interface GetServerContextualizationResult { + /** + * The retrieved server context. + */ + context: string | undefined; + } + + export interface ServerContextualizationProvider extends DataProvider { + /** + * Gets server context, which can be in the form of create scripts but is left up each provider. + * @param ownerUri The URI of the connection to get context for. + */ + getServerContextualization(ownerUri: string): Thenable; + } + } + + /** + * Component to display text with an icon representing the severity + */ + export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { + /** + * An event fired when the InfoBox is clicked + */ + onDidClick: vscode.Event; + /** + * An event fired when the Infobox link is clicked + */ + onLinkClick: vscode.Event; + } + + export interface InfoBoxComponentProperties { + /** + * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. + * Default value is false. + */ + isClickable?: boolean | undefined; + + /** + * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes + */ + clickableButtonAriaLabel?: string; + + /** + * List of links to embed within the text. If links are specified there must be placeholder + * values in the value indicating where the links should be placed, in the format {i} + * + * e.g. "Click {0} for more information!"" + */ + links?: LinkArea[]; + } + + /** + * Event argument for infobox link click event. + */ + export interface InfoBoxLinkClickEventArgs { + /** + * Index of the link selected + */ + index: number; + /** + * Link that is clicked + */ + link: LinkArea; + } + + export interface TextComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface ContainerProperties extends ComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface DropDownProperties { + /** + * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. + */ + strictSelection?: boolean; + } + + export interface NodeInfo { + /** + * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node + * under the database, the nodeType is Folder, the objectType is be Tables. + */ + objectType?: string; + /* + * The path of the parent node. + */ + parentNodePath: string; + /** + * Filterable properties that this node supports + */ + filterableProperties?: NodeFilterProperty[]; + } + + export interface NodeFilterProperty { + /** + * The non-localized name of the filter property + */ + name: string; + /** + * The name of the filter property displayed to the user + */ + displayName: string; + /** + * The type of the filter property + */ + type: NodeFilterPropertyDataType; + /** + * The description of the filter property + */ + description: string; + } + + /** + * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice + */ + export interface NodeFilterChoiceProperty extends NodeFilterProperty { + /** + * The list of choices for the filter property if the type is choice + */ + choices: NodeFilterChoicePropertyValue[]; + } + + export interface NodeFilterChoicePropertyValue { + /** + * The value of the choice + */ + value: string; + /** + * The display name of the choice + * If not specified, the value will be used as the display name + * If specified, the display name will be used in the dropdown + */ + displayName?: string; + } + + export interface NodeFilter { + /** + * The name of the filter property + */ + name: string; + /** + * The operator of the filter property + */ + operator: NodeFilterOperator; + /** + * The applied values of the filter property + */ + value: string | string[] | number | number[] | boolean | undefined; + } + + export enum NodeFilterPropertyDataType { + String = 0, + Number = 1, + Boolean = 2, + Date = 3, + Choice = 4 + } + + export enum NodeFilterOperator { + Equals = 0, + NotEquals = 1, + LessThan = 2, + LessThanOrEquals = 3, + GreaterThan = 4, + GreaterThanOrEquals = 5, + Between = 6, + NotBetween = 7, + Contains = 8, + NotContains = 9, + StartsWith = 10, + NotStartsWith = 11, + EndsWith = 12, + NotEndsWith = 13 + } + + export interface ModelView extends vscode.Disposable { } + + export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } + + export namespace window { + export interface Wizard extends LoadingComponentBase { } + + export interface Dialog extends LoadingComponentBase, vscode.Disposable { } + + export interface ModelViewPanel extends vscode.Disposable { } + + export interface ModelViewDashboard extends vscode.Disposable { } + + /** + * Opens the error dialog with customization options provided. + * @param options Dialog options to customize error dialog. + * @returns Id of action button clicked by user, e.g. ok, cancel + */ + export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; + + /** + * Provides dialog options to customize modal dialog content and layout + */ + export interface IErrorDialogOptions { + /** + * Severity Level to identify icon of modal dialog. + */ + severity: MessageLevel; + /** + * Title of modal dialog header. + */ + headerTitle: string; + /** + * Message text to show on dialog. + */ + message: string; + /** + * (Optional) Detailed message, e.g stack trace of error. + */ + messageDetails?: string; + /** + * Telemetry View to be used for emitting telemetry events. + */ + telemetryView?: string, + /** + * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. + * If custom 'actions' are not provided, 'OK' button will be shown by default. + */ + actions?: IDialogAction[]; + /** + * (Optional) If provided, instruction text is shown in bold below message. + */ + instructionText?: string; + /** + * (Optional) If provided, appends read more link after instruction text. + */ + readMoreLink?: string; + } + + /** + * An action that will be rendered as a button on the dialog. + */ + export interface IDialogAction { + /** + * Identifier of action. + */ + id: string; + /** + * Label of Action button. + */ + label: string; + /** + * Defines if button styling and focus should be based on primary action. + */ + isPrimary: boolean; + } + + export interface FileFilters { + /** + * The label to display in the file filter field next to the list of filters. + */ + label: string; + /** + * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). + */ + filters: string[]; + } + + /** + * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local + * files without any connection is opened via vscode.window.showOpenDialog. + * @param connectionUri The URI of the connection to the target server + * @param targetPath The file path on the server machine to open by default in the dialog + * @param fileFilters The filters used to limit which files are displayed in the file browser + * @param showFoldersOnly Optional argument to specify whether the browser should only show folders + * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. + */ + export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; + } + + export interface FileBrowserProvider extends DataProvider { + openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; + } + + export interface TableComponent { + /** + * Set active cell. + */ + setActiveCell(row: number, column: number): void; + } + + export interface ProfilerProvider { + startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; + } + + export enum ProfilingSessionType { + RemoteSession = 0, + LocalFile = 1 + } + + export interface SplitViewLayout extends FlexLayout { + /** + * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal + * If undefined, the size of the model view container is used + */ + splitViewSize?: number | string | undefined; + } } From 4ab2c0fea727f4b4a8a49198ca122807d2c8f82d Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Mon, 26 Aug 2024 14:18:59 -0700 Subject: [PATCH 10/21] Revert "Indent using tabs" This reverts commit 9e242e8e04d45976ffc4a86bd8c5b678b2e3fbda. --- src/azdata.proposed.d.ts | 4220 +++++++++++++++++++------------------- 1 file changed, 2110 insertions(+), 2110 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 720ed09..8a5b6d9 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -9,2114 +9,2114 @@ import * as vscode from 'vscode'; declare module 'azdata' { - export namespace nb { - export interface NotebookDocument { - /** - * Sets the trust mode for the notebook document. - */ - setTrusted(state: boolean): void; - } - - export interface ISessionOptions { - /** - * The spec for the kernel being used to create this session. - */ - kernelSpec?: IKernelSpec; - } - - export interface IKernelSpec { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages?: string[]; - } - - export interface IStandardKernel { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages: string[]; - readonly blockedOnSAW?: boolean; - } - - export interface IKernelChangedArgs { - nbKernelAlias?: string - } - - export interface ICellOutput { - /** - * Unique identifier for this cell output. - */ - id?: string; - } - - export interface IExecuteResult { - data: any; - } - - export interface IExecuteResultUpdate { - output_type: string; - resultSet: ResultSetSummary; - data: any; - } - - export interface IExecuteRequest { - /** - * The language of the notebook document that is executing this request. - */ - language: string; - } - - export interface INotebookMetadata { - connection_name?: string; - multi_connection_mode?: boolean; - } - - export interface ICellMetadata { - connection_name?: string; - } - - export interface ICellContents { - attachments?: ICellAttachments; - } - - export type ICellAttachments = { [key: string]: ICellAttachment }; - export type ICellAttachment = { [key: string]: string }; - - export interface SessionManager { - /** - * Shutdown all sessions. - */ - shutdownAll(): Thenable; - /** - * Disposes the session manager. - */ - dispose(): void; - } - - /** - * An event that is emitted when a {@link NotebookDocument} is closed. - */ - export const onDidCloseNotebookDocument: vscode.Event; - - export interface IKernel { - - /** - * Restart a kernel. - * - * #### Notes - * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). - * - * The promise is fulfilled on a valid response and rejected otherwise. - * - * It is assumed that the API call does not mutate the kernel id or name. - * - * The promise will be rejected if the kernel status is `Dead` or if the - * request fails or the response is invalid. - */ - restart(): Thenable; - } - } - - export interface LoadingComponentBase { - /** - * When true, the component will display a loading spinner. - */ - loading?: boolean; - - /** - * This sets the alert text which gets announced when the loading spinner is shown. - */ - loadingText?: string; - - /** - * The text to display while loading is set to false. Will also be announced through screen readers - * once loading is completed. - */ - loadingCompletedText?: string; - } - - /** - * The column information of a data set. - */ - export interface SimpleColumnInfo { - /** - * The column name. - */ - name: string; - /** - * The data type of the column. - */ - dataTypeName: string; - } - - /** - * The parameters for start data serialization request. - */ - export interface SerializeDataStartRequestParams { - /** - * 'csv', 'json', 'excel', 'xml' - */ - saveFormat: string; - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch of the data set to be serialized. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - /** - * The columns of the data set. - */ - columns: SimpleColumnInfo[]; - /** - * Whether to include column headers to the target file. - */ - includeHeaders?: boolean; - /** - * The delimiter to seperate the cells. - */ - delimiter?: string; - /** - * The line seperator. - */ - lineSeperator?: string; - /** - * Character used for enclosing text fields when saving results as CSV. - */ - textIdentifier?: string; - /** - * File encoding used when saving results as CSV. - */ - encoding?: string; - /** - * When true, XML output will be formatted when saving results as XML. - */ - formatted?: boolean; - } - - /** - * The parameters for continue data serialization request. - */ - export interface SerializeDataContinueRequestParams { - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - } - - /** - * The result of data serialization data request. - */ - export interface SerializeDataResult { - /** - * The output message. - */ - messages?: string; - /** - * Whether the serialization is succeeded. - */ - succeeded: boolean; - } - - /** - * The serialization provider. - */ - export interface SerializationProvider extends DataProvider { - /** - * Start the data serialization. - * @param requestParams the request parameters. - */ - startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; - /** - * Continue the data serialization. - * @param requestParams the request parameters. - */ - continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; - } - - export namespace dataprotocol { - /** - * Registers a SerializationProvider. - * @param provider The data serialization provider. - */ - export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; - export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; - /** - * Registers a DataGridProvider which is used to provide lists of items to a data grid - * @param provider The provider implementation - */ - export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; - } - - export enum DataProviderType { - DataGridProvider = 'DataGridProvider' - } - - /** - * The type of the DataGrid column - */ - export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; - - /** - * A column in a data grid - */ - export interface DataGridColumn { - /** - * The text to display on the column heading. - */ - name: string; - - /** - * The property name in the DataGridItem - */ - field: string; - - /** - * A unique identifier for the column within the grid. - */ - id: string; - - /** - * The type of column this is. This is used to determine how to render the contents. - */ - type: DataGridColumnType; - - /** - * Whether this column is sortable. - */ - sortable?: boolean; - - /** - * Whether this column is filterable - */ - filterable?: boolean; - - /** - * If false, column can no longer be resized. - */ - resizable?: boolean; - - /** - * If set to a non-empty string, a tooltip will appear on hover containing the string. - */ - tooltip?: string; - - /** - * Width of the column in pixels. - */ - width?: number - } - - /** - * Info for a command to execute - */ - export interface ExecuteCommandInfo { - /** - * The ID of the command to execute - */ - id: string; - /** - * The text to display for the action - */ - displayText?: string; - /** - * The optional args to pass to the command - */ - args?: any[]; - } - - /** - * Info for displaying a hyperlink value in a Data Grid table - */ - export interface DataGridHyperlinkInfo { - /** - * The text to display for the link - */ - displayText: string; - /** - * The URL to open or command to execute - */ - linkOrCommand: string | ExecuteCommandInfo; - } - - /** - * An item for displaying in a data grid - */ - export interface DataGridItem { - /** - * A unique identifier for this item - */ - id: string; - - /** - * The other properties that will be displayed in the grid columns - */ - [key: string]: string | DataGridHyperlinkInfo; - } - - /** - * A data provider that provides lists of resource items for a data grid - */ - export interface DataGridProvider extends DataProvider { - /** - * Gets the list of data grid items for this provider - */ - getDataGridItems(): Thenable; - /** - * Gets the list of data grid columns for this provider - */ - getDataGridColumns(): Thenable; - - /** - * The user visible string to use for the title of the grid - */ - title: string; - } - - export interface ConnectionProvider extends DataProvider { - /** - * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) - */ - changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; - } - - // Password Change Request ---------------------------------------------------------------------- - export interface PasswordChangeResult { - /** - * Whether the password change was successful - */ - result: boolean; - /** - * Error message if the password change was unsuccessful - */ - errorMessage?: string; - } - - export interface IConnectionProfile extends ConnectionInfo { - azureAccount?: string; - azureResourceId?: string; - azurePortalEndpoint?: string; - } - - export interface PromptFailedResult extends ProviderError { } - - export interface ProviderError { - /** - * Error name - */ - name?: string; - - /** - * Error code - */ - errorCode?: string; - - /** - * Error message - */ - errorMessage?: string; - } - - - export namespace diagnostics { - /** - * Represents a diagnostics provider of accounts. - */ - export interface ErrorDiagnosticsProviderMetadata { - /** - * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. - * Note: only ONE diagnostic provider per id/name at a time. - */ - targetProviderId: string; - } - - export interface ConnectionDiagnosticsResult { - /** - * Whether the error was handled or not. - */ - handled: boolean, - /** - * Whether reconnect should be attempted. - */ - reconnect?: boolean, - /** - * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. - */ - options?: { [name: string]: any }; - } - - /** - * Provides error information - */ - export interface IErrorInformation { - /** - * Error code - */ - errorCode: number, - /** - * Error Message - */ - errorMessage: string, - /** - * Stack trace of error - */ - messageDetails: string - } - - /** - * Diagnostics object for handling errors for a provider. - */ - export interface ErrorDiagnosticsProvider { - /** - * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. - * @param errorInfo The error information of the connection error. - * @param connection The connection profile that caused the error. - * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. - */ - handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; - } - - /** - * Registers provider with instance of Diagnostic Provider implementation. - * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. - * @param providerMetadata Additional data used to register the provider - * @param errorDiagnostics The provider's diagnostic object that handles errors. - * @returns A disposable that when disposed will unregister the provider - */ - export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; - } - - export namespace connection { - - /** - * Opens the change password dialog. - * @param profile The connection profile to change the password for. - * @returns The new password that is returned from the operation or undefined if unsuccessful. - */ - export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; - } - - export interface ConnectionInfoSummary { - /** - * ID used to identify the connection on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - export interface QueryExecuteCompleteNotificationResult { - /** - * ID used to identify the connection used to run the query on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - /* - * Add optional per-OS default value. - */ - export interface DefaultValueOsOverride { - os: string; - - defaultValueOverride: string; - } - - export interface ConnectionOption { - defaultValueOsOverrides?: DefaultValueOsOverride[]; - - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * When set to true, the respective connection option will be rendered on the main connection dialog - * and not the Advanced Options window. - */ - showOnConnectionDialog?: boolean; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - - export interface ServiceOption { - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - /** - * This change event defines actions - */ - export interface SelectionChangeEvent { - /** - * Values that affect actions defined in this event. - */ - values: string[]; - - /** - * Action to be taken on another option when selected value matches to the list of values provided. - */ - dependentOptionActions: DependentOptionAction[]; - } - - export interface DependentOptionAction { - /** - * Name of option affected by defined action. - */ - optionName: string, - - /** - * Action to be taken, Supported values: 'show', 'hide'. - */ - action: string; - - /** - * Whether or not the option should be set to required when visible. Defaults to false. - * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. - * When set to true, providers must handle property validation. - */ - required?: boolean; - } - - // Object Explorer interfaces -------------------------------- - export interface ObjectExplorerSession { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - } - - export interface ExpandNodeInfo { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - - /** - * Filters to apply to the child nodes being returned - */ - filters?: NodeFilter[]; - } - // End Object Explorer interfaces ---------------------------- - - export interface TaskInfo { - targetLocation?: string; - } - - export interface ButtonColumnOption { - icon?: IconPath; - } - - export namespace sqlAssessment { - - export enum SqlAssessmentTargetType { - Server = 1, - Database = 2 - } - - export enum SqlAssessmentResultItemKind { - RealResult = 0, - Warning = 1, - Error = 2 - } - } - // Assessment interfaces - - export interface SqlAssessmentResultItem { - rulesetVersion: string; - rulesetName: string; - targetType: sqlAssessment.SqlAssessmentTargetType; - targetName: string; - checkId: string; - tags: string[]; - displayName: string; - description: string; - message: string; - helpLink: string; - level: string; - timestamp: string; - kind: sqlAssessment.SqlAssessmentResultItemKind; - } - - export interface SqlAssessmentResult extends ResultStatus { - items: SqlAssessmentResultItem[]; - apiVersion: string; - } - - export interface SqlAssessmentServicesProvider extends DataProvider { - assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; - } - - export interface TreeItem2 extends vscode.TreeItem { - payload?: IConnectionProfile; - childProvider?: string; - type?: ExtensionNodeType; - } - - export interface Component extends vscode.Disposable { } - - export namespace workspace { - /** - * Creates and enters a workspace at the specified location - */ - export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; - - /** - * Enters the workspace with the provided path - * @param workspaceFile - */ - export function enterWorkspace(workspaceFile: vscode.Uri): Promise; - - /** - * Saves and enters the workspace with the provided path - * @param workspaceFile - */ - export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; - } - - export interface TableComponentProperties { - /** - * Specifies whether to use headerFilter plugin - */ - headerFilter?: boolean, - } - - export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; - - export interface ExecutionPlanComponentProperties extends ComponentProperties { - /** - * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs - */ - data?: ExecutionPlanData; - } - - /** - * Defines the executionPlan component - */ - export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { - } - - export interface ModelBuilder { - executionPlan(): ComponentBuilder; - } - - export interface ListViewOption { - /** - * The optional accessibility label for the column. Default is the label for the list view option. - */ - ariaLabel?: string; - /** - * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. - */ - icon?: IconPath; - } - - export interface IconColumnCellValue { - /** - * The icon to be displayed. - */ - icon: IconPath; - /** - * The title of the icon. - */ - title: string; - } - - export interface ButtonColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the button. - */ - title?: string; - } - - export interface HyperlinkColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the hyperlink. - */ - title?: string; - - /** - * The url to open. - */ - url?: string; - /** - * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. - */ - role?: 'button' | 'link'; - } - - export interface ContextMenuColumnCellValue { - /** - * The title of the hyperlink. By default, the title is 'Show Actions' - */ - title?: string; - /** - * commands for the menu. Use an array for a group and menu separators will be added. - */ - commands: (string | string[])[]; - /** - * context that will be passed to the commands. - */ - context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined - } - - export enum ColumnType { - icon = 3, - hyperlink = 4, - contextMenu = 5 - } - - export interface TableColumn { - /** - * The text to display on the column heading. 'value' property will be used, if not specified - */ - name?: string; - - /** - * whether the column is resizable. Default value is true. - */ - resizable?: boolean; - } - - export interface IconColumnOptions { - /** - * The icon to use for all the cells in this column. - */ - icon?: IconPath; - } - - export interface ButtonColumn extends IconColumnOptions, TableColumn { - /** - * Whether to show the text, default value is false. - */ - showText?: boolean; - } - - export interface HyperlinkColumn extends IconColumnOptions, TableColumn { - } - - export interface CheckboxColumn extends TableColumn { - action: ActionOnCellCheckboxCheck; - } - - export interface ContextMenuColumn extends TableColumn { - } - - export interface QueryExecuteResultSetNotificationParams { - /** - * Contains execution plans returned by the database in ResultSets. - */ - executionPlans: executionPlan.ExecutionPlanGraph[]; - } - - export interface ObjectMetadata { - /* - * Parent object name for subobjects such as triggers, indexes, etc. - */ - parentName?: string; - - /* - * Parent object type name, such as Table, View, etc. - */ - parentTypeName?: string; - } - - /** - * Represents a selected range in the result grid. - */ - export interface SelectionRange { - fromRow: number; - toRow: number; - fromColumn: number; - toColumn: number; - } - - /** - * Parameters for the copy results request. - */ - export interface CopyResultsRequestParams { - /** - * URI of the editor. - */ - ownerUri: string; - /** - * Index of the batch. - */ - batchIndex: number; - /** - * Index of the result set. - */ - resultSetIndex: number; - /** - * Whether to include the column headers. - */ - includeHeaders: boolean - /** - * The selected ranges to be copied. - */ - selections: SelectionRange[]; - /** - * * Whether to copy the results directly from the backend. - */ - copyInBackend: boolean; - } - - export interface CopyResultsRequestResult { - /** - * Result string from copy operation - */ - results: string; - } - - export interface QueryProvider { - /** - * Notify clients that the URI for a connection has been changed. - */ - connectionUriChanged?(newUri: string, oldUri: string): Thenable; - /** - * Copy the selected data to the clipboard. - * This is introduced to address the performance issue of large amount of data to ADS side. - * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. - * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. - */ - copyResults?(requestParams: CopyResultsRequestParams): Thenable; - } - - export enum DataProviderType { - TableDesignerProvider = 'TableDesignerProvider', - ExecutionPlanProvider = 'ExecutionPlanProvider', - ServerContextualizationProvider = 'ServerContextualizationProvider' - } - - export namespace dataprotocol { - export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; - export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; - /** - * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub - * Copilot for improved suggestions. - * @param provider The provider to register - */ - export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; - } - - export namespace designers { - /** - * Open a table designer window. - * @param providerId The table designer provider Id. - * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. - * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry - * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited - */ - export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; - - /** - * Definition for the table designer provider. - */ - export interface TableDesignerProvider extends DataProvider { - /** - * Initialize the table designer for the specified table. - * @param table the table information. - */ - initializeTableDesigner(table: TableInfo): Thenable; - - /** - * Process the table change. - * @param table the table information - * @param tableChangeInfo the information about the change user made through the UI. - */ - processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; - - /** - * Publish the changes. - * @param table the table information - */ - publishChanges(table: TableInfo): Thenable; - - /** - * Generate script for the changes. - * @param table the table information - */ - generateScript(table: TableInfo): Thenable; - - /** - * Generate preview report describing the changes to be made. - * @param table the table information - */ - generatePreviewReport(table: TableInfo): Thenable; - - /** - * Notify the provider that the table designer has been closed. - * @param table the table information - */ - disposeTableDesigner(table: TableInfo): Thenable; - } - - /** - * The information of the table. - */ - export interface TableInfo { - /** - * Used as the table designer editor's tab header text. - */ - title: string; - /** - * Used as the table designer editor's tab header hover text. - */ - tooltip: string; - /** - * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. - */ - id: string; - /** - * A boolean value indicates whether a new table is being designed. - */ - isNewTable: boolean; - /** - * Extension can store additional information that the provider needs to uniquely identify a table. - */ - [key: string]: any; - /** - * Table icon type that's shown in the editor tab. Default is the basic - * table icon. - */ - tableIcon?: TableIcon; - } - - /** - * The information to populate the table designer UI. - */ - export interface TableDesignerInfo { - /** - * The view definition. - */ - view: TableDesignerView; - /** - * The initial state of the designer. - */ - viewModel: DesignerViewModel; - /** - * The new table info after initialization. - */ - tableInfo: TableInfo; - /** - * The issues. - */ - issues?: DesignerIssue[]; - } - - /** - * Table icon that's shown on the editor tab - */ - export enum TableIcon { - Basic = 'Basic', - Temporal = 'Temporal', - GraphNode = 'GraphNode', - GraphEdge = 'GraphEdge' - } - - /** - * Name of the common table properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableProperty { - Columns = 'columns', - Description = 'description', - Name = 'name', - Schema = 'schema', - Script = 'script', - ForeignKeys = 'foreignKeys', - CheckConstraints = 'checkConstraints', - Indexes = 'indexes', - PrimaryKey = 'primaryKey', - PrimaryKeyName = 'primaryKeyName', - PrimaryKeyDescription = 'primaryKeyDescription', - PrimaryKeyColumns = 'primaryKeyColumns' - } - /** - * Name of the common table column properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableColumnProperty { - AllowNulls = 'allowNulls', - DefaultValue = 'defaultValue', - Length = 'length', - Name = 'name', - Description = 'description', - Type = 'type', - AdvancedType = 'advancedType', - IsPrimaryKey = 'isPrimaryKey', - Precision = 'precision', - Scale = 'scale' - } - - /** - * Name of the common foreign key constraint properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableForeignKeyProperty { - Name = 'name', - Description = 'description', - ForeignTable = 'foreignTable', - OnDeleteAction = 'onDeleteAction', - OnUpdateAction = 'onUpdateAction', - Columns = 'columns' - } - - /** - * Name of the columns mapping properties for foreign key. - */ - export enum ForeignKeyColumnMappingProperty { - Column = 'column', - ForeignColumn = 'foreignColumn' - } - - /** - * Name of the common check constraint properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableCheckConstraintProperty { - Name = 'name', - Description = 'description', - Expression = 'expression' - } - - /** - * Name of the common index properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableIndexProperty { - Name = 'name', - Description = 'description', - Columns = 'columns' - } - - /** - * Name of the common properties of table index column specification. - */ - export enum TableIndexColumnSpecificationProperty { - Column = 'column' - } - - /** - * The table designer view definition. - */ - export interface TableDesignerView { - /** - * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} - */ - additionalTableProperties?: DesignerDataPropertyInfo[]; - /** - * Additional tabs. - */ - additionalTabs?: DesignerTab[]; - /** - * Columns table options. - * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. - * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. - */ - columnTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign keys table options. - * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. - * Default columns to display values are: Name, PrimaryKeyTable. - */ - foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign key column mapping table options. - * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. - * Default columns to display values are: Column, ForeignColumn. - */ - foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Check constraints table options. - * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} - * Default columns to display values are: Name, Expression. - */ - checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Indexes table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} - * Default columns to display values are: Name. - */ - indexTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Index column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Primary column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. - */ - additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; - /** - * Components to be placed under the pre-defined tabs. - */ - additionalComponents?: DesignerDataPropertyWithTabInfo[]; - /** - * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. - */ - useAdvancedSaveMode: boolean; - } - - export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { - /** - * Whether to show the table. Default value is false. - */ - showTable?: boolean; - /** - * Properties to be displayed in the table, other properties can be accessed in the properties view. - */ - propertiesToDisplay?: string[]; - /** - * Additional properties for the entity. - */ - additionalProperties?: DesignerDataPropertyInfo[]; - } - - /** - * The view model of the designer. - */ - export interface DesignerViewModel { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of a designer tab. - */ - export interface DesignerTab { - /** - * The title of the tab. - */ - title: string; - /** - * the components to be displayed in this tab. - */ - components: DesignerDataPropertyInfo[]; - } - - /** - * The definition of the property in the designer. - */ - export interface DesignerDataPropertyInfo { - /** - * The property name. - */ - propertyName: string; - /** - * The description of the property. - */ - description?: string; - /** - * The component type. - */ - componentType: DesignerComponentTypeName; - /** - * The group name, properties with the same group name will be displayed under the same group on the UI. - */ - group?: string; - /** - * Whether the property should be displayed in the properties view. The default value is true. - */ - showInPropertiesView?: boolean; - /** - * The properties of the component. - */ - componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of the property in the designer with tab info. - */ - export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { - /** - * The tab info where this property belongs to. - */ - tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; - } - - /** - * The child component types supported by designer. - */ - export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; - - export interface DesignerTablePropertiesBase { - /** - * Whether user can add new rows to the table. The default value is true. - */ - canAddRows?: boolean; - /** - * Whether user can remove rows from the table. The default value is true. - */ - canRemoveRows?: boolean; - /** - * Whether user can move rows from one index to another. The default value is true. - */ - canMoveRows?: boolean; - /** - * Whether user can insert rows at a given index to the table. The default value is true. - */ - canInsertRows?: boolean; - /** - * Whether to show confirmation when user removes a row. The default value is false. - */ - showRemoveRowConfirmation?: boolean; - /** - * The confirmation message to be displayed when user removes a row. - */ - removeRowConfirmationMessage?: string; - /** - * Whether to show the item detail in properties view. The default value is true. - */ - showItemDetailInPropertiesView?: boolean; - /** - * The label of the add new button. The default value is 'Add New'. - */ - labelForAddNewButton?: string; - } - - /** - * The properties for the table component in the designer. - */ - export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { - /** - * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. - */ - columns?: string[]; - /** - * The display name of the object type. - */ - objectTypeDisplayName: string; - /** - * the properties of the table data item. - */ - itemProperties?: DesignerDataPropertyInfo[]; - /** - * The data to be displayed. - */ - data?: DesignerTableComponentDataItem[]; - } - - /** - * The data item of the designer's table component. - */ - export interface DesignerTableComponentDataItem { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; - /** - * Whether the row can be deleted. The default value is true. - */ - canBeDeleted?: boolean; - } - - /** - * Type of the edit originated from the designer UI. - */ - export enum DesignerEditType { - /** - * Add a row to a table. - */ - Add = 0, - /** - * Remove a row from a table. - */ - Remove = 1, - /** - * Update a property. - */ - Update = 2, - /** - * Change the position of an item in the collection. - */ - Move = 3 - } - - /** - * Information of the edit originated from the designer UI. - */ - export interface DesignerEdit { - /** - * The edit type. - */ - type: DesignerEditType; - /** - * the path of the edit target. - */ - path: DesignerPropertyPath; - /** - * the new value. - */ - value?: any; - } - - /** - * The path of the property. - * Below are the 3 scenarios and their expected path. - * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. - * 1. 'Add' scenario - * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. - * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. - * 2. 'Update' scenario - * a. ['propertyName1']. Example: update the name of the table: ['name']. - * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. - * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. - * 3. 'Remove' scenario - * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. - * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. - */ - export type DesignerPropertyPath = (string | number)[]; - - /** - * Severity of the messages returned by the provider after processing an edit. - * 'error': The issue must be fixed in order to commit the changes. - * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. - * 'information': Informational message. - */ - export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; - - /** - * Represents the issue in the designer - */ - export interface DesignerIssue { - /** - * Severity of the issue. - */ - severity: DesignerIssueSeverity, - /** - * Path of the property that is associated with the issue. - */ - propertyPath?: DesignerPropertyPath, - /** - * Description of the issue. - */ - description: string, - /** - * Url to a web page that has the explaination of the issue. - */ - moreInfoLink?: string; - } - - /** - * The result returned by the table designer provider after handling an edit request. - */ - export interface DesignerEditResult { - /** - * The new view information if the view needs to be refreshed. - */ - view?: T; - /** - * The view model object. - */ - viewModel: DesignerViewModel; - /** - * Whether the current state is valid. - */ - isValid: boolean; - /** - * Issues of current state. - */ - issues?: DesignerIssue[]; - /** - * The input validation error. - */ - inputValidationError?: string; - /** - * Metadata related to the table - */ - metadata?: { [key: string]: string }; - } - - /** - * The result returned by the table designer provider after handling the publish changes request. - */ - export interface PublishChangesResult { - /** - * The new table information after the changes are published. - */ - newTableInfo: TableInfo; - /** - * The new view model. - */ - viewModel: DesignerViewModel; - /** - * The new view. - */ - view: TableDesignerView; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - - export interface GeneratePreviewReportResult { - /** - * Report generated for generate preview - */ - report: string; - /** - * Format (mimeType) of the report - */ - mimeType: string; - /** - * Whether user confirmation is required, the default value is false. - */ - requireConfirmation?: boolean; - /** - * The confirmation text. - */ - confirmationText?: string; - /** - * The table schema validation error. - */ - schemaValidationError?: string; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - } - - export namespace executionPlan { - export interface ExecutionPlanGraph { - /** - * Root of the execution plan tree - */ - root: ExecutionPlanNode; - /** - * Underlying query for the execution plan graph. - */ - query: string; - /** - * String representation of graph - */ - graphFile: ExecutionPlanGraphInfo; - /** - * Query recommendations for optimizing performance - */ - recommendations: ExecutionPlanRecommendations[]; - } - - export interface ExecutionPlanNode { - /** - * Unique id given to node by the provider - */ - id: string; - /** - * Type of the node. This property determines the icon that is displayed for it - */ - type: string; - /** - * Cost associated with the node - */ - cost: number; - /** - * Cost of the node subtree - */ - subTreeCost: number; - /** - * Relative cost of the node compared to its siblings. - */ - relativeCost: number; - /** - * Time take by the node operation in milliseconds - */ - elapsedTimeInMs: number; - /** - * CPU time taken by the node operation in milliseconds - */ - elapsedCpuTimeInMs: number; - /** - * Node properties to be shown in the tooltip - */ - properties: ExecutionPlanGraphElementProperty[]; - /** - * Display name for the node - */ - name: string; - /** - * Description associated with the node. - */ - description: string; - /** - * Subtext displayed under the node name - */ - subtext: string[]; - /** - * Direct children of the nodes. - */ - children: ExecutionPlanNode[]; - /** - * Edges corresponding to the children. - */ - edges: ExecutionPlanEdge[]; - /** - * Warning/parallelism badges applicable to the current node - */ - badges: ExecutionPlanBadge[]; - /** - * Data to show in top operations table for the node. - */ - topOperationsData: TopOperationsDataItem[]; - /** - * Output row count associated with the node - */ - rowCountDisplayString: string; - /** - * Cost string for the node - */ - costDisplayString: string; - /** - * Cost metrics for the node - */ - costMetrics: CostMetric[]; - } - - export interface CostMetric { - /** - * Name of the cost metric. - */ - name: string; - /** - * The value of the cost metric - */ - value: number | undefined; - } - - export interface ExecutionPlanBadge { - /** - * Type of the node overlay. This determines the icon that is displayed for it - */ - type: BadgeType; - /** - * Text to display for the overlay tooltip - */ - tooltip: string; - } - - export enum BadgeType { - Warning = 0, - CriticalWarning = 1, - Parallelism = 2 - } - - export interface ExecutionPlanEdge { - /** - * Count of the rows returned by the subtree of the edge. - */ - rowCount: number; - /** - * Size of the rows returned by the subtree of the edge. - */ - rowSize: number; - /** - * Edge properties to be shown in the tooltip. - */ - properties: ExecutionPlanGraphElementProperty[] - } - - export interface ExecutionPlanGraphElementProperty { - /** - * Name of the property - */ - name: string; - /** - * value for the property - */ - value: string | ExecutionPlanGraphElementProperty[]; - /** - * Flag to show/hide props in tooltip - */ - showInTooltip: boolean; - /** - * Display order of property - */ - displayOrder: number; - /** - * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip - */ - positionAtBottom: boolean; - /** - * Display value of property to show in tooltip and other UI element. - */ - displayValue: string; - /** - * Data type of the property value - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Indicates which value is better when 2 similar properties are compared. - */ - betterValue: ExecutionPlanGraphElementPropertyBetterValue; - } - - export enum ExecutionPlanGraphElementPropertyDataType { - Number = 0, - String = 1, - Boolean = 2, - Nested = 3 - } - - export enum ExecutionPlanGraphElementPropertyBetterValue { - LowerNumber = 0, - HigherNumber = 1, - True = 2, - False = 3, - None = 4 - } - - export interface ExecutionPlanRecommendations { - /** - * Text displayed in the show plan graph control description - */ - displayString: string; - /** - * Query that is recommended to the user - */ - queryText: string; - /** - * Query that will be opened in a new file once the user click on the recommendation - */ - queryWithDescription: string; - } - - export interface ExecutionPlanGraphInfo { - /** - * File contents - */ - graphFileContent: string; - /** - * File type for execution plan. This will be the file type of the editor when the user opens the graph file - */ - graphFileType: string; - /** - * Index of the execution plan in the file content - */ - planIndexInFile?: number; - } - - export interface GetExecutionPlanResult extends ResultStatus { - graphs: ExecutionPlanGraph[] - } - - export interface ExecutionGraphComparisonResult { - /** - * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. - */ - baseNode: ExecutionPlanNode; - /** - * The children of the ExecutionGraphComparisonResult. - */ - children: ExecutionGraphComparisonResult[]; - /** - * The group index of the ExecutionGraphComparisonResult. - */ - groupIndex: number; - /** - * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. - */ - hasMatch: boolean; - /** - * List of matching nodes for the ExecutionGraphComparisonResult. - */ - matchingNodesId: number[]; - /** - * The parent of the ExecutionGraphComparisonResult. - */ - parentNode: ExecutionGraphComparisonResult; - } - - export interface ExecutionPlanComparisonResult extends ResultStatus { - firstComparisonResult: ExecutionGraphComparisonResult; - secondComparisonResult: ExecutionGraphComparisonResult; - } - - export interface IsExecutionPlanResult { - isExecutionPlan: boolean; - queryExecutionPlanFileExtension: string; - } - - export interface ExecutionPlanProvider extends DataProvider { - // execution plan service methods - - /** - * Gets the execution plan graph from the provider for a given plan file - * @param planFile file that contains the execution plan - */ - getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; - /** - * Compares two execution plans and identifies matching regions in both execution plans. - * @param firstPlanFile file that contains the first execution plan. - * @param secondPlanFile file that contains the second execution plan. - */ - compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; - /** - * Determines if the provided value is an execution plan and returns the appropriate file extension. - * @param value String that needs to be checked. - */ - isExecutionPlan(value: string): Thenable; - } - - export interface TopOperationsDataItem { - /** - * Column name for the top operation data item - */ - columnName: string; - /** - * Cell data type for the top operation data item - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Cell value for the top operation data item - */ - displayValue: string | number | boolean; - } - } - - export namespace contextualization { - export interface GetServerContextualizationResult { - /** - * The retrieved server context. - */ - context: string | undefined; - } - - export interface ServerContextualizationProvider extends DataProvider { - /** - * Gets server context, which can be in the form of create scripts but is left up each provider. - * @param ownerUri The URI of the connection to get context for. - */ - getServerContextualization(ownerUri: string): Thenable; - } - } - - /** - * Component to display text with an icon representing the severity - */ - export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { - /** - * An event fired when the InfoBox is clicked - */ - onDidClick: vscode.Event; - /** - * An event fired when the Infobox link is clicked - */ - onLinkClick: vscode.Event; - } - - export interface InfoBoxComponentProperties { - /** - * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. - * Default value is false. - */ - isClickable?: boolean | undefined; - - /** - * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes - */ - clickableButtonAriaLabel?: string; - - /** - * List of links to embed within the text. If links are specified there must be placeholder - * values in the value indicating where the links should be placed, in the format {i} - * - * e.g. "Click {0} for more information!"" - */ - links?: LinkArea[]; - } - - /** - * Event argument for infobox link click event. - */ - export interface InfoBoxLinkClickEventArgs { - /** - * Index of the link selected - */ - index: number; - /** - * Link that is clicked - */ - link: LinkArea; - } - - export interface TextComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface ContainerProperties extends ComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface DropDownProperties { - /** - * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. - */ - strictSelection?: boolean; - } - - export interface NodeInfo { - /** - * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node - * under the database, the nodeType is Folder, the objectType is be Tables. - */ - objectType?: string; - /* - * The path of the parent node. - */ - parentNodePath: string; - /** - * Filterable properties that this node supports - */ - filterableProperties?: NodeFilterProperty[]; - } - - export interface NodeFilterProperty { - /** - * The non-localized name of the filter property - */ - name: string; - /** - * The name of the filter property displayed to the user - */ - displayName: string; - /** - * The type of the filter property - */ - type: NodeFilterPropertyDataType; - /** - * The description of the filter property - */ - description: string; - } - - /** - * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice - */ - export interface NodeFilterChoiceProperty extends NodeFilterProperty { - /** - * The list of choices for the filter property if the type is choice - */ - choices: NodeFilterChoicePropertyValue[]; - } - - export interface NodeFilterChoicePropertyValue { - /** - * The value of the choice - */ - value: string; - /** - * The display name of the choice - * If not specified, the value will be used as the display name - * If specified, the display name will be used in the dropdown - */ - displayName?: string; - } - - export interface NodeFilter { - /** - * The name of the filter property - */ - name: string; - /** - * The operator of the filter property - */ - operator: NodeFilterOperator; - /** - * The applied values of the filter property - */ - value: string | string[] | number | number[] | boolean | undefined; - } - - export enum NodeFilterPropertyDataType { - String = 0, - Number = 1, - Boolean = 2, - Date = 3, - Choice = 4 - } - - export enum NodeFilterOperator { - Equals = 0, - NotEquals = 1, - LessThan = 2, - LessThanOrEquals = 3, - GreaterThan = 4, - GreaterThanOrEquals = 5, - Between = 6, - NotBetween = 7, - Contains = 8, - NotContains = 9, - StartsWith = 10, - NotStartsWith = 11, - EndsWith = 12, - NotEndsWith = 13 - } - - export interface ModelView extends vscode.Disposable { } - - export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } - - export namespace window { - export interface Wizard extends LoadingComponentBase { } - - export interface Dialog extends LoadingComponentBase, vscode.Disposable { } - - export interface ModelViewPanel extends vscode.Disposable { } - - export interface ModelViewDashboard extends vscode.Disposable { } - - /** - * Opens the error dialog with customization options provided. - * @param options Dialog options to customize error dialog. - * @returns Id of action button clicked by user, e.g. ok, cancel - */ - export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; - - /** - * Provides dialog options to customize modal dialog content and layout - */ - export interface IErrorDialogOptions { - /** - * Severity Level to identify icon of modal dialog. - */ - severity: MessageLevel; - /** - * Title of modal dialog header. - */ - headerTitle: string; - /** - * Message text to show on dialog. - */ - message: string; - /** - * (Optional) Detailed message, e.g stack trace of error. - */ - messageDetails?: string; - /** - * Telemetry View to be used for emitting telemetry events. - */ - telemetryView?: string, - /** - * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. - * If custom 'actions' are not provided, 'OK' button will be shown by default. - */ - actions?: IDialogAction[]; - /** - * (Optional) If provided, instruction text is shown in bold below message. - */ - instructionText?: string; - /** - * (Optional) If provided, appends read more link after instruction text. - */ - readMoreLink?: string; - } - - /** - * An action that will be rendered as a button on the dialog. - */ - export interface IDialogAction { - /** - * Identifier of action. - */ - id: string; - /** - * Label of Action button. - */ - label: string; - /** - * Defines if button styling and focus should be based on primary action. - */ - isPrimary: boolean; - } - - export interface FileFilters { - /** - * The label to display in the file filter field next to the list of filters. - */ - label: string; - /** - * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). - */ - filters: string[]; - } - - /** - * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local - * files without any connection is opened via vscode.window.showOpenDialog. - * @param connectionUri The URI of the connection to the target server - * @param targetPath The file path on the server machine to open by default in the dialog - * @param fileFilters The filters used to limit which files are displayed in the file browser - * @param showFoldersOnly Optional argument to specify whether the browser should only show folders - * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. - */ - export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; - } - - export interface FileBrowserProvider extends DataProvider { - openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; - } - - export interface TableComponent { - /** - * Set active cell. - */ - setActiveCell(row: number, column: number): void; - } - - export interface ProfilerProvider { - startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; - } - - export enum ProfilingSessionType { - RemoteSession = 0, - LocalFile = 1 - } - - export interface SplitViewLayout extends FlexLayout { - /** - * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal - * If undefined, the size of the model view container is used - */ - splitViewSize?: number | string | undefined; - } + export namespace nb { + export interface NotebookDocument { + /** + * Sets the trust mode for the notebook document. + */ + setTrusted(state: boolean): void; + } + + export interface ISessionOptions { + /** + * The spec for the kernel being used to create this session. + */ + kernelSpec?: IKernelSpec; + } + + export interface IKernelSpec { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages?: string[]; + } + + export interface IStandardKernel { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages: string[]; + readonly blockedOnSAW?: boolean; + } + + export interface IKernelChangedArgs { + nbKernelAlias?: string + } + + export interface ICellOutput { + /** + * Unique identifier for this cell output. + */ + id?: string; + } + + export interface IExecuteResult { + data: any; + } + + export interface IExecuteResultUpdate { + output_type: string; + resultSet: ResultSetSummary; + data: any; + } + + export interface IExecuteRequest { + /** + * The language of the notebook document that is executing this request. + */ + language: string; + } + + export interface INotebookMetadata { + connection_name?: string; + multi_connection_mode?: boolean; + } + + export interface ICellMetadata { + connection_name?: string; + } + + export interface ICellContents { + attachments?: ICellAttachments; + } + + export type ICellAttachments = { [key: string]: ICellAttachment }; + export type ICellAttachment = { [key: string]: string }; + + export interface SessionManager { + /** + * Shutdown all sessions. + */ + shutdownAll(): Thenable; + /** + * Disposes the session manager. + */ + dispose(): void; + } + + /** + * An event that is emitted when a {@link NotebookDocument} is closed. + */ + export const onDidCloseNotebookDocument: vscode.Event; + + export interface IKernel { + + /** + * Restart a kernel. + * + * #### Notes + * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). + * + * The promise is fulfilled on a valid response and rejected otherwise. + * + * It is assumed that the API call does not mutate the kernel id or name. + * + * The promise will be rejected if the kernel status is `Dead` or if the + * request fails or the response is invalid. + */ + restart(): Thenable; + } + } + + export interface LoadingComponentBase { + /** + * When true, the component will display a loading spinner. + */ + loading?: boolean; + + /** + * This sets the alert text which gets announced when the loading spinner is shown. + */ + loadingText?: string; + + /** + * The text to display while loading is set to false. Will also be announced through screen readers + * once loading is completed. + */ + loadingCompletedText?: string; + } + + /** + * The column information of a data set. + */ + export interface SimpleColumnInfo { + /** + * The column name. + */ + name: string; + /** + * The data type of the column. + */ + dataTypeName: string; + } + + /** + * The parameters for start data serialization request. + */ + export interface SerializeDataStartRequestParams { + /** + * 'csv', 'json', 'excel', 'xml' + */ + saveFormat: string; + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch of the data set to be serialized. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + /** + * The columns of the data set. + */ + columns: SimpleColumnInfo[]; + /** + * Whether to include column headers to the target file. + */ + includeHeaders?: boolean; + /** + * The delimiter to seperate the cells. + */ + delimiter?: string; + /** + * The line seperator. + */ + lineSeperator?: string; + /** + * Character used for enclosing text fields when saving results as CSV. + */ + textIdentifier?: string; + /** + * File encoding used when saving results as CSV. + */ + encoding?: string; + /** + * When true, XML output will be formatted when saving results as XML. + */ + formatted?: boolean; + } + + /** + * The parameters for continue data serialization request. + */ + export interface SerializeDataContinueRequestParams { + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + } + + /** + * The result of data serialization data request. + */ + export interface SerializeDataResult { + /** + * The output message. + */ + messages?: string; + /** + * Whether the serialization is succeeded. + */ + succeeded: boolean; + } + + /** + * The serialization provider. + */ + export interface SerializationProvider extends DataProvider { + /** + * Start the data serialization. + * @param requestParams the request parameters. + */ + startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; + /** + * Continue the data serialization. + * @param requestParams the request parameters. + */ + continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; + } + + export namespace dataprotocol { + /** + * Registers a SerializationProvider. + * @param provider The data serialization provider. + */ + export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; + export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; + /** + * Registers a DataGridProvider which is used to provide lists of items to a data grid + * @param provider The provider implementation + */ + export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; + } + + export enum DataProviderType { + DataGridProvider = 'DataGridProvider' + } + + /** + * The type of the DataGrid column + */ + export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; + + /** + * A column in a data grid + */ + export interface DataGridColumn { + /** + * The text to display on the column heading. + */ + name: string; + + /** + * The property name in the DataGridItem + */ + field: string; + + /** + * A unique identifier for the column within the grid. + */ + id: string; + + /** + * The type of column this is. This is used to determine how to render the contents. + */ + type: DataGridColumnType; + + /** + * Whether this column is sortable. + */ + sortable?: boolean; + + /** + * Whether this column is filterable + */ + filterable?: boolean; + + /** + * If false, column can no longer be resized. + */ + resizable?: boolean; + + /** + * If set to a non-empty string, a tooltip will appear on hover containing the string. + */ + tooltip?: string; + + /** + * Width of the column in pixels. + */ + width?: number + } + + /** + * Info for a command to execute + */ + export interface ExecuteCommandInfo { + /** + * The ID of the command to execute + */ + id: string; + /** + * The text to display for the action + */ + displayText?: string; + /** + * The optional args to pass to the command + */ + args?: any[]; + } + + /** + * Info for displaying a hyperlink value in a Data Grid table + */ + export interface DataGridHyperlinkInfo { + /** + * The text to display for the link + */ + displayText: string; + /** + * The URL to open or command to execute + */ + linkOrCommand: string | ExecuteCommandInfo; + } + + /** + * An item for displaying in a data grid + */ + export interface DataGridItem { + /** + * A unique identifier for this item + */ + id: string; + + /** + * The other properties that will be displayed in the grid columns + */ + [key: string]: string | DataGridHyperlinkInfo; + } + + /** + * A data provider that provides lists of resource items for a data grid + */ + export interface DataGridProvider extends DataProvider { + /** + * Gets the list of data grid items for this provider + */ + getDataGridItems(): Thenable; + /** + * Gets the list of data grid columns for this provider + */ + getDataGridColumns(): Thenable; + + /** + * The user visible string to use for the title of the grid + */ + title: string; + } + + export interface ConnectionProvider extends DataProvider { + /** + * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) + */ + changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; + } + + // Password Change Request ---------------------------------------------------------------------- + export interface PasswordChangeResult { + /** + * Whether the password change was successful + */ + result: boolean; + /** + * Error message if the password change was unsuccessful + */ + errorMessage?: string; + } + + export interface IConnectionProfile extends ConnectionInfo { + azureAccount?: string; + azureResourceId?: string; + azurePortalEndpoint?: string; + } + + export interface PromptFailedResult extends ProviderError { } + + export interface ProviderError { + /** + * Error name + */ + name?: string; + + /** + * Error code + */ + errorCode?: string; + + /** + * Error message + */ + errorMessage?: string; + } + + + export namespace diagnostics { + /** + * Represents a diagnostics provider of accounts. + */ + export interface ErrorDiagnosticsProviderMetadata { + /** + * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. + * Note: only ONE diagnostic provider per id/name at a time. + */ + targetProviderId: string; + } + + export interface ConnectionDiagnosticsResult { + /** + * Whether the error was handled or not. + */ + handled: boolean, + /** + * Whether reconnect should be attempted. + */ + reconnect?: boolean, + /** + * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. + */ + options?: { [name: string]: any }; + } + + /** + * Provides error information + */ + export interface IErrorInformation { + /** + * Error code + */ + errorCode: number, + /** + * Error Message + */ + errorMessage: string, + /** + * Stack trace of error + */ + messageDetails: string + } + + /** + * Diagnostics object for handling errors for a provider. + */ + export interface ErrorDiagnosticsProvider { + /** + * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. + * @param errorInfo The error information of the connection error. + * @param connection The connection profile that caused the error. + * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. + */ + handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; + } + + /** + * Registers provider with instance of Diagnostic Provider implementation. + * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. + * @param providerMetadata Additional data used to register the provider + * @param errorDiagnostics The provider's diagnostic object that handles errors. + * @returns A disposable that when disposed will unregister the provider + */ + export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; + } + + export namespace connection { + + /** + * Opens the change password dialog. + * @param profile The connection profile to change the password for. + * @returns The new password that is returned from the operation or undefined if unsuccessful. + */ + export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; + } + + export interface ConnectionInfoSummary { + /** + * ID used to identify the connection on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + export interface QueryExecuteCompleteNotificationResult { + /** + * ID used to identify the connection used to run the query on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + /* + * Add optional per-OS default value. + */ + export interface DefaultValueOsOverride { + os: string; + + defaultValueOverride: string; + } + + export interface ConnectionOption { + defaultValueOsOverrides?: DefaultValueOsOverride[]; + + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * When set to true, the respective connection option will be rendered on the main connection dialog + * and not the Advanced Options window. + */ + showOnConnectionDialog?: boolean; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + + export interface ServiceOption { + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + /** + * This change event defines actions + */ + export interface SelectionChangeEvent { + /** + * Values that affect actions defined in this event. + */ + values: string[]; + + /** + * Action to be taken on another option when selected value matches to the list of values provided. + */ + dependentOptionActions: DependentOptionAction[]; + } + + export interface DependentOptionAction { + /** + * Name of option affected by defined action. + */ + optionName: string, + + /** + * Action to be taken, Supported values: 'show', 'hide'. + */ + action: string; + + /** + * Whether or not the option should be set to required when visible. Defaults to false. + * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. + * When set to true, providers must handle property validation. + */ + required?: boolean; + } + + // Object Explorer interfaces -------------------------------- + export interface ObjectExplorerSession { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + } + + export interface ExpandNodeInfo { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + + /** + * Filters to apply to the child nodes being returned + */ + filters?: NodeFilter[]; + } + // End Object Explorer interfaces ---------------------------- + + export interface TaskInfo { + targetLocation?: string; + } + + export interface ButtonColumnOption { + icon?: IconPath; + } + + export namespace sqlAssessment { + + export enum SqlAssessmentTargetType { + Server = 1, + Database = 2 + } + + export enum SqlAssessmentResultItemKind { + RealResult = 0, + Warning = 1, + Error = 2 + } + } + // Assessment interfaces + + export interface SqlAssessmentResultItem { + rulesetVersion: string; + rulesetName: string; + targetType: sqlAssessment.SqlAssessmentTargetType; + targetName: string; + checkId: string; + tags: string[]; + displayName: string; + description: string; + message: string; + helpLink: string; + level: string; + timestamp: string; + kind: sqlAssessment.SqlAssessmentResultItemKind; + } + + export interface SqlAssessmentResult extends ResultStatus { + items: SqlAssessmentResultItem[]; + apiVersion: string; + } + + export interface SqlAssessmentServicesProvider extends DataProvider { + assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; + } + + export interface TreeItem2 extends vscode.TreeItem { + payload?: IConnectionProfile; + childProvider?: string; + type?: ExtensionNodeType; + } + + export interface Component extends vscode.Disposable { } + + export namespace workspace { + /** + * Creates and enters a workspace at the specified location + */ + export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; + + /** + * Enters the workspace with the provided path + * @param workspaceFile + */ + export function enterWorkspace(workspaceFile: vscode.Uri): Promise; + + /** + * Saves and enters the workspace with the provided path + * @param workspaceFile + */ + export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; + } + + export interface TableComponentProperties { + /** + * Specifies whether to use headerFilter plugin + */ + headerFilter?: boolean, + } + + export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; + + export interface ExecutionPlanComponentProperties extends ComponentProperties { + /** + * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs + */ + data?: ExecutionPlanData; + } + + /** + * Defines the executionPlan component + */ + export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { + } + + export interface ModelBuilder { + executionPlan(): ComponentBuilder; + } + + export interface ListViewOption { + /** + * The optional accessibility label for the column. Default is the label for the list view option. + */ + ariaLabel?: string; + /** + * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. + */ + icon?: IconPath; + } + + export interface IconColumnCellValue { + /** + * The icon to be displayed. + */ + icon: IconPath; + /** + * The title of the icon. + */ + title: string; + } + + export interface ButtonColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the button. + */ + title?: string; + } + + export interface HyperlinkColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the hyperlink. + */ + title?: string; + + /** + * The url to open. + */ + url?: string; + /** + * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. + */ + role?: 'button' | 'link'; + } + + export interface ContextMenuColumnCellValue { + /** + * The title of the hyperlink. By default, the title is 'Show Actions' + */ + title?: string; + /** + * commands for the menu. Use an array for a group and menu separators will be added. + */ + commands: (string | string[])[]; + /** + * context that will be passed to the commands. + */ + context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined + } + + export enum ColumnType { + icon = 3, + hyperlink = 4, + contextMenu = 5 + } + + export interface TableColumn { + /** + * The text to display on the column heading. 'value' property will be used, if not specified + */ + name?: string; + + /** + * whether the column is resizable. Default value is true. + */ + resizable?: boolean; + } + + export interface IconColumnOptions { + /** + * The icon to use for all the cells in this column. + */ + icon?: IconPath; + } + + export interface ButtonColumn extends IconColumnOptions, TableColumn { + /** + * Whether to show the text, default value is false. + */ + showText?: boolean; + } + + export interface HyperlinkColumn extends IconColumnOptions, TableColumn { + } + + export interface CheckboxColumn extends TableColumn { + action: ActionOnCellCheckboxCheck; + } + + export interface ContextMenuColumn extends TableColumn { + } + + export interface QueryExecuteResultSetNotificationParams { + /** + * Contains execution plans returned by the database in ResultSets. + */ + executionPlans: executionPlan.ExecutionPlanGraph[]; + } + + export interface ObjectMetadata { + /* + * Parent object name for subobjects such as triggers, indexes, etc. + */ + parentName?: string; + + /* + * Parent object type name, such as Table, View, etc. + */ + parentTypeName?: string; + } + + /** + * Represents a selected range in the result grid. + */ + export interface SelectionRange { + fromRow: number; + toRow: number; + fromColumn: number; + toColumn: number; + } + + /** + * Parameters for the copy results request. + */ + export interface CopyResultsRequestParams { + /** + * URI of the editor. + */ + ownerUri: string; + /** + * Index of the batch. + */ + batchIndex: number; + /** + * Index of the result set. + */ + resultSetIndex: number; + /** + * Whether to include the column headers. + */ + includeHeaders: boolean + /** + * The selected ranges to be copied. + */ + selections: SelectionRange[]; + /** + * * Whether to copy the results directly from the backend. + */ + copyInBackend: boolean; + } + + export interface CopyResultsRequestResult { + /** + * Result string from copy operation + */ + results: string; + } + + export interface QueryProvider { + /** + * Notify clients that the URI for a connection has been changed. + */ + connectionUriChanged?(newUri: string, oldUri: string): Thenable; + /** + * Copy the selected data to the clipboard. + * This is introduced to address the performance issue of large amount of data to ADS side. + * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. + * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. + */ + copyResults?(requestParams: CopyResultsRequestParams): Thenable; + } + + export enum DataProviderType { + TableDesignerProvider = 'TableDesignerProvider', + ExecutionPlanProvider = 'ExecutionPlanProvider', + ServerContextualizationProvider = 'ServerContextualizationProvider' + } + + export namespace dataprotocol { + export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; + export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; + /** + * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub + * Copilot for improved suggestions. + * @param provider The provider to register + */ + export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; + } + + export namespace designers { + /** + * Open a table designer window. + * @param providerId The table designer provider Id. + * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. + * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry + * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited + */ + export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; + + /** + * Definition for the table designer provider. + */ + export interface TableDesignerProvider extends DataProvider { + /** + * Initialize the table designer for the specified table. + * @param table the table information. + */ + initializeTableDesigner(table: TableInfo): Thenable; + + /** + * Process the table change. + * @param table the table information + * @param tableChangeInfo the information about the change user made through the UI. + */ + processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; + + /** + * Publish the changes. + * @param table the table information + */ + publishChanges(table: TableInfo): Thenable; + + /** + * Generate script for the changes. + * @param table the table information + */ + generateScript(table: TableInfo): Thenable; + + /** + * Generate preview report describing the changes to be made. + * @param table the table information + */ + generatePreviewReport(table: TableInfo): Thenable; + + /** + * Notify the provider that the table designer has been closed. + * @param table the table information + */ + disposeTableDesigner(table: TableInfo): Thenable; + } + + /** + * The information of the table. + */ + export interface TableInfo { + /** + * Used as the table designer editor's tab header text. + */ + title: string; + /** + * Used as the table designer editor's tab header hover text. + */ + tooltip: string; + /** + * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. + */ + id: string; + /** + * A boolean value indicates whether a new table is being designed. + */ + isNewTable: boolean; + /** + * Extension can store additional information that the provider needs to uniquely identify a table. + */ + [key: string]: any; + /** + * Table icon type that's shown in the editor tab. Default is the basic + * table icon. + */ + tableIcon?: TableIcon; + } + + /** + * The information to populate the table designer UI. + */ + export interface TableDesignerInfo { + /** + * The view definition. + */ + view: TableDesignerView; + /** + * The initial state of the designer. + */ + viewModel: DesignerViewModel; + /** + * The new table info after initialization. + */ + tableInfo: TableInfo; + /** + * The issues. + */ + issues?: DesignerIssue[]; + } + + /** + * Table icon that's shown on the editor tab + */ + export enum TableIcon { + Basic = 'Basic', + Temporal = 'Temporal', + GraphNode = 'GraphNode', + GraphEdge = 'GraphEdge' + } + + /** + * Name of the common table properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableProperty { + Columns = 'columns', + Description = 'description', + Name = 'name', + Schema = 'schema', + Script = 'script', + ForeignKeys = 'foreignKeys', + CheckConstraints = 'checkConstraints', + Indexes = 'indexes', + PrimaryKey = 'primaryKey', + PrimaryKeyName = 'primaryKeyName', + PrimaryKeyDescription = 'primaryKeyDescription', + PrimaryKeyColumns = 'primaryKeyColumns' + } + /** + * Name of the common table column properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableColumnProperty { + AllowNulls = 'allowNulls', + DefaultValue = 'defaultValue', + Length = 'length', + Name = 'name', + Description = 'description', + Type = 'type', + AdvancedType = 'advancedType', + IsPrimaryKey = 'isPrimaryKey', + Precision = 'precision', + Scale = 'scale' + } + + /** + * Name of the common foreign key constraint properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableForeignKeyProperty { + Name = 'name', + Description = 'description', + ForeignTable = 'foreignTable', + OnDeleteAction = 'onDeleteAction', + OnUpdateAction = 'onUpdateAction', + Columns = 'columns' + } + + /** + * Name of the columns mapping properties for foreign key. + */ + export enum ForeignKeyColumnMappingProperty { + Column = 'column', + ForeignColumn = 'foreignColumn' + } + + /** + * Name of the common check constraint properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableCheckConstraintProperty { + Name = 'name', + Description = 'description', + Expression = 'expression' + } + + /** + * Name of the common index properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableIndexProperty { + Name = 'name', + Description = 'description', + Columns = 'columns' + } + + /** + * Name of the common properties of table index column specification. + */ + export enum TableIndexColumnSpecificationProperty { + Column = 'column' + } + + /** + * The table designer view definition. + */ + export interface TableDesignerView { + /** + * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} + */ + additionalTableProperties?: DesignerDataPropertyInfo[]; + /** + * Additional tabs. + */ + additionalTabs?: DesignerTab[]; + /** + * Columns table options. + * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. + * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. + */ + columnTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign keys table options. + * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. + * Default columns to display values are: Name, PrimaryKeyTable. + */ + foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign key column mapping table options. + * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. + * Default columns to display values are: Column, ForeignColumn. + */ + foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Check constraints table options. + * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} + * Default columns to display values are: Name, Expression. + */ + checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Indexes table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} + * Default columns to display values are: Name. + */ + indexTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Index column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Primary column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. + */ + additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; + /** + * Components to be placed under the pre-defined tabs. + */ + additionalComponents?: DesignerDataPropertyWithTabInfo[]; + /** + * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. + */ + useAdvancedSaveMode: boolean; + } + + export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { + /** + * Whether to show the table. Default value is false. + */ + showTable?: boolean; + /** + * Properties to be displayed in the table, other properties can be accessed in the properties view. + */ + propertiesToDisplay?: string[]; + /** + * Additional properties for the entity. + */ + additionalProperties?: DesignerDataPropertyInfo[]; + } + + /** + * The view model of the designer. + */ + export interface DesignerViewModel { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of a designer tab. + */ + export interface DesignerTab { + /** + * The title of the tab. + */ + title: string; + /** + * the components to be displayed in this tab. + */ + components: DesignerDataPropertyInfo[]; + } + + /** + * The definition of the property in the designer. + */ + export interface DesignerDataPropertyInfo { + /** + * The property name. + */ + propertyName: string; + /** + * The description of the property. + */ + description?: string; + /** + * The component type. + */ + componentType: DesignerComponentTypeName; + /** + * The group name, properties with the same group name will be displayed under the same group on the UI. + */ + group?: string; + /** + * Whether the property should be displayed in the properties view. The default value is true. + */ + showInPropertiesView?: boolean; + /** + * The properties of the component. + */ + componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of the property in the designer with tab info. + */ + export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { + /** + * The tab info where this property belongs to. + */ + tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; + } + + /** + * The child component types supported by designer. + */ + export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; + + export interface DesignerTablePropertiesBase { + /** + * Whether user can add new rows to the table. The default value is true. + */ + canAddRows?: boolean; + /** + * Whether user can remove rows from the table. The default value is true. + */ + canRemoveRows?: boolean; + /** + * Whether user can move rows from one index to another. The default value is true. + */ + canMoveRows?: boolean; + /** + * Whether user can insert rows at a given index to the table. The default value is true. + */ + canInsertRows?: boolean; + /** + * Whether to show confirmation when user removes a row. The default value is false. + */ + showRemoveRowConfirmation?: boolean; + /** + * The confirmation message to be displayed when user removes a row. + */ + removeRowConfirmationMessage?: string; + /** + * Whether to show the item detail in properties view. The default value is true. + */ + showItemDetailInPropertiesView?: boolean; + /** + * The label of the add new button. The default value is 'Add New'. + */ + labelForAddNewButton?: string; + } + + /** + * The properties for the table component in the designer. + */ + export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { + /** + * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. + */ + columns?: string[]; + /** + * The display name of the object type. + */ + objectTypeDisplayName: string; + /** + * the properties of the table data item. + */ + itemProperties?: DesignerDataPropertyInfo[]; + /** + * The data to be displayed. + */ + data?: DesignerTableComponentDataItem[]; + } + + /** + * The data item of the designer's table component. + */ + export interface DesignerTableComponentDataItem { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; + /** + * Whether the row can be deleted. The default value is true. + */ + canBeDeleted?: boolean; + } + + /** + * Type of the edit originated from the designer UI. + */ + export enum DesignerEditType { + /** + * Add a row to a table. + */ + Add = 0, + /** + * Remove a row from a table. + */ + Remove = 1, + /** + * Update a property. + */ + Update = 2, + /** + * Change the position of an item in the collection. + */ + Move = 3 + } + + /** + * Information of the edit originated from the designer UI. + */ + export interface DesignerEdit { + /** + * The edit type. + */ + type: DesignerEditType; + /** + * the path of the edit target. + */ + path: DesignerPropertyPath; + /** + * the new value. + */ + value?: any; + } + + /** + * The path of the property. + * Below are the 3 scenarios and their expected path. + * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. + * 1. 'Add' scenario + * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. + * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. + * 2. 'Update' scenario + * a. ['propertyName1']. Example: update the name of the table: ['name']. + * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. + * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. + * 3. 'Remove' scenario + * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. + * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. + */ + export type DesignerPropertyPath = (string | number)[]; + + /** + * Severity of the messages returned by the provider after processing an edit. + * 'error': The issue must be fixed in order to commit the changes. + * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. + * 'information': Informational message. + */ + export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; + + /** + * Represents the issue in the designer + */ + export interface DesignerIssue { + /** + * Severity of the issue. + */ + severity: DesignerIssueSeverity, + /** + * Path of the property that is associated with the issue. + */ + propertyPath?: DesignerPropertyPath, + /** + * Description of the issue. + */ + description: string, + /** + * Url to a web page that has the explaination of the issue. + */ + moreInfoLink?: string; + } + + /** + * The result returned by the table designer provider after handling an edit request. + */ + export interface DesignerEditResult { + /** + * The new view information if the view needs to be refreshed. + */ + view?: T; + /** + * The view model object. + */ + viewModel: DesignerViewModel; + /** + * Whether the current state is valid. + */ + isValid: boolean; + /** + * Issues of current state. + */ + issues?: DesignerIssue[]; + /** + * The input validation error. + */ + inputValidationError?: string; + /** + * Metadata related to the table + */ + metadata?: { [key: string]: string }; + } + + /** + * The result returned by the table designer provider after handling the publish changes request. + */ + export interface PublishChangesResult { + /** + * The new table information after the changes are published. + */ + newTableInfo: TableInfo; + /** + * The new view model. + */ + viewModel: DesignerViewModel; + /** + * The new view. + */ + view: TableDesignerView; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + + export interface GeneratePreviewReportResult { + /** + * Report generated for generate preview + */ + report: string; + /** + * Format (mimeType) of the report + */ + mimeType: string; + /** + * Whether user confirmation is required, the default value is false. + */ + requireConfirmation?: boolean; + /** + * The confirmation text. + */ + confirmationText?: string; + /** + * The table schema validation error. + */ + schemaValidationError?: string; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + } + + export namespace executionPlan { + export interface ExecutionPlanGraph { + /** + * Root of the execution plan tree + */ + root: ExecutionPlanNode; + /** + * Underlying query for the execution plan graph. + */ + query: string; + /** + * String representation of graph + */ + graphFile: ExecutionPlanGraphInfo; + /** + * Query recommendations for optimizing performance + */ + recommendations: ExecutionPlanRecommendations[]; + } + + export interface ExecutionPlanNode { + /** + * Unique id given to node by the provider + */ + id: string; + /** + * Type of the node. This property determines the icon that is displayed for it + */ + type: string; + /** + * Cost associated with the node + */ + cost: number; + /** + * Cost of the node subtree + */ + subTreeCost: number; + /** + * Relative cost of the node compared to its siblings. + */ + relativeCost: number; + /** + * Time take by the node operation in milliseconds + */ + elapsedTimeInMs: number; + /** + * CPU time taken by the node operation in milliseconds + */ + elapsedCpuTimeInMs: number; + /** + * Node properties to be shown in the tooltip + */ + properties: ExecutionPlanGraphElementProperty[]; + /** + * Display name for the node + */ + name: string; + /** + * Description associated with the node. + */ + description: string; + /** + * Subtext displayed under the node name + */ + subtext: string[]; + /** + * Direct children of the nodes. + */ + children: ExecutionPlanNode[]; + /** + * Edges corresponding to the children. + */ + edges: ExecutionPlanEdge[]; + /** + * Warning/parallelism badges applicable to the current node + */ + badges: ExecutionPlanBadge[]; + /** + * Data to show in top operations table for the node. + */ + topOperationsData: TopOperationsDataItem[]; + /** + * Output row count associated with the node + */ + rowCountDisplayString: string; + /** + * Cost string for the node + */ + costDisplayString: string; + /** + * Cost metrics for the node + */ + costMetrics: CostMetric[]; + } + + export interface CostMetric { + /** + * Name of the cost metric. + */ + name: string; + /** + * The value of the cost metric + */ + value: number | undefined; + } + + export interface ExecutionPlanBadge { + /** + * Type of the node overlay. This determines the icon that is displayed for it + */ + type: BadgeType; + /** + * Text to display for the overlay tooltip + */ + tooltip: string; + } + + export enum BadgeType { + Warning = 0, + CriticalWarning = 1, + Parallelism = 2 + } + + export interface ExecutionPlanEdge { + /** + * Count of the rows returned by the subtree of the edge. + */ + rowCount: number; + /** + * Size of the rows returned by the subtree of the edge. + */ + rowSize: number; + /** + * Edge properties to be shown in the tooltip. + */ + properties: ExecutionPlanGraphElementProperty[] + } + + export interface ExecutionPlanGraphElementProperty { + /** + * Name of the property + */ + name: string; + /** + * value for the property + */ + value: string | ExecutionPlanGraphElementProperty[]; + /** + * Flag to show/hide props in tooltip + */ + showInTooltip: boolean; + /** + * Display order of property + */ + displayOrder: number; + /** + * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip + */ + positionAtBottom: boolean; + /** + * Display value of property to show in tooltip and other UI element. + */ + displayValue: string; + /** + * Data type of the property value + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Indicates which value is better when 2 similar properties are compared. + */ + betterValue: ExecutionPlanGraphElementPropertyBetterValue; + } + + export enum ExecutionPlanGraphElementPropertyDataType { + Number = 0, + String = 1, + Boolean = 2, + Nested = 3 + } + + export enum ExecutionPlanGraphElementPropertyBetterValue { + LowerNumber = 0, + HigherNumber = 1, + True = 2, + False = 3, + None = 4 + } + + export interface ExecutionPlanRecommendations { + /** + * Text displayed in the show plan graph control description + */ + displayString: string; + /** + * Query that is recommended to the user + */ + queryText: string; + /** + * Query that will be opened in a new file once the user click on the recommendation + */ + queryWithDescription: string; + } + + export interface ExecutionPlanGraphInfo { + /** + * File contents + */ + graphFileContent: string; + /** + * File type for execution plan. This will be the file type of the editor when the user opens the graph file + */ + graphFileType: string; + /** + * Index of the execution plan in the file content + */ + planIndexInFile?: number; + } + + export interface GetExecutionPlanResult extends ResultStatus { + graphs: ExecutionPlanGraph[] + } + + export interface ExecutionGraphComparisonResult { + /** + * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. + */ + baseNode: ExecutionPlanNode; + /** + * The children of the ExecutionGraphComparisonResult. + */ + children: ExecutionGraphComparisonResult[]; + /** + * The group index of the ExecutionGraphComparisonResult. + */ + groupIndex: number; + /** + * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. + */ + hasMatch: boolean; + /** + * List of matching nodes for the ExecutionGraphComparisonResult. + */ + matchingNodesId: number[]; + /** + * The parent of the ExecutionGraphComparisonResult. + */ + parentNode: ExecutionGraphComparisonResult; + } + + export interface ExecutionPlanComparisonResult extends ResultStatus { + firstComparisonResult: ExecutionGraphComparisonResult; + secondComparisonResult: ExecutionGraphComparisonResult; + } + + export interface IsExecutionPlanResult { + isExecutionPlan: boolean; + queryExecutionPlanFileExtension: string; + } + + export interface ExecutionPlanProvider extends DataProvider { + // execution plan service methods + + /** + * Gets the execution plan graph from the provider for a given plan file + * @param planFile file that contains the execution plan + */ + getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; + /** + * Compares two execution plans and identifies matching regions in both execution plans. + * @param firstPlanFile file that contains the first execution plan. + * @param secondPlanFile file that contains the second execution plan. + */ + compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; + /** + * Determines if the provided value is an execution plan and returns the appropriate file extension. + * @param value String that needs to be checked. + */ + isExecutionPlan(value: string): Thenable; + } + + export interface TopOperationsDataItem { + /** + * Column name for the top operation data item + */ + columnName: string; + /** + * Cell data type for the top operation data item + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Cell value for the top operation data item + */ + displayValue: string | number | boolean; + } + } + + export namespace contextualization { + export interface GetServerContextualizationResult { + /** + * The retrieved server context. + */ + context: string | undefined; + } + + export interface ServerContextualizationProvider extends DataProvider { + /** + * Gets server context, which can be in the form of create scripts but is left up each provider. + * @param ownerUri The URI of the connection to get context for. + */ + getServerContextualization(ownerUri: string): Thenable; + } + } + + /** + * Component to display text with an icon representing the severity + */ + export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { + /** + * An event fired when the InfoBox is clicked + */ + onDidClick: vscode.Event; + /** + * An event fired when the Infobox link is clicked + */ + onLinkClick: vscode.Event; + } + + export interface InfoBoxComponentProperties { + /** + * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. + * Default value is false. + */ + isClickable?: boolean | undefined; + + /** + * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes + */ + clickableButtonAriaLabel?: string; + + /** + * List of links to embed within the text. If links are specified there must be placeholder + * values in the value indicating where the links should be placed, in the format {i} + * + * e.g. "Click {0} for more information!"" + */ + links?: LinkArea[]; + } + + /** + * Event argument for infobox link click event. + */ + export interface InfoBoxLinkClickEventArgs { + /** + * Index of the link selected + */ + index: number; + /** + * Link that is clicked + */ + link: LinkArea; + } + + export interface TextComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface ContainerProperties extends ComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface DropDownProperties { + /** + * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. + */ + strictSelection?: boolean; + } + + export interface NodeInfo { + /** + * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node + * under the database, the nodeType is Folder, the objectType is be Tables. + */ + objectType?: string; + /* + * The path of the parent node. + */ + parentNodePath: string; + /** + * Filterable properties that this node supports + */ + filterableProperties?: NodeFilterProperty[]; + } + + export interface NodeFilterProperty { + /** + * The non-localized name of the filter property + */ + name: string; + /** + * The name of the filter property displayed to the user + */ + displayName: string; + /** + * The type of the filter property + */ + type: NodeFilterPropertyDataType; + /** + * The description of the filter property + */ + description: string; + } + + /** + * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice + */ + export interface NodeFilterChoiceProperty extends NodeFilterProperty { + /** + * The list of choices for the filter property if the type is choice + */ + choices: NodeFilterChoicePropertyValue[]; + } + + export interface NodeFilterChoicePropertyValue { + /** + * The value of the choice + */ + value: string; + /** + * The display name of the choice + * If not specified, the value will be used as the display name + * If specified, the display name will be used in the dropdown + */ + displayName?: string; + } + + export interface NodeFilter { + /** + * The name of the filter property + */ + name: string; + /** + * The operator of the filter property + */ + operator: NodeFilterOperator; + /** + * The applied values of the filter property + */ + value: string | string[] | number | number[] | boolean | undefined; + } + + export enum NodeFilterPropertyDataType { + String = 0, + Number = 1, + Boolean = 2, + Date = 3, + Choice = 4 + } + + export enum NodeFilterOperator { + Equals = 0, + NotEquals = 1, + LessThan = 2, + LessThanOrEquals = 3, + GreaterThan = 4, + GreaterThanOrEquals = 5, + Between = 6, + NotBetween = 7, + Contains = 8, + NotContains = 9, + StartsWith = 10, + NotStartsWith = 11, + EndsWith = 12, + NotEndsWith = 13 + } + + export interface ModelView extends vscode.Disposable { } + + export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } + + export namespace window { + export interface Wizard extends LoadingComponentBase { } + + export interface Dialog extends LoadingComponentBase, vscode.Disposable { } + + export interface ModelViewPanel extends vscode.Disposable { } + + export interface ModelViewDashboard extends vscode.Disposable { } + + /** + * Opens the error dialog with customization options provided. + * @param options Dialog options to customize error dialog. + * @returns Id of action button clicked by user, e.g. ok, cancel + */ + export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; + + /** + * Provides dialog options to customize modal dialog content and layout + */ + export interface IErrorDialogOptions { + /** + * Severity Level to identify icon of modal dialog. + */ + severity: MessageLevel; + /** + * Title of modal dialog header. + */ + headerTitle: string; + /** + * Message text to show on dialog. + */ + message: string; + /** + * (Optional) Detailed message, e.g stack trace of error. + */ + messageDetails?: string; + /** + * Telemetry View to be used for emitting telemetry events. + */ + telemetryView?: string, + /** + * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. + * If custom 'actions' are not provided, 'OK' button will be shown by default. + */ + actions?: IDialogAction[]; + /** + * (Optional) If provided, instruction text is shown in bold below message. + */ + instructionText?: string; + /** + * (Optional) If provided, appends read more link after instruction text. + */ + readMoreLink?: string; + } + + /** + * An action that will be rendered as a button on the dialog. + */ + export interface IDialogAction { + /** + * Identifier of action. + */ + id: string; + /** + * Label of Action button. + */ + label: string; + /** + * Defines if button styling and focus should be based on primary action. + */ + isPrimary: boolean; + } + + export interface FileFilters { + /** + * The label to display in the file filter field next to the list of filters. + */ + label: string; + /** + * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). + */ + filters: string[]; + } + + /** + * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local + * files without any connection is opened via vscode.window.showOpenDialog. + * @param connectionUri The URI of the connection to the target server + * @param targetPath The file path on the server machine to open by default in the dialog + * @param fileFilters The filters used to limit which files are displayed in the file browser + * @param showFoldersOnly Optional argument to specify whether the browser should only show folders + * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. + */ + export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; + } + + export interface FileBrowserProvider extends DataProvider { + openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; + } + + export interface TableComponent { + /** + * Set active cell. + */ + setActiveCell(row: number, column: number): void; + } + + export interface ProfilerProvider { + startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; + } + + export enum ProfilingSessionType { + RemoteSession = 0, + LocalFile = 1 + } + + export interface SplitViewLayout extends FlexLayout { + /** + * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal + * If undefined, the size of the model view container is used + */ + splitViewSize?: number | string | undefined; + } } From 727376b22280239ce94d078905d571cc6f443b1a Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Mon, 26 Aug 2024 14:20:04 -0700 Subject: [PATCH 11/21] Revert "Fix indentation" This reverts commit 1b7949f409f3c18d8f64adf28787b9ec1f5e374f. --- src/azdata.proposed.d.ts | 4220 +++++++++++++++++++------------------- 1 file changed, 2110 insertions(+), 2110 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 8a5b6d9..720ed09 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -9,2114 +9,2114 @@ import * as vscode from 'vscode'; declare module 'azdata' { - export namespace nb { - export interface NotebookDocument { - /** - * Sets the trust mode for the notebook document. - */ - setTrusted(state: boolean): void; - } - - export interface ISessionOptions { - /** - * The spec for the kernel being used to create this session. - */ - kernelSpec?: IKernelSpec; - } - - export interface IKernelSpec { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages?: string[]; - } - - export interface IStandardKernel { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages: string[]; - readonly blockedOnSAW?: boolean; - } - - export interface IKernelChangedArgs { - nbKernelAlias?: string - } - - export interface ICellOutput { - /** - * Unique identifier for this cell output. - */ - id?: string; - } - - export interface IExecuteResult { - data: any; - } - - export interface IExecuteResultUpdate { - output_type: string; - resultSet: ResultSetSummary; - data: any; - } - - export interface IExecuteRequest { - /** - * The language of the notebook document that is executing this request. - */ - language: string; - } - - export interface INotebookMetadata { - connection_name?: string; - multi_connection_mode?: boolean; - } - - export interface ICellMetadata { - connection_name?: string; - } - - export interface ICellContents { - attachments?: ICellAttachments; - } - - export type ICellAttachments = { [key: string]: ICellAttachment }; - export type ICellAttachment = { [key: string]: string }; - - export interface SessionManager { - /** - * Shutdown all sessions. - */ - shutdownAll(): Thenable; - /** - * Disposes the session manager. - */ - dispose(): void; - } - - /** - * An event that is emitted when a {@link NotebookDocument} is closed. - */ - export const onDidCloseNotebookDocument: vscode.Event; - - export interface IKernel { - - /** - * Restart a kernel. - * - * #### Notes - * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). - * - * The promise is fulfilled on a valid response and rejected otherwise. - * - * It is assumed that the API call does not mutate the kernel id or name. - * - * The promise will be rejected if the kernel status is `Dead` or if the - * request fails or the response is invalid. - */ - restart(): Thenable; - } - } - - export interface LoadingComponentBase { - /** - * When true, the component will display a loading spinner. - */ - loading?: boolean; - - /** - * This sets the alert text which gets announced when the loading spinner is shown. - */ - loadingText?: string; - - /** - * The text to display while loading is set to false. Will also be announced through screen readers - * once loading is completed. - */ - loadingCompletedText?: string; - } - - /** - * The column information of a data set. - */ - export interface SimpleColumnInfo { - /** - * The column name. - */ - name: string; - /** - * The data type of the column. - */ - dataTypeName: string; - } - - /** - * The parameters for start data serialization request. - */ - export interface SerializeDataStartRequestParams { - /** - * 'csv', 'json', 'excel', 'xml' - */ - saveFormat: string; - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch of the data set to be serialized. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - /** - * The columns of the data set. - */ - columns: SimpleColumnInfo[]; - /** - * Whether to include column headers to the target file. - */ - includeHeaders?: boolean; - /** - * The delimiter to seperate the cells. - */ - delimiter?: string; - /** - * The line seperator. - */ - lineSeperator?: string; - /** - * Character used for enclosing text fields when saving results as CSV. - */ - textIdentifier?: string; - /** - * File encoding used when saving results as CSV. - */ - encoding?: string; - /** - * When true, XML output will be formatted when saving results as XML. - */ - formatted?: boolean; - } - - /** - * The parameters for continue data serialization request. - */ - export interface SerializeDataContinueRequestParams { - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - } - - /** - * The result of data serialization data request. - */ - export interface SerializeDataResult { - /** - * The output message. - */ - messages?: string; - /** - * Whether the serialization is succeeded. - */ - succeeded: boolean; - } - - /** - * The serialization provider. - */ - export interface SerializationProvider extends DataProvider { - /** - * Start the data serialization. - * @param requestParams the request parameters. - */ - startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; - /** - * Continue the data serialization. - * @param requestParams the request parameters. - */ - continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; - } - - export namespace dataprotocol { - /** - * Registers a SerializationProvider. - * @param provider The data serialization provider. - */ - export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; - export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; - /** - * Registers a DataGridProvider which is used to provide lists of items to a data grid - * @param provider The provider implementation - */ - export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; - } - - export enum DataProviderType { - DataGridProvider = 'DataGridProvider' - } - - /** - * The type of the DataGrid column - */ - export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; - - /** - * A column in a data grid - */ - export interface DataGridColumn { - /** - * The text to display on the column heading. - */ - name: string; - - /** - * The property name in the DataGridItem - */ - field: string; - - /** - * A unique identifier for the column within the grid. - */ - id: string; - - /** - * The type of column this is. This is used to determine how to render the contents. - */ - type: DataGridColumnType; - - /** - * Whether this column is sortable. - */ - sortable?: boolean; - - /** - * Whether this column is filterable - */ - filterable?: boolean; - - /** - * If false, column can no longer be resized. - */ - resizable?: boolean; - - /** - * If set to a non-empty string, a tooltip will appear on hover containing the string. - */ - tooltip?: string; - - /** - * Width of the column in pixels. - */ - width?: number - } - - /** - * Info for a command to execute - */ - export interface ExecuteCommandInfo { - /** - * The ID of the command to execute - */ - id: string; - /** - * The text to display for the action - */ - displayText?: string; - /** - * The optional args to pass to the command - */ - args?: any[]; - } - - /** - * Info for displaying a hyperlink value in a Data Grid table - */ - export interface DataGridHyperlinkInfo { - /** - * The text to display for the link - */ - displayText: string; - /** - * The URL to open or command to execute - */ - linkOrCommand: string | ExecuteCommandInfo; - } - - /** - * An item for displaying in a data grid - */ - export interface DataGridItem { - /** - * A unique identifier for this item - */ - id: string; - - /** - * The other properties that will be displayed in the grid columns - */ - [key: string]: string | DataGridHyperlinkInfo; - } - - /** - * A data provider that provides lists of resource items for a data grid - */ - export interface DataGridProvider extends DataProvider { - /** - * Gets the list of data grid items for this provider - */ - getDataGridItems(): Thenable; - /** - * Gets the list of data grid columns for this provider - */ - getDataGridColumns(): Thenable; - - /** - * The user visible string to use for the title of the grid - */ - title: string; - } - - export interface ConnectionProvider extends DataProvider { - /** - * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) - */ - changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; - } - - // Password Change Request ---------------------------------------------------------------------- - export interface PasswordChangeResult { - /** - * Whether the password change was successful - */ - result: boolean; - /** - * Error message if the password change was unsuccessful - */ - errorMessage?: string; - } - - export interface IConnectionProfile extends ConnectionInfo { - azureAccount?: string; - azureResourceId?: string; - azurePortalEndpoint?: string; - } - - export interface PromptFailedResult extends ProviderError { } - - export interface ProviderError { - /** - * Error name - */ - name?: string; - - /** - * Error code - */ - errorCode?: string; - - /** - * Error message - */ - errorMessage?: string; - } - - - export namespace diagnostics { - /** - * Represents a diagnostics provider of accounts. - */ - export interface ErrorDiagnosticsProviderMetadata { - /** - * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. - * Note: only ONE diagnostic provider per id/name at a time. - */ - targetProviderId: string; - } - - export interface ConnectionDiagnosticsResult { - /** - * Whether the error was handled or not. - */ - handled: boolean, - /** - * Whether reconnect should be attempted. - */ - reconnect?: boolean, - /** - * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. - */ - options?: { [name: string]: any }; - } - - /** - * Provides error information - */ - export interface IErrorInformation { - /** - * Error code - */ - errorCode: number, - /** - * Error Message - */ - errorMessage: string, - /** - * Stack trace of error - */ - messageDetails: string - } - - /** - * Diagnostics object for handling errors for a provider. - */ - export interface ErrorDiagnosticsProvider { - /** - * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. - * @param errorInfo The error information of the connection error. - * @param connection The connection profile that caused the error. - * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. - */ - handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; - } - - /** - * Registers provider with instance of Diagnostic Provider implementation. - * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. - * @param providerMetadata Additional data used to register the provider - * @param errorDiagnostics The provider's diagnostic object that handles errors. - * @returns A disposable that when disposed will unregister the provider - */ - export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; - } - - export namespace connection { - - /** - * Opens the change password dialog. - * @param profile The connection profile to change the password for. - * @returns The new password that is returned from the operation or undefined if unsuccessful. - */ - export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; - } - - export interface ConnectionInfoSummary { - /** - * ID used to identify the connection on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - export interface QueryExecuteCompleteNotificationResult { - /** - * ID used to identify the connection used to run the query on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - /* - * Add optional per-OS default value. - */ - export interface DefaultValueOsOverride { - os: string; - - defaultValueOverride: string; - } - - export interface ConnectionOption { - defaultValueOsOverrides?: DefaultValueOsOverride[]; - - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * When set to true, the respective connection option will be rendered on the main connection dialog - * and not the Advanced Options window. - */ - showOnConnectionDialog?: boolean; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - - export interface ServiceOption { - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - /** - * This change event defines actions - */ - export interface SelectionChangeEvent { - /** - * Values that affect actions defined in this event. - */ - values: string[]; - - /** - * Action to be taken on another option when selected value matches to the list of values provided. - */ - dependentOptionActions: DependentOptionAction[]; - } - - export interface DependentOptionAction { - /** - * Name of option affected by defined action. - */ - optionName: string, - - /** - * Action to be taken, Supported values: 'show', 'hide'. - */ - action: string; - - /** - * Whether or not the option should be set to required when visible. Defaults to false. - * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. - * When set to true, providers must handle property validation. - */ - required?: boolean; - } - - // Object Explorer interfaces -------------------------------- - export interface ObjectExplorerSession { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - } - - export interface ExpandNodeInfo { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - - /** - * Filters to apply to the child nodes being returned - */ - filters?: NodeFilter[]; - } - // End Object Explorer interfaces ---------------------------- - - export interface TaskInfo { - targetLocation?: string; - } - - export interface ButtonColumnOption { - icon?: IconPath; - } - - export namespace sqlAssessment { - - export enum SqlAssessmentTargetType { - Server = 1, - Database = 2 - } - - export enum SqlAssessmentResultItemKind { - RealResult = 0, - Warning = 1, - Error = 2 - } - } - // Assessment interfaces - - export interface SqlAssessmentResultItem { - rulesetVersion: string; - rulesetName: string; - targetType: sqlAssessment.SqlAssessmentTargetType; - targetName: string; - checkId: string; - tags: string[]; - displayName: string; - description: string; - message: string; - helpLink: string; - level: string; - timestamp: string; - kind: sqlAssessment.SqlAssessmentResultItemKind; - } - - export interface SqlAssessmentResult extends ResultStatus { - items: SqlAssessmentResultItem[]; - apiVersion: string; - } - - export interface SqlAssessmentServicesProvider extends DataProvider { - assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; - } - - export interface TreeItem2 extends vscode.TreeItem { - payload?: IConnectionProfile; - childProvider?: string; - type?: ExtensionNodeType; - } - - export interface Component extends vscode.Disposable { } - - export namespace workspace { - /** - * Creates and enters a workspace at the specified location - */ - export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; - - /** - * Enters the workspace with the provided path - * @param workspaceFile - */ - export function enterWorkspace(workspaceFile: vscode.Uri): Promise; - - /** - * Saves and enters the workspace with the provided path - * @param workspaceFile - */ - export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; - } - - export interface TableComponentProperties { - /** - * Specifies whether to use headerFilter plugin - */ - headerFilter?: boolean, - } - - export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; - - export interface ExecutionPlanComponentProperties extends ComponentProperties { - /** - * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs - */ - data?: ExecutionPlanData; - } - - /** - * Defines the executionPlan component - */ - export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { - } - - export interface ModelBuilder { - executionPlan(): ComponentBuilder; - } - - export interface ListViewOption { - /** - * The optional accessibility label for the column. Default is the label for the list view option. - */ - ariaLabel?: string; - /** - * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. - */ - icon?: IconPath; - } - - export interface IconColumnCellValue { - /** - * The icon to be displayed. - */ - icon: IconPath; - /** - * The title of the icon. - */ - title: string; - } - - export interface ButtonColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the button. - */ - title?: string; - } - - export interface HyperlinkColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the hyperlink. - */ - title?: string; - - /** - * The url to open. - */ - url?: string; - /** - * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. - */ - role?: 'button' | 'link'; - } - - export interface ContextMenuColumnCellValue { - /** - * The title of the hyperlink. By default, the title is 'Show Actions' - */ - title?: string; - /** - * commands for the menu. Use an array for a group and menu separators will be added. - */ - commands: (string | string[])[]; - /** - * context that will be passed to the commands. - */ - context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined - } - - export enum ColumnType { - icon = 3, - hyperlink = 4, - contextMenu = 5 - } - - export interface TableColumn { - /** - * The text to display on the column heading. 'value' property will be used, if not specified - */ - name?: string; - - /** - * whether the column is resizable. Default value is true. - */ - resizable?: boolean; - } - - export interface IconColumnOptions { - /** - * The icon to use for all the cells in this column. - */ - icon?: IconPath; - } - - export interface ButtonColumn extends IconColumnOptions, TableColumn { - /** - * Whether to show the text, default value is false. - */ - showText?: boolean; - } - - export interface HyperlinkColumn extends IconColumnOptions, TableColumn { - } - - export interface CheckboxColumn extends TableColumn { - action: ActionOnCellCheckboxCheck; - } - - export interface ContextMenuColumn extends TableColumn { - } - - export interface QueryExecuteResultSetNotificationParams { - /** - * Contains execution plans returned by the database in ResultSets. - */ - executionPlans: executionPlan.ExecutionPlanGraph[]; - } - - export interface ObjectMetadata { - /* - * Parent object name for subobjects such as triggers, indexes, etc. - */ - parentName?: string; - - /* - * Parent object type name, such as Table, View, etc. - */ - parentTypeName?: string; - } - - /** - * Represents a selected range in the result grid. - */ - export interface SelectionRange { - fromRow: number; - toRow: number; - fromColumn: number; - toColumn: number; - } - - /** - * Parameters for the copy results request. - */ - export interface CopyResultsRequestParams { - /** - * URI of the editor. - */ - ownerUri: string; - /** - * Index of the batch. - */ - batchIndex: number; - /** - * Index of the result set. - */ - resultSetIndex: number; - /** - * Whether to include the column headers. - */ - includeHeaders: boolean - /** - * The selected ranges to be copied. - */ - selections: SelectionRange[]; - /** - * * Whether to copy the results directly from the backend. - */ - copyInBackend: boolean; - } - - export interface CopyResultsRequestResult { - /** - * Result string from copy operation - */ - results: string; - } - - export interface QueryProvider { - /** - * Notify clients that the URI for a connection has been changed. - */ - connectionUriChanged?(newUri: string, oldUri: string): Thenable; - /** - * Copy the selected data to the clipboard. - * This is introduced to address the performance issue of large amount of data to ADS side. - * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. - * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. - */ - copyResults?(requestParams: CopyResultsRequestParams): Thenable; - } - - export enum DataProviderType { - TableDesignerProvider = 'TableDesignerProvider', - ExecutionPlanProvider = 'ExecutionPlanProvider', - ServerContextualizationProvider = 'ServerContextualizationProvider' - } - - export namespace dataprotocol { - export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; - export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; - /** - * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub - * Copilot for improved suggestions. - * @param provider The provider to register - */ - export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; - } - - export namespace designers { - /** - * Open a table designer window. - * @param providerId The table designer provider Id. - * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. - * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry - * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited - */ - export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; - - /** - * Definition for the table designer provider. - */ - export interface TableDesignerProvider extends DataProvider { - /** - * Initialize the table designer for the specified table. - * @param table the table information. - */ - initializeTableDesigner(table: TableInfo): Thenable; - - /** - * Process the table change. - * @param table the table information - * @param tableChangeInfo the information about the change user made through the UI. - */ - processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; - - /** - * Publish the changes. - * @param table the table information - */ - publishChanges(table: TableInfo): Thenable; - - /** - * Generate script for the changes. - * @param table the table information - */ - generateScript(table: TableInfo): Thenable; - - /** - * Generate preview report describing the changes to be made. - * @param table the table information - */ - generatePreviewReport(table: TableInfo): Thenable; - - /** - * Notify the provider that the table designer has been closed. - * @param table the table information - */ - disposeTableDesigner(table: TableInfo): Thenable; - } - - /** - * The information of the table. - */ - export interface TableInfo { - /** - * Used as the table designer editor's tab header text. - */ - title: string; - /** - * Used as the table designer editor's tab header hover text. - */ - tooltip: string; - /** - * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. - */ - id: string; - /** - * A boolean value indicates whether a new table is being designed. - */ - isNewTable: boolean; - /** - * Extension can store additional information that the provider needs to uniquely identify a table. - */ - [key: string]: any; - /** - * Table icon type that's shown in the editor tab. Default is the basic - * table icon. - */ - tableIcon?: TableIcon; - } - - /** - * The information to populate the table designer UI. - */ - export interface TableDesignerInfo { - /** - * The view definition. - */ - view: TableDesignerView; - /** - * The initial state of the designer. - */ - viewModel: DesignerViewModel; - /** - * The new table info after initialization. - */ - tableInfo: TableInfo; - /** - * The issues. - */ - issues?: DesignerIssue[]; - } - - /** - * Table icon that's shown on the editor tab - */ - export enum TableIcon { - Basic = 'Basic', - Temporal = 'Temporal', - GraphNode = 'GraphNode', - GraphEdge = 'GraphEdge' - } - - /** - * Name of the common table properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableProperty { - Columns = 'columns', - Description = 'description', - Name = 'name', - Schema = 'schema', - Script = 'script', - ForeignKeys = 'foreignKeys', - CheckConstraints = 'checkConstraints', - Indexes = 'indexes', - PrimaryKey = 'primaryKey', - PrimaryKeyName = 'primaryKeyName', - PrimaryKeyDescription = 'primaryKeyDescription', - PrimaryKeyColumns = 'primaryKeyColumns' - } - /** - * Name of the common table column properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableColumnProperty { - AllowNulls = 'allowNulls', - DefaultValue = 'defaultValue', - Length = 'length', - Name = 'name', - Description = 'description', - Type = 'type', - AdvancedType = 'advancedType', - IsPrimaryKey = 'isPrimaryKey', - Precision = 'precision', - Scale = 'scale' - } - - /** - * Name of the common foreign key constraint properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableForeignKeyProperty { - Name = 'name', - Description = 'description', - ForeignTable = 'foreignTable', - OnDeleteAction = 'onDeleteAction', - OnUpdateAction = 'onUpdateAction', - Columns = 'columns' - } - - /** - * Name of the columns mapping properties for foreign key. - */ - export enum ForeignKeyColumnMappingProperty { - Column = 'column', - ForeignColumn = 'foreignColumn' - } - - /** - * Name of the common check constraint properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableCheckConstraintProperty { - Name = 'name', - Description = 'description', - Expression = 'expression' - } - - /** - * Name of the common index properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableIndexProperty { - Name = 'name', - Description = 'description', - Columns = 'columns' - } - - /** - * Name of the common properties of table index column specification. - */ - export enum TableIndexColumnSpecificationProperty { - Column = 'column' - } - - /** - * The table designer view definition. - */ - export interface TableDesignerView { - /** - * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} - */ - additionalTableProperties?: DesignerDataPropertyInfo[]; - /** - * Additional tabs. - */ - additionalTabs?: DesignerTab[]; - /** - * Columns table options. - * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. - * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. - */ - columnTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign keys table options. - * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. - * Default columns to display values are: Name, PrimaryKeyTable. - */ - foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign key column mapping table options. - * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. - * Default columns to display values are: Column, ForeignColumn. - */ - foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Check constraints table options. - * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} - * Default columns to display values are: Name, Expression. - */ - checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Indexes table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} - * Default columns to display values are: Name. - */ - indexTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Index column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Primary column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. - */ - additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; - /** - * Components to be placed under the pre-defined tabs. - */ - additionalComponents?: DesignerDataPropertyWithTabInfo[]; - /** - * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. - */ - useAdvancedSaveMode: boolean; - } - - export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { - /** - * Whether to show the table. Default value is false. - */ - showTable?: boolean; - /** - * Properties to be displayed in the table, other properties can be accessed in the properties view. - */ - propertiesToDisplay?: string[]; - /** - * Additional properties for the entity. - */ - additionalProperties?: DesignerDataPropertyInfo[]; - } - - /** - * The view model of the designer. - */ - export interface DesignerViewModel { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of a designer tab. - */ - export interface DesignerTab { - /** - * The title of the tab. - */ - title: string; - /** - * the components to be displayed in this tab. - */ - components: DesignerDataPropertyInfo[]; - } - - /** - * The definition of the property in the designer. - */ - export interface DesignerDataPropertyInfo { - /** - * The property name. - */ - propertyName: string; - /** - * The description of the property. - */ - description?: string; - /** - * The component type. - */ - componentType: DesignerComponentTypeName; - /** - * The group name, properties with the same group name will be displayed under the same group on the UI. - */ - group?: string; - /** - * Whether the property should be displayed in the properties view. The default value is true. - */ - showInPropertiesView?: boolean; - /** - * The properties of the component. - */ - componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of the property in the designer with tab info. - */ - export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { - /** - * The tab info where this property belongs to. - */ - tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; - } - - /** - * The child component types supported by designer. - */ - export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; - - export interface DesignerTablePropertiesBase { - /** - * Whether user can add new rows to the table. The default value is true. - */ - canAddRows?: boolean; - /** - * Whether user can remove rows from the table. The default value is true. - */ - canRemoveRows?: boolean; - /** - * Whether user can move rows from one index to another. The default value is true. - */ - canMoveRows?: boolean; - /** - * Whether user can insert rows at a given index to the table. The default value is true. - */ - canInsertRows?: boolean; - /** - * Whether to show confirmation when user removes a row. The default value is false. - */ - showRemoveRowConfirmation?: boolean; - /** - * The confirmation message to be displayed when user removes a row. - */ - removeRowConfirmationMessage?: string; - /** - * Whether to show the item detail in properties view. The default value is true. - */ - showItemDetailInPropertiesView?: boolean; - /** - * The label of the add new button. The default value is 'Add New'. - */ - labelForAddNewButton?: string; - } - - /** - * The properties for the table component in the designer. - */ - export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { - /** - * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. - */ - columns?: string[]; - /** - * The display name of the object type. - */ - objectTypeDisplayName: string; - /** - * the properties of the table data item. - */ - itemProperties?: DesignerDataPropertyInfo[]; - /** - * The data to be displayed. - */ - data?: DesignerTableComponentDataItem[]; - } - - /** - * The data item of the designer's table component. - */ - export interface DesignerTableComponentDataItem { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; - /** - * Whether the row can be deleted. The default value is true. - */ - canBeDeleted?: boolean; - } - - /** - * Type of the edit originated from the designer UI. - */ - export enum DesignerEditType { - /** - * Add a row to a table. - */ - Add = 0, - /** - * Remove a row from a table. - */ - Remove = 1, - /** - * Update a property. - */ - Update = 2, - /** - * Change the position of an item in the collection. - */ - Move = 3 - } - - /** - * Information of the edit originated from the designer UI. - */ - export interface DesignerEdit { - /** - * The edit type. - */ - type: DesignerEditType; - /** - * the path of the edit target. - */ - path: DesignerPropertyPath; - /** - * the new value. - */ - value?: any; - } - - /** - * The path of the property. - * Below are the 3 scenarios and their expected path. - * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. - * 1. 'Add' scenario - * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. - * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. - * 2. 'Update' scenario - * a. ['propertyName1']. Example: update the name of the table: ['name']. - * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. - * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. - * 3. 'Remove' scenario - * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. - * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. - */ - export type DesignerPropertyPath = (string | number)[]; - - /** - * Severity of the messages returned by the provider after processing an edit. - * 'error': The issue must be fixed in order to commit the changes. - * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. - * 'information': Informational message. - */ - export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; - - /** - * Represents the issue in the designer - */ - export interface DesignerIssue { - /** - * Severity of the issue. - */ - severity: DesignerIssueSeverity, - /** - * Path of the property that is associated with the issue. - */ - propertyPath?: DesignerPropertyPath, - /** - * Description of the issue. - */ - description: string, - /** - * Url to a web page that has the explaination of the issue. - */ - moreInfoLink?: string; - } - - /** - * The result returned by the table designer provider after handling an edit request. - */ - export interface DesignerEditResult { - /** - * The new view information if the view needs to be refreshed. - */ - view?: T; - /** - * The view model object. - */ - viewModel: DesignerViewModel; - /** - * Whether the current state is valid. - */ - isValid: boolean; - /** - * Issues of current state. - */ - issues?: DesignerIssue[]; - /** - * The input validation error. - */ - inputValidationError?: string; - /** - * Metadata related to the table - */ - metadata?: { [key: string]: string }; - } - - /** - * The result returned by the table designer provider after handling the publish changes request. - */ - export interface PublishChangesResult { - /** - * The new table information after the changes are published. - */ - newTableInfo: TableInfo; - /** - * The new view model. - */ - viewModel: DesignerViewModel; - /** - * The new view. - */ - view: TableDesignerView; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - - export interface GeneratePreviewReportResult { - /** - * Report generated for generate preview - */ - report: string; - /** - * Format (mimeType) of the report - */ - mimeType: string; - /** - * Whether user confirmation is required, the default value is false. - */ - requireConfirmation?: boolean; - /** - * The confirmation text. - */ - confirmationText?: string; - /** - * The table schema validation error. - */ - schemaValidationError?: string; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - } - - export namespace executionPlan { - export interface ExecutionPlanGraph { - /** - * Root of the execution plan tree - */ - root: ExecutionPlanNode; - /** - * Underlying query for the execution plan graph. - */ - query: string; - /** - * String representation of graph - */ - graphFile: ExecutionPlanGraphInfo; - /** - * Query recommendations for optimizing performance - */ - recommendations: ExecutionPlanRecommendations[]; - } - - export interface ExecutionPlanNode { - /** - * Unique id given to node by the provider - */ - id: string; - /** - * Type of the node. This property determines the icon that is displayed for it - */ - type: string; - /** - * Cost associated with the node - */ - cost: number; - /** - * Cost of the node subtree - */ - subTreeCost: number; - /** - * Relative cost of the node compared to its siblings. - */ - relativeCost: number; - /** - * Time take by the node operation in milliseconds - */ - elapsedTimeInMs: number; - /** - * CPU time taken by the node operation in milliseconds - */ - elapsedCpuTimeInMs: number; - /** - * Node properties to be shown in the tooltip - */ - properties: ExecutionPlanGraphElementProperty[]; - /** - * Display name for the node - */ - name: string; - /** - * Description associated with the node. - */ - description: string; - /** - * Subtext displayed under the node name - */ - subtext: string[]; - /** - * Direct children of the nodes. - */ - children: ExecutionPlanNode[]; - /** - * Edges corresponding to the children. - */ - edges: ExecutionPlanEdge[]; - /** - * Warning/parallelism badges applicable to the current node - */ - badges: ExecutionPlanBadge[]; - /** - * Data to show in top operations table for the node. - */ - topOperationsData: TopOperationsDataItem[]; - /** - * Output row count associated with the node - */ - rowCountDisplayString: string; - /** - * Cost string for the node - */ - costDisplayString: string; - /** - * Cost metrics for the node - */ - costMetrics: CostMetric[]; - } - - export interface CostMetric { - /** - * Name of the cost metric. - */ - name: string; - /** - * The value of the cost metric - */ - value: number | undefined; - } - - export interface ExecutionPlanBadge { - /** - * Type of the node overlay. This determines the icon that is displayed for it - */ - type: BadgeType; - /** - * Text to display for the overlay tooltip - */ - tooltip: string; - } - - export enum BadgeType { - Warning = 0, - CriticalWarning = 1, - Parallelism = 2 - } - - export interface ExecutionPlanEdge { - /** - * Count of the rows returned by the subtree of the edge. - */ - rowCount: number; - /** - * Size of the rows returned by the subtree of the edge. - */ - rowSize: number; - /** - * Edge properties to be shown in the tooltip. - */ - properties: ExecutionPlanGraphElementProperty[] - } - - export interface ExecutionPlanGraphElementProperty { - /** - * Name of the property - */ - name: string; - /** - * value for the property - */ - value: string | ExecutionPlanGraphElementProperty[]; - /** - * Flag to show/hide props in tooltip - */ - showInTooltip: boolean; - /** - * Display order of property - */ - displayOrder: number; - /** - * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip - */ - positionAtBottom: boolean; - /** - * Display value of property to show in tooltip and other UI element. - */ - displayValue: string; - /** - * Data type of the property value - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Indicates which value is better when 2 similar properties are compared. - */ - betterValue: ExecutionPlanGraphElementPropertyBetterValue; - } - - export enum ExecutionPlanGraphElementPropertyDataType { - Number = 0, - String = 1, - Boolean = 2, - Nested = 3 - } - - export enum ExecutionPlanGraphElementPropertyBetterValue { - LowerNumber = 0, - HigherNumber = 1, - True = 2, - False = 3, - None = 4 - } - - export interface ExecutionPlanRecommendations { - /** - * Text displayed in the show plan graph control description - */ - displayString: string; - /** - * Query that is recommended to the user - */ - queryText: string; - /** - * Query that will be opened in a new file once the user click on the recommendation - */ - queryWithDescription: string; - } - - export interface ExecutionPlanGraphInfo { - /** - * File contents - */ - graphFileContent: string; - /** - * File type for execution plan. This will be the file type of the editor when the user opens the graph file - */ - graphFileType: string; - /** - * Index of the execution plan in the file content - */ - planIndexInFile?: number; - } - - export interface GetExecutionPlanResult extends ResultStatus { - graphs: ExecutionPlanGraph[] - } - - export interface ExecutionGraphComparisonResult { - /** - * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. - */ - baseNode: ExecutionPlanNode; - /** - * The children of the ExecutionGraphComparisonResult. - */ - children: ExecutionGraphComparisonResult[]; - /** - * The group index of the ExecutionGraphComparisonResult. - */ - groupIndex: number; - /** - * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. - */ - hasMatch: boolean; - /** - * List of matching nodes for the ExecutionGraphComparisonResult. - */ - matchingNodesId: number[]; - /** - * The parent of the ExecutionGraphComparisonResult. - */ - parentNode: ExecutionGraphComparisonResult; - } - - export interface ExecutionPlanComparisonResult extends ResultStatus { - firstComparisonResult: ExecutionGraphComparisonResult; - secondComparisonResult: ExecutionGraphComparisonResult; - } - - export interface IsExecutionPlanResult { - isExecutionPlan: boolean; - queryExecutionPlanFileExtension: string; - } - - export interface ExecutionPlanProvider extends DataProvider { - // execution plan service methods - - /** - * Gets the execution plan graph from the provider for a given plan file - * @param planFile file that contains the execution plan - */ - getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; - /** - * Compares two execution plans and identifies matching regions in both execution plans. - * @param firstPlanFile file that contains the first execution plan. - * @param secondPlanFile file that contains the second execution plan. - */ - compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; - /** - * Determines if the provided value is an execution plan and returns the appropriate file extension. - * @param value String that needs to be checked. - */ - isExecutionPlan(value: string): Thenable; - } - - export interface TopOperationsDataItem { - /** - * Column name for the top operation data item - */ - columnName: string; - /** - * Cell data type for the top operation data item - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Cell value for the top operation data item - */ - displayValue: string | number | boolean; - } - } - - export namespace contextualization { - export interface GetServerContextualizationResult { - /** - * The retrieved server context. - */ - context: string | undefined; - } - - export interface ServerContextualizationProvider extends DataProvider { - /** - * Gets server context, which can be in the form of create scripts but is left up each provider. - * @param ownerUri The URI of the connection to get context for. - */ - getServerContextualization(ownerUri: string): Thenable; - } - } - - /** - * Component to display text with an icon representing the severity - */ - export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { - /** - * An event fired when the InfoBox is clicked - */ - onDidClick: vscode.Event; - /** - * An event fired when the Infobox link is clicked - */ - onLinkClick: vscode.Event; - } - - export interface InfoBoxComponentProperties { - /** - * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. - * Default value is false. - */ - isClickable?: boolean | undefined; - - /** - * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes - */ - clickableButtonAriaLabel?: string; - - /** - * List of links to embed within the text. If links are specified there must be placeholder - * values in the value indicating where the links should be placed, in the format {i} - * - * e.g. "Click {0} for more information!"" - */ - links?: LinkArea[]; - } - - /** - * Event argument for infobox link click event. - */ - export interface InfoBoxLinkClickEventArgs { - /** - * Index of the link selected - */ - index: number; - /** - * Link that is clicked - */ - link: LinkArea; - } - - export interface TextComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface ContainerProperties extends ComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface DropDownProperties { - /** - * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. - */ - strictSelection?: boolean; - } - - export interface NodeInfo { - /** - * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node - * under the database, the nodeType is Folder, the objectType is be Tables. - */ - objectType?: string; - /* - * The path of the parent node. - */ - parentNodePath: string; - /** - * Filterable properties that this node supports - */ - filterableProperties?: NodeFilterProperty[]; - } - - export interface NodeFilterProperty { - /** - * The non-localized name of the filter property - */ - name: string; - /** - * The name of the filter property displayed to the user - */ - displayName: string; - /** - * The type of the filter property - */ - type: NodeFilterPropertyDataType; - /** - * The description of the filter property - */ - description: string; - } - - /** - * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice - */ - export interface NodeFilterChoiceProperty extends NodeFilterProperty { - /** - * The list of choices for the filter property if the type is choice - */ - choices: NodeFilterChoicePropertyValue[]; - } - - export interface NodeFilterChoicePropertyValue { - /** - * The value of the choice - */ - value: string; - /** - * The display name of the choice - * If not specified, the value will be used as the display name - * If specified, the display name will be used in the dropdown - */ - displayName?: string; - } - - export interface NodeFilter { - /** - * The name of the filter property - */ - name: string; - /** - * The operator of the filter property - */ - operator: NodeFilterOperator; - /** - * The applied values of the filter property - */ - value: string | string[] | number | number[] | boolean | undefined; - } - - export enum NodeFilterPropertyDataType { - String = 0, - Number = 1, - Boolean = 2, - Date = 3, - Choice = 4 - } - - export enum NodeFilterOperator { - Equals = 0, - NotEquals = 1, - LessThan = 2, - LessThanOrEquals = 3, - GreaterThan = 4, - GreaterThanOrEquals = 5, - Between = 6, - NotBetween = 7, - Contains = 8, - NotContains = 9, - StartsWith = 10, - NotStartsWith = 11, - EndsWith = 12, - NotEndsWith = 13 - } - - export interface ModelView extends vscode.Disposable { } - - export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } - - export namespace window { - export interface Wizard extends LoadingComponentBase { } - - export interface Dialog extends LoadingComponentBase, vscode.Disposable { } - - export interface ModelViewPanel extends vscode.Disposable { } - - export interface ModelViewDashboard extends vscode.Disposable { } - - /** - * Opens the error dialog with customization options provided. - * @param options Dialog options to customize error dialog. - * @returns Id of action button clicked by user, e.g. ok, cancel - */ - export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; - - /** - * Provides dialog options to customize modal dialog content and layout - */ - export interface IErrorDialogOptions { - /** - * Severity Level to identify icon of modal dialog. - */ - severity: MessageLevel; - /** - * Title of modal dialog header. - */ - headerTitle: string; - /** - * Message text to show on dialog. - */ - message: string; - /** - * (Optional) Detailed message, e.g stack trace of error. - */ - messageDetails?: string; - /** - * Telemetry View to be used for emitting telemetry events. - */ - telemetryView?: string, - /** - * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. - * If custom 'actions' are not provided, 'OK' button will be shown by default. - */ - actions?: IDialogAction[]; - /** - * (Optional) If provided, instruction text is shown in bold below message. - */ - instructionText?: string; - /** - * (Optional) If provided, appends read more link after instruction text. - */ - readMoreLink?: string; - } - - /** - * An action that will be rendered as a button on the dialog. - */ - export interface IDialogAction { - /** - * Identifier of action. - */ - id: string; - /** - * Label of Action button. - */ - label: string; - /** - * Defines if button styling and focus should be based on primary action. - */ - isPrimary: boolean; - } - - export interface FileFilters { - /** - * The label to display in the file filter field next to the list of filters. - */ - label: string; - /** - * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). - */ - filters: string[]; - } - - /** - * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local - * files without any connection is opened via vscode.window.showOpenDialog. - * @param connectionUri The URI of the connection to the target server - * @param targetPath The file path on the server machine to open by default in the dialog - * @param fileFilters The filters used to limit which files are displayed in the file browser - * @param showFoldersOnly Optional argument to specify whether the browser should only show folders - * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. - */ - export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; - } - - export interface FileBrowserProvider extends DataProvider { - openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; - } - - export interface TableComponent { - /** - * Set active cell. - */ - setActiveCell(row: number, column: number): void; - } - - export interface ProfilerProvider { - startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; - } - - export enum ProfilingSessionType { - RemoteSession = 0, - LocalFile = 1 - } - - export interface SplitViewLayout extends FlexLayout { - /** - * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal - * If undefined, the size of the model view container is used - */ - splitViewSize?: number | string | undefined; - } + export namespace nb { + export interface NotebookDocument { + /** + * Sets the trust mode for the notebook document. + */ + setTrusted(state: boolean): void; + } + + export interface ISessionOptions { + /** + * The spec for the kernel being used to create this session. + */ + kernelSpec?: IKernelSpec; + } + + export interface IKernelSpec { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages?: string[]; + } + + export interface IStandardKernel { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages: string[]; + readonly blockedOnSAW?: boolean; + } + + export interface IKernelChangedArgs { + nbKernelAlias?: string + } + + export interface ICellOutput { + /** + * Unique identifier for this cell output. + */ + id?: string; + } + + export interface IExecuteResult { + data: any; + } + + export interface IExecuteResultUpdate { + output_type: string; + resultSet: ResultSetSummary; + data: any; + } + + export interface IExecuteRequest { + /** + * The language of the notebook document that is executing this request. + */ + language: string; + } + + export interface INotebookMetadata { + connection_name?: string; + multi_connection_mode?: boolean; + } + + export interface ICellMetadata { + connection_name?: string; + } + + export interface ICellContents { + attachments?: ICellAttachments; + } + + export type ICellAttachments = { [key: string]: ICellAttachment }; + export type ICellAttachment = { [key: string]: string }; + + export interface SessionManager { + /** + * Shutdown all sessions. + */ + shutdownAll(): Thenable; + /** + * Disposes the session manager. + */ + dispose(): void; + } + + /** + * An event that is emitted when a {@link NotebookDocument} is closed. + */ + export const onDidCloseNotebookDocument: vscode.Event; + + export interface IKernel { + + /** + * Restart a kernel. + * + * #### Notes + * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). + * + * The promise is fulfilled on a valid response and rejected otherwise. + * + * It is assumed that the API call does not mutate the kernel id or name. + * + * The promise will be rejected if the kernel status is `Dead` or if the + * request fails or the response is invalid. + */ + restart(): Thenable; + } + } + + export interface LoadingComponentBase { + /** + * When true, the component will display a loading spinner. + */ + loading?: boolean; + + /** + * This sets the alert text which gets announced when the loading spinner is shown. + */ + loadingText?: string; + + /** + * The text to display while loading is set to false. Will also be announced through screen readers + * once loading is completed. + */ + loadingCompletedText?: string; + } + + /** + * The column information of a data set. + */ + export interface SimpleColumnInfo { + /** + * The column name. + */ + name: string; + /** + * The data type of the column. + */ + dataTypeName: string; + } + + /** + * The parameters for start data serialization request. + */ + export interface SerializeDataStartRequestParams { + /** + * 'csv', 'json', 'excel', 'xml' + */ + saveFormat: string; + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch of the data set to be serialized. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + /** + * The columns of the data set. + */ + columns: SimpleColumnInfo[]; + /** + * Whether to include column headers to the target file. + */ + includeHeaders?: boolean; + /** + * The delimiter to seperate the cells. + */ + delimiter?: string; + /** + * The line seperator. + */ + lineSeperator?: string; + /** + * Character used for enclosing text fields when saving results as CSV. + */ + textIdentifier?: string; + /** + * File encoding used when saving results as CSV. + */ + encoding?: string; + /** + * When true, XML output will be formatted when saving results as XML. + */ + formatted?: boolean; + } + + /** + * The parameters for continue data serialization request. + */ + export interface SerializeDataContinueRequestParams { + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + } + + /** + * The result of data serialization data request. + */ + export interface SerializeDataResult { + /** + * The output message. + */ + messages?: string; + /** + * Whether the serialization is succeeded. + */ + succeeded: boolean; + } + + /** + * The serialization provider. + */ + export interface SerializationProvider extends DataProvider { + /** + * Start the data serialization. + * @param requestParams the request parameters. + */ + startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; + /** + * Continue the data serialization. + * @param requestParams the request parameters. + */ + continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; + } + + export namespace dataprotocol { + /** + * Registers a SerializationProvider. + * @param provider The data serialization provider. + */ + export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; + export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; + /** + * Registers a DataGridProvider which is used to provide lists of items to a data grid + * @param provider The provider implementation + */ + export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; + } + + export enum DataProviderType { + DataGridProvider = 'DataGridProvider' + } + + /** + * The type of the DataGrid column + */ + export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; + + /** + * A column in a data grid + */ + export interface DataGridColumn { + /** + * The text to display on the column heading. + */ + name: string; + + /** + * The property name in the DataGridItem + */ + field: string; + + /** + * A unique identifier for the column within the grid. + */ + id: string; + + /** + * The type of column this is. This is used to determine how to render the contents. + */ + type: DataGridColumnType; + + /** + * Whether this column is sortable. + */ + sortable?: boolean; + + /** + * Whether this column is filterable + */ + filterable?: boolean; + + /** + * If false, column can no longer be resized. + */ + resizable?: boolean; + + /** + * If set to a non-empty string, a tooltip will appear on hover containing the string. + */ + tooltip?: string; + + /** + * Width of the column in pixels. + */ + width?: number + } + + /** + * Info for a command to execute + */ + export interface ExecuteCommandInfo { + /** + * The ID of the command to execute + */ + id: string; + /** + * The text to display for the action + */ + displayText?: string; + /** + * The optional args to pass to the command + */ + args?: any[]; + } + + /** + * Info for displaying a hyperlink value in a Data Grid table + */ + export interface DataGridHyperlinkInfo { + /** + * The text to display for the link + */ + displayText: string; + /** + * The URL to open or command to execute + */ + linkOrCommand: string | ExecuteCommandInfo; + } + + /** + * An item for displaying in a data grid + */ + export interface DataGridItem { + /** + * A unique identifier for this item + */ + id: string; + + /** + * The other properties that will be displayed in the grid columns + */ + [key: string]: string | DataGridHyperlinkInfo; + } + + /** + * A data provider that provides lists of resource items for a data grid + */ + export interface DataGridProvider extends DataProvider { + /** + * Gets the list of data grid items for this provider + */ + getDataGridItems(): Thenable; + /** + * Gets the list of data grid columns for this provider + */ + getDataGridColumns(): Thenable; + + /** + * The user visible string to use for the title of the grid + */ + title: string; + } + + export interface ConnectionProvider extends DataProvider { + /** + * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) + */ + changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; + } + + // Password Change Request ---------------------------------------------------------------------- + export interface PasswordChangeResult { + /** + * Whether the password change was successful + */ + result: boolean; + /** + * Error message if the password change was unsuccessful + */ + errorMessage?: string; + } + + export interface IConnectionProfile extends ConnectionInfo { + azureAccount?: string; + azureResourceId?: string; + azurePortalEndpoint?: string; + } + + export interface PromptFailedResult extends ProviderError { } + + export interface ProviderError { + /** + * Error name + */ + name?: string; + + /** + * Error code + */ + errorCode?: string; + + /** + * Error message + */ + errorMessage?: string; + } + + + export namespace diagnostics { + /** + * Represents a diagnostics provider of accounts. + */ + export interface ErrorDiagnosticsProviderMetadata { + /** + * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. + * Note: only ONE diagnostic provider per id/name at a time. + */ + targetProviderId: string; + } + + export interface ConnectionDiagnosticsResult { + /** + * Whether the error was handled or not. + */ + handled: boolean, + /** + * Whether reconnect should be attempted. + */ + reconnect?: boolean, + /** + * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. + */ + options?: { [name: string]: any }; + } + + /** + * Provides error information + */ + export interface IErrorInformation { + /** + * Error code + */ + errorCode: number, + /** + * Error Message + */ + errorMessage: string, + /** + * Stack trace of error + */ + messageDetails: string + } + + /** + * Diagnostics object for handling errors for a provider. + */ + export interface ErrorDiagnosticsProvider { + /** + * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. + * @param errorInfo The error information of the connection error. + * @param connection The connection profile that caused the error. + * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. + */ + handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; + } + + /** + * Registers provider with instance of Diagnostic Provider implementation. + * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. + * @param providerMetadata Additional data used to register the provider + * @param errorDiagnostics The provider's diagnostic object that handles errors. + * @returns A disposable that when disposed will unregister the provider + */ + export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; + } + + export namespace connection { + + /** + * Opens the change password dialog. + * @param profile The connection profile to change the password for. + * @returns The new password that is returned from the operation or undefined if unsuccessful. + */ + export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; + } + + export interface ConnectionInfoSummary { + /** + * ID used to identify the connection on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + export interface QueryExecuteCompleteNotificationResult { + /** + * ID used to identify the connection used to run the query on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + /* + * Add optional per-OS default value. + */ + export interface DefaultValueOsOverride { + os: string; + + defaultValueOverride: string; + } + + export interface ConnectionOption { + defaultValueOsOverrides?: DefaultValueOsOverride[]; + + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * When set to true, the respective connection option will be rendered on the main connection dialog + * and not the Advanced Options window. + */ + showOnConnectionDialog?: boolean; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + + export interface ServiceOption { + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + /** + * This change event defines actions + */ + export interface SelectionChangeEvent { + /** + * Values that affect actions defined in this event. + */ + values: string[]; + + /** + * Action to be taken on another option when selected value matches to the list of values provided. + */ + dependentOptionActions: DependentOptionAction[]; + } + + export interface DependentOptionAction { + /** + * Name of option affected by defined action. + */ + optionName: string, + + /** + * Action to be taken, Supported values: 'show', 'hide'. + */ + action: string; + + /** + * Whether or not the option should be set to required when visible. Defaults to false. + * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. + * When set to true, providers must handle property validation. + */ + required?: boolean; + } + + // Object Explorer interfaces -------------------------------- + export interface ObjectExplorerSession { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + } + + export interface ExpandNodeInfo { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + + /** + * Filters to apply to the child nodes being returned + */ + filters?: NodeFilter[]; + } + // End Object Explorer interfaces ---------------------------- + + export interface TaskInfo { + targetLocation?: string; + } + + export interface ButtonColumnOption { + icon?: IconPath; + } + + export namespace sqlAssessment { + + export enum SqlAssessmentTargetType { + Server = 1, + Database = 2 + } + + export enum SqlAssessmentResultItemKind { + RealResult = 0, + Warning = 1, + Error = 2 + } + } + // Assessment interfaces + + export interface SqlAssessmentResultItem { + rulesetVersion: string; + rulesetName: string; + targetType: sqlAssessment.SqlAssessmentTargetType; + targetName: string; + checkId: string; + tags: string[]; + displayName: string; + description: string; + message: string; + helpLink: string; + level: string; + timestamp: string; + kind: sqlAssessment.SqlAssessmentResultItemKind; + } + + export interface SqlAssessmentResult extends ResultStatus { + items: SqlAssessmentResultItem[]; + apiVersion: string; + } + + export interface SqlAssessmentServicesProvider extends DataProvider { + assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; + } + + export interface TreeItem2 extends vscode.TreeItem { + payload?: IConnectionProfile; + childProvider?: string; + type?: ExtensionNodeType; + } + + export interface Component extends vscode.Disposable { } + + export namespace workspace { + /** + * Creates and enters a workspace at the specified location + */ + export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; + + /** + * Enters the workspace with the provided path + * @param workspaceFile + */ + export function enterWorkspace(workspaceFile: vscode.Uri): Promise; + + /** + * Saves and enters the workspace with the provided path + * @param workspaceFile + */ + export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; + } + + export interface TableComponentProperties { + /** + * Specifies whether to use headerFilter plugin + */ + headerFilter?: boolean, + } + + export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; + + export interface ExecutionPlanComponentProperties extends ComponentProperties { + /** + * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs + */ + data?: ExecutionPlanData; + } + + /** + * Defines the executionPlan component + */ + export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { + } + + export interface ModelBuilder { + executionPlan(): ComponentBuilder; + } + + export interface ListViewOption { + /** + * The optional accessibility label for the column. Default is the label for the list view option. + */ + ariaLabel?: string; + /** + * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. + */ + icon?: IconPath; + } + + export interface IconColumnCellValue { + /** + * The icon to be displayed. + */ + icon: IconPath; + /** + * The title of the icon. + */ + title: string; + } + + export interface ButtonColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the button. + */ + title?: string; + } + + export interface HyperlinkColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the hyperlink. + */ + title?: string; + + /** + * The url to open. + */ + url?: string; + /** + * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. + */ + role?: 'button' | 'link'; + } + + export interface ContextMenuColumnCellValue { + /** + * The title of the hyperlink. By default, the title is 'Show Actions' + */ + title?: string; + /** + * commands for the menu. Use an array for a group and menu separators will be added. + */ + commands: (string | string[])[]; + /** + * context that will be passed to the commands. + */ + context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined + } + + export enum ColumnType { + icon = 3, + hyperlink = 4, + contextMenu = 5 + } + + export interface TableColumn { + /** + * The text to display on the column heading. 'value' property will be used, if not specified + */ + name?: string; + + /** + * whether the column is resizable. Default value is true. + */ + resizable?: boolean; + } + + export interface IconColumnOptions { + /** + * The icon to use for all the cells in this column. + */ + icon?: IconPath; + } + + export interface ButtonColumn extends IconColumnOptions, TableColumn { + /** + * Whether to show the text, default value is false. + */ + showText?: boolean; + } + + export interface HyperlinkColumn extends IconColumnOptions, TableColumn { + } + + export interface CheckboxColumn extends TableColumn { + action: ActionOnCellCheckboxCheck; + } + + export interface ContextMenuColumn extends TableColumn { + } + + export interface QueryExecuteResultSetNotificationParams { + /** + * Contains execution plans returned by the database in ResultSets. + */ + executionPlans: executionPlan.ExecutionPlanGraph[]; + } + + export interface ObjectMetadata { + /* + * Parent object name for subobjects such as triggers, indexes, etc. + */ + parentName?: string; + + /* + * Parent object type name, such as Table, View, etc. + */ + parentTypeName?: string; + } + + /** + * Represents a selected range in the result grid. + */ + export interface SelectionRange { + fromRow: number; + toRow: number; + fromColumn: number; + toColumn: number; + } + + /** + * Parameters for the copy results request. + */ + export interface CopyResultsRequestParams { + /** + * URI of the editor. + */ + ownerUri: string; + /** + * Index of the batch. + */ + batchIndex: number; + /** + * Index of the result set. + */ + resultSetIndex: number; + /** + * Whether to include the column headers. + */ + includeHeaders: boolean + /** + * The selected ranges to be copied. + */ + selections: SelectionRange[]; + /** + * * Whether to copy the results directly from the backend. + */ + copyInBackend: boolean; + } + + export interface CopyResultsRequestResult { + /** + * Result string from copy operation + */ + results: string; + } + + export interface QueryProvider { + /** + * Notify clients that the URI for a connection has been changed. + */ + connectionUriChanged?(newUri: string, oldUri: string): Thenable; + /** + * Copy the selected data to the clipboard. + * This is introduced to address the performance issue of large amount of data to ADS side. + * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. + * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. + */ + copyResults?(requestParams: CopyResultsRequestParams): Thenable; + } + + export enum DataProviderType { + TableDesignerProvider = 'TableDesignerProvider', + ExecutionPlanProvider = 'ExecutionPlanProvider', + ServerContextualizationProvider = 'ServerContextualizationProvider' + } + + export namespace dataprotocol { + export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; + export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; + /** + * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub + * Copilot for improved suggestions. + * @param provider The provider to register + */ + export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; + } + + export namespace designers { + /** + * Open a table designer window. + * @param providerId The table designer provider Id. + * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. + * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry + * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited + */ + export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; + + /** + * Definition for the table designer provider. + */ + export interface TableDesignerProvider extends DataProvider { + /** + * Initialize the table designer for the specified table. + * @param table the table information. + */ + initializeTableDesigner(table: TableInfo): Thenable; + + /** + * Process the table change. + * @param table the table information + * @param tableChangeInfo the information about the change user made through the UI. + */ + processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; + + /** + * Publish the changes. + * @param table the table information + */ + publishChanges(table: TableInfo): Thenable; + + /** + * Generate script for the changes. + * @param table the table information + */ + generateScript(table: TableInfo): Thenable; + + /** + * Generate preview report describing the changes to be made. + * @param table the table information + */ + generatePreviewReport(table: TableInfo): Thenable; + + /** + * Notify the provider that the table designer has been closed. + * @param table the table information + */ + disposeTableDesigner(table: TableInfo): Thenable; + } + + /** + * The information of the table. + */ + export interface TableInfo { + /** + * Used as the table designer editor's tab header text. + */ + title: string; + /** + * Used as the table designer editor's tab header hover text. + */ + tooltip: string; + /** + * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. + */ + id: string; + /** + * A boolean value indicates whether a new table is being designed. + */ + isNewTable: boolean; + /** + * Extension can store additional information that the provider needs to uniquely identify a table. + */ + [key: string]: any; + /** + * Table icon type that's shown in the editor tab. Default is the basic + * table icon. + */ + tableIcon?: TableIcon; + } + + /** + * The information to populate the table designer UI. + */ + export interface TableDesignerInfo { + /** + * The view definition. + */ + view: TableDesignerView; + /** + * The initial state of the designer. + */ + viewModel: DesignerViewModel; + /** + * The new table info after initialization. + */ + tableInfo: TableInfo; + /** + * The issues. + */ + issues?: DesignerIssue[]; + } + + /** + * Table icon that's shown on the editor tab + */ + export enum TableIcon { + Basic = 'Basic', + Temporal = 'Temporal', + GraphNode = 'GraphNode', + GraphEdge = 'GraphEdge' + } + + /** + * Name of the common table properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableProperty { + Columns = 'columns', + Description = 'description', + Name = 'name', + Schema = 'schema', + Script = 'script', + ForeignKeys = 'foreignKeys', + CheckConstraints = 'checkConstraints', + Indexes = 'indexes', + PrimaryKey = 'primaryKey', + PrimaryKeyName = 'primaryKeyName', + PrimaryKeyDescription = 'primaryKeyDescription', + PrimaryKeyColumns = 'primaryKeyColumns' + } + /** + * Name of the common table column properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableColumnProperty { + AllowNulls = 'allowNulls', + DefaultValue = 'defaultValue', + Length = 'length', + Name = 'name', + Description = 'description', + Type = 'type', + AdvancedType = 'advancedType', + IsPrimaryKey = 'isPrimaryKey', + Precision = 'precision', + Scale = 'scale' + } + + /** + * Name of the common foreign key constraint properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableForeignKeyProperty { + Name = 'name', + Description = 'description', + ForeignTable = 'foreignTable', + OnDeleteAction = 'onDeleteAction', + OnUpdateAction = 'onUpdateAction', + Columns = 'columns' + } + + /** + * Name of the columns mapping properties for foreign key. + */ + export enum ForeignKeyColumnMappingProperty { + Column = 'column', + ForeignColumn = 'foreignColumn' + } + + /** + * Name of the common check constraint properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableCheckConstraintProperty { + Name = 'name', + Description = 'description', + Expression = 'expression' + } + + /** + * Name of the common index properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableIndexProperty { + Name = 'name', + Description = 'description', + Columns = 'columns' + } + + /** + * Name of the common properties of table index column specification. + */ + export enum TableIndexColumnSpecificationProperty { + Column = 'column' + } + + /** + * The table designer view definition. + */ + export interface TableDesignerView { + /** + * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} + */ + additionalTableProperties?: DesignerDataPropertyInfo[]; + /** + * Additional tabs. + */ + additionalTabs?: DesignerTab[]; + /** + * Columns table options. + * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. + * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. + */ + columnTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign keys table options. + * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. + * Default columns to display values are: Name, PrimaryKeyTable. + */ + foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign key column mapping table options. + * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. + * Default columns to display values are: Column, ForeignColumn. + */ + foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Check constraints table options. + * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} + * Default columns to display values are: Name, Expression. + */ + checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Indexes table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} + * Default columns to display values are: Name. + */ + indexTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Index column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Primary column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. + */ + additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; + /** + * Components to be placed under the pre-defined tabs. + */ + additionalComponents?: DesignerDataPropertyWithTabInfo[]; + /** + * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. + */ + useAdvancedSaveMode: boolean; + } + + export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { + /** + * Whether to show the table. Default value is false. + */ + showTable?: boolean; + /** + * Properties to be displayed in the table, other properties can be accessed in the properties view. + */ + propertiesToDisplay?: string[]; + /** + * Additional properties for the entity. + */ + additionalProperties?: DesignerDataPropertyInfo[]; + } + + /** + * The view model of the designer. + */ + export interface DesignerViewModel { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of a designer tab. + */ + export interface DesignerTab { + /** + * The title of the tab. + */ + title: string; + /** + * the components to be displayed in this tab. + */ + components: DesignerDataPropertyInfo[]; + } + + /** + * The definition of the property in the designer. + */ + export interface DesignerDataPropertyInfo { + /** + * The property name. + */ + propertyName: string; + /** + * The description of the property. + */ + description?: string; + /** + * The component type. + */ + componentType: DesignerComponentTypeName; + /** + * The group name, properties with the same group name will be displayed under the same group on the UI. + */ + group?: string; + /** + * Whether the property should be displayed in the properties view. The default value is true. + */ + showInPropertiesView?: boolean; + /** + * The properties of the component. + */ + componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of the property in the designer with tab info. + */ + export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { + /** + * The tab info where this property belongs to. + */ + tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; + } + + /** + * The child component types supported by designer. + */ + export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; + + export interface DesignerTablePropertiesBase { + /** + * Whether user can add new rows to the table. The default value is true. + */ + canAddRows?: boolean; + /** + * Whether user can remove rows from the table. The default value is true. + */ + canRemoveRows?: boolean; + /** + * Whether user can move rows from one index to another. The default value is true. + */ + canMoveRows?: boolean; + /** + * Whether user can insert rows at a given index to the table. The default value is true. + */ + canInsertRows?: boolean; + /** + * Whether to show confirmation when user removes a row. The default value is false. + */ + showRemoveRowConfirmation?: boolean; + /** + * The confirmation message to be displayed when user removes a row. + */ + removeRowConfirmationMessage?: string; + /** + * Whether to show the item detail in properties view. The default value is true. + */ + showItemDetailInPropertiesView?: boolean; + /** + * The label of the add new button. The default value is 'Add New'. + */ + labelForAddNewButton?: string; + } + + /** + * The properties for the table component in the designer. + */ + export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { + /** + * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. + */ + columns?: string[]; + /** + * The display name of the object type. + */ + objectTypeDisplayName: string; + /** + * the properties of the table data item. + */ + itemProperties?: DesignerDataPropertyInfo[]; + /** + * The data to be displayed. + */ + data?: DesignerTableComponentDataItem[]; + } + + /** + * The data item of the designer's table component. + */ + export interface DesignerTableComponentDataItem { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; + /** + * Whether the row can be deleted. The default value is true. + */ + canBeDeleted?: boolean; + } + + /** + * Type of the edit originated from the designer UI. + */ + export enum DesignerEditType { + /** + * Add a row to a table. + */ + Add = 0, + /** + * Remove a row from a table. + */ + Remove = 1, + /** + * Update a property. + */ + Update = 2, + /** + * Change the position of an item in the collection. + */ + Move = 3 + } + + /** + * Information of the edit originated from the designer UI. + */ + export interface DesignerEdit { + /** + * The edit type. + */ + type: DesignerEditType; + /** + * the path of the edit target. + */ + path: DesignerPropertyPath; + /** + * the new value. + */ + value?: any; + } + + /** + * The path of the property. + * Below are the 3 scenarios and their expected path. + * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. + * 1. 'Add' scenario + * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. + * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. + * 2. 'Update' scenario + * a. ['propertyName1']. Example: update the name of the table: ['name']. + * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. + * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. + * 3. 'Remove' scenario + * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. + * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. + */ + export type DesignerPropertyPath = (string | number)[]; + + /** + * Severity of the messages returned by the provider after processing an edit. + * 'error': The issue must be fixed in order to commit the changes. + * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. + * 'information': Informational message. + */ + export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; + + /** + * Represents the issue in the designer + */ + export interface DesignerIssue { + /** + * Severity of the issue. + */ + severity: DesignerIssueSeverity, + /** + * Path of the property that is associated with the issue. + */ + propertyPath?: DesignerPropertyPath, + /** + * Description of the issue. + */ + description: string, + /** + * Url to a web page that has the explaination of the issue. + */ + moreInfoLink?: string; + } + + /** + * The result returned by the table designer provider after handling an edit request. + */ + export interface DesignerEditResult { + /** + * The new view information if the view needs to be refreshed. + */ + view?: T; + /** + * The view model object. + */ + viewModel: DesignerViewModel; + /** + * Whether the current state is valid. + */ + isValid: boolean; + /** + * Issues of current state. + */ + issues?: DesignerIssue[]; + /** + * The input validation error. + */ + inputValidationError?: string; + /** + * Metadata related to the table + */ + metadata?: { [key: string]: string }; + } + + /** + * The result returned by the table designer provider after handling the publish changes request. + */ + export interface PublishChangesResult { + /** + * The new table information after the changes are published. + */ + newTableInfo: TableInfo; + /** + * The new view model. + */ + viewModel: DesignerViewModel; + /** + * The new view. + */ + view: TableDesignerView; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + + export interface GeneratePreviewReportResult { + /** + * Report generated for generate preview + */ + report: string; + /** + * Format (mimeType) of the report + */ + mimeType: string; + /** + * Whether user confirmation is required, the default value is false. + */ + requireConfirmation?: boolean; + /** + * The confirmation text. + */ + confirmationText?: string; + /** + * The table schema validation error. + */ + schemaValidationError?: string; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + } + + export namespace executionPlan { + export interface ExecutionPlanGraph { + /** + * Root of the execution plan tree + */ + root: ExecutionPlanNode; + /** + * Underlying query for the execution plan graph. + */ + query: string; + /** + * String representation of graph + */ + graphFile: ExecutionPlanGraphInfo; + /** + * Query recommendations for optimizing performance + */ + recommendations: ExecutionPlanRecommendations[]; + } + + export interface ExecutionPlanNode { + /** + * Unique id given to node by the provider + */ + id: string; + /** + * Type of the node. This property determines the icon that is displayed for it + */ + type: string; + /** + * Cost associated with the node + */ + cost: number; + /** + * Cost of the node subtree + */ + subTreeCost: number; + /** + * Relative cost of the node compared to its siblings. + */ + relativeCost: number; + /** + * Time take by the node operation in milliseconds + */ + elapsedTimeInMs: number; + /** + * CPU time taken by the node operation in milliseconds + */ + elapsedCpuTimeInMs: number; + /** + * Node properties to be shown in the tooltip + */ + properties: ExecutionPlanGraphElementProperty[]; + /** + * Display name for the node + */ + name: string; + /** + * Description associated with the node. + */ + description: string; + /** + * Subtext displayed under the node name + */ + subtext: string[]; + /** + * Direct children of the nodes. + */ + children: ExecutionPlanNode[]; + /** + * Edges corresponding to the children. + */ + edges: ExecutionPlanEdge[]; + /** + * Warning/parallelism badges applicable to the current node + */ + badges: ExecutionPlanBadge[]; + /** + * Data to show in top operations table for the node. + */ + topOperationsData: TopOperationsDataItem[]; + /** + * Output row count associated with the node + */ + rowCountDisplayString: string; + /** + * Cost string for the node + */ + costDisplayString: string; + /** + * Cost metrics for the node + */ + costMetrics: CostMetric[]; + } + + export interface CostMetric { + /** + * Name of the cost metric. + */ + name: string; + /** + * The value of the cost metric + */ + value: number | undefined; + } + + export interface ExecutionPlanBadge { + /** + * Type of the node overlay. This determines the icon that is displayed for it + */ + type: BadgeType; + /** + * Text to display for the overlay tooltip + */ + tooltip: string; + } + + export enum BadgeType { + Warning = 0, + CriticalWarning = 1, + Parallelism = 2 + } + + export interface ExecutionPlanEdge { + /** + * Count of the rows returned by the subtree of the edge. + */ + rowCount: number; + /** + * Size of the rows returned by the subtree of the edge. + */ + rowSize: number; + /** + * Edge properties to be shown in the tooltip. + */ + properties: ExecutionPlanGraphElementProperty[] + } + + export interface ExecutionPlanGraphElementProperty { + /** + * Name of the property + */ + name: string; + /** + * value for the property + */ + value: string | ExecutionPlanGraphElementProperty[]; + /** + * Flag to show/hide props in tooltip + */ + showInTooltip: boolean; + /** + * Display order of property + */ + displayOrder: number; + /** + * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip + */ + positionAtBottom: boolean; + /** + * Display value of property to show in tooltip and other UI element. + */ + displayValue: string; + /** + * Data type of the property value + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Indicates which value is better when 2 similar properties are compared. + */ + betterValue: ExecutionPlanGraphElementPropertyBetterValue; + } + + export enum ExecutionPlanGraphElementPropertyDataType { + Number = 0, + String = 1, + Boolean = 2, + Nested = 3 + } + + export enum ExecutionPlanGraphElementPropertyBetterValue { + LowerNumber = 0, + HigherNumber = 1, + True = 2, + False = 3, + None = 4 + } + + export interface ExecutionPlanRecommendations { + /** + * Text displayed in the show plan graph control description + */ + displayString: string; + /** + * Query that is recommended to the user + */ + queryText: string; + /** + * Query that will be opened in a new file once the user click on the recommendation + */ + queryWithDescription: string; + } + + export interface ExecutionPlanGraphInfo { + /** + * File contents + */ + graphFileContent: string; + /** + * File type for execution plan. This will be the file type of the editor when the user opens the graph file + */ + graphFileType: string; + /** + * Index of the execution plan in the file content + */ + planIndexInFile?: number; + } + + export interface GetExecutionPlanResult extends ResultStatus { + graphs: ExecutionPlanGraph[] + } + + export interface ExecutionGraphComparisonResult { + /** + * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. + */ + baseNode: ExecutionPlanNode; + /** + * The children of the ExecutionGraphComparisonResult. + */ + children: ExecutionGraphComparisonResult[]; + /** + * The group index of the ExecutionGraphComparisonResult. + */ + groupIndex: number; + /** + * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. + */ + hasMatch: boolean; + /** + * List of matching nodes for the ExecutionGraphComparisonResult. + */ + matchingNodesId: number[]; + /** + * The parent of the ExecutionGraphComparisonResult. + */ + parentNode: ExecutionGraphComparisonResult; + } + + export interface ExecutionPlanComparisonResult extends ResultStatus { + firstComparisonResult: ExecutionGraphComparisonResult; + secondComparisonResult: ExecutionGraphComparisonResult; + } + + export interface IsExecutionPlanResult { + isExecutionPlan: boolean; + queryExecutionPlanFileExtension: string; + } + + export interface ExecutionPlanProvider extends DataProvider { + // execution plan service methods + + /** + * Gets the execution plan graph from the provider for a given plan file + * @param planFile file that contains the execution plan + */ + getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; + /** + * Compares two execution plans and identifies matching regions in both execution plans. + * @param firstPlanFile file that contains the first execution plan. + * @param secondPlanFile file that contains the second execution plan. + */ + compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; + /** + * Determines if the provided value is an execution plan and returns the appropriate file extension. + * @param value String that needs to be checked. + */ + isExecutionPlan(value: string): Thenable; + } + + export interface TopOperationsDataItem { + /** + * Column name for the top operation data item + */ + columnName: string; + /** + * Cell data type for the top operation data item + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Cell value for the top operation data item + */ + displayValue: string | number | boolean; + } + } + + export namespace contextualization { + export interface GetServerContextualizationResult { + /** + * The retrieved server context. + */ + context: string | undefined; + } + + export interface ServerContextualizationProvider extends DataProvider { + /** + * Gets server context, which can be in the form of create scripts but is left up each provider. + * @param ownerUri The URI of the connection to get context for. + */ + getServerContextualization(ownerUri: string): Thenable; + } + } + + /** + * Component to display text with an icon representing the severity + */ + export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { + /** + * An event fired when the InfoBox is clicked + */ + onDidClick: vscode.Event; + /** + * An event fired when the Infobox link is clicked + */ + onLinkClick: vscode.Event; + } + + export interface InfoBoxComponentProperties { + /** + * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. + * Default value is false. + */ + isClickable?: boolean | undefined; + + /** + * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes + */ + clickableButtonAriaLabel?: string; + + /** + * List of links to embed within the text. If links are specified there must be placeholder + * values in the value indicating where the links should be placed, in the format {i} + * + * e.g. "Click {0} for more information!"" + */ + links?: LinkArea[]; + } + + /** + * Event argument for infobox link click event. + */ + export interface InfoBoxLinkClickEventArgs { + /** + * Index of the link selected + */ + index: number; + /** + * Link that is clicked + */ + link: LinkArea; + } + + export interface TextComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface ContainerProperties extends ComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface DropDownProperties { + /** + * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. + */ + strictSelection?: boolean; + } + + export interface NodeInfo { + /** + * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node + * under the database, the nodeType is Folder, the objectType is be Tables. + */ + objectType?: string; + /* + * The path of the parent node. + */ + parentNodePath: string; + /** + * Filterable properties that this node supports + */ + filterableProperties?: NodeFilterProperty[]; + } + + export interface NodeFilterProperty { + /** + * The non-localized name of the filter property + */ + name: string; + /** + * The name of the filter property displayed to the user + */ + displayName: string; + /** + * The type of the filter property + */ + type: NodeFilterPropertyDataType; + /** + * The description of the filter property + */ + description: string; + } + + /** + * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice + */ + export interface NodeFilterChoiceProperty extends NodeFilterProperty { + /** + * The list of choices for the filter property if the type is choice + */ + choices: NodeFilterChoicePropertyValue[]; + } + + export interface NodeFilterChoicePropertyValue { + /** + * The value of the choice + */ + value: string; + /** + * The display name of the choice + * If not specified, the value will be used as the display name + * If specified, the display name will be used in the dropdown + */ + displayName?: string; + } + + export interface NodeFilter { + /** + * The name of the filter property + */ + name: string; + /** + * The operator of the filter property + */ + operator: NodeFilterOperator; + /** + * The applied values of the filter property + */ + value: string | string[] | number | number[] | boolean | undefined; + } + + export enum NodeFilterPropertyDataType { + String = 0, + Number = 1, + Boolean = 2, + Date = 3, + Choice = 4 + } + + export enum NodeFilterOperator { + Equals = 0, + NotEquals = 1, + LessThan = 2, + LessThanOrEquals = 3, + GreaterThan = 4, + GreaterThanOrEquals = 5, + Between = 6, + NotBetween = 7, + Contains = 8, + NotContains = 9, + StartsWith = 10, + NotStartsWith = 11, + EndsWith = 12, + NotEndsWith = 13 + } + + export interface ModelView extends vscode.Disposable { } + + export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } + + export namespace window { + export interface Wizard extends LoadingComponentBase { } + + export interface Dialog extends LoadingComponentBase, vscode.Disposable { } + + export interface ModelViewPanel extends vscode.Disposable { } + + export interface ModelViewDashboard extends vscode.Disposable { } + + /** + * Opens the error dialog with customization options provided. + * @param options Dialog options to customize error dialog. + * @returns Id of action button clicked by user, e.g. ok, cancel + */ + export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; + + /** + * Provides dialog options to customize modal dialog content and layout + */ + export interface IErrorDialogOptions { + /** + * Severity Level to identify icon of modal dialog. + */ + severity: MessageLevel; + /** + * Title of modal dialog header. + */ + headerTitle: string; + /** + * Message text to show on dialog. + */ + message: string; + /** + * (Optional) Detailed message, e.g stack trace of error. + */ + messageDetails?: string; + /** + * Telemetry View to be used for emitting telemetry events. + */ + telemetryView?: string, + /** + * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. + * If custom 'actions' are not provided, 'OK' button will be shown by default. + */ + actions?: IDialogAction[]; + /** + * (Optional) If provided, instruction text is shown in bold below message. + */ + instructionText?: string; + /** + * (Optional) If provided, appends read more link after instruction text. + */ + readMoreLink?: string; + } + + /** + * An action that will be rendered as a button on the dialog. + */ + export interface IDialogAction { + /** + * Identifier of action. + */ + id: string; + /** + * Label of Action button. + */ + label: string; + /** + * Defines if button styling and focus should be based on primary action. + */ + isPrimary: boolean; + } + + export interface FileFilters { + /** + * The label to display in the file filter field next to the list of filters. + */ + label: string; + /** + * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). + */ + filters: string[]; + } + + /** + * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local + * files without any connection is opened via vscode.window.showOpenDialog. + * @param connectionUri The URI of the connection to the target server + * @param targetPath The file path on the server machine to open by default in the dialog + * @param fileFilters The filters used to limit which files are displayed in the file browser + * @param showFoldersOnly Optional argument to specify whether the browser should only show folders + * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. + */ + export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; + } + + export interface FileBrowserProvider extends DataProvider { + openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; + } + + export interface TableComponent { + /** + * Set active cell. + */ + setActiveCell(row: number, column: number): void; + } + + export interface ProfilerProvider { + startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; + } + + export enum ProfilingSessionType { + RemoteSession = 0, + LocalFile = 1 + } + + export interface SplitViewLayout extends FlexLayout { + /** + * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal + * If undefined, the size of the model view container is used + */ + splitViewSize?: number | string | undefined; + } } From 4732035158dac819165c4989313dbf97e6ec63de Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Mon, 26 Aug 2024 14:20:27 -0700 Subject: [PATCH 12/21] Revert "Rename request prop to copy in backend" This reverts commit 13588a51f96d785f0dd3bff2796ba933478e2a1c. --- src/azdata.proposed.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 720ed09..d0db626 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -886,9 +886,9 @@ declare module 'azdata' { */ selections: SelectionRange[]; /** - * * Whether to copy the results directly from the backend. + * Whether to copy the results directly to the clipboard from STS. */ - copyInBackend: boolean; + CopyDirectlyToClipboard: boolean; } export interface CopyResultsRequestResult { From b0b42773b8074a8c2ac971a0892ccbc9386ec3fa Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Mon, 26 Aug 2024 14:20:42 -0700 Subject: [PATCH 13/21] Revert "Add copy to clipboard flag" This reverts commit 2b2dff4c3fc8f206086920e6f8dcc5bd4c348a6e. --- src/azdata.proposed.d.ts | 4240 +++++++++++++++++++------------------- 1 file changed, 2118 insertions(+), 2122 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index d0db626..251aafd 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -1,2122 +1,2118 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// This is the place for API experiments and proposal. - -import * as vscode from 'vscode'; - -declare module 'azdata' { - - export namespace nb { - export interface NotebookDocument { - /** - * Sets the trust mode for the notebook document. - */ - setTrusted(state: boolean): void; - } - - export interface ISessionOptions { - /** - * The spec for the kernel being used to create this session. - */ - kernelSpec?: IKernelSpec; - } - - export interface IKernelSpec { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages?: string[]; - } - - export interface IStandardKernel { - /** - * The list of languages that are supported for this kernel. - */ - supportedLanguages: string[]; - readonly blockedOnSAW?: boolean; - } - - export interface IKernelChangedArgs { - nbKernelAlias?: string - } - - export interface ICellOutput { - /** - * Unique identifier for this cell output. - */ - id?: string; - } - - export interface IExecuteResult { - data: any; - } - - export interface IExecuteResultUpdate { - output_type: string; - resultSet: ResultSetSummary; - data: any; - } - - export interface IExecuteRequest { - /** - * The language of the notebook document that is executing this request. - */ - language: string; - } - - export interface INotebookMetadata { - connection_name?: string; - multi_connection_mode?: boolean; - } - - export interface ICellMetadata { - connection_name?: string; - } - - export interface ICellContents { - attachments?: ICellAttachments; - } - - export type ICellAttachments = { [key: string]: ICellAttachment }; - export type ICellAttachment = { [key: string]: string }; - - export interface SessionManager { - /** - * Shutdown all sessions. - */ - shutdownAll(): Thenable; - /** - * Disposes the session manager. - */ - dispose(): void; - } - - /** - * An event that is emitted when a {@link NotebookDocument} is closed. - */ - export const onDidCloseNotebookDocument: vscode.Event; - - export interface IKernel { - - /** - * Restart a kernel. - * - * #### Notes - * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). - * - * The promise is fulfilled on a valid response and rejected otherwise. - * - * It is assumed that the API call does not mutate the kernel id or name. - * - * The promise will be rejected if the kernel status is `Dead` or if the - * request fails or the response is invalid. - */ - restart(): Thenable; - } - } - - export interface LoadingComponentBase { - /** - * When true, the component will display a loading spinner. - */ - loading?: boolean; - - /** - * This sets the alert text which gets announced when the loading spinner is shown. - */ - loadingText?: string; - - /** - * The text to display while loading is set to false. Will also be announced through screen readers - * once loading is completed. - */ - loadingCompletedText?: string; - } - - /** - * The column information of a data set. - */ - export interface SimpleColumnInfo { - /** - * The column name. - */ - name: string; - /** - * The data type of the column. - */ - dataTypeName: string; - } - - /** - * The parameters for start data serialization request. - */ - export interface SerializeDataStartRequestParams { - /** - * 'csv', 'json', 'excel', 'xml' - */ - saveFormat: string; - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch of the data set to be serialized. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - /** - * The columns of the data set. - */ - columns: SimpleColumnInfo[]; - /** - * Whether to include column headers to the target file. - */ - includeHeaders?: boolean; - /** - * The delimiter to seperate the cells. - */ - delimiter?: string; - /** - * The line seperator. - */ - lineSeperator?: string; - /** - * Character used for enclosing text fields when saving results as CSV. - */ - textIdentifier?: string; - /** - * File encoding used when saving results as CSV. - */ - encoding?: string; - /** - * When true, XML output will be formatted when saving results as XML. - */ - formatted?: boolean; - } - - /** - * The parameters for continue data serialization request. - */ - export interface SerializeDataContinueRequestParams { - /** - * The path of the target file. - */ - filePath: string; - /** - * Whether the request is the last batch. - */ - isLastBatch: boolean; - /** - * Data to be serialized. - */ - rows: DbCellValue[][]; - } - - /** - * The result of data serialization data request. - */ - export interface SerializeDataResult { - /** - * The output message. - */ - messages?: string; - /** - * Whether the serialization is succeeded. - */ - succeeded: boolean; - } - - /** - * The serialization provider. - */ - export interface SerializationProvider extends DataProvider { - /** - * Start the data serialization. - * @param requestParams the request parameters. - */ - startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; - /** - * Continue the data serialization. - * @param requestParams the request parameters. - */ - continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; - } - - export namespace dataprotocol { - /** - * Registers a SerializationProvider. - * @param provider The data serialization provider. - */ - export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; - export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; - /** - * Registers a DataGridProvider which is used to provide lists of items to a data grid - * @param provider The provider implementation - */ - export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; - } - - export enum DataProviderType { - DataGridProvider = 'DataGridProvider' - } - - /** - * The type of the DataGrid column - */ - export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; - - /** - * A column in a data grid - */ - export interface DataGridColumn { - /** - * The text to display on the column heading. - */ - name: string; - - /** - * The property name in the DataGridItem - */ - field: string; - - /** - * A unique identifier for the column within the grid. - */ - id: string; - - /** - * The type of column this is. This is used to determine how to render the contents. - */ - type: DataGridColumnType; - - /** - * Whether this column is sortable. - */ - sortable?: boolean; - - /** - * Whether this column is filterable - */ - filterable?: boolean; - - /** - * If false, column can no longer be resized. - */ - resizable?: boolean; - - /** - * If set to a non-empty string, a tooltip will appear on hover containing the string. - */ - tooltip?: string; - - /** - * Width of the column in pixels. - */ - width?: number - } - - /** - * Info for a command to execute - */ - export interface ExecuteCommandInfo { - /** - * The ID of the command to execute - */ - id: string; - /** - * The text to display for the action - */ - displayText?: string; - /** - * The optional args to pass to the command - */ - args?: any[]; - } - - /** - * Info for displaying a hyperlink value in a Data Grid table - */ - export interface DataGridHyperlinkInfo { - /** - * The text to display for the link - */ - displayText: string; - /** - * The URL to open or command to execute - */ - linkOrCommand: string | ExecuteCommandInfo; - } - - /** - * An item for displaying in a data grid - */ - export interface DataGridItem { - /** - * A unique identifier for this item - */ - id: string; - - /** - * The other properties that will be displayed in the grid columns - */ - [key: string]: string | DataGridHyperlinkInfo; - } - - /** - * A data provider that provides lists of resource items for a data grid - */ - export interface DataGridProvider extends DataProvider { - /** - * Gets the list of data grid items for this provider - */ - getDataGridItems(): Thenable; - /** - * Gets the list of data grid columns for this provider - */ - getDataGridColumns(): Thenable; - - /** - * The user visible string to use for the title of the grid - */ - title: string; - } - - export interface ConnectionProvider extends DataProvider { - /** - * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) - */ - changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; - } - - // Password Change Request ---------------------------------------------------------------------- - export interface PasswordChangeResult { - /** - * Whether the password change was successful - */ - result: boolean; - /** - * Error message if the password change was unsuccessful - */ - errorMessage?: string; - } - - export interface IConnectionProfile extends ConnectionInfo { - azureAccount?: string; - azureResourceId?: string; - azurePortalEndpoint?: string; - } - - export interface PromptFailedResult extends ProviderError { } - - export interface ProviderError { - /** - * Error name - */ - name?: string; - - /** - * Error code - */ - errorCode?: string; - - /** - * Error message - */ - errorMessage?: string; - } - - - export namespace diagnostics { - /** - * Represents a diagnostics provider of accounts. - */ - export interface ErrorDiagnosticsProviderMetadata { - /** - * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. - * Note: only ONE diagnostic provider per id/name at a time. - */ - targetProviderId: string; - } - - export interface ConnectionDiagnosticsResult { - /** - * Whether the error was handled or not. - */ - handled: boolean, - /** - * Whether reconnect should be attempted. - */ - reconnect?: boolean, - /** - * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. - */ - options?: { [name: string]: any }; - } - - /** - * Provides error information - */ - export interface IErrorInformation { - /** - * Error code - */ - errorCode: number, - /** - * Error Message - */ - errorMessage: string, - /** - * Stack trace of error - */ - messageDetails: string - } - - /** - * Diagnostics object for handling errors for a provider. - */ - export interface ErrorDiagnosticsProvider { - /** - * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. - * @param errorInfo The error information of the connection error. - * @param connection The connection profile that caused the error. - * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. - */ - handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; - } - - /** - * Registers provider with instance of Diagnostic Provider implementation. - * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. - * @param providerMetadata Additional data used to register the provider - * @param errorDiagnostics The provider's diagnostic object that handles errors. - * @returns A disposable that when disposed will unregister the provider - */ - export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; - } - - export namespace connection { - - /** - * Opens the change password dialog. - * @param profile The connection profile to change the password for. - * @returns The new password that is returned from the operation or undefined if unsuccessful. - */ - export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; - } - - export interface ConnectionInfoSummary { - /** - * ID used to identify the connection on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - export interface QueryExecuteCompleteNotificationResult { - /** - * ID used to identify the connection used to run the query on the server, if available. - */ - serverConnectionId?: string | undefined; - } - - /* - * Add optional per-OS default value. - */ - export interface DefaultValueOsOverride { - os: string; - - defaultValueOverride: string; - } - - export interface ConnectionOption { - defaultValueOsOverrides?: DefaultValueOsOverride[]; - - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * When set to true, the respective connection option will be rendered on the main connection dialog - * and not the Advanced Options window. - */ - showOnConnectionDialog?: boolean; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - - export interface ServiceOption { - /** - * Used to define placeholder text - */ - placeholder?: string; - - /** - * Used to define list of values based on which another option is rendered visible/hidden. - */ - onSelectionChange?: SelectionChangeEvent[]; - } - /** - * This change event defines actions - */ - export interface SelectionChangeEvent { - /** - * Values that affect actions defined in this event. - */ - values: string[]; - - /** - * Action to be taken on another option when selected value matches to the list of values provided. - */ - dependentOptionActions: DependentOptionAction[]; - } - - export interface DependentOptionAction { - /** - * Name of option affected by defined action. - */ - optionName: string, - - /** - * Action to be taken, Supported values: 'show', 'hide'. - */ - action: string; - - /** - * Whether or not the option should be set to required when visible. Defaults to false. - * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. - * When set to true, providers must handle property validation. - */ - required?: boolean; - } - - // Object Explorer interfaces -------------------------------- - export interface ObjectExplorerSession { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - } - - export interface ExpandNodeInfo { - /** - * Authentication token for the current session. - */ - securityToken?: accounts.AccountSecurityToken | undefined; - - /** - * Filters to apply to the child nodes being returned - */ - filters?: NodeFilter[]; - } - // End Object Explorer interfaces ---------------------------- - - export interface TaskInfo { - targetLocation?: string; - } - - export interface ButtonColumnOption { - icon?: IconPath; - } - - export namespace sqlAssessment { - - export enum SqlAssessmentTargetType { - Server = 1, - Database = 2 - } - - export enum SqlAssessmentResultItemKind { - RealResult = 0, - Warning = 1, - Error = 2 - } - } - // Assessment interfaces - - export interface SqlAssessmentResultItem { - rulesetVersion: string; - rulesetName: string; - targetType: sqlAssessment.SqlAssessmentTargetType; - targetName: string; - checkId: string; - tags: string[]; - displayName: string; - description: string; - message: string; - helpLink: string; - level: string; - timestamp: string; - kind: sqlAssessment.SqlAssessmentResultItemKind; - } - - export interface SqlAssessmentResult extends ResultStatus { - items: SqlAssessmentResultItem[]; - apiVersion: string; - } - - export interface SqlAssessmentServicesProvider extends DataProvider { - assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; - generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; - } - - export interface TreeItem2 extends vscode.TreeItem { - payload?: IConnectionProfile; - childProvider?: string; - type?: ExtensionNodeType; - } - - export interface Component extends vscode.Disposable { } - - export namespace workspace { - /** - * Creates and enters a workspace at the specified location - */ - export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; - - /** - * Enters the workspace with the provided path - * @param workspaceFile - */ - export function enterWorkspace(workspaceFile: vscode.Uri): Promise; - - /** - * Saves and enters the workspace with the provided path - * @param workspaceFile - */ - export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; - } - - export interface TableComponentProperties { - /** - * Specifies whether to use headerFilter plugin - */ - headerFilter?: boolean, - } - - export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; - - export interface ExecutionPlanComponentProperties extends ComponentProperties { - /** - * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs - */ - data?: ExecutionPlanData; - } - - /** - * Defines the executionPlan component - */ - export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { - } - - export interface ModelBuilder { - executionPlan(): ComponentBuilder; - } - - export interface ListViewOption { - /** - * The optional accessibility label for the column. Default is the label for the list view option. - */ - ariaLabel?: string; - /** - * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. - */ - icon?: IconPath; - } - - export interface IconColumnCellValue { - /** - * The icon to be displayed. - */ - icon: IconPath; - /** - * The title of the icon. - */ - title: string; - } - - export interface ButtonColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the button. - */ - title?: string; - } - - export interface HyperlinkColumnCellValue { - /** - * The icon to be displayed. - */ - icon?: IconPath; - /** - * The title of the hyperlink. - */ - title?: string; - - /** - * The url to open. - */ - url?: string; - /** - * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. - */ - role?: 'button' | 'link'; - } - - export interface ContextMenuColumnCellValue { - /** - * The title of the hyperlink. By default, the title is 'Show Actions' - */ - title?: string; - /** - * commands for the menu. Use an array for a group and menu separators will be added. - */ - commands: (string | string[])[]; - /** - * context that will be passed to the commands. - */ - context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined - } - - export enum ColumnType { - icon = 3, - hyperlink = 4, - contextMenu = 5 - } - - export interface TableColumn { - /** - * The text to display on the column heading. 'value' property will be used, if not specified - */ - name?: string; - - /** - * whether the column is resizable. Default value is true. - */ - resizable?: boolean; - } - - export interface IconColumnOptions { - /** - * The icon to use for all the cells in this column. - */ - icon?: IconPath; - } - - export interface ButtonColumn extends IconColumnOptions, TableColumn { - /** - * Whether to show the text, default value is false. - */ - showText?: boolean; - } - - export interface HyperlinkColumn extends IconColumnOptions, TableColumn { - } - - export interface CheckboxColumn extends TableColumn { - action: ActionOnCellCheckboxCheck; - } - - export interface ContextMenuColumn extends TableColumn { - } - - export interface QueryExecuteResultSetNotificationParams { - /** - * Contains execution plans returned by the database in ResultSets. - */ - executionPlans: executionPlan.ExecutionPlanGraph[]; - } - - export interface ObjectMetadata { - /* - * Parent object name for subobjects such as triggers, indexes, etc. - */ - parentName?: string; - - /* - * Parent object type name, such as Table, View, etc. - */ - parentTypeName?: string; - } - - /** - * Represents a selected range in the result grid. - */ - export interface SelectionRange { - fromRow: number; - toRow: number; - fromColumn: number; - toColumn: number; - } - - /** - * Parameters for the copy results request. - */ - export interface CopyResultsRequestParams { - /** - * URI of the editor. - */ - ownerUri: string; - /** - * Index of the batch. - */ - batchIndex: number; - /** - * Index of the result set. - */ - resultSetIndex: number; - /** - * Whether to include the column headers. - */ - includeHeaders: boolean - /** - * The selected ranges to be copied. - */ - selections: SelectionRange[]; - /** - * Whether to copy the results directly to the clipboard from STS. - */ - CopyDirectlyToClipboard: boolean; - } - - export interface CopyResultsRequestResult { - /** - * Result string from copy operation - */ - results: string; - } - - export interface QueryProvider { - /** - * Notify clients that the URI for a connection has been changed. - */ - connectionUriChanged?(newUri: string, oldUri: string): Thenable; - /** - * Copy the selected data to the clipboard. - * This is introduced to address the performance issue of large amount of data to ADS side. - * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. - * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. - */ - copyResults?(requestParams: CopyResultsRequestParams): Thenable; - } - - export enum DataProviderType { - TableDesignerProvider = 'TableDesignerProvider', - ExecutionPlanProvider = 'ExecutionPlanProvider', - ServerContextualizationProvider = 'ServerContextualizationProvider' - } - - export namespace dataprotocol { - export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; - export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; - /** - * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub - * Copilot for improved suggestions. - * @param provider The provider to register - */ - export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; - } - - export namespace designers { - /** - * Open a table designer window. - * @param providerId The table designer provider Id. - * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. - * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry - * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited - */ - export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; - - /** - * Definition for the table designer provider. - */ - export interface TableDesignerProvider extends DataProvider { - /** - * Initialize the table designer for the specified table. - * @param table the table information. - */ - initializeTableDesigner(table: TableInfo): Thenable; - - /** - * Process the table change. - * @param table the table information - * @param tableChangeInfo the information about the change user made through the UI. - */ - processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; - - /** - * Publish the changes. - * @param table the table information - */ - publishChanges(table: TableInfo): Thenable; - - /** - * Generate script for the changes. - * @param table the table information - */ - generateScript(table: TableInfo): Thenable; - - /** - * Generate preview report describing the changes to be made. - * @param table the table information - */ - generatePreviewReport(table: TableInfo): Thenable; - - /** - * Notify the provider that the table designer has been closed. - * @param table the table information - */ - disposeTableDesigner(table: TableInfo): Thenable; - } - - /** - * The information of the table. - */ - export interface TableInfo { - /** - * Used as the table designer editor's tab header text. - */ - title: string; - /** - * Used as the table designer editor's tab header hover text. - */ - tooltip: string; - /** - * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. - */ - id: string; - /** - * A boolean value indicates whether a new table is being designed. - */ - isNewTable: boolean; - /** - * Extension can store additional information that the provider needs to uniquely identify a table. - */ - [key: string]: any; - /** - * Table icon type that's shown in the editor tab. Default is the basic - * table icon. - */ - tableIcon?: TableIcon; - } - - /** - * The information to populate the table designer UI. - */ - export interface TableDesignerInfo { - /** - * The view definition. - */ - view: TableDesignerView; - /** - * The initial state of the designer. - */ - viewModel: DesignerViewModel; - /** - * The new table info after initialization. - */ - tableInfo: TableInfo; - /** - * The issues. - */ - issues?: DesignerIssue[]; - } - - /** - * Table icon that's shown on the editor tab - */ - export enum TableIcon { - Basic = 'Basic', - Temporal = 'Temporal', - GraphNode = 'GraphNode', - GraphEdge = 'GraphEdge' - } - - /** - * Name of the common table properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableProperty { - Columns = 'columns', - Description = 'description', - Name = 'name', - Schema = 'schema', - Script = 'script', - ForeignKeys = 'foreignKeys', - CheckConstraints = 'checkConstraints', - Indexes = 'indexes', - PrimaryKey = 'primaryKey', - PrimaryKeyName = 'primaryKeyName', - PrimaryKeyDescription = 'primaryKeyDescription', - PrimaryKeyColumns = 'primaryKeyColumns' - } - /** - * Name of the common table column properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableColumnProperty { - AllowNulls = 'allowNulls', - DefaultValue = 'defaultValue', - Length = 'length', - Name = 'name', - Description = 'description', - Type = 'type', - AdvancedType = 'advancedType', - IsPrimaryKey = 'isPrimaryKey', - Precision = 'precision', - Scale = 'scale' - } - - /** - * Name of the common foreign key constraint properties. - * Extensions can use the names to access the designer view model. - */ - export enum TableForeignKeyProperty { - Name = 'name', - Description = 'description', - ForeignTable = 'foreignTable', - OnDeleteAction = 'onDeleteAction', - OnUpdateAction = 'onUpdateAction', - Columns = 'columns' - } - - /** - * Name of the columns mapping properties for foreign key. - */ - export enum ForeignKeyColumnMappingProperty { - Column = 'column', - ForeignColumn = 'foreignColumn' - } - - /** - * Name of the common check constraint properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableCheckConstraintProperty { - Name = 'name', - Description = 'description', - Expression = 'expression' - } - - /** - * Name of the common index properties. - * Extensions can use the name to access the designer view model. - */ - export enum TableIndexProperty { - Name = 'name', - Description = 'description', - Columns = 'columns' - } - - /** - * Name of the common properties of table index column specification. - */ - export enum TableIndexColumnSpecificationProperty { - Column = 'column' - } - - /** - * The table designer view definition. - */ - export interface TableDesignerView { - /** - * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} - */ - additionalTableProperties?: DesignerDataPropertyInfo[]; - /** - * Additional tabs. - */ - additionalTabs?: DesignerTab[]; - /** - * Columns table options. - * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. - * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. - */ - columnTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign keys table options. - * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. - * Default columns to display values are: Name, PrimaryKeyTable. - */ - foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Foreign key column mapping table options. - * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. - * Default columns to display values are: Column, ForeignColumn. - */ - foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Check constraints table options. - * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} - * Default columns to display values are: Name, Expression. - */ - checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Indexes table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} - * Default columns to display values are: Name. - */ - indexTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Index column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Primary column specification table options. - * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} - * Default columns to display values are: Column. - */ - primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; - /** - * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. - */ - additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; - /** - * Components to be placed under the pre-defined tabs. - */ - additionalComponents?: DesignerDataPropertyWithTabInfo[]; - /** - * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. - */ - useAdvancedSaveMode: boolean; - } - - export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { - /** - * Whether to show the table. Default value is false. - */ - showTable?: boolean; - /** - * Properties to be displayed in the table, other properties can be accessed in the properties view. - */ - propertiesToDisplay?: string[]; - /** - * Additional properties for the entity. - */ - additionalProperties?: DesignerDataPropertyInfo[]; - } - - /** - * The view model of the designer. - */ - export interface DesignerViewModel { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of a designer tab. - */ - export interface DesignerTab { - /** - * The title of the tab. - */ - title: string; - /** - * the components to be displayed in this tab. - */ - components: DesignerDataPropertyInfo[]; - } - - /** - * The definition of the property in the designer. - */ - export interface DesignerDataPropertyInfo { - /** - * The property name. - */ - propertyName: string; - /** - * The description of the property. - */ - description?: string; - /** - * The component type. - */ - componentType: DesignerComponentTypeName; - /** - * The group name, properties with the same group name will be displayed under the same group on the UI. - */ - group?: string; - /** - * Whether the property should be displayed in the properties view. The default value is true. - */ - showInPropertiesView?: boolean; - /** - * The properties of the component. - */ - componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; - } - - /** - * The definition of the property in the designer with tab info. - */ - export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { - /** - * The tab info where this property belongs to. - */ - tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; - } - - /** - * The child component types supported by designer. - */ - export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; - - export interface DesignerTablePropertiesBase { - /** - * Whether user can add new rows to the table. The default value is true. - */ - canAddRows?: boolean; - /** - * Whether user can remove rows from the table. The default value is true. - */ - canRemoveRows?: boolean; - /** - * Whether user can move rows from one index to another. The default value is true. - */ - canMoveRows?: boolean; - /** - * Whether user can insert rows at a given index to the table. The default value is true. - */ - canInsertRows?: boolean; - /** - * Whether to show confirmation when user removes a row. The default value is false. - */ - showRemoveRowConfirmation?: boolean; - /** - * The confirmation message to be displayed when user removes a row. - */ - removeRowConfirmationMessage?: string; - /** - * Whether to show the item detail in properties view. The default value is true. - */ - showItemDetailInPropertiesView?: boolean; - /** - * The label of the add new button. The default value is 'Add New'. - */ - labelForAddNewButton?: string; - } - - /** - * The properties for the table component in the designer. - */ - export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { - /** - * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. - */ - columns?: string[]; - /** - * The display name of the object type. - */ - objectTypeDisplayName: string; - /** - * the properties of the table data item. - */ - itemProperties?: DesignerDataPropertyInfo[]; - /** - * The data to be displayed. - */ - data?: DesignerTableComponentDataItem[]; - } - - /** - * The data item of the designer's table component. - */ - export interface DesignerTableComponentDataItem { - [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; - /** - * Whether the row can be deleted. The default value is true. - */ - canBeDeleted?: boolean; - } - - /** - * Type of the edit originated from the designer UI. - */ - export enum DesignerEditType { - /** - * Add a row to a table. - */ - Add = 0, - /** - * Remove a row from a table. - */ - Remove = 1, - /** - * Update a property. - */ - Update = 2, - /** - * Change the position of an item in the collection. - */ - Move = 3 - } - - /** - * Information of the edit originated from the designer UI. - */ - export interface DesignerEdit { - /** - * The edit type. - */ - type: DesignerEditType; - /** - * the path of the edit target. - */ - path: DesignerPropertyPath; - /** - * the new value. - */ - value?: any; - } - - /** - * The path of the property. - * Below are the 3 scenarios and their expected path. - * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. - * 1. 'Add' scenario - * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. - * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. - * 2. 'Update' scenario - * a. ['propertyName1']. Example: update the name of the table: ['name']. - * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. - * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. - * 3. 'Remove' scenario - * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. - * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. - */ - export type DesignerPropertyPath = (string | number)[]; - - /** - * Severity of the messages returned by the provider after processing an edit. - * 'error': The issue must be fixed in order to commit the changes. - * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. - * 'information': Informational message. - */ - export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; - - /** - * Represents the issue in the designer - */ - export interface DesignerIssue { - /** - * Severity of the issue. - */ - severity: DesignerIssueSeverity, - /** - * Path of the property that is associated with the issue. - */ - propertyPath?: DesignerPropertyPath, - /** - * Description of the issue. - */ - description: string, - /** - * Url to a web page that has the explaination of the issue. - */ - moreInfoLink?: string; - } - - /** - * The result returned by the table designer provider after handling an edit request. - */ - export interface DesignerEditResult { - /** - * The new view information if the view needs to be refreshed. - */ - view?: T; - /** - * The view model object. - */ - viewModel: DesignerViewModel; - /** - * Whether the current state is valid. - */ - isValid: boolean; - /** - * Issues of current state. - */ - issues?: DesignerIssue[]; - /** - * The input validation error. - */ - inputValidationError?: string; - /** - * Metadata related to the table - */ - metadata?: { [key: string]: string }; - } - - /** - * The result returned by the table designer provider after handling the publish changes request. - */ - export interface PublishChangesResult { - /** - * The new table information after the changes are published. - */ - newTableInfo: TableInfo; - /** - * The new view model. - */ - viewModel: DesignerViewModel; - /** - * The new view. - */ - view: TableDesignerView; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - - export interface GeneratePreviewReportResult { - /** - * Report generated for generate preview - */ - report: string; - /** - * Format (mimeType) of the report - */ - mimeType: string; - /** - * Whether user confirmation is required, the default value is false. - */ - requireConfirmation?: boolean; - /** - * The confirmation text. - */ - confirmationText?: string; - /** - * The table schema validation error. - */ - schemaValidationError?: string; - /** - * Metadata related to the table to be captured - */ - metadata?: { [key: string]: string }; - } - } - - export namespace executionPlan { - export interface ExecutionPlanGraph { - /** - * Root of the execution plan tree - */ - root: ExecutionPlanNode; - /** - * Underlying query for the execution plan graph. - */ - query: string; - /** - * String representation of graph - */ - graphFile: ExecutionPlanGraphInfo; - /** - * Query recommendations for optimizing performance - */ - recommendations: ExecutionPlanRecommendations[]; - } - - export interface ExecutionPlanNode { - /** - * Unique id given to node by the provider - */ - id: string; - /** - * Type of the node. This property determines the icon that is displayed for it - */ - type: string; - /** - * Cost associated with the node - */ - cost: number; - /** - * Cost of the node subtree - */ - subTreeCost: number; - /** - * Relative cost of the node compared to its siblings. - */ - relativeCost: number; - /** - * Time take by the node operation in milliseconds - */ - elapsedTimeInMs: number; - /** - * CPU time taken by the node operation in milliseconds - */ - elapsedCpuTimeInMs: number; - /** - * Node properties to be shown in the tooltip - */ - properties: ExecutionPlanGraphElementProperty[]; - /** - * Display name for the node - */ - name: string; - /** - * Description associated with the node. - */ - description: string; - /** - * Subtext displayed under the node name - */ - subtext: string[]; - /** - * Direct children of the nodes. - */ - children: ExecutionPlanNode[]; - /** - * Edges corresponding to the children. - */ - edges: ExecutionPlanEdge[]; - /** - * Warning/parallelism badges applicable to the current node - */ - badges: ExecutionPlanBadge[]; - /** - * Data to show in top operations table for the node. - */ - topOperationsData: TopOperationsDataItem[]; - /** - * Output row count associated with the node - */ - rowCountDisplayString: string; - /** - * Cost string for the node - */ - costDisplayString: string; - /** - * Cost metrics for the node - */ - costMetrics: CostMetric[]; - } - - export interface CostMetric { - /** - * Name of the cost metric. - */ - name: string; - /** - * The value of the cost metric - */ - value: number | undefined; - } - - export interface ExecutionPlanBadge { - /** - * Type of the node overlay. This determines the icon that is displayed for it - */ - type: BadgeType; - /** - * Text to display for the overlay tooltip - */ - tooltip: string; - } - - export enum BadgeType { - Warning = 0, - CriticalWarning = 1, - Parallelism = 2 - } - - export interface ExecutionPlanEdge { - /** - * Count of the rows returned by the subtree of the edge. - */ - rowCount: number; - /** - * Size of the rows returned by the subtree of the edge. - */ - rowSize: number; - /** - * Edge properties to be shown in the tooltip. - */ - properties: ExecutionPlanGraphElementProperty[] - } - - export interface ExecutionPlanGraphElementProperty { - /** - * Name of the property - */ - name: string; - /** - * value for the property - */ - value: string | ExecutionPlanGraphElementProperty[]; - /** - * Flag to show/hide props in tooltip - */ - showInTooltip: boolean; - /** - * Display order of property - */ - displayOrder: number; - /** - * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip - */ - positionAtBottom: boolean; - /** - * Display value of property to show in tooltip and other UI element. - */ - displayValue: string; - /** - * Data type of the property value - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Indicates which value is better when 2 similar properties are compared. - */ - betterValue: ExecutionPlanGraphElementPropertyBetterValue; - } - - export enum ExecutionPlanGraphElementPropertyDataType { - Number = 0, - String = 1, - Boolean = 2, - Nested = 3 - } - - export enum ExecutionPlanGraphElementPropertyBetterValue { - LowerNumber = 0, - HigherNumber = 1, - True = 2, - False = 3, - None = 4 - } - - export interface ExecutionPlanRecommendations { - /** - * Text displayed in the show plan graph control description - */ - displayString: string; - /** - * Query that is recommended to the user - */ - queryText: string; - /** - * Query that will be opened in a new file once the user click on the recommendation - */ - queryWithDescription: string; - } - - export interface ExecutionPlanGraphInfo { - /** - * File contents - */ - graphFileContent: string; - /** - * File type for execution plan. This will be the file type of the editor when the user opens the graph file - */ - graphFileType: string; - /** - * Index of the execution plan in the file content - */ - planIndexInFile?: number; - } - - export interface GetExecutionPlanResult extends ResultStatus { - graphs: ExecutionPlanGraph[] - } - - export interface ExecutionGraphComparisonResult { - /** - * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. - */ - baseNode: ExecutionPlanNode; - /** - * The children of the ExecutionGraphComparisonResult. - */ - children: ExecutionGraphComparisonResult[]; - /** - * The group index of the ExecutionGraphComparisonResult. - */ - groupIndex: number; - /** - * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. - */ - hasMatch: boolean; - /** - * List of matching nodes for the ExecutionGraphComparisonResult. - */ - matchingNodesId: number[]; - /** - * The parent of the ExecutionGraphComparisonResult. - */ - parentNode: ExecutionGraphComparisonResult; - } - - export interface ExecutionPlanComparisonResult extends ResultStatus { - firstComparisonResult: ExecutionGraphComparisonResult; - secondComparisonResult: ExecutionGraphComparisonResult; - } - - export interface IsExecutionPlanResult { - isExecutionPlan: boolean; - queryExecutionPlanFileExtension: string; - } - - export interface ExecutionPlanProvider extends DataProvider { - // execution plan service methods - - /** - * Gets the execution plan graph from the provider for a given plan file - * @param planFile file that contains the execution plan - */ - getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; - /** - * Compares two execution plans and identifies matching regions in both execution plans. - * @param firstPlanFile file that contains the first execution plan. - * @param secondPlanFile file that contains the second execution plan. - */ - compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; - /** - * Determines if the provided value is an execution plan and returns the appropriate file extension. - * @param value String that needs to be checked. - */ - isExecutionPlan(value: string): Thenable; - } - - export interface TopOperationsDataItem { - /** - * Column name for the top operation data item - */ - columnName: string; - /** - * Cell data type for the top operation data item - */ - dataType: ExecutionPlanGraphElementPropertyDataType; - /** - * Cell value for the top operation data item - */ - displayValue: string | number | boolean; - } - } - - export namespace contextualization { - export interface GetServerContextualizationResult { - /** - * The retrieved server context. - */ - context: string | undefined; - } - - export interface ServerContextualizationProvider extends DataProvider { - /** - * Gets server context, which can be in the form of create scripts but is left up each provider. - * @param ownerUri The URI of the connection to get context for. - */ - getServerContextualization(ownerUri: string): Thenable; - } - } - - /** - * Component to display text with an icon representing the severity - */ - export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { - /** - * An event fired when the InfoBox is clicked - */ - onDidClick: vscode.Event; - /** - * An event fired when the Infobox link is clicked - */ - onLinkClick: vscode.Event; - } - - export interface InfoBoxComponentProperties { - /** - * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. - * Default value is false. - */ - isClickable?: boolean | undefined; - - /** - * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes - */ - clickableButtonAriaLabel?: string; - - /** - * List of links to embed within the text. If links are specified there must be placeholder - * values in the value indicating where the links should be placed, in the format {i} - * - * e.g. "Click {0} for more information!"" - */ - links?: LinkArea[]; - } - - /** - * Event argument for infobox link click event. - */ - export interface InfoBoxLinkClickEventArgs { - /** - * Index of the link selected - */ - index: number; - /** - * Link that is clicked - */ - link: LinkArea; - } - - export interface TextComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface ContainerProperties extends ComponentProperties { - /** - * Corresponds to the aria-live accessibility attribute for this component - */ - ariaLive?: AriaLiveValue; - } - - export interface DropDownProperties { - /** - * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. - */ - strictSelection?: boolean; - } - - export interface NodeInfo { - /** - * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node - * under the database, the nodeType is Folder, the objectType is be Tables. - */ - objectType?: string; - /* - * The path of the parent node. - */ - parentNodePath: string; - /** - * Filterable properties that this node supports - */ - filterableProperties?: NodeFilterProperty[]; - } - - export interface NodeFilterProperty { - /** - * The non-localized name of the filter property - */ - name: string; - /** - * The name of the filter property displayed to the user - */ - displayName: string; - /** - * The type of the filter property - */ - type: NodeFilterPropertyDataType; - /** - * The description of the filter property - */ - description: string; - } - - /** - * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice - */ - export interface NodeFilterChoiceProperty extends NodeFilterProperty { - /** - * The list of choices for the filter property if the type is choice - */ - choices: NodeFilterChoicePropertyValue[]; - } - - export interface NodeFilterChoicePropertyValue { - /** - * The value of the choice - */ - value: string; - /** - * The display name of the choice - * If not specified, the value will be used as the display name - * If specified, the display name will be used in the dropdown - */ - displayName?: string; - } - - export interface NodeFilter { - /** - * The name of the filter property - */ - name: string; - /** - * The operator of the filter property - */ - operator: NodeFilterOperator; - /** - * The applied values of the filter property - */ - value: string | string[] | number | number[] | boolean | undefined; - } - - export enum NodeFilterPropertyDataType { - String = 0, - Number = 1, - Boolean = 2, - Date = 3, - Choice = 4 - } - - export enum NodeFilterOperator { - Equals = 0, - NotEquals = 1, - LessThan = 2, - LessThanOrEquals = 3, - GreaterThan = 4, - GreaterThanOrEquals = 5, - Between = 6, - NotBetween = 7, - Contains = 8, - NotContains = 9, - StartsWith = 10, - NotStartsWith = 11, - EndsWith = 12, - NotEndsWith = 13 - } - - export interface ModelView extends vscode.Disposable { } - - export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } - - export namespace window { - export interface Wizard extends LoadingComponentBase { } - - export interface Dialog extends LoadingComponentBase, vscode.Disposable { } - - export interface ModelViewPanel extends vscode.Disposable { } - - export interface ModelViewDashboard extends vscode.Disposable { } - - /** - * Opens the error dialog with customization options provided. - * @param options Dialog options to customize error dialog. - * @returns Id of action button clicked by user, e.g. ok, cancel - */ - export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; - - /** - * Provides dialog options to customize modal dialog content and layout - */ - export interface IErrorDialogOptions { - /** - * Severity Level to identify icon of modal dialog. - */ - severity: MessageLevel; - /** - * Title of modal dialog header. - */ - headerTitle: string; - /** - * Message text to show on dialog. - */ - message: string; - /** - * (Optional) Detailed message, e.g stack trace of error. - */ - messageDetails?: string; - /** - * Telemetry View to be used for emitting telemetry events. - */ - telemetryView?: string, - /** - * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. - * If custom 'actions' are not provided, 'OK' button will be shown by default. - */ - actions?: IDialogAction[]; - /** - * (Optional) If provided, instruction text is shown in bold below message. - */ - instructionText?: string; - /** - * (Optional) If provided, appends read more link after instruction text. - */ - readMoreLink?: string; - } - - /** - * An action that will be rendered as a button on the dialog. - */ - export interface IDialogAction { - /** - * Identifier of action. - */ - id: string; - /** - * Label of Action button. - */ - label: string; - /** - * Defines if button styling and focus should be based on primary action. - */ - isPrimary: boolean; - } - - export interface FileFilters { - /** - * The label to display in the file filter field next to the list of filters. - */ - label: string; - /** - * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). - */ - filters: string[]; - } - - /** - * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local - * files without any connection is opened via vscode.window.showOpenDialog. - * @param connectionUri The URI of the connection to the target server - * @param targetPath The file path on the server machine to open by default in the dialog - * @param fileFilters The filters used to limit which files are displayed in the file browser - * @param showFoldersOnly Optional argument to specify whether the browser should only show folders - * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. - */ - export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; - } - - export interface FileBrowserProvider extends DataProvider { - openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; - } - - export interface TableComponent { - /** - * Set active cell. - */ - setActiveCell(row: number, column: number): void; - } - - export interface ProfilerProvider { - startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; - } - - export enum ProfilingSessionType { - RemoteSession = 0, - LocalFile = 1 - } - - export interface SplitViewLayout extends FlexLayout { - /** - * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal - * If undefined, the size of the model view container is used - */ - splitViewSize?: number | string | undefined; - } -} +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// This is the place for API experiments and proposal. + +import * as vscode from 'vscode'; + +declare module 'azdata' { + + export namespace nb { + export interface NotebookDocument { + /** + * Sets the trust mode for the notebook document. + */ + setTrusted(state: boolean): void; + } + + export interface ISessionOptions { + /** + * The spec for the kernel being used to create this session. + */ + kernelSpec?: IKernelSpec; + } + + export interface IKernelSpec { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages?: string[]; + } + + export interface IStandardKernel { + /** + * The list of languages that are supported for this kernel. + */ + supportedLanguages: string[]; + readonly blockedOnSAW?: boolean; + } + + export interface IKernelChangedArgs { + nbKernelAlias?: string + } + + export interface ICellOutput { + /** + * Unique identifier for this cell output. + */ + id?: string; + } + + export interface IExecuteResult { + data: any; + } + + export interface IExecuteResultUpdate { + output_type: string; + resultSet: ResultSetSummary; + data: any; + } + + export interface IExecuteRequest { + /** + * The language of the notebook document that is executing this request. + */ + language: string; + } + + export interface INotebookMetadata { + connection_name?: string; + multi_connection_mode?: boolean; + } + + export interface ICellMetadata { + connection_name?: string; + } + + export interface ICellContents { + attachments?: ICellAttachments; + } + + export type ICellAttachments = { [key: string]: ICellAttachment }; + export type ICellAttachment = { [key: string]: string }; + + export interface SessionManager { + /** + * Shutdown all sessions. + */ + shutdownAll(): Thenable; + /** + * Disposes the session manager. + */ + dispose(): void; + } + + /** + * An event that is emitted when a {@link NotebookDocument} is closed. + */ + export const onDidCloseNotebookDocument: vscode.Event; + + export interface IKernel { + + /** + * Restart a kernel. + * + * #### Notes + * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/4.x/notebook/services/api/api.yaml#!/kernels). + * + * The promise is fulfilled on a valid response and rejected otherwise. + * + * It is assumed that the API call does not mutate the kernel id or name. + * + * The promise will be rejected if the kernel status is `Dead` or if the + * request fails or the response is invalid. + */ + restart(): Thenable; + } + } + + export interface LoadingComponentBase { + /** + * When true, the component will display a loading spinner. + */ + loading?: boolean; + + /** + * This sets the alert text which gets announced when the loading spinner is shown. + */ + loadingText?: string; + + /** + * The text to display while loading is set to false. Will also be announced through screen readers + * once loading is completed. + */ + loadingCompletedText?: string; + } + + /** + * The column information of a data set. + */ + export interface SimpleColumnInfo { + /** + * The column name. + */ + name: string; + /** + * The data type of the column. + */ + dataTypeName: string; + } + + /** + * The parameters for start data serialization request. + */ + export interface SerializeDataStartRequestParams { + /** + * 'csv', 'json', 'excel', 'xml' + */ + saveFormat: string; + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch of the data set to be serialized. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + /** + * The columns of the data set. + */ + columns: SimpleColumnInfo[]; + /** + * Whether to include column headers to the target file. + */ + includeHeaders?: boolean; + /** + * The delimiter to seperate the cells. + */ + delimiter?: string; + /** + * The line seperator. + */ + lineSeperator?: string; + /** + * Character used for enclosing text fields when saving results as CSV. + */ + textIdentifier?: string; + /** + * File encoding used when saving results as CSV. + */ + encoding?: string; + /** + * When true, XML output will be formatted when saving results as XML. + */ + formatted?: boolean; + } + + /** + * The parameters for continue data serialization request. + */ + export interface SerializeDataContinueRequestParams { + /** + * The path of the target file. + */ + filePath: string; + /** + * Whether the request is the last batch. + */ + isLastBatch: boolean; + /** + * Data to be serialized. + */ + rows: DbCellValue[][]; + } + + /** + * The result of data serialization data request. + */ + export interface SerializeDataResult { + /** + * The output message. + */ + messages?: string; + /** + * Whether the serialization is succeeded. + */ + succeeded: boolean; + } + + /** + * The serialization provider. + */ + export interface SerializationProvider extends DataProvider { + /** + * Start the data serialization. + * @param requestParams the request parameters. + */ + startSerialization(requestParams: SerializeDataStartRequestParams): Thenable; + /** + * Continue the data serialization. + * @param requestParams the request parameters. + */ + continueSerialization(requestParams: SerializeDataContinueRequestParams): Thenable; + } + + export namespace dataprotocol { + /** + * Registers a SerializationProvider. + * @param provider The data serialization provider. + */ + export function registerSerializationProvider(provider: SerializationProvider): vscode.Disposable; + export function registerSqlAssessmentServicesProvider(provider: SqlAssessmentServicesProvider): vscode.Disposable; + /** + * Registers a DataGridProvider which is used to provide lists of items to a data grid + * @param provider The provider implementation + */ + export function registerDataGridProvider(provider: DataGridProvider): vscode.Disposable; + } + + export enum DataProviderType { + DataGridProvider = 'DataGridProvider' + } + + /** + * The type of the DataGrid column + */ + export type DataGridColumnType = 'hyperlink' | 'text' | 'image'; + + /** + * A column in a data grid + */ + export interface DataGridColumn { + /** + * The text to display on the column heading. + */ + name: string; + + /** + * The property name in the DataGridItem + */ + field: string; + + /** + * A unique identifier for the column within the grid. + */ + id: string; + + /** + * The type of column this is. This is used to determine how to render the contents. + */ + type: DataGridColumnType; + + /** + * Whether this column is sortable. + */ + sortable?: boolean; + + /** + * Whether this column is filterable + */ + filterable?: boolean; + + /** + * If false, column can no longer be resized. + */ + resizable?: boolean; + + /** + * If set to a non-empty string, a tooltip will appear on hover containing the string. + */ + tooltip?: string; + + /** + * Width of the column in pixels. + */ + width?: number + } + + /** + * Info for a command to execute + */ + export interface ExecuteCommandInfo { + /** + * The ID of the command to execute + */ + id: string; + /** + * The text to display for the action + */ + displayText?: string; + /** + * The optional args to pass to the command + */ + args?: any[]; + } + + /** + * Info for displaying a hyperlink value in a Data Grid table + */ + export interface DataGridHyperlinkInfo { + /** + * The text to display for the link + */ + displayText: string; + /** + * The URL to open or command to execute + */ + linkOrCommand: string | ExecuteCommandInfo; + } + + /** + * An item for displaying in a data grid + */ + export interface DataGridItem { + /** + * A unique identifier for this item + */ + id: string; + + /** + * The other properties that will be displayed in the grid columns + */ + [key: string]: string | DataGridHyperlinkInfo; + } + + /** + * A data provider that provides lists of resource items for a data grid + */ + export interface DataGridProvider extends DataProvider { + /** + * Gets the list of data grid items for this provider + */ + getDataGridItems(): Thenable; + /** + * Gets the list of data grid columns for this provider + */ + getDataGridColumns(): Thenable; + + /** + * The user visible string to use for the title of the grid + */ + title: string; + } + + export interface ConnectionProvider extends DataProvider { + /** + * Changes a user's password for the scenario of password expiration during SQL Authentication. (for Azure Data Studio use only) + */ + changePassword?(connectionUri: string, connectionInfo: ConnectionInfo, newPassword: string): Thenable; + } + + // Password Change Request ---------------------------------------------------------------------- + export interface PasswordChangeResult { + /** + * Whether the password change was successful + */ + result: boolean; + /** + * Error message if the password change was unsuccessful + */ + errorMessage?: string; + } + + export interface IConnectionProfile extends ConnectionInfo { + azureAccount?: string; + azureResourceId?: string; + azurePortalEndpoint?: string; + } + + export interface PromptFailedResult extends ProviderError { } + + export interface ProviderError { + /** + * Error name + */ + name?: string; + + /** + * Error code + */ + errorCode?: string; + + /** + * Error message + */ + errorMessage?: string; + } + + + export namespace diagnostics { + /** + * Represents a diagnostics provider of accounts. + */ + export interface ErrorDiagnosticsProviderMetadata { + /** + * The id of the provider (ex. a connection provider) that a diagnostics provider will handle errors for. + * Note: only ONE diagnostic provider per id/name at a time. + */ + targetProviderId: string; + } + + export interface ConnectionDiagnosticsResult { + /** + * Whether the error was handled or not. + */ + handled: boolean, + /** + * Whether reconnect should be attempted. + */ + reconnect?: boolean, + /** + * If given, the new set of connection options to assign to the original connection profile, overwriting any previous options. + */ + options?: { [name: string]: any }; + } + + /** + * Provides error information + */ + export interface IErrorInformation { + /** + * Error code + */ + errorCode: number, + /** + * Error Message + */ + errorMessage: string, + /** + * Stack trace of error + */ + messageDetails: string + } + + /** + * Diagnostics object for handling errors for a provider. + */ + export interface ErrorDiagnosticsProvider { + /** + * Called when a connection error occurs, allowing the provider to optionally handle the error and fix any issues before continuing with completing the connection. + * @param errorInfo The error information of the connection error. + * @param connection The connection profile that caused the error. + * @returns ConnectionDiagnosticsResult: The result from the provider for whether the error was handled. + */ + handleConnectionError(errorInfo: IErrorInformation, connection: connection.ConnectionProfile): Thenable; + } + + /** + * Registers provider with instance of Diagnostic Provider implementation. + * Note: only ONE diagnostic provider object can be assigned to a specific provider at a time. + * @param providerMetadata Additional data used to register the provider + * @param errorDiagnostics The provider's diagnostic object that handles errors. + * @returns A disposable that when disposed will unregister the provider + */ + export function registerDiagnosticsProvider(providerMetadata: ErrorDiagnosticsProviderMetadata, errorDiagnostics: ErrorDiagnosticsProvider): vscode.Disposable; + } + + export namespace connection { + + /** + * Opens the change password dialog. + * @param profile The connection profile to change the password for. + * @returns The new password that is returned from the operation or undefined if unsuccessful. + */ + export function openChangePasswordDialog(profile: IConnectionProfile): Thenable; + } + + export interface ConnectionInfoSummary { + /** + * ID used to identify the connection on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + export interface QueryExecuteCompleteNotificationResult { + /** + * ID used to identify the connection used to run the query on the server, if available. + */ + serverConnectionId?: string | undefined; + } + + /* + * Add optional per-OS default value. + */ + export interface DefaultValueOsOverride { + os: string; + + defaultValueOverride: string; + } + + export interface ConnectionOption { + defaultValueOsOverrides?: DefaultValueOsOverride[]; + + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * When set to true, the respective connection option will be rendered on the main connection dialog + * and not the Advanced Options window. + */ + showOnConnectionDialog?: boolean; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + + export interface ServiceOption { + /** + * Used to define placeholder text + */ + placeholder?: string; + + /** + * Used to define list of values based on which another option is rendered visible/hidden. + */ + onSelectionChange?: SelectionChangeEvent[]; + } + /** + * This change event defines actions + */ + export interface SelectionChangeEvent { + /** + * Values that affect actions defined in this event. + */ + values: string[]; + + /** + * Action to be taken on another option when selected value matches to the list of values provided. + */ + dependentOptionActions: DependentOptionAction[]; + } + + export interface DependentOptionAction { + /** + * Name of option affected by defined action. + */ + optionName: string, + + /** + * Action to be taken, Supported values: 'show', 'hide'. + */ + action: string; + + /** + * Whether or not the option should be set to required when visible. Defaults to false. + * NOTE: Since this is dynamically defined, option values are not updated on 'show' and validation is not performed. + * When set to true, providers must handle property validation. + */ + required?: boolean; + } + + // Object Explorer interfaces -------------------------------- + export interface ObjectExplorerSession { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + } + + export interface ExpandNodeInfo { + /** + * Authentication token for the current session. + */ + securityToken?: accounts.AccountSecurityToken | undefined; + + /** + * Filters to apply to the child nodes being returned + */ + filters?: NodeFilter[]; + } + // End Object Explorer interfaces ---------------------------- + + export interface TaskInfo { + targetLocation?: string; + } + + export interface ButtonColumnOption { + icon?: IconPath; + } + + export namespace sqlAssessment { + + export enum SqlAssessmentTargetType { + Server = 1, + Database = 2 + } + + export enum SqlAssessmentResultItemKind { + RealResult = 0, + Warning = 1, + Error = 2 + } + } + // Assessment interfaces + + export interface SqlAssessmentResultItem { + rulesetVersion: string; + rulesetName: string; + targetType: sqlAssessment.SqlAssessmentTargetType; + targetName: string; + checkId: string; + tags: string[]; + displayName: string; + description: string; + message: string; + helpLink: string; + level: string; + timestamp: string; + kind: sqlAssessment.SqlAssessmentResultItemKind; + } + + export interface SqlAssessmentResult extends ResultStatus { + items: SqlAssessmentResultItem[]; + apiVersion: string; + } + + export interface SqlAssessmentServicesProvider extends DataProvider { + assessmentInvoke(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + getAssessmentItems(ownerUri: string, targetType: sqlAssessment.SqlAssessmentTargetType): Promise; + generateAssessmentScript(items: SqlAssessmentResultItem[]): Promise; + } + + export interface TreeItem2 extends vscode.TreeItem { + payload?: IConnectionProfile; + childProvider?: string; + type?: ExtensionNodeType; + } + + export interface Component extends vscode.Disposable { } + + export namespace workspace { + /** + * Creates and enters a workspace at the specified location + */ + export function createAndEnterWorkspace(location: vscode.Uri, workspaceFile?: vscode.Uri): Promise; + + /** + * Enters the workspace with the provided path + * @param workspaceFile + */ + export function enterWorkspace(workspaceFile: vscode.Uri): Promise; + + /** + * Saves and enters the workspace with the provided path + * @param workspaceFile + */ + export function saveAndEnterWorkspace(workspaceFile: vscode.Uri): Promise; + } + + export interface TableComponentProperties { + /** + * Specifies whether to use headerFilter plugin + */ + headerFilter?: boolean, + } + + export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[]; + + export interface ExecutionPlanComponentProperties extends ComponentProperties { + /** + * Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs + */ + data?: ExecutionPlanData; + } + + /** + * Defines the executionPlan component + */ + export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties { + } + + export interface ModelBuilder { + executionPlan(): ComponentBuilder; + } + + export interface ListViewOption { + /** + * The optional accessibility label for the column. Default is the label for the list view option. + */ + ariaLabel?: string; + /** + * Specify the icon for the option. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. + */ + icon?: IconPath; + } + + export interface IconColumnCellValue { + /** + * The icon to be displayed. + */ + icon: IconPath; + /** + * The title of the icon. + */ + title: string; + } + + export interface ButtonColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the button. + */ + title?: string; + } + + export interface HyperlinkColumnCellValue { + /** + * The icon to be displayed. + */ + icon?: IconPath; + /** + * The title of the hyperlink. + */ + title?: string; + + /** + * The url to open. + */ + url?: string; + /** + * The role of the hyperlink. By default, the role is 'link' and the url will be opened in a new tab. + */ + role?: 'button' | 'link'; + } + + export interface ContextMenuColumnCellValue { + /** + * The title of the hyperlink. By default, the title is 'Show Actions' + */ + title?: string; + /** + * commands for the menu. Use an array for a group and menu separators will be added. + */ + commands: (string | string[])[]; + /** + * context that will be passed to the commands. + */ + context?: { [key: string]: string | boolean | number } | string | boolean | number | undefined + } + + export enum ColumnType { + icon = 3, + hyperlink = 4, + contextMenu = 5 + } + + export interface TableColumn { + /** + * The text to display on the column heading. 'value' property will be used, if not specified + */ + name?: string; + + /** + * whether the column is resizable. Default value is true. + */ + resizable?: boolean; + } + + export interface IconColumnOptions { + /** + * The icon to use for all the cells in this column. + */ + icon?: IconPath; + } + + export interface ButtonColumn extends IconColumnOptions, TableColumn { + /** + * Whether to show the text, default value is false. + */ + showText?: boolean; + } + + export interface HyperlinkColumn extends IconColumnOptions, TableColumn { + } + + export interface CheckboxColumn extends TableColumn { + action: ActionOnCellCheckboxCheck; + } + + export interface ContextMenuColumn extends TableColumn { + } + + export interface QueryExecuteResultSetNotificationParams { + /** + * Contains execution plans returned by the database in ResultSets. + */ + executionPlans: executionPlan.ExecutionPlanGraph[]; + } + + export interface ObjectMetadata { + /* + * Parent object name for subobjects such as triggers, indexes, etc. + */ + parentName?: string; + + /* + * Parent object type name, such as Table, View, etc. + */ + parentTypeName?: string; + } + + /** + * Represents a selected range in the result grid. + */ + export interface SelectionRange { + fromRow: number; + toRow: number; + fromColumn: number; + toColumn: number; + } + + /** + * Parameters for the copy results request. + */ + export interface CopyResultsRequestParams { + /** + * URI of the editor. + */ + ownerUri: string; + /** + * Index of the batch. + */ + batchIndex: number; + /** + * Index of the result set. + */ + resultSetIndex: number; + /** + * Whether to include the column headers. + */ + includeHeaders: boolean + /** + * The selected ranges to be copied. + */ + selections: SelectionRange[]; + } + + export interface CopyResultsRequestResult { + /** + * Result string from copy operation + */ + results: string; + } + + export interface QueryProvider { + /** + * Notify clients that the URI for a connection has been changed. + */ + connectionUriChanged?(newUri: string, oldUri: string): Thenable; + /** + * Copy the selected data to the clipboard. + * This is introduced to address the performance issue of large amount of data to ADS side. + * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. + * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. + */ + copyResults?(requestParams: CopyResultsRequestParams): Thenable; + } + + export enum DataProviderType { + TableDesignerProvider = 'TableDesignerProvider', + ExecutionPlanProvider = 'ExecutionPlanProvider', + ServerContextualizationProvider = 'ServerContextualizationProvider' + } + + export namespace dataprotocol { + export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable; + export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable; + /** + * Registers a server contextualization provider, which can provide context about a server to extensions like GitHub + * Copilot for improved suggestions. + * @param provider The provider to register + */ + export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable; + } + + export namespace designers { + /** + * Open a table designer window. + * @param providerId The table designer provider Id. + * @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table. + * @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry + * @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited + */ + export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable; + + /** + * Definition for the table designer provider. + */ + export interface TableDesignerProvider extends DataProvider { + /** + * Initialize the table designer for the specified table. + * @param table the table information. + */ + initializeTableDesigner(table: TableInfo): Thenable; + + /** + * Process the table change. + * @param table the table information + * @param tableChangeInfo the information about the change user made through the UI. + */ + processTableEdit(table: TableInfo, tableChangeInfo: DesignerEdit): Thenable>; + + /** + * Publish the changes. + * @param table the table information + */ + publishChanges(table: TableInfo): Thenable; + + /** + * Generate script for the changes. + * @param table the table information + */ + generateScript(table: TableInfo): Thenable; + + /** + * Generate preview report describing the changes to be made. + * @param table the table information + */ + generatePreviewReport(table: TableInfo): Thenable; + + /** + * Notify the provider that the table designer has been closed. + * @param table the table information + */ + disposeTableDesigner(table: TableInfo): Thenable; + } + + /** + * The information of the table. + */ + export interface TableInfo { + /** + * Used as the table designer editor's tab header text. + */ + title: string; + /** + * Used as the table designer editor's tab header hover text. + */ + tooltip: string; + /** + * Unique identifier of the table. Will be used to decide whether a designer is already opened for the table. + */ + id: string; + /** + * A boolean value indicates whether a new table is being designed. + */ + isNewTable: boolean; + /** + * Extension can store additional information that the provider needs to uniquely identify a table. + */ + [key: string]: any; + /** + * Table icon type that's shown in the editor tab. Default is the basic + * table icon. + */ + tableIcon?: TableIcon; + } + + /** + * The information to populate the table designer UI. + */ + export interface TableDesignerInfo { + /** + * The view definition. + */ + view: TableDesignerView; + /** + * The initial state of the designer. + */ + viewModel: DesignerViewModel; + /** + * The new table info after initialization. + */ + tableInfo: TableInfo; + /** + * The issues. + */ + issues?: DesignerIssue[]; + } + + /** + * Table icon that's shown on the editor tab + */ + export enum TableIcon { + Basic = 'Basic', + Temporal = 'Temporal', + GraphNode = 'GraphNode', + GraphEdge = 'GraphEdge' + } + + /** + * Name of the common table properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableProperty { + Columns = 'columns', + Description = 'description', + Name = 'name', + Schema = 'schema', + Script = 'script', + ForeignKeys = 'foreignKeys', + CheckConstraints = 'checkConstraints', + Indexes = 'indexes', + PrimaryKey = 'primaryKey', + PrimaryKeyName = 'primaryKeyName', + PrimaryKeyDescription = 'primaryKeyDescription', + PrimaryKeyColumns = 'primaryKeyColumns' + } + /** + * Name of the common table column properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableColumnProperty { + AllowNulls = 'allowNulls', + DefaultValue = 'defaultValue', + Length = 'length', + Name = 'name', + Description = 'description', + Type = 'type', + AdvancedType = 'advancedType', + IsPrimaryKey = 'isPrimaryKey', + Precision = 'precision', + Scale = 'scale' + } + + /** + * Name of the common foreign key constraint properties. + * Extensions can use the names to access the designer view model. + */ + export enum TableForeignKeyProperty { + Name = 'name', + Description = 'description', + ForeignTable = 'foreignTable', + OnDeleteAction = 'onDeleteAction', + OnUpdateAction = 'onUpdateAction', + Columns = 'columns' + } + + /** + * Name of the columns mapping properties for foreign key. + */ + export enum ForeignKeyColumnMappingProperty { + Column = 'column', + ForeignColumn = 'foreignColumn' + } + + /** + * Name of the common check constraint properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableCheckConstraintProperty { + Name = 'name', + Description = 'description', + Expression = 'expression' + } + + /** + * Name of the common index properties. + * Extensions can use the name to access the designer view model. + */ + export enum TableIndexProperty { + Name = 'name', + Description = 'description', + Columns = 'columns' + } + + /** + * Name of the common properties of table index column specification. + */ + export enum TableIndexColumnSpecificationProperty { + Column = 'column' + } + + /** + * The table designer view definition. + */ + export interface TableDesignerView { + /** + * Additional table properties. Common table properties are handled by Azure Data Studio. see {@link TableProperty} + */ + additionalTableProperties?: DesignerDataPropertyInfo[]; + /** + * Additional tabs. + */ + additionalTabs?: DesignerTab[]; + /** + * Columns table options. + * Common table columns properties are handled by Azure Data Studio. see {@link TableColumnProperty}. + * Default columns to display values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue. + */ + columnTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign keys table options. + * Common foreign key properties are handled by Azure Data Studio. see {@link TableForeignKeyProperty}. + * Default columns to display values are: Name, PrimaryKeyTable. + */ + foreignKeyTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Foreign key column mapping table options. + * Common foreign key column mapping properties are handled by Azure Data Studio. see {@link ForeignKeyColumnMappingProperty}. + * Default columns to display values are: Column, ForeignColumn. + */ + foreignKeyColumnMappingTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Check constraints table options. + * Common check constraint properties are handled by Azure Data Studio. see {@link TableCheckConstraintProperty} + * Default columns to display values are: Name, Expression. + */ + checkConstraintTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Indexes table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexProperty} + * Default columns to display values are: Name. + */ + indexTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Index column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + indexColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Primary column specification table options. + * Common index properties are handled by Azure Data Studio. see {@link TableIndexColumnSpecificationProperty} + * Default columns to display values are: Column. + */ + primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; + /** + * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. + */ + additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; + /** + * Components to be placed under the pre-defined tabs. + */ + additionalComponents?: DesignerDataPropertyWithTabInfo[]; + /** + * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. + */ + useAdvancedSaveMode: boolean; + } + + export interface TableDesignerBuiltInTableViewOptions extends DesignerTablePropertiesBase { + /** + * Whether to show the table. Default value is false. + */ + showTable?: boolean; + /** + * Properties to be displayed in the table, other properties can be accessed in the properties view. + */ + propertiesToDisplay?: string[]; + /** + * Additional properties for the entity. + */ + additionalProperties?: DesignerDataPropertyInfo[]; + } + + /** + * The view model of the designer. + */ + export interface DesignerViewModel { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of a designer tab. + */ + export interface DesignerTab { + /** + * The title of the tab. + */ + title: string; + /** + * the components to be displayed in this tab. + */ + components: DesignerDataPropertyInfo[]; + } + + /** + * The definition of the property in the designer. + */ + export interface DesignerDataPropertyInfo { + /** + * The property name. + */ + propertyName: string; + /** + * The description of the property. + */ + description?: string; + /** + * The component type. + */ + componentType: DesignerComponentTypeName; + /** + * The group name, properties with the same group name will be displayed under the same group on the UI. + */ + group?: string; + /** + * Whether the property should be displayed in the properties view. The default value is true. + */ + showInPropertiesView?: boolean; + /** + * The properties of the component. + */ + componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; + } + + /** + * The definition of the property in the designer with tab info. + */ + export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo { + /** + * The tab info where this property belongs to. + */ + tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes; + } + + /** + * The child component types supported by designer. + */ + export type DesignerComponentTypeName = 'input' | 'checkbox' | 'dropdown' | 'table'; + + export interface DesignerTablePropertiesBase { + /** + * Whether user can add new rows to the table. The default value is true. + */ + canAddRows?: boolean; + /** + * Whether user can remove rows from the table. The default value is true. + */ + canRemoveRows?: boolean; + /** + * Whether user can move rows from one index to another. The default value is true. + */ + canMoveRows?: boolean; + /** + * Whether user can insert rows at a given index to the table. The default value is true. + */ + canInsertRows?: boolean; + /** + * Whether to show confirmation when user removes a row. The default value is false. + */ + showRemoveRowConfirmation?: boolean; + /** + * The confirmation message to be displayed when user removes a row. + */ + removeRowConfirmationMessage?: string; + /** + * Whether to show the item detail in properties view. The default value is true. + */ + showItemDetailInPropertiesView?: boolean; + /** + * The label of the add new button. The default value is 'Add New'. + */ + labelForAddNewButton?: string; + } + + /** + * The properties for the table component in the designer. + */ + export interface DesignerTableProperties extends ComponentProperties, DesignerTablePropertiesBase { + /** + * the name of the properties to be displayed, properties not in this list will be accessible in properties pane. + */ + columns?: string[]; + /** + * The display name of the object type. + */ + objectTypeDisplayName: string; + /** + * the properties of the table data item. + */ + itemProperties?: DesignerDataPropertyInfo[]; + /** + * The data to be displayed. + */ + data?: DesignerTableComponentDataItem[]; + } + + /** + * The data item of the designer's table component. + */ + export interface DesignerTableComponentDataItem { + [key: string]: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties | boolean; + /** + * Whether the row can be deleted. The default value is true. + */ + canBeDeleted?: boolean; + } + + /** + * Type of the edit originated from the designer UI. + */ + export enum DesignerEditType { + /** + * Add a row to a table. + */ + Add = 0, + /** + * Remove a row from a table. + */ + Remove = 1, + /** + * Update a property. + */ + Update = 2, + /** + * Change the position of an item in the collection. + */ + Move = 3 + } + + /** + * Information of the edit originated from the designer UI. + */ + export interface DesignerEdit { + /** + * The edit type. + */ + type: DesignerEditType; + /** + * the path of the edit target. + */ + path: DesignerPropertyPath; + /** + * the new value. + */ + value?: any; + } + + /** + * The path of the property. + * Below are the 3 scenarios and their expected path. + * Note: 'index-{x}' in the description below are numbers represent the index of the object in the list. + * 1. 'Add' scenario + * a. ['propertyName1']. Example: add a column to the columns property: ['columns']. + * b. ['propertyName1',index-1,'propertyName2']. Example: add a column mapping to the first foreign key: ['foreignKeys',0,'mappings']. + * 2. 'Update' scenario + * a. ['propertyName1']. Example: update the name of the table: ['name']. + * b. ['propertyName1',index-1,'propertyName2']. Example: update the name of a column: ['columns',0,'name']. + * c. ['propertyName1',index-1,'propertyName2',index-2,'propertyName3']. Example: update the source column of an entry in a foreign key's column mapping table: ['foreignKeys',0,'mappings',0,'source']. + * 3. 'Remove' scenario + * a. ['propertyName1',index-1]. Example: remove a column from the columns property: ['columns',0']. + * b. ['propertyName1',index-1,'propertyName2',index-2]. Example: remove a column mapping from a foreign key's column mapping table: ['foreignKeys',0,'mappings',0]. + */ + export type DesignerPropertyPath = (string | number)[]; + + /** + * Severity of the messages returned by the provider after processing an edit. + * 'error': The issue must be fixed in order to commit the changes. + * 'warning': Inform the user the potential risks with the current state. e.g. Having multiple edge constraints is only useful as a temporary state. + * 'information': Informational message. + */ + export type DesignerIssueSeverity = 'error' | 'warning' | 'information'; + + /** + * Represents the issue in the designer + */ + export interface DesignerIssue { + /** + * Severity of the issue. + */ + severity: DesignerIssueSeverity, + /** + * Path of the property that is associated with the issue. + */ + propertyPath?: DesignerPropertyPath, + /** + * Description of the issue. + */ + description: string, + /** + * Url to a web page that has the explaination of the issue. + */ + moreInfoLink?: string; + } + + /** + * The result returned by the table designer provider after handling an edit request. + */ + export interface DesignerEditResult { + /** + * The new view information if the view needs to be refreshed. + */ + view?: T; + /** + * The view model object. + */ + viewModel: DesignerViewModel; + /** + * Whether the current state is valid. + */ + isValid: boolean; + /** + * Issues of current state. + */ + issues?: DesignerIssue[]; + /** + * The input validation error. + */ + inputValidationError?: string; + /** + * Metadata related to the table + */ + metadata?: { [key: string]: string }; + } + + /** + * The result returned by the table designer provider after handling the publish changes request. + */ + export interface PublishChangesResult { + /** + * The new table information after the changes are published. + */ + newTableInfo: TableInfo; + /** + * The new view model. + */ + viewModel: DesignerViewModel; + /** + * The new view. + */ + view: TableDesignerView; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + + export interface GeneratePreviewReportResult { + /** + * Report generated for generate preview + */ + report: string; + /** + * Format (mimeType) of the report + */ + mimeType: string; + /** + * Whether user confirmation is required, the default value is false. + */ + requireConfirmation?: boolean; + /** + * The confirmation text. + */ + confirmationText?: string; + /** + * The table schema validation error. + */ + schemaValidationError?: string; + /** + * Metadata related to the table to be captured + */ + metadata?: { [key: string]: string }; + } + } + + export namespace executionPlan { + export interface ExecutionPlanGraph { + /** + * Root of the execution plan tree + */ + root: ExecutionPlanNode; + /** + * Underlying query for the execution plan graph. + */ + query: string; + /** + * String representation of graph + */ + graphFile: ExecutionPlanGraphInfo; + /** + * Query recommendations for optimizing performance + */ + recommendations: ExecutionPlanRecommendations[]; + } + + export interface ExecutionPlanNode { + /** + * Unique id given to node by the provider + */ + id: string; + /** + * Type of the node. This property determines the icon that is displayed for it + */ + type: string; + /** + * Cost associated with the node + */ + cost: number; + /** + * Cost of the node subtree + */ + subTreeCost: number; + /** + * Relative cost of the node compared to its siblings. + */ + relativeCost: number; + /** + * Time take by the node operation in milliseconds + */ + elapsedTimeInMs: number; + /** + * CPU time taken by the node operation in milliseconds + */ + elapsedCpuTimeInMs: number; + /** + * Node properties to be shown in the tooltip + */ + properties: ExecutionPlanGraphElementProperty[]; + /** + * Display name for the node + */ + name: string; + /** + * Description associated with the node. + */ + description: string; + /** + * Subtext displayed under the node name + */ + subtext: string[]; + /** + * Direct children of the nodes. + */ + children: ExecutionPlanNode[]; + /** + * Edges corresponding to the children. + */ + edges: ExecutionPlanEdge[]; + /** + * Warning/parallelism badges applicable to the current node + */ + badges: ExecutionPlanBadge[]; + /** + * Data to show in top operations table for the node. + */ + topOperationsData: TopOperationsDataItem[]; + /** + * Output row count associated with the node + */ + rowCountDisplayString: string; + /** + * Cost string for the node + */ + costDisplayString: string; + /** + * Cost metrics for the node + */ + costMetrics: CostMetric[]; + } + + export interface CostMetric { + /** + * Name of the cost metric. + */ + name: string; + /** + * The value of the cost metric + */ + value: number | undefined; + } + + export interface ExecutionPlanBadge { + /** + * Type of the node overlay. This determines the icon that is displayed for it + */ + type: BadgeType; + /** + * Text to display for the overlay tooltip + */ + tooltip: string; + } + + export enum BadgeType { + Warning = 0, + CriticalWarning = 1, + Parallelism = 2 + } + + export interface ExecutionPlanEdge { + /** + * Count of the rows returned by the subtree of the edge. + */ + rowCount: number; + /** + * Size of the rows returned by the subtree of the edge. + */ + rowSize: number; + /** + * Edge properties to be shown in the tooltip. + */ + properties: ExecutionPlanGraphElementProperty[] + } + + export interface ExecutionPlanGraphElementProperty { + /** + * Name of the property + */ + name: string; + /** + * value for the property + */ + value: string | ExecutionPlanGraphElementProperty[]; + /** + * Flag to show/hide props in tooltip + */ + showInTooltip: boolean; + /** + * Display order of property + */ + displayOrder: number; + /** + * Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip + */ + positionAtBottom: boolean; + /** + * Display value of property to show in tooltip and other UI element. + */ + displayValue: string; + /** + * Data type of the property value + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Indicates which value is better when 2 similar properties are compared. + */ + betterValue: ExecutionPlanGraphElementPropertyBetterValue; + } + + export enum ExecutionPlanGraphElementPropertyDataType { + Number = 0, + String = 1, + Boolean = 2, + Nested = 3 + } + + export enum ExecutionPlanGraphElementPropertyBetterValue { + LowerNumber = 0, + HigherNumber = 1, + True = 2, + False = 3, + None = 4 + } + + export interface ExecutionPlanRecommendations { + /** + * Text displayed in the show plan graph control description + */ + displayString: string; + /** + * Query that is recommended to the user + */ + queryText: string; + /** + * Query that will be opened in a new file once the user click on the recommendation + */ + queryWithDescription: string; + } + + export interface ExecutionPlanGraphInfo { + /** + * File contents + */ + graphFileContent: string; + /** + * File type for execution plan. This will be the file type of the editor when the user opens the graph file + */ + graphFileType: string; + /** + * Index of the execution plan in the file content + */ + planIndexInFile?: number; + } + + export interface GetExecutionPlanResult extends ResultStatus { + graphs: ExecutionPlanGraph[] + } + + export interface ExecutionGraphComparisonResult { + /** + * The base ExecutionPlanNode for the ExecutionGraphComparisonResult. + */ + baseNode: ExecutionPlanNode; + /** + * The children of the ExecutionGraphComparisonResult. + */ + children: ExecutionGraphComparisonResult[]; + /** + * The group index of the ExecutionGraphComparisonResult. + */ + groupIndex: number; + /** + * Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan. + */ + hasMatch: boolean; + /** + * List of matching nodes for the ExecutionGraphComparisonResult. + */ + matchingNodesId: number[]; + /** + * The parent of the ExecutionGraphComparisonResult. + */ + parentNode: ExecutionGraphComparisonResult; + } + + export interface ExecutionPlanComparisonResult extends ResultStatus { + firstComparisonResult: ExecutionGraphComparisonResult; + secondComparisonResult: ExecutionGraphComparisonResult; + } + + export interface IsExecutionPlanResult { + isExecutionPlan: boolean; + queryExecutionPlanFileExtension: string; + } + + export interface ExecutionPlanProvider extends DataProvider { + // execution plan service methods + + /** + * Gets the execution plan graph from the provider for a given plan file + * @param planFile file that contains the execution plan + */ + getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable; + /** + * Compares two execution plans and identifies matching regions in both execution plans. + * @param firstPlanFile file that contains the first execution plan. + * @param secondPlanFile file that contains the second execution plan. + */ + compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable; + /** + * Determines if the provided value is an execution plan and returns the appropriate file extension. + * @param value String that needs to be checked. + */ + isExecutionPlan(value: string): Thenable; + } + + export interface TopOperationsDataItem { + /** + * Column name for the top operation data item + */ + columnName: string; + /** + * Cell data type for the top operation data item + */ + dataType: ExecutionPlanGraphElementPropertyDataType; + /** + * Cell value for the top operation data item + */ + displayValue: string | number | boolean; + } + } + + export namespace contextualization { + export interface GetServerContextualizationResult { + /** + * The retrieved server context. + */ + context: string | undefined; + } + + export interface ServerContextualizationProvider extends DataProvider { + /** + * Gets server context, which can be in the form of create scripts but is left up each provider. + * @param ownerUri The URI of the connection to get context for. + */ + getServerContextualization(ownerUri: string): Thenable; + } + } + + /** + * Component to display text with an icon representing the severity + */ + export interface InfoBoxComponent extends Component, InfoBoxComponentProperties { + /** + * An event fired when the InfoBox is clicked + */ + onDidClick: vscode.Event; + /** + * An event fired when the Infobox link is clicked + */ + onLinkClick: vscode.Event; + } + + export interface InfoBoxComponentProperties { + /** + * Sets whether the infobox is clickable or not. This will display a right arrow at the end of infobox text. + * Default value is false. + */ + isClickable?: boolean | undefined; + + /** + * Sets the ariaLabel for the right arrow button that shows up in clickable infoboxes + */ + clickableButtonAriaLabel?: string; + + /** + * List of links to embed within the text. If links are specified there must be placeholder + * values in the value indicating where the links should be placed, in the format {i} + * + * e.g. "Click {0} for more information!"" + */ + links?: LinkArea[]; + } + + /** + * Event argument for infobox link click event. + */ + export interface InfoBoxLinkClickEventArgs { + /** + * Index of the link selected + */ + index: number; + /** + * Link that is clicked + */ + link: LinkArea; + } + + export interface TextComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface ContainerProperties extends ComponentProperties { + /** + * Corresponds to the aria-live accessibility attribute for this component + */ + ariaLive?: AriaLiveValue; + } + + export interface DropDownProperties { + /** + * Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false. + */ + strictSelection?: boolean; + } + + export interface NodeInfo { + /** + * The object type of the node. Node type is used to determine the icon, the object type is the actual type of the node, e.g. for Tables node + * under the database, the nodeType is Folder, the objectType is be Tables. + */ + objectType?: string; + /* + * The path of the parent node. + */ + parentNodePath: string; + /** + * Filterable properties that this node supports + */ + filterableProperties?: NodeFilterProperty[]; + } + + export interface NodeFilterProperty { + /** + * The non-localized name of the filter property + */ + name: string; + /** + * The name of the filter property displayed to the user + */ + displayName: string; + /** + * The type of the filter property + */ + type: NodeFilterPropertyDataType; + /** + * The description of the filter property + */ + description: string; + } + + /** + * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice + */ + export interface NodeFilterChoiceProperty extends NodeFilterProperty { + /** + * The list of choices for the filter property if the type is choice + */ + choices: NodeFilterChoicePropertyValue[]; + } + + export interface NodeFilterChoicePropertyValue { + /** + * The value of the choice + */ + value: string; + /** + * The display name of the choice + * If not specified, the value will be used as the display name + * If specified, the display name will be used in the dropdown + */ + displayName?: string; + } + + export interface NodeFilter { + /** + * The name of the filter property + */ + name: string; + /** + * The operator of the filter property + */ + operator: NodeFilterOperator; + /** + * The applied values of the filter property + */ + value: string | string[] | number | number[] | boolean | undefined; + } + + export enum NodeFilterPropertyDataType { + String = 0, + Number = 1, + Boolean = 2, + Date = 3, + Choice = 4 + } + + export enum NodeFilterOperator { + Equals = 0, + NotEquals = 1, + LessThan = 2, + LessThanOrEquals = 3, + GreaterThan = 4, + GreaterThanOrEquals = 5, + Between = 6, + NotBetween = 7, + Contains = 8, + NotContains = 9, + StartsWith = 10, + NotStartsWith = 11, + EndsWith = 12, + NotEndsWith = 13 + } + + export interface ModelView extends vscode.Disposable { } + + export interface DeclarativeTableMenuCellValue extends vscode.Disposable { } + + export namespace window { + export interface Wizard extends LoadingComponentBase { } + + export interface Dialog extends LoadingComponentBase, vscode.Disposable { } + + export interface ModelViewPanel extends vscode.Disposable { } + + export interface ModelViewDashboard extends vscode.Disposable { } + + /** + * Opens the error dialog with customization options provided. + * @param options Dialog options to customize error dialog. + * @returns Id of action button clicked by user, e.g. ok, cancel + */ + export function openCustomErrorDialog(options: IErrorDialogOptions): Thenable; + + /** + * Provides dialog options to customize modal dialog content and layout + */ + export interface IErrorDialogOptions { + /** + * Severity Level to identify icon of modal dialog. + */ + severity: MessageLevel; + /** + * Title of modal dialog header. + */ + headerTitle: string; + /** + * Message text to show on dialog. + */ + message: string; + /** + * (Optional) Detailed message, e.g stack trace of error. + */ + messageDetails?: string; + /** + * Telemetry View to be used for emitting telemetry events. + */ + telemetryView?: string, + /** + * (Optional) List of custom actions to include in modal dialog alongwith a 'Cancel' button. + * If custom 'actions' are not provided, 'OK' button will be shown by default. + */ + actions?: IDialogAction[]; + /** + * (Optional) If provided, instruction text is shown in bold below message. + */ + instructionText?: string; + /** + * (Optional) If provided, appends read more link after instruction text. + */ + readMoreLink?: string; + } + + /** + * An action that will be rendered as a button on the dialog. + */ + export interface IDialogAction { + /** + * Identifier of action. + */ + id: string; + /** + * Label of Action button. + */ + label: string; + /** + * Defines if button styling and focus should be based on primary action. + */ + isPrimary: boolean; + } + + export interface FileFilters { + /** + * The label to display in the file filter field next to the list of filters. + */ + label: string; + /** + * The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files). + */ + filters: string[]; + } + + /** + * Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local + * files without any connection is opened via vscode.window.showOpenDialog. + * @param connectionUri The URI of the connection to the target server + * @param targetPath The file path on the server machine to open by default in the dialog + * @param fileFilters The filters used to limit which files are displayed in the file browser + * @param showFoldersOnly Optional argument to specify whether the browser should only show folders + * @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything. + */ + export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable; + } + + export interface FileBrowserProvider extends DataProvider { + openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable; + } + + export interface TableComponent { + /** + * Set active cell. + */ + setActiveCell(row: number, column: number): void; + } + + export interface ProfilerProvider { + startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable; + } + + export enum ProfilingSessionType { + RemoteSession = 0, + LocalFile = 1 + } + + export interface SplitViewLayout extends FlexLayout { + /** + * SplitView size. Height if the orientation is vertical, width if the orientation is horizontal + * If undefined, the size of the model view container is used + */ + splitViewSize?: number | string | undefined; + } +} From 21a5623df806842ca62192aea9ff17f3295d64fd Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Mon, 26 Aug 2024 14:20:59 -0700 Subject: [PATCH 14/21] Revert "Revert "Add copy results to clipboard notification"" This reverts commit 390158dfe0f7a06a0411cd68394556304ac087d5. --- src/azdata.proposed.d.ts | 4 ++++ src/main.ts | 9 ++++++++- src/protocol.ts | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 251aafd..2fb2c0e 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -906,6 +906,10 @@ declare module 'azdata' { * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. */ copyResults?(requestParams: CopyResultsRequestParams): Thenable; + /** + * Copy the selected data to the clipboard. + */ + copyResultsToClipboard?(requestParams: CopyResultsRequestParams): Thenable; } export enum DataProviderType { diff --git a/src/main.ts b/src/main.ts index d111e90..8392de0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -362,6 +362,7 @@ export class QueryFeature extends SqlOpsFeature { protocol.SaveResultsAsExcelRequest.type, protocol.SaveResultsAsXmlRequest.type, protocol.CopyResultsRequest.type, + protocol.CopyResultsToClipboardNotification.type, protocol.EditCommitRequest.type, protocol.EditCreateRowRequest.type, protocol.EditDeleteRowRequest.type, @@ -597,6 +598,11 @@ export class QueryFeature extends SqlOpsFeature { ); }; + let copyResultsToClipboard = (params: azdata.CopyResultsRequestParams): Thenable => { + client.sendNotification(protocol.CopyResultsToClipboardNotification.type, params); + return Promise.resolve(); + }; + // Edit Data Requests let commitEdit = (ownerUri: string): Thenable => { let params: azdata.EditCommitParams = { ownerUri }; @@ -738,7 +744,8 @@ export class QueryFeature extends SqlOpsFeature { runQueryString, saveResults, updateCell, - copyResults + copyResults, + copyResultsToClipboard }); } } diff --git a/src/protocol.ts b/src/protocol.ts index f47e512..8d37f98 100644 --- a/src/protocol.ts +++ b/src/protocol.ts @@ -473,6 +473,13 @@ export namespace CopyResultsRequest { } // --------------------------------- ------------------------------------------ +// --------------------------------- < Copy Results To Clipboard Notification > ------------------------------------------ +// copy results to clipboard +export namespace CopyResultsToClipboardNotification { + export const type = new NotificationType('query/copyToClipboard'); +} +// --------------------------------- ------------------------------------------ + // ------------------------------- < T-SQL Syntax Parse > ----------------------------------- export namespace SyntaxParseRequest { export const type = new RequestType('query/syntaxparse'); From 5a778d6df6aa8806cdc38982cacb522b62488df2 Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Mon, 26 Aug 2024 14:21:13 -0700 Subject: [PATCH 15/21] Revert "Add copy results to clipboard notification" This reverts commit eb3c23d52d4be30353189c3863abb6e78ffbb2d4. --- src/azdata.proposed.d.ts | 4 ---- src/main.ts | 9 +-------- src/protocol.ts | 7 ------- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 2fb2c0e..251aafd 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -906,10 +906,6 @@ declare module 'azdata' { * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. */ copyResults?(requestParams: CopyResultsRequestParams): Thenable; - /** - * Copy the selected data to the clipboard. - */ - copyResultsToClipboard?(requestParams: CopyResultsRequestParams): Thenable; } export enum DataProviderType { diff --git a/src/main.ts b/src/main.ts index 8392de0..d111e90 100644 --- a/src/main.ts +++ b/src/main.ts @@ -362,7 +362,6 @@ export class QueryFeature extends SqlOpsFeature { protocol.SaveResultsAsExcelRequest.type, protocol.SaveResultsAsXmlRequest.type, protocol.CopyResultsRequest.type, - protocol.CopyResultsToClipboardNotification.type, protocol.EditCommitRequest.type, protocol.EditCreateRowRequest.type, protocol.EditDeleteRowRequest.type, @@ -598,11 +597,6 @@ export class QueryFeature extends SqlOpsFeature { ); }; - let copyResultsToClipboard = (params: azdata.CopyResultsRequestParams): Thenable => { - client.sendNotification(protocol.CopyResultsToClipboardNotification.type, params); - return Promise.resolve(); - }; - // Edit Data Requests let commitEdit = (ownerUri: string): Thenable => { let params: azdata.EditCommitParams = { ownerUri }; @@ -744,8 +738,7 @@ export class QueryFeature extends SqlOpsFeature { runQueryString, saveResults, updateCell, - copyResults, - copyResultsToClipboard + copyResults }); } } diff --git a/src/protocol.ts b/src/protocol.ts index 8d37f98..f47e512 100644 --- a/src/protocol.ts +++ b/src/protocol.ts @@ -473,13 +473,6 @@ export namespace CopyResultsRequest { } // --------------------------------- ------------------------------------------ -// --------------------------------- < Copy Results To Clipboard Notification > ------------------------------------------ -// copy results to clipboard -export namespace CopyResultsToClipboardNotification { - export const type = new NotificationType('query/copyToClipboard'); -} -// --------------------------------- ------------------------------------------ - // ------------------------------- < T-SQL Syntax Parse > ----------------------------------- export namespace SyntaxParseRequest { export const type = new RequestType('query/syntaxparse'); From 6b5dd86b09917fd9c22921d3c8ec6602583ebb54 Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Mon, 26 Aug 2024 14:24:11 -0700 Subject: [PATCH 16/21] Add copy from UI process flag --- src/azdata.proposed.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 251aafd..225c193 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -885,6 +885,10 @@ declare module 'azdata' { * The selected ranges to be copied. */ selections: SelectionRange[]; + /** + * Whether to copy results from the UI process. + */ + copyFromUIProcess: boolean; } export interface CopyResultsRequestResult { From 66238195e04dc59740a1c8821159c39cce3c336d Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Mon, 26 Aug 2024 17:11:19 -0700 Subject: [PATCH 17/21] Check for remotes and platform before copy request --- src/azdata.proposed.d.ts | 2 +- src/main.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 225c193..ba9f3a3 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -888,7 +888,7 @@ declare module 'azdata' { /** * Whether to copy results from the UI process. */ - copyFromUIProcess: boolean; + copyFromUIProcess?: boolean; } export interface CopyResultsRequestResult { diff --git a/src/main.ts b/src/main.ts index d111e90..45be606 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,6 +8,7 @@ import * as UUID from 'vscode-languageclient/lib/utils/uuid'; import * as azdata from 'azdata'; import * as vscode from 'vscode'; +import * as os from 'os'; import { c2p, Ic2p } from './codeConverter'; @@ -588,6 +589,11 @@ export class QueryFeature extends SqlOpsFeature { }; let copyResults = (params: azdata.CopyResultsRequestParams): Thenable => { + params.copyFromUIProcess = true; + if (!vscode.env.remoteName && os.platform() !== 'linux') { + params.copyFromUIProcess = false; + } + return client.sendRequest(protocol.CopyResultsRequest.type, params).then( r => r, e => { From ca28c1355c2000a6a24b03f548f9ec3d8ac3ef4e Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Tue, 27 Aug 2024 15:41:44 -0700 Subject: [PATCH 18/21] Remove logical checks before making copy request --- src/main.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main.ts b/src/main.ts index 45be606..d111e90 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,7 +8,6 @@ import * as UUID from 'vscode-languageclient/lib/utils/uuid'; import * as azdata from 'azdata'; import * as vscode from 'vscode'; -import * as os from 'os'; import { c2p, Ic2p } from './codeConverter'; @@ -589,11 +588,6 @@ export class QueryFeature extends SqlOpsFeature { }; let copyResults = (params: azdata.CopyResultsRequestParams): Thenable => { - params.copyFromUIProcess = true; - if (!vscode.env.remoteName && os.platform() !== 'linux') { - params.copyFromUIProcess = false; - } - return client.sendRequest(protocol.CopyResultsRequest.type, params).then( r => r, e => { From 2f80b2f6e2d6c85c596adf161a6dc6dabe7970c2 Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Tue, 27 Aug 2024 17:22:18 -0700 Subject: [PATCH 19/21] Remove redundant flag --- src/azdata.proposed.d.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index ba9f3a3..251aafd 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -885,10 +885,6 @@ declare module 'azdata' { * The selected ranges to be copied. */ selections: SelectionRange[]; - /** - * Whether to copy results from the UI process. - */ - copyFromUIProcess?: boolean; } export interface CopyResultsRequestResult { From 66651ca8e418487caf2a34175351f3cdce75662f Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Tue, 27 Aug 2024 17:34:11 -0700 Subject: [PATCH 20/21] Revert PR #93 --- src/azdata.proposed.d.ts | 9 +-------- src/main.ts | 4 ++-- src/protocol.ts | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/azdata.proposed.d.ts b/src/azdata.proposed.d.ts index 251aafd..7888539 100644 --- a/src/azdata.proposed.d.ts +++ b/src/azdata.proposed.d.ts @@ -887,13 +887,6 @@ declare module 'azdata' { selections: SelectionRange[]; } - export interface CopyResultsRequestResult { - /** - * Result string from copy operation - */ - results: string; - } - export interface QueryProvider { /** * Notify clients that the URI for a connection has been changed. @@ -905,7 +898,7 @@ declare module 'azdata' { * ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json. * Otherwise, The default handler will load all the selected data to ADS and perform the copy operation. */ - copyResults?(requestParams: CopyResultsRequestParams): Thenable; + copyResults?(requestParams: CopyResultsRequestParams): Thenable; } export enum DataProviderType { diff --git a/src/main.ts b/src/main.ts index d111e90..0bfe6f3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -587,9 +587,9 @@ export class QueryFeature extends SqlOpsFeature { ); }; - let copyResults = (params: azdata.CopyResultsRequestParams): Thenable => { + let copyResults = (params: azdata.CopyResultsRequestParams): Thenable => { return client.sendRequest(protocol.CopyResultsRequest.type, params).then( - r => r, + r => undefined, e => { client.logFailedRequest(protocol.CopyResultsRequest.type, e); return Promise.reject(e); diff --git a/src/protocol.ts b/src/protocol.ts index f47e512..dce38d0 100644 --- a/src/protocol.ts +++ b/src/protocol.ts @@ -469,7 +469,7 @@ export namespace SaveResultsAsXmlRequest { // --------------------------------- < Copy Results Request > ------------------------------------------ // copy results to clipboard export namespace CopyResultsRequest { - export const type = new RequestType('query/copy'); + export const type = new RequestType('query/copy'); } // --------------------------------- ------------------------------------------ From a504cbb3cbe02efd68824e2b342783d1e31ae046 Mon Sep 17 00:00:00 2001 From: Lewis Sanchez Date: Thu, 12 Sep 2024 13:12:00 -0700 Subject: [PATCH 21/21] Bump package version --- lib/main.js | 2 +- lib/protocol.d.ts | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index fdc3f17..6a017ff 100644 --- a/lib/main.js +++ b/lib/main.js @@ -407,7 +407,7 @@ class QueryFeature extends SqlOpsFeature { }); }; let copyResults = (params) => { - return client.sendRequest(protocol.CopyResultsRequest.type, params).then(r => r, e => { + return client.sendRequest(protocol.CopyResultsRequest.type, params).then(r => undefined, e => { client.logFailedRequest(protocol.CopyResultsRequest.type, e); return Promise.reject(e); }); diff --git a/lib/protocol.d.ts b/lib/protocol.d.ts index 173569a..8597b3d 100644 --- a/lib/protocol.d.ts +++ b/lib/protocol.d.ts @@ -308,7 +308,7 @@ export declare namespace SaveResultsAsXmlRequest { const type: RequestType; } export declare namespace CopyResultsRequest { - const type: RequestType; + const type: RequestType; } export declare namespace SyntaxParseRequest { const type: RequestType; diff --git a/package.json b/package.json index c7d7a50..2593452 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dataprotocol-client", - "version": "2.0.0", + "version": "2.0.1", "description": "Client data protocol implementation for Azure Data Studio", "main": "lib/main", "typings": "lib/main",