mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Refact/idea lastknown (#501)
* close * connection is working * formatting * adds all * formatting * removed unneeded logging * readd npm shrinkwrap * addressed comments * fix capabilities cacheing * updated shrinkwrap * fixed tests * remove dead code * vbump sqltools
This commit is contained in:
68
dataprotocol-client/src/codeConverter.ts
Normal file
68
dataprotocol-client/src/codeConverter.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import * as data from 'data';
|
||||
import * as proto from './protocol';
|
||||
import * as types from './types';
|
||||
|
||||
export interface Ic2p {
|
||||
asConnectionParams(connectionUri: string, connectionInfo: data.ConnectionInfo): proto.ConnectParams;
|
||||
asExecutionPlanOptions(planOptions: data.ExecutionPlanOptions): data.ExecutionPlanOptions;
|
||||
asScriptingParams(connectionUri: string, operation: data.ScriptOperation, metadata: data.ObjectMetadata, paramDetails: data.ScriptingParamDetails): types.ScriptingParams;
|
||||
}
|
||||
|
||||
function asConnectionParams(ownerUri: string, connInfo: data.ConnectionInfo): proto.ConnectParams {
|
||||
return {
|
||||
ownerUri,
|
||||
connection: {
|
||||
options: connInfo.options
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function asExecutionPlanOptions(planOptions: data.ExecutionPlanOptions): data.ExecutionPlanOptions {
|
||||
return {
|
||||
displayEstimatedQueryPlan: planOptions ? planOptions.displayEstimatedQueryPlan : undefined,
|
||||
displayActualQueryPlan: planOptions ? planOptions.displayActualQueryPlan : undefined
|
||||
};
|
||||
}
|
||||
|
||||
function asScriptingParams(ownerURI: string, operation: data.ScriptOperation, metadata: data.ObjectMetadata, paramDetails: data.ScriptingParamDetails): types.ScriptingParams {
|
||||
let scriptingObject: types.ScriptingObject = {
|
||||
type: metadata.metadataTypeName,
|
||||
schema: metadata.schema,
|
||||
name: metadata.name
|
||||
};
|
||||
let targetDatabaseEngineEdition = paramDetails.targetDatabaseEngineEdition;
|
||||
let targetDatabaseEngineType = paramDetails.targetDatabaseEngineType;
|
||||
let scriptCompatibilityOption = paramDetails.scriptCompatibilityOption;
|
||||
let scriptOptions: types.ScriptOptions = {
|
||||
scriptCreateDrop: (operation === types.ScriptOperation.Delete) ? 'ScriptDrop' :
|
||||
(operation === types.ScriptOperation.Select) ? 'ScriptSelect' : 'ScriptCreate',
|
||||
typeOfDataToScript: 'SchemaOnly',
|
||||
scriptStatistics: 'ScriptStatsNone',
|
||||
targetDatabaseEngineEdition: targetDatabaseEngineEdition ? targetDatabaseEngineEdition : 'SqlServerEnterpriseEdition',
|
||||
targetDatabaseEngineType: targetDatabaseEngineType ? targetDatabaseEngineType : 'SingleInstance',
|
||||
scriptCompatibilityOption: scriptCompatibilityOption ? scriptCompatibilityOption : 'Script140Compat'
|
||||
};
|
||||
return {
|
||||
connectionString: null,
|
||||
filePath: paramDetails.filePath,
|
||||
scriptingObjects: [scriptingObject],
|
||||
scriptDestination: 'ToEditor',
|
||||
includeObjectCriteria: null,
|
||||
excludeObjectCriteria: null,
|
||||
includeSchemas: null,
|
||||
excludeSchemas: null,
|
||||
includeTypes: null,
|
||||
excludeTypes: null,
|
||||
scriptOptions,
|
||||
connectionDetails: null,
|
||||
selectScript: null,
|
||||
ownerURI,
|
||||
operation
|
||||
};
|
||||
}
|
||||
|
||||
export const c2p: Ic2p = {
|
||||
asConnectionParams,
|
||||
asExecutionPlanOptions,
|
||||
asScriptingParams
|
||||
};
|
||||
1311
dataprotocol-client/src/main.ts
Normal file
1311
dataprotocol-client/src/main.ts
Normal file
File diff suppressed because it is too large
Load Diff
633
dataprotocol-client/src/protocol.ts
Normal file
633
dataprotocol-client/src/protocol.ts
Normal file
@@ -0,0 +1,633 @@
|
||||
import { ClientCapabilities as VSClientCapabilities, RequestType, NotificationType } from 'vscode-languageclient';
|
||||
|
||||
import * as types from './types';
|
||||
import * as data from 'data';
|
||||
|
||||
export interface ConnectionClientCapabilities {
|
||||
connection?: {
|
||||
/**
|
||||
* Whether the connection support dynamic registration
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
backup?: {
|
||||
/**
|
||||
* Whether the backup support dynamic registration
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
restore?: {
|
||||
/**
|
||||
* Whether the restore support dynamic registration
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
query?: {
|
||||
/**
|
||||
* Whether the query support dynamic registration
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
objectExplorer?: {
|
||||
/**
|
||||
* Whether the object explorer support dynamic registration
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
scripting?: {
|
||||
/**
|
||||
* Whether the scripting support dynamic registration
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
taskServices?: {
|
||||
/**
|
||||
* Whether the task services support dynamic registration
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
fileBrowser?: {
|
||||
/**
|
||||
* Whether the file browser support dynamic registration
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
profiler?: {
|
||||
/**
|
||||
* Whether the profiler support dynamic registration
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
capabilities?: {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
metadata?: {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
adminServices?: {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ClientCapabilities extends VSClientCapabilities {
|
||||
connection?: ConnectionClientCapabilities;
|
||||
}
|
||||
|
||||
//---- Refresh IntelliSense ----------------------------------------
|
||||
|
||||
/**
|
||||
* Notification sent when the an IntelliSense cache invalidation is requested
|
||||
*/
|
||||
export namespace RebuildIntelliSenseNotification {
|
||||
export const type = new NotificationType<RebuildIntelliSenseParams, void>('textDocument/rebuildIntelliSense');
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild IntelliSense notification parameters
|
||||
*/
|
||||
export class RebuildIntelliSenseParams {
|
||||
/**
|
||||
* URI identifying the text document
|
||||
*/
|
||||
public ownerUri: string;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------- < Connect Request > ----------------------------------------------
|
||||
|
||||
/**
|
||||
* Connection request message format
|
||||
*/
|
||||
export interface ConnectParams {
|
||||
/**
|
||||
* URI identifying the owner of the connection
|
||||
*/
|
||||
ownerUri: string;
|
||||
|
||||
/**
|
||||
* Details for creating the connection
|
||||
*/
|
||||
connection: types.ConnectionDetails;
|
||||
}
|
||||
|
||||
|
||||
// Connection request message callback declaration
|
||||
export namespace ConnectionRequest {
|
||||
export const type = new RequestType<ConnectParams, boolean, void, void>('connection/connect');
|
||||
}
|
||||
|
||||
// ------------------------------- < Connection Complete Event > ------------------------------------
|
||||
|
||||
|
||||
export namespace ConnectionCompleteNotification {
|
||||
export const type = new NotificationType<types.ConnectionCompleteParams, void>('connection/complete');
|
||||
}
|
||||
|
||||
// ------------------------------- < Connection Changed Event > -------------------------------------
|
||||
|
||||
/**
|
||||
* Parameters for the ConnectionChanged notification.
|
||||
*/
|
||||
export class ConnectionChangedParams {
|
||||
/**
|
||||
* Owner URI of the connection that changed.
|
||||
*/
|
||||
public ownerUri: string;
|
||||
|
||||
/**
|
||||
* Summary of details containing any connection changes.
|
||||
*/
|
||||
public connection: types.ConnectionSummary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connection changed event callback declaration.
|
||||
*/
|
||||
export namespace ConnectionChangedNotification {
|
||||
export const type = new NotificationType<ConnectionChangedParams, void>('connection/connectionchanged');
|
||||
}
|
||||
|
||||
// ------------------------------- < Disconnect Request > -------------------------------------------
|
||||
|
||||
// Disconnect request message format
|
||||
export class DisconnectParams {
|
||||
// URI identifying the owner of the connection
|
||||
public ownerUri: string;
|
||||
}
|
||||
|
||||
// Disconnect response format
|
||||
export type DisconnectResult = boolean;
|
||||
|
||||
// Disconnect request message callback declaration
|
||||
export namespace DisconnectRequest {
|
||||
export const type = new RequestType<DisconnectParams, DisconnectResult, void, void>('connection/disconnect');
|
||||
}
|
||||
|
||||
// ------------------------------- < Cancel Connect Request > ---------------------------------------
|
||||
|
||||
|
||||
// Cancel connect request message format
|
||||
export class CancelConnectParams {
|
||||
/**
|
||||
* URI identifying the owner of the connection
|
||||
*/
|
||||
public ownerUri: string;
|
||||
}
|
||||
|
||||
// Cancel connect response format.
|
||||
export type CancelConnectResult = boolean;
|
||||
|
||||
// Cancel connect request message callback declaration
|
||||
export namespace CancelConnectRequest {
|
||||
export const type = new RequestType<CancelConnectParams, CancelConnectResult, void, void>('connection/cancelconnect');
|
||||
}
|
||||
|
||||
// ------------------------------- < Change Database Request > -------------------------------------
|
||||
|
||||
export class ChangeDatabaseParams {
|
||||
public ownerUri: string;
|
||||
public newDatabase: string;
|
||||
}
|
||||
|
||||
export namespace ChangeDatabaseRequest {
|
||||
export const type = new RequestType<ChangeDatabaseParams, boolean, void, void>('connection/changedatabase');
|
||||
}
|
||||
|
||||
// ------------------------------- < List Databases Request > ---------------------------------------
|
||||
|
||||
// List databases request format
|
||||
export class ListDatabasesParams {
|
||||
// Connection information to use for querying master
|
||||
public ownerUri: string;
|
||||
}
|
||||
|
||||
// List databases request callback declaration
|
||||
export namespace ListDatabasesRequest {
|
||||
export const type = new RequestType<ListDatabasesParams, data.ListDatabasesResult, void, void>('connection/listdatabases');
|
||||
}
|
||||
|
||||
// Language Flavor Changed ================================================================================
|
||||
|
||||
/**
|
||||
* Parameters to provide when sending a language flavor changed notification
|
||||
*/
|
||||
export interface DidChangeLanguageFlavorParams {
|
||||
uri: string;
|
||||
language: string;
|
||||
flavor: string;
|
||||
}
|
||||
|
||||
// ------------------------------- < Language Flavor Changed Notification > ---------------------------------------
|
||||
export namespace LanguageFlavorChangedNotification {
|
||||
export const type = new NotificationType<DidChangeLanguageFlavorParams, void>('connection/languageflavorchanged');
|
||||
}
|
||||
|
||||
// ------------------------------- < Table Metadata Request > ---------------------------------------
|
||||
|
||||
// Table metadata request format
|
||||
export class TableMetadataParams {
|
||||
// Connection information to use for querying master
|
||||
public ownerUri: string;
|
||||
|
||||
public schema: string;
|
||||
|
||||
public objectName: string;
|
||||
}
|
||||
|
||||
// Table metadata response format
|
||||
export class TableMetadataResult {
|
||||
public columns: data.ColumnMetadata[];
|
||||
}
|
||||
|
||||
// Table metadata request callback declaration
|
||||
export namespace TableMetadataRequest {
|
||||
export const type = new RequestType<TableMetadataParams, TableMetadataResult, void, void>('metadata/table');
|
||||
}
|
||||
|
||||
// ------------------------------- < View Metadata Request > ---------------------------------------
|
||||
|
||||
// Table metadata request callback declaration
|
||||
export namespace ViewMetadataRequest {
|
||||
export const type = new RequestType<TableMetadataParams, TableMetadataResult, void, void>('metadata/view');
|
||||
}
|
||||
|
||||
/**
|
||||
* Event sent when the language service is finished updating after a connection
|
||||
*/
|
||||
export namespace IntelliSenseReadyNotification {
|
||||
export const type = new NotificationType<types.IntelliSenseReadyParams, void>('textDocument/intelliSenseReady');
|
||||
}
|
||||
|
||||
// ------------------------------- < Capabilties Discovery Event > ------------------------------------
|
||||
|
||||
export class CapabiltiesDiscoveryParams {
|
||||
public hostName: string;
|
||||
|
||||
public hostVersion: string;
|
||||
}
|
||||
|
||||
export namespace CapabiltiesDiscoveryRequest {
|
||||
export const type = new RequestType<CapabiltiesDiscoveryParams, types.CapabiltiesDiscoveryResult, void, void>('capabilities/list');
|
||||
}
|
||||
|
||||
// Query Execution ================================================================================
|
||||
// ------------------------------- < Query Cancellation Request > ------------------------------------
|
||||
export namespace QueryCancelRequest {
|
||||
export const type = new RequestType<QueryCancelParams, data.QueryCancelResult, void, void>('query/cancel');
|
||||
}
|
||||
|
||||
export interface QueryCancelParams {
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
// ------------------------------- < Query Dispose Request > ------------------------------------
|
||||
|
||||
export namespace QueryDisposeRequest {
|
||||
export const type = new RequestType<QueryDisposeParams, QueryDisposeResult, void, void>('query/dispose');
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters to provide when disposing of a query
|
||||
*/
|
||||
export interface QueryDisposeParams {
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Result received upon successful disposal of a query
|
||||
*/
|
||||
export interface QueryDisposeResult {
|
||||
}
|
||||
|
||||
// ------------------------------- < Query Execution Complete Notification > ------------------------------------
|
||||
export namespace QueryExecuteCompleteNotification {
|
||||
export const type = new NotificationType<data.QueryExecuteCompleteNotificationResult, void>('query/complete');
|
||||
}
|
||||
|
||||
// ------------------------------- < Query Batch Start Notification > ------------------------------------
|
||||
export namespace QueryExecuteBatchStartNotification {
|
||||
export const type = new NotificationType<data.QueryExecuteBatchNotificationParams, void>('query/batchStart');
|
||||
}
|
||||
|
||||
// ------------------------------- < Query Batch Complete Notification > ------------------------------------
|
||||
export namespace QueryExecuteBatchCompleteNotification {
|
||||
export const type = new NotificationType<data.QueryExecuteBatchNotificationParams, void>('query/batchComplete');
|
||||
}
|
||||
|
||||
// ------------------------------- < Query ResultSet Complete Notification > ------------------------------------
|
||||
export namespace QueryExecuteResultSetCompleteNotification {
|
||||
export const type = new NotificationType<data.QueryExecuteResultSetCompleteNotificationParams, void>('query/resultSetComplete');
|
||||
}
|
||||
|
||||
// ------------------------------- < Query Message Notification > ------------------------------------
|
||||
export namespace QueryExecuteMessageNotification {
|
||||
export const type = new NotificationType<data.QueryExecuteMessageParams, void>('query/message');
|
||||
}
|
||||
|
||||
// ------------------------------- < Query Execution Request > ------------------------------------
|
||||
export namespace QueryExecuteRequest {
|
||||
export const type = new RequestType<data.QueryExecuteParams, QueryExecuteResult, void, void>('query/executeDocumentSelection');
|
||||
}
|
||||
|
||||
export interface QueryExecuteResult { }
|
||||
|
||||
// ------------------------------- < Query Results Request > ------------------------------------
|
||||
export namespace QueryExecuteSubsetRequest {
|
||||
export const type = new RequestType<data.QueryExecuteSubsetParams, data.QueryExecuteSubsetResult, void, void>('query/subset');
|
||||
}
|
||||
|
||||
export interface ResultSetSubset {
|
||||
rowCount: number;
|
||||
rows: data.DbCellValue[][];
|
||||
}
|
||||
|
||||
// ------------------------------- < Execute Statement > ------------------------------------
|
||||
export interface QueryExecuteStatementParams {
|
||||
ownerUri: string;
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export namespace QueryExecuteStatementRequest {
|
||||
export const type = new RequestType<QueryExecuteStatementParams, QueryExecuteResult, void, void>('query/executedocumentstatement');
|
||||
}
|
||||
|
||||
// --------------------------------- < Save Results as CSV Request > ------------------------------------------
|
||||
|
||||
// save results in csv format
|
||||
export namespace SaveResultsAsCsvRequest {
|
||||
export const type = new RequestType<data.SaveResultsRequestParams, data.SaveResultRequestResult, void, void>('query/saveCsv');
|
||||
}
|
||||
// --------------------------------- </ Save Results as CSV Request > ------------------------------------------
|
||||
|
||||
// --------------------------------- < Save Results as JSON Request > ------------------------------------------
|
||||
// save results in json format
|
||||
export namespace SaveResultsAsJsonRequest {
|
||||
export const type = new RequestType<data.SaveResultsRequestParams, data.SaveResultRequestResult, void, void>('query/saveJson');
|
||||
}
|
||||
// --------------------------------- </ Save Results as JSON Request > ------------------------------------------
|
||||
|
||||
// --------------------------------- < Save Results as Excel Request > ------------------------------------------
|
||||
// save results in Excel format
|
||||
export namespace SaveResultsAsExcelRequest {
|
||||
export const type = new RequestType<data.SaveResultsRequestParams, data.SaveResultRequestResult, void, void>('query/saveExcel');
|
||||
}
|
||||
// --------------------------------- </ Save Results as Excel Request > ------------------------------------------
|
||||
|
||||
// ------------------------------- < Execute and Return > -----------------------------------
|
||||
|
||||
export namespace SimpleExecuteRequest {
|
||||
export const type = new RequestType<data.SimpleExecuteParams, data.SimpleExecuteResult, void, void>('query/simpleexecute');
|
||||
}
|
||||
|
||||
// ------------------------------- < Execute String > ------------------------------------
|
||||
export interface QueryExecuteStringParams {
|
||||
query: string;
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
export namespace QueryExecuteStringRequest {
|
||||
export const type = new RequestType<QueryExecuteStringParams, QueryExecuteResult, void, void>('query/executeString');
|
||||
}
|
||||
|
||||
// ------------------------------- < Metadata Events > ------------------------------------
|
||||
|
||||
export namespace MetadataQueryRequest {
|
||||
export const type = new RequestType<types.MetadataQueryParams, types.MetadataQueryResult, void, void>('metadata/list');
|
||||
}
|
||||
|
||||
// ------------------------------- < Scripting Events > ------------------------------------
|
||||
|
||||
export namespace ScriptingRequest {
|
||||
export const type = new RequestType<types.ScriptingParams, data.ScriptingResult, void, void>('scripting/script');
|
||||
}
|
||||
|
||||
// ------------------------------- < Scripting Complete Event > ------------------------------------
|
||||
|
||||
export namespace ScriptingCompleteNotification {
|
||||
export const type = new NotificationType<types.ScriptingCompleteParams, void>('scripting/scriptComplete');
|
||||
}
|
||||
|
||||
|
||||
// Edit Data ======================================================================================
|
||||
// Shared Interfaces --------------------------------------------------------------------------
|
||||
export interface EditSessionOperationParams {
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
export interface EditRowOperationParams extends EditSessionOperationParams {
|
||||
rowId: number;
|
||||
}
|
||||
|
||||
export interface EditCellResult {
|
||||
cell: data.EditCell;
|
||||
isRowDirty: boolean;
|
||||
}
|
||||
|
||||
// edit/commit --------------------------------------------------------------------------------
|
||||
export namespace EditCommitRequest {
|
||||
export const type = new RequestType<data.EditCommitParams, EditCommitResult, void, void>('edit/commit');
|
||||
}
|
||||
|
||||
export interface EditCommitResult { }
|
||||
|
||||
// edit/createRow -----------------------------------------------------------------------------
|
||||
export namespace EditCreateRowRequest {
|
||||
export const type = new RequestType<data.EditCreateRowParams, data.EditCreateRowResult, void, void>('edit/createRow');
|
||||
}
|
||||
|
||||
// edit/deleteRow -----------------------------------------------------------------------------
|
||||
export namespace EditDeleteRowRequest {
|
||||
export const type = new RequestType<data.EditDeleteRowParams, EditDeleteRowResult, void, void>('edit/deleteRow');
|
||||
}
|
||||
|
||||
export interface EditDeleteRowResult { }
|
||||
|
||||
// edit/dispose -------------------------------------------------------------------------------
|
||||
export namespace EditDisposeRequest {
|
||||
export const type = new RequestType<data.EditDisposeParams, EditDisposeResult, void, void>('edit/dispose');
|
||||
}
|
||||
|
||||
export interface EditDisposeResult { }
|
||||
|
||||
// edit/initialize ----------------------------------------------------------------------------
|
||||
export namespace EditInitializeRequest {
|
||||
export const type = new RequestType<data.EditInitializeParams, EditInitializeResult, void, void>('edit/initialize');
|
||||
}
|
||||
|
||||
export interface EditInitializeResult { }
|
||||
|
||||
// edit/revertCell --------------------------------------------------------------------------------
|
||||
export namespace EditRevertCellRequest {
|
||||
export const type = new RequestType<data.EditRevertCellParams, data.EditRevertCellResult, void, void>('edit/revertCell');
|
||||
}
|
||||
|
||||
// edit/revertRow -----------------------------------------------------------------------------
|
||||
export namespace EditRevertRowRequest {
|
||||
export const type = new RequestType<data.EditRevertRowParams, EditRevertRowResult, void, void>('edit/revertRow');
|
||||
}
|
||||
|
||||
export interface EditRevertRowResult { }
|
||||
|
||||
// edit/sessionReady Event --------------------------------------------------------------------
|
||||
export namespace EditSessionReadyNotification {
|
||||
export const type = new NotificationType<data.EditSessionReadyParams, void>('edit/sessionReady');
|
||||
}
|
||||
|
||||
// edit/updateCell ----------------------------------------------------------------------------
|
||||
export namespace EditUpdateCellRequest {
|
||||
export const type = new RequestType<data.EditUpdateCellParams, data.EditUpdateCellResult, void, void>('edit/updateCell');
|
||||
}
|
||||
|
||||
// edit/subset ------------------------------------------------------------------------------------
|
||||
export namespace EditSubsetRequest {
|
||||
export const type = new RequestType<data.EditSubsetParams, data.EditSubsetResult, void, void>('edit/subset');
|
||||
}
|
||||
|
||||
// ------------------------------- < Object Explorer Events > ------------------------------------
|
||||
|
||||
export namespace ObjectExplorerCreateSessionRequest {
|
||||
export const type = new RequestType<types.ConnectionDetails, types.CreateSessionResponse, void, void>('objectexplorer/createsession');
|
||||
}
|
||||
|
||||
export namespace ObjectExplorerExpandRequest {
|
||||
export const type = new RequestType<types.ExpandParams, boolean, void, void>('objectexplorer/expand');
|
||||
}
|
||||
|
||||
export namespace ObjectExplorerRefreshRequest {
|
||||
export const type = new RequestType<types.ExpandParams, boolean, void, void>('objectexplorer/refresh');
|
||||
}
|
||||
|
||||
export namespace ObjectExplorerCloseSessionRequest {
|
||||
export const type = new RequestType<types.CloseSessionParams, types.CloseSessionResponse, void, void>('objectexplorer/closesession');
|
||||
}
|
||||
|
||||
// ------------------------------- < Object Explorer Events > ------------------------------------
|
||||
|
||||
|
||||
export namespace ObjectExplorerCreateSessionCompleteNotification {
|
||||
export const type = new NotificationType<types.SessionCreatedParameters, void>('objectexplorer/sessioncreated');
|
||||
}
|
||||
|
||||
export namespace ObjectExplorerExpandCompleteNotification {
|
||||
export const type = new NotificationType<types.ExpandResponse, void>('objectexplorer/expandCompleted');
|
||||
}
|
||||
|
||||
// ------------------------------- < Task Service Events > ------------------------------------
|
||||
|
||||
export namespace ListTasksRequest {
|
||||
export const type = new RequestType<data.ListTasksParams, data.ListTasksResponse, void, void>('tasks/listtasks');
|
||||
}
|
||||
|
||||
export namespace CancelTaskRequest {
|
||||
export const type = new RequestType<data.CancelTaskParams, boolean, void, void>('tasks/canceltask');
|
||||
}
|
||||
|
||||
// ------------------------------- < Task Service Events > ------------------------------------
|
||||
|
||||
|
||||
export namespace TaskStatusChangedNotification {
|
||||
export const type = new NotificationType<data.TaskProgressInfo, void>('tasks/statuschanged');
|
||||
}
|
||||
|
||||
export namespace TaskCreatedNotification {
|
||||
export const type = new NotificationType<data.TaskInfo, void>('tasks/newtaskcreated');
|
||||
}
|
||||
|
||||
// ------------------------------- < Admin Service Events > ------------------------------------
|
||||
|
||||
export namespace CreateDatabaseRequest {
|
||||
export const type = new RequestType<types.CreateDatabaseParams, data.CreateDatabaseResponse, void, void>('admin/createdatabase');
|
||||
}
|
||||
|
||||
export namespace DefaultDatabaseInfoRequest {
|
||||
export const type = new RequestType<types.DefaultDatabaseInfoParams, types.DefaultDatabaseInfoResponse, void, void>('admin/defaultdatabaseinfo');
|
||||
}
|
||||
|
||||
export namespace CreateLoginRequest {
|
||||
export const type = new RequestType<types.CreateLoginParams, data.CreateLoginResponse, void, void>('admin/createlogin');
|
||||
}
|
||||
|
||||
export namespace GetDatabaseInfoRequest {
|
||||
export const type = new RequestType<types.GetDatabaseInfoParams, types.GetDatabaseInfoResponse, void, void>('admin/getdatabaseinfo');
|
||||
}
|
||||
|
||||
// ------------------------------- < Disaster Recovery Events > ------------------------------------
|
||||
|
||||
export namespace BackupRequest {
|
||||
export const type = new RequestType<types.BackupParams, data.BackupResponse, void, void>('backup/backup');
|
||||
}
|
||||
|
||||
export namespace BackupConfigInfoRequest {
|
||||
export const type = new RequestType<types.DefaultDatabaseInfoParams, types.BackupConfigInfoResponse, void, void>('backup/backupconfiginfo');
|
||||
}
|
||||
|
||||
export namespace RestoreRequest {
|
||||
export const type = new RequestType<types.RestoreParams, data.RestoreResponse, void, void>('restore/restore');
|
||||
}
|
||||
|
||||
export namespace RestorePlanRequest {
|
||||
export const type = new RequestType<types.RestoreParams, data.RestorePlanResponse, void, void>('restore/restoreplan');
|
||||
}
|
||||
|
||||
export namespace CancelRestorePlanRequest {
|
||||
export const type = new RequestType<types.RestoreParams, boolean, void, void>('restore/cancelrestoreplan');
|
||||
}
|
||||
|
||||
export namespace RestoreConfigInfoRequest {
|
||||
export const type = new RequestType<types.RestoreConfigInfoRequestParams, types.RestoreConfigInfoResponse, void, void>('restore/restoreconfiginfo');
|
||||
}
|
||||
|
||||
// ------------------------------- < File Browser Events > ------------------------------------
|
||||
|
||||
export namespace FileBrowserOpenRequest {
|
||||
export const type = new RequestType<types.FileBrowserOpenParams, boolean, void, void>('filebrowser/open');
|
||||
}
|
||||
|
||||
export namespace FileBrowserOpenedNotification {
|
||||
export const type = new NotificationType<data.FileBrowserOpenedParams, void>('filebrowser/opencomplete');
|
||||
}
|
||||
|
||||
export namespace FileBrowserExpandRequest {
|
||||
export const type = new RequestType<types.FileBrowserExpandParams, boolean, void, void>('filebrowser/expand');
|
||||
}
|
||||
|
||||
export namespace FileBrowserExpandedNotification {
|
||||
export const type = new NotificationType<data.FileBrowserExpandedParams, void>('filebrowser/expandcomplete');
|
||||
}
|
||||
|
||||
export namespace FileBrowserValidateRequest {
|
||||
export const type = new RequestType<types.FileBrowserValidateParams, boolean, void, void>('filebrowser/validate');
|
||||
}
|
||||
|
||||
export namespace FileBrowserValidatedNotification {
|
||||
export const type = new NotificationType<data.FileBrowserValidatedParams, void>('filebrowser/validatecomplete');
|
||||
}
|
||||
|
||||
export namespace FileBrowserCloseRequest {
|
||||
export const type = new RequestType<types.FileBrowserCloseParams, data.FileBrowserCloseResponse, void, void>('filebrowser/close');
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------- < Profiler Events > ------------------------------------
|
||||
|
||||
export namespace StartProfilingRequest {
|
||||
export const type = new RequestType<types.StartProfilingParams, types.StartProfilingResponse, void, void>('profiler/start');
|
||||
}
|
||||
|
||||
export namespace StopProfilingRequest {
|
||||
export const type = new RequestType<types.StopProfilingParams, types.StopProfilingResponse, void, void>('profiler/stop');
|
||||
}
|
||||
|
||||
export namespace ProfilerEventsAvailableNotification {
|
||||
export const type = new NotificationType<types.ProfilerEventsAvailableParams, void>('profiler/eventsavailable');
|
||||
}
|
||||
50
dataprotocol-client/src/protocolConverter.ts
Normal file
50
dataprotocol-client/src/protocolConverter.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import * as data from 'data';
|
||||
import * as types from './types';
|
||||
|
||||
export interface Ip2c {
|
||||
asProviderMetadata(params: types.MetadataQueryResult): data.ProviderMetadata;
|
||||
}
|
||||
|
||||
function asProviderMetadata(params: types.MetadataQueryResult): data.ProviderMetadata {
|
||||
let objectMetadata: data.ObjectMetadata[] = [];
|
||||
|
||||
if (!params.metadata || !params.metadata.length) {
|
||||
return {
|
||||
objectMetadata
|
||||
};
|
||||
}
|
||||
|
||||
for (let i = 0; i < params.metadata.length; ++i) {
|
||||
let metadata: data.ObjectMetadata = params.metadata[i];
|
||||
|
||||
let metadataTypeName: string;
|
||||
if (metadata.metadataTypeName) {
|
||||
// Read from the provider since it's defined
|
||||
metadataTypeName = metadata.metadataTypeName;
|
||||
} else if (metadata.metadataType === types.MetadataType.View) {
|
||||
metadataTypeName = 'View';
|
||||
} else if (metadata.metadataType === types.MetadataType.SProc) {
|
||||
metadataTypeName = 'StoredProcedure';
|
||||
} else if (metadata.metadataType === types.MetadataType.Function) {
|
||||
metadataTypeName = 'Function';
|
||||
} else {
|
||||
metadataTypeName = 'Table';
|
||||
}
|
||||
|
||||
objectMetadata.push({
|
||||
metadataTypeName,
|
||||
metadataType: metadata.metadataType,
|
||||
name: metadata.name,
|
||||
schema: metadata.schema,
|
||||
urn: metadata.urn
|
||||
});
|
||||
}
|
||||
|
||||
return <data.ProviderMetadata>{
|
||||
objectMetadata
|
||||
};
|
||||
}
|
||||
|
||||
export const p2c: Ip2c = {
|
||||
asProviderMetadata
|
||||
};
|
||||
12
dataprotocol-client/src/tsconfig.json
Normal file
12
dataprotocol-client/src/tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"sourceMap": false,
|
||||
"inlineSources": false,
|
||||
"declaration": true,
|
||||
"stripInternal": true,
|
||||
"outDir": "../lib"
|
||||
}
|
||||
}
|
||||
928
dataprotocol-client/src/types.ts
Normal file
928
dataprotocol-client/src/types.ts
Normal file
@@ -0,0 +1,928 @@
|
||||
import * as data from 'data';
|
||||
|
||||
export interface CreateSessionResponse {
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface SessionCreatedParameters {
|
||||
success: boolean;
|
||||
sessionId: string;
|
||||
rootNode: NodeInfo;
|
||||
errorMessage: string;
|
||||
}
|
||||
|
||||
export interface ExpandResponse {
|
||||
nodePath: string;
|
||||
sessionId: string;
|
||||
nodes: NodeInfo[];
|
||||
errorMessage: string;
|
||||
}
|
||||
|
||||
export interface NodeInfo {
|
||||
nodePath: string;
|
||||
nodeType: string;
|
||||
nodeSubType: string;
|
||||
nodeStatus: string;
|
||||
label: string;
|
||||
isLeaf: boolean;
|
||||
metadata: data.ObjectMetadata;
|
||||
errorMessage: string;
|
||||
}
|
||||
|
||||
export interface ExpandParams {
|
||||
sessionId: string;
|
||||
nodePath: string;
|
||||
}
|
||||
|
||||
export interface CloseSessionParams {
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface CloseSessionResponse {
|
||||
success: boolean;
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface CategoryValue {
|
||||
displayName: string;
|
||||
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface ServiceOption {
|
||||
name: string;
|
||||
|
||||
displayName: string;
|
||||
|
||||
description: string;
|
||||
|
||||
groupName: string;
|
||||
|
||||
valueType: string;
|
||||
|
||||
defaultValue: string;
|
||||
|
||||
objectType: string;
|
||||
|
||||
categoryValues: CategoryValue[];
|
||||
|
||||
isRequired: boolean;
|
||||
|
||||
isArray: boolean;
|
||||
}
|
||||
|
||||
export interface ConnectionOption {
|
||||
name: string;
|
||||
|
||||
displayName: string;
|
||||
|
||||
description: string;
|
||||
|
||||
groupName: string;
|
||||
|
||||
valueType: string;
|
||||
|
||||
defaultValue: string;
|
||||
|
||||
objectType: string;
|
||||
|
||||
categoryValues: CategoryValue[];
|
||||
|
||||
specialValueType: string;
|
||||
|
||||
isIdentity: boolean;
|
||||
|
||||
isRequired: boolean;
|
||||
|
||||
isArray: boolean;
|
||||
}
|
||||
|
||||
export interface ConnectionProviderOptions {
|
||||
options: ConnectionOption[];
|
||||
}
|
||||
|
||||
export interface AdminServicesProviderOptions {
|
||||
databaseInfoOptions: ServiceOption[];
|
||||
|
||||
databaseFileInfoOptions: ServiceOption[];
|
||||
|
||||
fileGroupInfoOptions: ServiceOption[];
|
||||
}
|
||||
|
||||
export interface FeatureMetadataProvider {
|
||||
enabled: boolean;
|
||||
featureName: string;
|
||||
optionsMetadata: ServiceOption[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters to initialize a connection to a database
|
||||
*/
|
||||
export interface ConnectionDetails {
|
||||
|
||||
/**
|
||||
* connection options
|
||||
*/
|
||||
options: {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary that identifies a unique database connection.
|
||||
*/
|
||||
export class ConnectionSummary {
|
||||
/**
|
||||
* server name
|
||||
*/
|
||||
public serverName: string;
|
||||
|
||||
/**
|
||||
* database name
|
||||
*/
|
||||
public databaseName: string;
|
||||
|
||||
/**
|
||||
* user name
|
||||
*/
|
||||
public userName: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connection response format.
|
||||
*/
|
||||
export class ConnectionCompleteParams {
|
||||
/**
|
||||
* URI identifying the owner of the connection
|
||||
*/
|
||||
public ownerUri: string;
|
||||
|
||||
/**
|
||||
* connection id returned from service host.
|
||||
*/
|
||||
public connectionId: string;
|
||||
|
||||
/**
|
||||
* any diagnostic messages return from the service host.
|
||||
*/
|
||||
public messages: string;
|
||||
|
||||
/**
|
||||
* Error message returned from the engine, if any.
|
||||
*/
|
||||
public errorMessage: string;
|
||||
|
||||
/**
|
||||
* Error number returned from the engine, if any.
|
||||
*/
|
||||
public errorNumber: number;
|
||||
|
||||
/**
|
||||
* Information about the connected server.
|
||||
*/
|
||||
public serverInfo: ServerInfo;
|
||||
|
||||
/**
|
||||
* information about the actual connection established
|
||||
*/
|
||||
public connectionSummary: ConnectionSummary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update event parameters
|
||||
*/
|
||||
export class IntelliSenseReadyParams {
|
||||
/**
|
||||
* URI identifying the text document
|
||||
*/
|
||||
public ownerUri: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about a SQL Server instance.
|
||||
*/
|
||||
export class ServerInfo {
|
||||
/**
|
||||
* The major version of the SQL Server instance.
|
||||
*/
|
||||
public serverMajorVersion: number;
|
||||
|
||||
/**
|
||||
* The minor version of the SQL Server instance.
|
||||
*/
|
||||
public serverMinorVersion: number;
|
||||
|
||||
/**
|
||||
* The build of the SQL Server instance.
|
||||
*/
|
||||
public serverReleaseVersion: number;
|
||||
|
||||
/**
|
||||
* The ID of the engine edition of the SQL Server instance.
|
||||
*/
|
||||
public engineEditionId: number;
|
||||
|
||||
/**
|
||||
* String containing the full server version text.
|
||||
*/
|
||||
public serverVersion: string;
|
||||
|
||||
/**
|
||||
* String describing the product level of the server.
|
||||
*/
|
||||
public serverLevel: string;
|
||||
|
||||
/**
|
||||
* The edition of the SQL Server instance.
|
||||
*/
|
||||
public serverEdition: string;
|
||||
|
||||
/**
|
||||
* Whether the SQL Server instance is running in the cloud (Azure) or not.
|
||||
*/
|
||||
public isCloud: boolean;
|
||||
|
||||
/**
|
||||
* The version of Azure that the SQL Server instance is running on, if applicable.
|
||||
*/
|
||||
public azureVersion: number;
|
||||
|
||||
/**
|
||||
* The Operating System version string of the machine running the SQL Server instance.
|
||||
*/
|
||||
public osVersion: string;
|
||||
}
|
||||
|
||||
export class CapabiltiesDiscoveryResult {
|
||||
public capabilities: data.DataProtocolServerCapabilities;
|
||||
}
|
||||
|
||||
// Task Services types
|
||||
|
||||
export enum TaskStatus {
|
||||
notStarted = 0,
|
||||
inProgress = 1,
|
||||
succeeded = 2,
|
||||
succeededWithWarning = 3,
|
||||
failed = 4,
|
||||
canceled = 5
|
||||
}
|
||||
|
||||
// Admin Services types
|
||||
|
||||
export interface CreateDatabaseParams {
|
||||
ownerUri: string;
|
||||
|
||||
databaseInfo: data.DatabaseInfo;
|
||||
}
|
||||
|
||||
export interface DefaultDatabaseInfoParams {
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
export interface DefaultDatabaseInfoResponse {
|
||||
defaultDatabaseInfo: data.DatabaseInfo;
|
||||
}
|
||||
|
||||
export interface GetDatabaseInfoResponse {
|
||||
databaseInfo: data.DatabaseInfo;
|
||||
}
|
||||
|
||||
export interface GetDatabaseInfoParams {
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
export interface BackupConfigInfoResponse {
|
||||
backupConfigInfo: data.BackupConfigInfo;
|
||||
}
|
||||
|
||||
export interface CreateLoginParams {
|
||||
ownerUri: string;
|
||||
|
||||
loginInfo: data.LoginInfo;
|
||||
}
|
||||
|
||||
// Disaster Recovery types
|
||||
|
||||
export interface BackupInfo {
|
||||
ownerUri: string;
|
||||
|
||||
databaseName: string;
|
||||
|
||||
backupType: number;
|
||||
|
||||
backupComponent: number;
|
||||
|
||||
backupDeviceType: number;
|
||||
|
||||
selectedFiles: string;
|
||||
|
||||
backupsetName: string;
|
||||
|
||||
selectedFileGroup: { [path: string]: string };
|
||||
|
||||
// List of {key: backup path, value: device type}
|
||||
backupPathDevices: { [path: string]: number };
|
||||
|
||||
backupPathList: [string];
|
||||
|
||||
isCopyOnly: boolean;
|
||||
|
||||
formatMedia: boolean;
|
||||
|
||||
initialize: boolean;
|
||||
|
||||
skipTapeHeader: boolean;
|
||||
|
||||
mediaName: string;
|
||||
|
||||
mediaDescription: string;
|
||||
|
||||
checksum: boolean;
|
||||
|
||||
continueAfterError: boolean;
|
||||
|
||||
logTruncation: boolean;
|
||||
|
||||
tailLogBackup: boolean;
|
||||
|
||||
retainDays: number;
|
||||
|
||||
compressionOption: number;
|
||||
|
||||
verifyBackupRequired: boolean;
|
||||
|
||||
encryptionAlgorithm: number;
|
||||
|
||||
encryptorType: number;
|
||||
|
||||
encryptorName: string;
|
||||
}
|
||||
|
||||
export interface BackupParams {
|
||||
ownerUri: string;
|
||||
|
||||
backupInfo: BackupInfo;
|
||||
|
||||
taskExecutionMode: data.TaskExecutionMode;
|
||||
}
|
||||
|
||||
export interface RestoreParams {
|
||||
ownerUri: string;
|
||||
options: {};
|
||||
taskExecutionMode: data.TaskExecutionMode;
|
||||
}
|
||||
|
||||
export interface RestoreConfigInfoRequestParams {
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
export interface RestoreConfigInfoResponse {
|
||||
configInfo: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface RestoreDatabaseFileInfo {
|
||||
fileType: string;
|
||||
|
||||
logicalFileName: string;
|
||||
|
||||
originalFileName: string;
|
||||
|
||||
restoreAsFileName: string;
|
||||
}
|
||||
|
||||
export interface FileBrowserOpenParams {
|
||||
ownerUri: string;
|
||||
expandPath: string;
|
||||
fileFilters: string[];
|
||||
changeFilter: boolean;
|
||||
}
|
||||
|
||||
export interface FileTreeNode {
|
||||
children: FileTreeNode[];
|
||||
isExpanded: boolean;
|
||||
isFile: boolean;
|
||||
name: string;
|
||||
fullPath: string;
|
||||
}
|
||||
|
||||
export interface FileTree {
|
||||
rootNode: FileTreeNode;
|
||||
selectedNode: FileTreeNode;
|
||||
}
|
||||
|
||||
export interface FileBrowserExpandParams {
|
||||
ownerUri: string;
|
||||
expandPath: string;
|
||||
}
|
||||
|
||||
export interface FileBrowserValidateParams {
|
||||
ownerUri: string;
|
||||
serviceType: string;
|
||||
selectedFiles: string[];
|
||||
}
|
||||
|
||||
export interface FileBrowserCloseParams {
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
export interface DatabaseFileInfo {
|
||||
properties: LocalizedPropertyInfo[];
|
||||
id: string;
|
||||
isSelected: boolean;
|
||||
}
|
||||
|
||||
export interface LocalizedPropertyInfo {
|
||||
propertyName: string;
|
||||
propertyValue: string;
|
||||
propertyDisplayName: string;
|
||||
propertyValueDisplayName: string;
|
||||
}
|
||||
|
||||
export interface RestorePlanDetailInfo {
|
||||
name: string;
|
||||
currentValue: any;
|
||||
isReadOnly: boolean;
|
||||
isVisible: boolean;
|
||||
defaultValue: any;
|
||||
|
||||
}
|
||||
|
||||
// Query Execution types
|
||||
export interface ResultSetSummary {
|
||||
id: number;
|
||||
batchId: number;
|
||||
rowCount: number;
|
||||
columnInfo: IDbColumn[];
|
||||
}
|
||||
|
||||
export interface BatchSummary {
|
||||
hasError: boolean;
|
||||
id: number;
|
||||
selection: data.ISelectionData;
|
||||
resultSetSummaries: ResultSetSummary[];
|
||||
executionElapsed: string;
|
||||
executionEnd: string;
|
||||
executionStart: string;
|
||||
}
|
||||
|
||||
export interface IDbColumn {
|
||||
allowDBNull?: boolean;
|
||||
baseCatalogName: string;
|
||||
baseColumnName: string;
|
||||
baseSchemaName: string;
|
||||
baseServerName: string;
|
||||
baseTableName: string;
|
||||
columnName: string;
|
||||
columnOrdinal?: number;
|
||||
columnSize?: number;
|
||||
isAliased?: boolean;
|
||||
isAutoIncrement?: boolean;
|
||||
isExpression?: boolean;
|
||||
isHidden?: boolean;
|
||||
isIdentity?: boolean;
|
||||
isKey?: boolean;
|
||||
isBytes?: boolean;
|
||||
isChars?: boolean;
|
||||
isSqlVariant?: boolean;
|
||||
isUdt?: boolean;
|
||||
dataType: string;
|
||||
isXml?: boolean;
|
||||
isJson?: boolean;
|
||||
isLong?: boolean;
|
||||
isReadOnly?: boolean;
|
||||
isUnique?: boolean;
|
||||
numericPrecision?: number;
|
||||
numericScale?: number;
|
||||
udtAssemblyQualifiedName: string;
|
||||
dataTypeName: string;
|
||||
}
|
||||
|
||||
export interface IGridResultSet {
|
||||
columns: IDbColumn[];
|
||||
rowsUri: string;
|
||||
numberOfRows: number;
|
||||
}
|
||||
|
||||
export interface IResultMessage {
|
||||
batchId?: number;
|
||||
isError: boolean;
|
||||
time: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export enum EditRowState {
|
||||
clean = 0,
|
||||
dirtyInsert = 1,
|
||||
dirtyDelete = 2,
|
||||
dirtyUpdate = 3
|
||||
}
|
||||
|
||||
export interface EditRow {
|
||||
cells: data.DbCellValue[];
|
||||
id: number;
|
||||
isDirty: boolean;
|
||||
state: EditRowState;
|
||||
}
|
||||
|
||||
export class MetadataQueryParams {
|
||||
/**
|
||||
* Owner URI of the connection that changed.
|
||||
*/
|
||||
public ownerUri: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used as value version of data.MetadataType THESE SHOULD MIRROR
|
||||
*/
|
||||
export enum MetadataType {
|
||||
Table = 0,
|
||||
View = 1,
|
||||
SProc = 2,
|
||||
Function = 3
|
||||
}
|
||||
|
||||
export class MetadataQueryResult {
|
||||
public metadata: data.ObjectMetadata[];
|
||||
}
|
||||
|
||||
export interface ScriptOptions {
|
||||
/**
|
||||
* Generate ANSI padding statements
|
||||
*/
|
||||
scriptANSIPadding?: boolean;
|
||||
|
||||
/**
|
||||
* Append the generated script to a file
|
||||
*/
|
||||
appendToFile?: boolean;
|
||||
|
||||
/**
|
||||
* Continue to script if an error occurs. Otherwise, stop.
|
||||
*/
|
||||
continueScriptingOnError?: boolean;
|
||||
|
||||
/**
|
||||
* Convert user-defined data types to base types.
|
||||
*/
|
||||
convertUDDTToBaseType?: boolean;
|
||||
|
||||
/**
|
||||
* Generate script for dependent objects for each object scripted.
|
||||
*/
|
||||
generateScriptForDependentObjects?: boolean;
|
||||
|
||||
/**
|
||||
* Include descriptive headers for each object generated.
|
||||
*/
|
||||
includeDescriptiveHeaders?: boolean;
|
||||
|
||||
/**
|
||||
* Check that an object with the given name exists before dropping or altering or that an object with the given name does not exist before creating.
|
||||
*/
|
||||
includeIfNotExists?: boolean;
|
||||
|
||||
/**
|
||||
* Script options to set vardecimal storage format.
|
||||
*/
|
||||
includeVarDecimal?: boolean;
|
||||
|
||||
/**
|
||||
* Include system generated constraint names to enforce declarative referential integrity.
|
||||
*/
|
||||
scriptDRIIncludeSystemNames?: boolean;
|
||||
|
||||
/**
|
||||
* Include statements in the script that are not supported on the specified SQL Server database engine type.
|
||||
*/
|
||||
includeUnsupportedStatements?: boolean;
|
||||
|
||||
/**
|
||||
* Prefix object names with the object schema.
|
||||
*/
|
||||
schemaQualify?: boolean;
|
||||
|
||||
/**
|
||||
* Script options to set bindings option.
|
||||
*/
|
||||
bindings?: boolean;
|
||||
|
||||
/**
|
||||
* Script the objects that use collation.
|
||||
*/
|
||||
collation?: boolean;
|
||||
|
||||
/**
|
||||
* Script the default values.
|
||||
*/
|
||||
default?: boolean;
|
||||
|
||||
/**
|
||||
* Script Object CREATE/DROP statements.
|
||||
*/
|
||||
scriptCreateDrop: string;
|
||||
|
||||
/**
|
||||
* Script the Extended Properties for each object scripted.
|
||||
*/
|
||||
scriptExtendedProperties?: boolean;
|
||||
|
||||
/**
|
||||
* Script only features compatible with the specified version of SQL Server.
|
||||
*/
|
||||
scriptCompatibilityOption: string;
|
||||
|
||||
/**
|
||||
* Script only features compatible with the specified SQL Server database engine type.
|
||||
*/
|
||||
targetDatabaseEngineType: string;
|
||||
|
||||
/**
|
||||
* Script only features compatible with the specified SQL Server database engine edition.
|
||||
*/
|
||||
targetDatabaseEngineEdition: string;
|
||||
|
||||
/**
|
||||
* Script all logins available on the server. Passwords will not be scripted.
|
||||
*/
|
||||
scriptLogins?: boolean;
|
||||
|
||||
/**
|
||||
* Generate object-level permissions.
|
||||
*/
|
||||
scriptObjectLevelPermissions?: boolean;
|
||||
|
||||
/**
|
||||
* Script owner for the objects.
|
||||
*/
|
||||
scriptOwner?: boolean;
|
||||
|
||||
/**
|
||||
* Script statistics, and optionally include histograms, for each selected table or view.
|
||||
*/
|
||||
scriptStatistics: string;
|
||||
|
||||
/**
|
||||
* Generate USE DATABASE statement.
|
||||
*/
|
||||
scripUseDatabase?: boolean;
|
||||
|
||||
/**
|
||||
* Generate script that contains schema only or schema and data.
|
||||
*/
|
||||
typeOfDataToScript: string;
|
||||
|
||||
/**
|
||||
* Scripts the change tracking information.
|
||||
*/
|
||||
scriptChangeTracking?: boolean;
|
||||
|
||||
/**
|
||||
* Script the check constraints for each table or view scripted.
|
||||
*/
|
||||
scriptCheckConstraints?: boolean;
|
||||
|
||||
/**
|
||||
* Scripts the data compression information.
|
||||
*/
|
||||
scriptDataCompressionOptions?: boolean;
|
||||
|
||||
/**
|
||||
* Script the foreign keys for each table scripted.
|
||||
*/
|
||||
scriptForeignKeys?: boolean;
|
||||
|
||||
/**
|
||||
* Script the full-text indexes for each table or indexed view scripted.
|
||||
*/
|
||||
scriptFullTextIndexes?: boolean;
|
||||
|
||||
/**
|
||||
* Script the indexes (including XML and clustered indexes) for each table or indexed view scripted.
|
||||
*/
|
||||
scriptIndexes?: boolean;
|
||||
|
||||
/**
|
||||
* Script the primary keys for each table or view scripted
|
||||
*/
|
||||
scriptPrimaryKeys?: boolean;
|
||||
|
||||
/**
|
||||
* Script the triggers for each table or view scripted
|
||||
*/
|
||||
scriptTriggers?: boolean;
|
||||
|
||||
/**
|
||||
* Script the unique keys for each table or view scripted.
|
||||
*/
|
||||
uniqueKeys?: boolean;
|
||||
}
|
||||
|
||||
export interface ScriptingObject {
|
||||
/**
|
||||
* The database object type
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The schema of the database object
|
||||
*/
|
||||
schema: string;
|
||||
|
||||
/**
|
||||
* The database object name
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface ScriptingParams {
|
||||
/**
|
||||
* File path used when writing out the script.
|
||||
*/
|
||||
filePath: string;
|
||||
|
||||
/**
|
||||
* Whether scripting to a single file or file per object.
|
||||
*/
|
||||
scriptDestination: string;
|
||||
|
||||
/**
|
||||
* Connection string of the target database the scripting operation will run against.
|
||||
*/
|
||||
connectionString: string;
|
||||
|
||||
/**
|
||||
* A list of scripting objects to script
|
||||
*/
|
||||
scriptingObjects: ScriptingObject[];
|
||||
|
||||
/**
|
||||
* A list of scripting object which specify the include criteria of objects to script.
|
||||
*/
|
||||
includeObjectCriteria: ScriptingObject[];
|
||||
|
||||
/**
|
||||
* A list of scripting object which specify the exclude criteria of objects to not script.
|
||||
*/
|
||||
excludeObjectCriteria: ScriptingObject[];
|
||||
|
||||
/**
|
||||
* A list of schema name of objects to script.
|
||||
*/
|
||||
includeSchemas: string[];
|
||||
|
||||
/**
|
||||
* A list of schema name of objects to not script.
|
||||
*/
|
||||
excludeSchemas: string[];
|
||||
|
||||
/**
|
||||
* A list of type name of objects to script.
|
||||
*/
|
||||
includeTypes: string[];
|
||||
|
||||
/**
|
||||
* A list of type name of objects to not script.
|
||||
*/
|
||||
excludeTypes: string[];
|
||||
|
||||
/**
|
||||
* Scripting options for the ScriptingParams
|
||||
*/
|
||||
scriptOptions: ScriptOptions;
|
||||
|
||||
/**
|
||||
* Connection details for the ScriptingParams
|
||||
*/
|
||||
connectionDetails: ConnectionDetails;
|
||||
|
||||
/**
|
||||
* Owner URI of the connection
|
||||
*/
|
||||
ownerURI: string;
|
||||
|
||||
/**
|
||||
* Whether the scripting operation is for
|
||||
* select script statements
|
||||
*/
|
||||
selectScript: boolean;
|
||||
|
||||
/**
|
||||
* Operation associated with the script request
|
||||
*/
|
||||
operation: data.ScriptOperation;
|
||||
}
|
||||
|
||||
export interface ScriptingCompleteParams {
|
||||
/**
|
||||
* The error details for an error that occurred during the scripting operation.
|
||||
*/
|
||||
errorDetails: string;
|
||||
|
||||
/**
|
||||
* The error message for an error that occurred during the scripting operation.
|
||||
*/
|
||||
errorMessage: string;
|
||||
|
||||
/**
|
||||
* A value to indicate an error occurred during the scripting operation.
|
||||
*/
|
||||
hasError: boolean;
|
||||
|
||||
/**
|
||||
* A value to indicate the scripting operation was canceled.
|
||||
*/
|
||||
canceled: boolean;
|
||||
|
||||
/**
|
||||
* A value to indicate the scripting operation successfully completed.
|
||||
*/
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
export class TableMetadata {
|
||||
|
||||
columns: data.ColumnMetadata[];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters to start a profiler session
|
||||
*/
|
||||
export interface StartProfilingParams {
|
||||
/**
|
||||
* Session Owner URI
|
||||
*/
|
||||
ownerUri: string;
|
||||
|
||||
/**
|
||||
* Session options
|
||||
*/
|
||||
options: {};
|
||||
}
|
||||
|
||||
export interface StartProfilingResponse {
|
||||
succeeded: string;
|
||||
errorMessage: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters to start a profiler session
|
||||
*/
|
||||
export interface StopProfilingParams {
|
||||
/**
|
||||
* Session Owner URI
|
||||
*/
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
export interface StopProfilingResponse {
|
||||
succeeded: string;
|
||||
errorMessage: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Profiler Event
|
||||
*/
|
||||
export interface ProfilerEvent {
|
||||
/**
|
||||
* Event class name
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Event timestamp
|
||||
*/
|
||||
timestamp: string;
|
||||
|
||||
/**
|
||||
* Event values
|
||||
*/
|
||||
values: {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Profiler events available notification parameters
|
||||
*/
|
||||
export interface ProfilerEventsAvailableParams {
|
||||
/**
|
||||
* Session owner URI
|
||||
*/
|
||||
ownerUri: string;
|
||||
|
||||
/**
|
||||
* New profiler events available
|
||||
*/
|
||||
events: ProfilerEvent[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Used as value version of data.ScriptOperation THESE SHOULD BE THE SAME
|
||||
*/
|
||||
export enum ScriptOperation {
|
||||
Select = 0,
|
||||
Create = 1,
|
||||
Insert = 2,
|
||||
Update = 3,
|
||||
Delete = 4,
|
||||
Execute = 5,
|
||||
Alter = 6
|
||||
}
|
||||
2
dataprotocol-client/src/typings/ref.d.ts
vendored
Normal file
2
dataprotocol-client/src/typings/ref.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
/// <reference path='../../../src/sql/data.d.ts'/>
|
||||
Reference in New Issue
Block a user