remove api used only by us (#5588)

* remove api used only by us

* fix the exthost crash issue
This commit is contained in:
Alan Ren
2019-05-23 22:02:28 -07:00
committed by GitHub
parent fb97bf6041
commit 2e8d62d0ca
5 changed files with 5 additions and 1295 deletions

View File

@@ -53,7 +53,7 @@
}
},
"dependencies": {
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#0.2.15",
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#0.3.0",
"htmlparser2": "^3.10.1",
"service-downloader": "github:anthonydresser/service-downloader#0.1.5",
"vscode-extension-telemetry": "0.0.18",
@@ -65,4 +65,4 @@
"publisherDisplayName": "Microsoft",
"publisherId": "Microsoft"
}
}
}

View File

@@ -75,9 +75,9 @@ core-util-is@~1.0.0:
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#0.2.15":
version "0.2.15"
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/a2cd2db109de882f0959f7b6421c86afa585f460"
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#0.3.0":
version "0.3.0"
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/21487d15a5f753ba885ce1e489abc0af03487544"
dependencies:
vscode-languageclient "3.5.1"

243
src/sql/sqlops.d.ts vendored
View File

@@ -13,10 +13,6 @@ declare module 'sqlops' {
export namespace dataprotocol {
export function registerConnectionProvider(provider: ConnectionProvider): vscode.Disposable;
export function registerBackupProvider(provider: BackupProvider): vscode.Disposable;
export function registerRestoreProvider(provider: RestoreProvider): vscode.Disposable;
export function registerScriptingProvider(provider: ScriptingProvider): vscode.Disposable;
export function registerObjectExplorerProvider(provider: ObjectExplorerProvider): vscode.Disposable;
@@ -27,8 +23,6 @@ declare module 'sqlops' {
export function registerFileBrowserProvider(provider: FileBrowserProvider): vscode.Disposable;
export function registerProfilerProvider(provider: ProfilerProvider): vscode.Disposable;
export function registerMetadataProvider(provider: MetadataProvider): vscode.Disposable;
export function registerQueryProvider(provider: QueryProvider): vscode.Disposable;
@@ -37,9 +31,6 @@ declare module 'sqlops' {
export function registerCapabilitiesServiceProvider(provider: CapabilitiesProvider): vscode.Disposable;
export function registerDacFxServicesProvider(provider: DacFxServicesProvider): vscode.Disposable;
/**
* An [event](#Event) which fires when the specific flavor of a language used in DMP
* connections has changed. And example is for a SQL connection, the flavor changes
@@ -1261,71 +1252,6 @@ declare module 'sqlops' {
errorMessage: string;
}
// DacFx interfaces -----------------------------------------------------------------------
export interface DacFxResult extends ResultStatus {
operationId: string;
}
export interface GenerateDeployPlanResult extends DacFxResult {
report: string;
}
export interface ExportParams {
databaseName: string;
packageFilePath: string;
ownerUri: string;
taskExecutionMode: TaskExecutionMode;
}
export interface ImportParams {
packageFilePath: string;
databaseName: string;
ownerUri: string;
taskExecutionMode: TaskExecutionMode;
}
export interface ExtractParams {
databaseName: string;
packageFilePath: string;
applicationName: string;
applicationVersion: string;
ownerUri: string;
taskExecutionMode: TaskExecutionMode;
}
export interface DeployParams {
packageFilePath: string;
databaseName: string;
upgradeExisting: boolean;
ownerUri: string;
taskExecutionMode: TaskExecutionMode;
}
export interface GenerateDeployScriptParams {
packageFilePath: string;
databaseName: string;
scriptFilePath: string;
ownerUri: string;
taskExecutionMode: TaskExecutionMode;
}
export interface GenerateDeployPlan {
packageFilePath: string;
databaseName: string;
ownerUri: string;
taskExecutionMode: TaskExecutionMode;
}
export interface DacFxServicesProvider extends DataProvider {
exportBacpac(databaseName: string, packageFilePath: string, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable<DacFxResult>;
importBacpac(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable<DacFxResult>;
extractDacpac(databaseName: string, packageFilePath: string, applicationName: string, applicationVersion: string, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable<DacFxResult>;
deployDacpac(packageFilePath: string, databaseName: string, upgradeExisting: boolean, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable<DacFxResult>;
generateDeployScript(packageFilePath: string, databaseName: string, scriptFilePath: string, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable<DacFxResult>;
generateDeployPlan(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable<GenerateDeployPlanResult>;
}
// Security service interfaces ------------------------------------------------------------------------
export interface CredentialInfo {
id: number;
@@ -1399,175 +1325,6 @@ declare module 'sqlops' {
registerOnTaskStatusChanged(handler: (response: TaskProgressInfo) => any): void;
}
// Disaster Recovery interfaces -----------------------------------------------------------------------
export interface BackupConfigInfo {
recoveryModel: string;
defaultBackupFolder: string;
backupEncryptors: {};
}
export interface BackupResponse {
result: boolean;
taskId: number;
}
export interface BackupProvider extends DataProvider {
backup(connectionUri: string, backupInfo: { [key: string]: any }, taskExecutionMode: TaskExecutionMode): Thenable<BackupResponse>;
getBackupConfigInfo(connectionUri: string): Thenable<BackupConfigInfo>;
}
export interface RestoreProvider extends DataProvider {
getRestorePlan(connectionUri: string, restoreInfo: RestoreInfo): Thenable<RestorePlanResponse>;
cancelRestorePlan(connectionUri: string, restoreInfo: RestoreInfo): Thenable<boolean>;
restore(connectionUri: string, restoreInfo: RestoreInfo): Thenable<RestoreResponse>;
getRestoreConfigInfo(connectionUri: string): Thenable<RestoreConfigInfo>;
}
export interface RestoreInfo {
options: { [key: string]: any };
taskExecutionMode: TaskExecutionMode;
}
export interface RestoreDatabaseFileInfo {
fileType: string;
logicalFileName: string;
originalFileName: string;
restoreAsFileName: 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;
}
export interface RestorePlanResponse {
sessionId: string;
backupSetsToRestore: DatabaseFileInfo[];
canRestore: boolean;
errorMessage: string;
dbFiles: RestoreDatabaseFileInfo[];
databaseNamesFromBackupSets: string[];
planDetails: { [key: string]: RestorePlanDetailInfo };
}
export interface RestoreConfigInfo {
configInfo: { [key: string]: any };
}
export interface RestoreResponse {
result: boolean;
taskId: string;
errorMessage: string;
}
export interface ProfilerProvider extends DataProvider {
createSession(sessionId: string, sessionName: string, template: ProfilerSessionTemplate): Thenable<boolean>;
startSession(sessionId: string, sessionName: string): Thenable<boolean>;
stopSession(sessionId: string): Thenable<boolean>;
pauseSession(sessionId: string): Thenable<boolean>;
getXEventSessions(sessionId: string): Thenable<string[]>;
connectSession(sessionId: string): Thenable<boolean>;
disconnectSession(sessionId: string): Thenable<boolean>;
registerOnSessionEventsAvailable(handler: (response: ProfilerSessionEvents) => any): void;
registerOnSessionStopped(handler: (response: ProfilerSessionStoppedParams) => any): void;
registerOnProfilerSessionCreated(handler: (response: ProfilerSessionCreatedParams) => any): void;
}
export interface IProfilerTableRow {
/**
* Name of the event; known issue this is not camel case, need to figure
* out a better way to determine column id's from rendered column names
*/
EventClass: string;
}
export interface IProfilerMoreRowsNotificationParams {
uri: string;
rowCount: number;
data: IProfilerTableRow;
}
/**
* Profiler Event
*/
export interface ProfilerEvent {
/**
* Event class name
*/
name: string;
/**
* Event timestamp
*/
timestamp: string;
/**
* Event values
*/
values: {};
}
/**
* Profiler Session Template
*/
export interface ProfilerSessionTemplate {
/**
* Template name
*/
name: string;
/**
* Default view for template
*/
defaultView: string;
/**
* TSQL for creating a session
*/
createStatement: string;
}
export interface ProfilerSessionEvents {
sessionId: string;
events: ProfilerEvent[];
eventsLost: boolean;
}
export interface ProfilerSessionStoppedParams {
ownerUri: string;
sessionId: number;
}
export interface ProfilerSessionCreatedParams {
ownerUri: string;
sessionName: string;
templateName: string;
}
// File browser interfaces -----------------------------------------------------------------------

View File

@@ -1744,993 +1744,4 @@ declare module 'sqlops' {
*/
export function connect(connectionProfile: IConnectionProfile, saveConnection?: boolean, showDashboard?: boolean): Thenable<ConnectionResult>;
}
export namespace nb {
/**
* All notebook documents currently known to the system.
*
*/
export let notebookDocuments: NotebookDocument[];
/**
* The currently active Notebook editor or `undefined`. The active editor is the one
* that currently has focus or, when none has focus, the one that has changed
* input most recently.
*/
export let activeNotebookEditor: NotebookEditor | undefined;
/**
* The currently visible editors or an empty array.
*/
export let visibleNotebookEditors: NotebookEditor[];
/**
* An event that is emitted when a [notebook document](#NotebookDocument) is opened.
*
* To add an event listener when a visible text document is opened, use the [TextEditor](#TextEditor) events in the
* [window](#window) namespace. Note that:
*
* - The event is emitted before the [document](#NotebookDocument) is updated in the
* [active notebook editor](#nb.activeNotebookEditor)
* - When a [notebook document](#NotebookDocument) is already open (e.g.: open in another visible notebook editor) this event is not emitted
*
*/
export const onDidOpenNotebookDocument: vscode.Event<NotebookDocument>;
/**
* An event that is emitted when a [notebook's](#NotebookDocument) cell contents are changed.
*/
export const onDidChangeNotebookCell: vscode.Event<NotebookCellChangeEvent>;
/**
* Show the given document in a notebook editor. A [column](#ViewColumn) can be provided
* to control where the editor is being shown. Might change the [active editor](#nb.activeNotebookEditor).
*
* The document is denoted by an [uri](#Uri). Depending on the [scheme](#Uri.scheme) the
* following rules apply:
* `file`-scheme: Open a file on disk, will be rejected if the file does not exist or cannot be loaded.
* `untitled`-scheme: A new file that should be saved on disk, e.g. `untitled:c:\frodo\new.js`. The language
* will be derived from the file name.
* For all other schemes the registered notebook providers are consulted.
*
* @param document A document to be shown.
* @param column A view column in which the [editor](#NotebookEditor) should be shown. The default is the [active](#ViewColumn.Active), other values
* are adjusted to be `Min(column, columnCount + 1)`, the [active](#ViewColumn.Active)-column is not adjusted. Use [`ViewColumn.Beside`](#ViewColumn.Beside)
* to open the editor to the side of the currently active one.
* @param preserveFocus When `true` the editor will not take focus.
* @return A promise that resolves to a [notebook editor](#NotebookEditor).
*/
export function showNotebookDocument(uri: vscode.Uri, showOptions?: NotebookShowOptions): Thenable<NotebookEditor>;
export interface NotebookDocument {
/**
* The associated uri for this notebook document.
*
* *Note* that most documents use the `file`-scheme, which means they are files on disk. However, **not** all documents are
* saved on disk and therefore the `scheme` must be checked before trying to access the underlying file or siblings on disk.
*
*/
readonly uri: vscode.Uri;
/**
* The file system path of the associated resource. Shorthand
* notation for [TextDocument.uri.fsPath](#TextDocument.uri). Independent of the uri scheme.
*/
readonly fileName: string;
/**
* Is this document representing an untitled file which has never been saved yet. *Note* that
* this does not mean the document will be saved to disk, use [`uri.scheme`](#Uri.scheme)
* to figure out where a document will be [saved](#FileSystemProvider), e.g. `file`, `ftp` etc.
*/
readonly isUntitled: boolean;
/**
* The identifier of the Notebook provider associated with this document.
*/
readonly providerId: string;
/**
* `true` if there are unpersisted changes.
*/
readonly isDirty: boolean;
/**
* `true` if the document have been closed. A closed document isn't synchronized anymore
* and won't be re-used when the same resource is opened again.
*/
readonly isClosed: boolean;
/**
* All cells.
*/
readonly cells: NotebookCell[];
/**
* The spec for current kernel, if applicable. This will be undefined
* until a kernel has been started
*/
readonly kernelSpec: IKernelSpec;
/**
* Save the underlying file.
*
* @return A promise that will resolve to true when the file
* has been saved. If the file was not dirty or the save failed,
* will return false.
*/
save(): Thenable<boolean>;
/**
* Ensure a cell range is completely contained in this document.
*
* @param range A cell range.
* @return The given range or a new, adjusted range.
*/
validateCellRange(range: CellRange): CellRange;
}
/**
* A cell range represents an ordered pair of two positions in a list of cells.
* It is guaranteed that [start](#CellRange.start).isBeforeOrEqual([end](#CellRange.end))
*
* CellRange objects are __immutable__.
*/
export class CellRange {
/**
* The start index. It is before or equal to [end](#CellRange.end).
*/
readonly start: number;
/**
* The end index. It is after or equal to [start](#CellRange.start).
*/
readonly end: number;
/**
* Create a new range from two positions. If `start` is not
* before or equal to `end`, the values will be swapped.
*
* @param start A number.
* @param end A number.
*/
constructor(start: number, end: number);
}
export interface NotebookEditor {
/**
* The document associated with this editor. The document will be the same for the entire lifetime of this editor.
*/
readonly document: NotebookDocument;
/**
* The column in which this editor shows. Will be `undefined` in case this
* isn't one of the main editors, e.g an embedded editor, or when the editor
* column is larger than three.
*/
viewColumn?: vscode.ViewColumn;
/**
* Perform an edit on the document associated with this notebook editor.
*
* The given callback-function is invoked with an [edit-builder](#NotebookEditorEdit) which must
* be used to make edits. Note that the edit-builder is only valid while the
* callback executes.
*
* @param callback A function which can create edits using an [edit-builder](#NotebookEditorEdit).
* @param options The undo/redo behavior around this edit. By default, undo stops will be created before and after this edit.
* @return A promise that resolves with a value indicating if the edits could be applied.
*/
edit(callback: (editBuilder: NotebookEditorEdit) => void, options?: { undoStopBefore: boolean; undoStopAfter: boolean; }): Thenable<boolean>;
/**
* Kicks off execution of a cell. Thenable will resolve only once the full execution is completed.
*
*
* @param cell An optional cell in this notebook which should be executed. If no cell is defined, it will run the active cell instead
* @return A promise that resolves with a value indicating if the cell was run or not.
*/
runCell(cell?: NotebookCell): Thenable<boolean>;
}
export interface NotebookCell {
contents: ICellContents;
uri?: vscode.Uri;
}
export interface NotebookShowOptions {
/**
* An optional view column in which the [editor](#NotebookEditor) should be shown.
* The default is the [active](#ViewColumn.Active), other values are adjusted to
* be `Min(column, columnCount + 1)`, the [active](#ViewColumn.Active)-column is
* not adjusted. Use [`ViewColumn.Beside`](#ViewColumn.Beside) to open the
* editor to the side of the currently active one.
*/
viewColumn?: vscode.ViewColumn;
/**
* An optional flag that when `true` will stop the [editor](#NotebookEditor) from taking focus.
*/
preserveFocus?: boolean;
/**
* An optional flag that controls if an [editor](#NotebookEditor)-tab will be replaced
* with the next editor or if it will be kept.
*/
preview?: boolean;
/**
* An optional string indicating which notebook provider to initially use
*/
providerId?: string;
/**
* Optional ID indicating the initial connection to use for this editor
*/
connectionId?: string;
/**
* Default kernel for notebook
*/
defaultKernel?: nb.IKernelSpec;
}
/**
* Represents an event describing the change in a [notebook documents's cells](#NotebookDocument.cells).
*/
export interface NotebookCellChangeEvent {
/**
* The [notebook document](#NotebookDocument) for which the selections have changed.
*/
notebook: NotebookDocument;
/**
* The new value for the [notebook documents's cells](#NotebookDocument.cells).
*/
cells: NotebookCell[];
/**
* The [change kind](#TextEditorSelectionChangeKind) which has triggered this
* event. Can be `undefined`.
*/
kind?: vscode.TextEditorSelectionChangeKind;
}
/**
* A complex edit that will be applied in one transaction on a TextEditor.
* This holds a description of the edits and if the edits are valid (i.e. no overlapping regions, document was not changed in the meantime, etc.)
* they can be applied on a [document](#TextDocument) associated with a [text editor](#TextEditor).
*
*/
export interface NotebookEditorEdit {
/**
* Replace a cell range with a new cell.
*
* @param location The range this operation should remove.
* @param value The new cell this operation should insert after removing `location`.
*/
replace(location: number | CellRange, value: ICellContents): void;
/**
* Insert a cell (optionally) at a specific index. Any index outside of the length of the cells
* will result in the cell being added at the end.
*
* @param index The position where the new text should be inserted.
* @param value The new text this operation should insert.
*/
insertCell(value: ICellContents, index?: number): void;
/**
* Delete a certain cell.
*
* @param index The index of the cell to remove.
*/
deleteCell(index: number): void;
}
/**
* Register a notebook provider. The supported file types handled by this
* provider are defined in the `package.json:
* ```json
* {
* "contributes": {
* "notebook.providers": [{
* "provider": "providername",
* "fileExtensions": ["FILEEXT"]
* }]
* }
* }
* ```
* @export
* @param {NotebookProvider} provider
* @returns {vscode.Disposable}
*/
export function registerNotebookProvider(provider: NotebookProvider): vscode.Disposable;
export interface IStandardKernel {
readonly name: string;
readonly displayName: string;
readonly connectionProviderIds: string[];
}
export interface NotebookProvider {
readonly providerId: string;
readonly standardKernels: IStandardKernel[];
getNotebookManager(notebookUri: vscode.Uri): Thenable<NotebookManager>;
handleNotebookClosed(notebookUri: vscode.Uri): void;
}
export interface NotebookManager {
/**
* Manages reading and writing contents to/from files.
* Files may be local or remote, with this manager giving them a chance to convert and migrate
* from specific notebook file types to and from a standard type for this UI
*/
readonly contentManager: ContentManager;
/**
* A SessionManager that handles starting, stopping and handling notifications around sessions.
* Each notebook has 1 session associated with it, and the session is responsible
* for kernel management
*/
readonly sessionManager: SessionManager;
/**
* (Optional) ServerManager to handle server lifetime management operations.
* Depending on the implementation this may not be needed.
*/
readonly serverManager?: ServerManager;
}
/**
* Defines the contracts needed to manage the lifetime of a notebook server.
*/
export interface ServerManager {
/**
* Indicates if the server is started at the current time
*/
readonly isStarted: boolean;
/**
* Event sent when the server has started. This can be used to query
* the manager for server settings
*/
readonly onServerStarted: vscode.Event<void>;
/**
* Starts the server. Some server types may not support or require this.
* Should no-op if server is already started
*/
startServer(): Thenable<void>;
/**
* Stops the server. Some server types may not support or require this
*/
stopServer(): Thenable<void>;
}
//#region Content APIs
/**
* Handles interacting with file and folder contents
*/
export interface ContentManager {
/* Reads contents from a Uri representing a local or remote notebook and returns a
* JSON object containing the cells and metadata about the notebook
*/
getNotebookContents(notebookUri: vscode.Uri): Thenable<INotebookContents>;
/**
* Save a file.
*
* @param notebookUri - The desired file path.
*
* @param notebook - notebook to be saved.
*
* @returns A thenable which resolves with the file content model when the
* file is saved.
*/
save(notebookUri: vscode.Uri, notebook: INotebookContents): Thenable<INotebookContents>;
}
/**
* Interface defining the file format contents of a notebook, usually in a serializable
* format. This interface does not have any methods for manipulating or interacting
* with a notebook object.
*
*/
export interface INotebookContents {
readonly cells: ICellContents[];
readonly metadata: INotebookMetadata;
readonly nbformat: number;
readonly nbformat_minor: number;
}
export interface INotebookMetadata {
kernelspec: IKernelInfo;
language_info?: ILanguageInfo;
}
export interface IKernelInfo {
name: string;
language?: string;
display_name?: string;
}
export interface ILanguageInfo {
name: string;
version: string;
mimetype?: string;
codemirror_mode?: string | ICodeMirrorMode;
}
export interface ICodeMirrorMode {
name: string;
version: string;
}
/**
* Interface defining the file format contents of a notebook cell, usually in a serializable
* format. This interface does not have any methods for manipulating or interacting
* with a cell object.
*
*/
export interface ICellContents {
cell_type: CellType;
source: string | string[];
metadata?: {
language?: string;
};
execution_count?: number;
outputs?: ICellOutput[];
}
export type CellType = 'code' | 'markdown' | 'raw';
export interface ICellOutput {
output_type: OutputTypeName;
}
/**
* An alias for a stream type.
*/
export type StreamType = 'stdout' | 'stderr';
/**
* A multiline string.
*/
export type MultilineString = string | string[];
export interface IStreamResult extends ICellOutput {
output_type: 'stream';
/**
* Stream output field defining the stream name, for example stdout
*/
name: StreamType;
/**
* Stream output field defining the multiline stream text
*/
text: MultilineString;
}
export interface IDisplayResult extends ICellOutput {
/**
* Mime bundle expected to contain mime type -> contents mappings.
* This is dynamic and is controlled by kernels, so cannot be more specific
*/
data: {};
/**
* Optional metadata, also a mime bundle
*/
metadata?: {};
}
export interface IDisplayData extends IDisplayResult {
output_type: 'display_data';
}
export interface IUpdateDisplayData extends IDisplayResult {
output_type: 'update_display_data';
}
export interface IExecuteResult extends IDisplayResult {
/**
* Type of cell output.
*/
output_type: 'execute_result';
/**
* Number of times the cell was executed
*/
execution_count: number;
}
export interface IErrorResult extends ICellOutput {
/**
* Type of cell output.
*/
output_type: 'error';
/**
* Exception name
*/
ename: string;
/**
* Exception value
*/
evalue: string;
/**
* Stacktrace equivalent
*/
traceback?: string[];
}
export type OutputTypeName =
| 'execute_result'
| 'display_data'
| 'stream'
| 'error'
| 'update_display_data';
export type Output = nb.IDisplayData | nb.IUpdateDisplayData | nb.IExecuteResult | nb.IErrorResult | nb.IStreamResult;
//#endregion
//#region Session APIs
export interface SessionManager {
/**
* Indicates whether the manager is ready.
*/
readonly isReady: boolean;
/**
* A Thenable that is fulfilled when the manager is ready.
*/
readonly ready: Thenable<void>;
readonly specs: IAllKernels | undefined;
startNew(options: ISessionOptions): Thenable<ISession>;
shutdown(id: string): Thenable<void>;
}
export interface ISession {
/**
* Is change of kernels supported for this session?
*/
canChangeKernels: boolean;
/*
* Unique id of the session.
*/
readonly id: string;
/**
* The current path associated with the session.
*/
readonly path: string;
/**
* The current name associated with the session.
*/
readonly name: string;
/**
* The type of the session.
*/
readonly type: string;
/**
* The status indicates if the kernel is healthy, dead, starting, etc.
*/
readonly status: KernelStatus;
/**
* The kernel.
*
* #### Notes
* This is a read-only property, and can be altered by [changeKernel].
*/
readonly kernel: IKernel;
/**
* Tracks whether the default kernel failed to load
* This could be for a reason such as the kernel name not being recognized as a valid kernel;
*/
defaultKernelLoaded?: boolean;
changeKernel(kernelInfo: IKernelSpec): Thenable<IKernel>;
configureKernel(kernelInfo: IKernelSpec): Thenable<void>;
configureConnection(connection: IConnectionProfile): Thenable<void>;
}
export interface ISessionOptions {
/**
* The path (not including name) to the session.
*/
path: string;
/**
* The name of the session.
*/
name?: string;
/**
* The type of the session.
*/
type?: string;
/**
* The type of kernel (e.g. python3).
*/
kernelName?: string;
/**
* The id of an existing kernel.
*/
kernelId?: string;
}
export interface IKernel {
readonly id: string;
readonly name: string;
readonly supportsIntellisense: boolean;
/**
* Test whether the kernel is ready.
*/
readonly isReady: boolean;
/**
* A Thenable that is fulfilled when the kernel is ready.
*/
readonly ready: Thenable<void>;
/**
* The cached kernel info.
*
* #### Notes
* This value will be null until the kernel is ready.
*/
readonly info: IInfoReply | null;
/**
* Gets the full specification for this kernel, which can be serialized to
* a noteobok file
*/
getSpec(): Thenable<IKernelSpec>;
/**
* Send an `execute_request` message.
*
* @param content - The content of the request.
*
* @param disposeOnDone - Whether to dispose of the future when done.
*
* @returns A kernel future.
*
* #### Notes
* See [Messaging in
* Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#execute).
*
* This method returns a kernel future, rather than a Thenable, since execution may
* have many response messages (for example, many iopub display messages).
*
* Future `onReply` is called with the `execute_reply` content when the
* shell reply is received and validated.
*
* **See also:** [[IExecuteReply]]
*/
requestExecute(content: IExecuteRequest, disposeOnDone?: boolean): IFuture;
/**
* Send a `complete_request` message.
*
* @param content - The content of the request.
*
* @returns A Thenable that resolves with the response message.
*
* #### Notes
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#completion).
*
* Fulfills with the `complete_reply` content when the shell reply is
* received and validated.
*/
requestComplete(content: ICompleteRequest): Thenable<ICompleteReplyMsg>;
/**
* Interrupt a kernel.
*
* #### Notes
* Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/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.
*/
interrupt(): Thenable<void>;
}
export interface IInfoReply {
protocol_version: string;
implementation: string;
implementation_version: string;
language_info: ILanguageInfo;
banner: string;
help_links: {
text: string;
url: string;
}[];
}
/**
* The contents of a requestExecute message sent to the server.
*/
export interface IExecuteRequest extends IExecuteOptions {
code: string;
}
/**
* The options used to configure an execute request.
*/
export interface IExecuteOptions {
/**
* Whether to execute the code as quietly as possible.
* The default is `false`.
*/
silent?: boolean;
/**
* Whether to store history of the execution.
* The default `true` if silent is False.
* It is forced to `false ` if silent is `true`.
*/
store_history?: boolean;
/**
* A mapping of names to expressions to be evaluated in the
* kernel's interactive namespace.
*/
user_expressions?: {};
/**
* Whether to allow stdin requests.
* The default is `true`.
*/
allow_stdin?: boolean;
/**
* Whether to the abort execution queue on an error.
* The default is `false`.
*/
stop_on_error?: boolean;
}
/**
* The content of a `'complete_request'` message.
*
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#completion).
*
* **See also:** [[ICompleteReply]], [[IKernel.complete]]
*/
export interface ICompleteRequest {
code: string;
cursor_pos: number;
}
export interface ICompletionContent {
matches: string[];
cursor_start: number;
cursor_end: number;
metadata: any;
status: 'ok' | 'error';
}
/**
* A `'complete_reply'` message on the `'stream'` channel.
*
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#completion).
*
* **See also:** [[ICompleteRequest]], [[IKernel.complete]]
*/
export interface ICompleteReplyMsg extends IShellMessage {
content: ICompletionContent;
}
/**
* The valid Kernel status states.
*/
export type KernelStatus =
| 'unknown'
| 'starting'
| 'reconnecting'
| 'idle'
| 'busy'
| 'restarting'
| 'dead'
| 'connected';
/**
* An arguments object for the kernel changed event.
*/
export interface IKernelChangedArgs {
oldValue: IKernel | null;
newValue: IKernel | null;
}
/// -------- JSON objects, and objects primarily intended not to have methods -----------
export interface IAllKernels {
defaultKernel: string;
kernels: IKernelSpec[];
}
export interface IKernelSpec {
name: string;
language?: string;
display_name?: string;
}
export interface MessageHandler<T extends IMessage> {
handle(message: T): void | Thenable<void>;
}
/**
* A Future interface for responses from the kernel.
*
* When a message is sent to a kernel, a Future is created to handle any
* responses that may come from the kernel.
*/
export interface IFuture extends vscode.Disposable {
/**
* The original outgoing message.
*/
readonly msg: IMessage;
/**
* A Thenable that resolves when the future is done.
*
* #### Notes
* The future is done when there are no more responses expected from the
* kernel.
*
* The `done` Thenable resolves to the reply message if there is one,
* otherwise it resolves to `undefined`.
*/
readonly done: Thenable<IShellMessage | undefined>;
/**
* Set the reply handler for the kernel future.
*
* #### Notes
* If the handler returns a Thenable, all kernel message processing pauses
* until the Thenable is resolved. If there is a reply message, the future
* `done` Thenable also resolves to the reply message after this handler has
* been called.
*/
setReplyHandler(handler: MessageHandler<IShellMessage>): void;
/**
* Sets the stdin handler for the kernel future.
*
* #### Notes
* If the handler returns a Thenable, all kernel message processing pauses
* until the Thenable is resolved.
*/
setStdInHandler(handler: MessageHandler<IStdinMessage>): void;
/**
* Sets the iopub handler for the kernel future.
*
* #### Notes
* If the handler returns a Thenable, all kernel message processing pauses
* until the Thenable is resolved.
*/
setIOPubHandler(handler: MessageHandler<IIOPubMessage>): void;
/**
* Register hook for IOPub messages.
*
* @param hook - The callback invoked for an IOPub message.
*
* #### Notes
* The IOPub hook system allows you to preempt the handlers for IOPub
* messages handled by the future.
*
* The most recently registered hook is run first. A hook can return a
* boolean or a Thenable to a boolean, in which case all kernel message
* processing pauses until the Thenable is fulfilled. If a hook return value
* resolves to false, any later hooks will not run and the function will
* return a Thenable resolving to false. If a hook throws an error, the error
* is logged to the console and the next hook is run. If a hook is
* registered during the hook processing, it will not run until the next
* message. If a hook is removed during the hook processing, it will be
* deactivated immediately.
*/
registerMessageHook(
hook: (msg: IIOPubMessage) => boolean | Thenable<boolean>
): void;
/**
* Remove a hook for IOPub messages.
*
* @param hook - The hook to remove.
*
* #### Notes
* If a hook is removed during the hook processing, it will be deactivated immediately.
*/
removeMessageHook(
hook: (msg: IIOPubMessage) => boolean | Thenable<boolean>
): void;
/**
* Send an `input_reply` message.
*/
sendInputReply(content: IInputReply): void;
}
export interface IExecuteReplyMsg extends IShellMessage {
content: IExecuteReply;
}
/**
* The content of an `execute-reply` message.
*
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#execution-results).
*/
export interface IExecuteReply {
status: 'ok' | 'error' | 'abort';
execution_count: number | null;
}
/**
* The valid channel names.
*/
export type Channel = 'shell' | 'iopub' | 'stdin' | 'execute_reply';
/**
* Kernel message header content.
*
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#general-message-format).
*
* **See also:** [[IMessage]]
*/
export interface IHeader {
username: string;
version: string;
session: string;
msg_id: string;
msg_type: string;
}
/**
* A kernel message
*/
export interface IMessage {
type: Channel;
header: IHeader;
parent_header: IHeader | {};
metadata: {};
content: any;
}
/**
* A kernel message on the `'shell'` channel.
*/
export interface IShellMessage extends IMessage {
channel: 'shell';
}
/**
* A kernel message on the `'iopub'` channel.
*/
export interface IIOPubMessage extends IMessage {
channel: 'iopub';
}
/**
* A kernel message on the `'stdin'` channel.
*/
export interface IStdinMessage extends IMessage {
channel: 'stdin';
}
/**
* The content of an `'input_reply'` message.
*/
export interface IInputReply {
value: string;
}
//#endregion
}
}

View File

@@ -730,30 +730,6 @@ export function createApiFactory(
return extHostDataProvider.$registerScriptingProvider(provider);
};
let registerProfilerProvider = (provider: sqlops.ProfilerProvider): vscode.Disposable => {
provider.registerOnSessionEventsAvailable((response: sqlops.ProfilerSessionEvents) => {
extHostDataProvider.$onSessionEventsAvailable(provider.handle, response);
});
provider.registerOnSessionStopped((response: sqlops.ProfilerSessionStoppedParams) => {
extHostDataProvider.$onSessionStopped(provider.handle, response);
});
provider.registerOnProfilerSessionCreated((response: sqlops.ProfilerSessionCreatedParams) => {
extHostDataProvider.$onProfilerSessionCreated(provider.handle, response);
});
return extHostDataProvider.$registerProfilerProvider(provider);
};
let registerBackupProvider = (provider: sqlops.BackupProvider): vscode.Disposable => {
return extHostDataProvider.$registerBackupProvider(provider);
};
let registerRestoreProvider = (provider: sqlops.RestoreProvider): vscode.Disposable => {
return extHostDataProvider.$registerRestoreProvider(provider);
};
let registerMetadataProvider = (provider: sqlops.MetadataProvider): vscode.Disposable => {
return extHostDataProvider.$registerMetadataProvider(provider);
};
@@ -766,27 +742,19 @@ export function createApiFactory(
return extHostDataProvider.$registerAdminServicesProvider(provider);
};
let registerDacFxServicesProvider = (provider: sqlops.DacFxServicesProvider): vscode.Disposable => {
return extHostDataProvider.$registerDacFxServiceProvider(provider);
};
// namespace: dataprotocol
const dataprotocol: typeof sqlops.dataprotocol = {
registerBackupProvider,
registerConnectionProvider,
registerFileBrowserProvider,
registerMetadataProvider,
registerObjectExplorerProvider,
registerObjectExplorerNodeProvider,
registerProfilerProvider,
registerRestoreProvider,
registerScriptingProvider,
registerTaskServicesProvider,
registerQueryProvider,
registerAdminServicesProvider,
registerCapabilitiesServiceProvider,
registerDacFxServicesProvider,
onDidChangeLanguageFlavor(listener: (e: sqlops.DidChangeLanguageFlavorParams) => any, thisArgs?: any, disposables?: extHostTypes.Disposable[]) {
return extHostDataProvider.onDidChangeLanguageFlavor(listener, thisArgs, disposables);
},
@@ -910,31 +878,6 @@ export function createApiFactory(
}
};
const nb = {
get notebookDocuments() {
return extHostNotebookDocumentsAndEditors.getAllDocuments().map(doc => doc.document);
},
get activeNotebookEditor() {
return extHostNotebookDocumentsAndEditors.getActiveEditor();
},
get visibleNotebookEditors() {
return extHostNotebookDocumentsAndEditors.getAllEditors();
},
get onDidOpenNotebookDocument() {
return extHostNotebookDocumentsAndEditors.onDidOpenNotebookDocument;
},
get onDidChangeNotebookCell() {
return extHostNotebookDocumentsAndEditors.onDidChangeNotebookCell;
},
showNotebookDocument(uri: vscode.Uri, showOptions: sqlops.nb.NotebookShowOptions) {
return extHostNotebookDocumentsAndEditors.showNotebookDocument(uri, showOptions);
},
registerNotebookProvider(provider: sqlops.nb.NotebookProvider): vscode.Disposable {
return extHostNotebook.registerNotebookProvider(provider);
},
CellRange: sqlExtHostTypes.CellRange
};
return {
connection,
credentials,
@@ -961,7 +904,6 @@ export function createApiFactory(
Orientation: sqlExtHostTypes.Orientation,
SqlThemeIcon: sqlExtHostTypes.SqlThemeIcon,
TreeComponentItem: sqlExtHostTypes.TreeComponentItem,
nb: nb,
AzureResource: sqlExtHostTypes.AzureResource,
extensions: extensions,
TreeItem: sqlExtHostTypes.TreeItem