Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#65095 Azure Data Studio 1.43.0 Extension A…
Browse files Browse the repository at this point in the history
…PI by @Charles-Gagnon

* Azure Data Studio 1.43.0 Extension API

* Add test and fixes

* fix test

---------

Co-authored-by: Azure Data Studio <azuredatastudio@microsoft.com>
  • Loading branch information
Charles-Gagnon and Azure Data Studio authored Apr 12, 2023
1 parent f93c95e commit a785fc8
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 11 deletions.
16 changes: 16 additions & 0 deletions types/azdata/azdata-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,19 @@ const account: azdata.Account = {
};

azdata.accounts.getAccountSecurityToken(account, 'tenant-id', azdata.AzureResource.Custom);

const connectionProfile: azdata.connection.ConnectionProfile = {
providerId: 'MyProvider',
connectionId: 'MyConnectionId',
connectionName: 'MyConnectionName',
serverName: 'MyServerName',
databaseName: 'MyDatabaseName',
userName: 'MyUsername',
password: 'MyPassword',
authenticationType: azdata.connection.AuthenticationType.SqlLogin,
savePassword: false,
groupFullName: 'MyGroupFullName',
groupId: 'MyGroupId',
saveProfile: false,
options: {}
};
118 changes: 107 additions & 11 deletions types/azdata/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for Azure Data Studio 1.42
// Type definitions for Azure Data Studio 1.43
// Project: https://github.com/microsoft/azuredatastudio
// Definitions by: Charles Gagnon <https://github.com/Charles-Gagnon>
// Alan Ren: <https://github.com/alanrenmsft>
Expand All @@ -13,7 +13,7 @@
*--------------------------------------------------------------------------------------------*/

/**
* Type Definition for Azure Data Studio 1.42 Extension API
* Type Definition for Azure Data Studio 1.43 Extension API
* See https://docs.microsoft.com/sql/azure-data-studio/extensibility-apis for more information
*/

Expand All @@ -25,6 +25,22 @@ declare module 'azdata' {
*/
export const version: string;

export namespace env {
/**
* Well-known app quality values
*/
export enum AppQuality {
stable = 'stable',
insider = 'insider',
dev = 'dev'
}

/**
* The version of Azure Data Studio this is currently running as - such as `stable`, or `insider`
*/
export const quality: AppQuality | string | undefined;
}

// EXPORTED NAMESPACES /////////////////////////////////////////////////
/**
* Namespace for Data Management Protocol global methods
Expand Down Expand Up @@ -106,6 +122,36 @@ declare module 'azdata' {
* Namespace for connection management
*/
export namespace connection {
/**
* Well-known Authentication types commonly supported by connection providers.
*/
export enum AuthenticationType {
/**
* Username and password
*/
SqlLogin = 'SqlLogin',
/**
* Windows Authentication
*/
Integrated = 'Integrated',
/**
* Azure Active Directory - Universal with MFA support
*/
AzureMFA = 'AzureMFA',
/**
* Azure Active Directory - Password
*/
AzureMFAAndUser = 'AzureMFAAndUser',
/**
* Datacenter Security Token Service Authentication
*/
DSTSAuth = 'dstsAuth',
/**
* No authentication required
*/
None = 'None'
}

/**
* Connection profile primary class
*/
Expand All @@ -117,7 +163,7 @@ declare module 'azdata' {
databaseName: string;
userName: string;
password: string;
authenticationType: string;
authenticationType: string | AuthenticationType;
savePassword: boolean;
groupFullName: string;
groupId: string;
Expand Down Expand Up @@ -322,7 +368,7 @@ declare module 'azdata' {
/**
* Get the parent node. Returns undefined if there is none.
*/
getParent(): Thenable<ObjectExplorerNode>;
getParent(): Thenable<ObjectExplorerNode | undefined>;

/**
* Refresh the node, expanding it if it has children
Expand Down Expand Up @@ -384,7 +430,10 @@ declare module 'azdata' {
databaseName?: string | undefined;
userName: string;
password: string;
authenticationType: string;
/**
* The type of authentication to use when connecting
*/
authenticationType: string | connection.AuthenticationType;
savePassword: boolean;
groupFullName?: string | undefined;
groupId?: string | undefined;
Expand Down Expand Up @@ -1961,8 +2010,8 @@ declare module 'azdata' {

// Proxy management methods
getProxies(ownerUri: string): Thenable<AgentProxiesResult>;
createProxy(ownerUri: string, proxyInfo: AgentProxyInfo): Thenable<CreateAgentOperatorResult>;
updateProxy(ownerUri: string, originalProxyName: string, proxyInfo: AgentProxyInfo): Thenable<UpdateAgentOperatorResult>;
createProxy(ownerUri: string, proxyInfo: AgentProxyInfo): Thenable<CreateAgentProxyResult>;
updateProxy(ownerUri: string, originalProxyName: string, proxyInfo: AgentProxyInfo): Thenable<UpdateAgentProxyResult>;
deleteProxy(ownerUri: string, proxyInfo: AgentProxyInfo): Thenable<ResultStatus>;

// Credential method
Expand Down Expand Up @@ -2999,6 +3048,11 @@ declare module 'azdata' {
export interface ContainerBuilder<TComponent extends Component, TLayout, TItemLayout, TPropertyBag extends ContainerProperties> extends ComponentBuilder<TComponent, TPropertyBag> {
withLayout(layout: TLayout): ContainerBuilder<TComponent, TLayout, TItemLayout, TPropertyBag>;
withItems(components: Array<Component>, itemLayout?: TItemLayout): ContainerBuilder<TComponent, TLayout, TItemLayout, TPropertyBag>;
/**
* Sets the initial set of properties for the container being created
* @param properties The properties to apply to the container
*/
withProps(properties: TPropertyBag): ContainerBuilder<TComponent, TLayout, TItemLayout, TPropertyBag>;
}

export interface FlexBuilder extends ContainerBuilder<FlexContainer, FlexLayout, FlexItemLayout, ContainerProperties> {
Expand Down Expand Up @@ -3586,9 +3640,14 @@ declare module 'azdata' {
title?: string | undefined;
}

/**
* Supported values for aria-live accessibility attribute
*/
export type AriaLiveValue = 'polite' | 'assertive' | 'off';

export interface InputBoxProperties extends ComponentProperties {
value?: string | undefined;
ariaLive?: string | undefined;
ariaLive?: AriaLiveValue | undefined;
placeHolder?: string | undefined;
inputType?: InputBoxInputType | undefined;
required?: boolean | undefined;
Expand Down Expand Up @@ -4180,6 +4239,10 @@ declare module 'azdata' {
export interface TableComponent extends Component, TableComponentProperties {
onRowSelected: vscode.Event<any>;
onCellAction?: vscode.Event<ICellActionEventArgs> | undefined;
/**
* Append data to the existing table data.
*/
appendData(data: any[][]): Thenable<void>;
}

export interface FileBrowserTreeComponent extends Component, FileBrowserTreeProperties {
Expand Down Expand Up @@ -4940,7 +5003,7 @@ declare module 'azdata' {
* Set the informational message shown in the dialog. Hidden when the message is
* undefined or the text is empty or undefined. The default level is error.
*/
message: DialogMessage;
message?: DialogMessage;

/**
* Set the dialog name when opening
Expand Down Expand Up @@ -5239,9 +5302,41 @@ declare module 'azdata' {
| 'executionPlan'
| 'visualize';

/**
* A message sent during the execution of a query
*/
export interface QueryMessage {
/**
* The message string
*/
message: string;
/**
* Whether this message is an error message or not
*/
isError: boolean;
/**
* The timestamp for when this message was sent
*/
time?: string;
}

/**
* Information about a query that was executed
*/
export interface QueryInfo {
/**
* Any messages that have been received from the query provider
*/
messages: QueryMessage[];
/**
* The ranges for each batch that has executed so far
*/
batchRanges: vscode.Range[];
}

export interface QueryEventListener {
/**
* A callback that is called whenever a query event occurs
* An event that is fired for query events
* @param type The type of query event
* @param document The document this event was sent by
* @param args The extra information for the event, if any
Expand All @@ -5250,8 +5345,9 @@ declare module 'azdata' {
* queryStop: undefined
* executionPlan: string (the plan itself)
* visualize: ResultSetSummary (the result set to be visualized)
* @param queryInfo The information about the query that triggered this event
*/
onQueryEvent(type: QueryEventType, document: QueryDocument, args: ResultSetSummary | string | undefined): void;
onQueryEvent(type: QueryEventType, document: QueryDocument, args: ResultSetSummary | string | undefined, queryInfo: QueryInfo): void;
}

export interface QueryDocument {
Expand Down

0 comments on commit a785fc8

Please sign in to comment.