Extensions Cleanup (#359)
* clean up extensions * updated copyrights * formatting
0
extensions/account-provider-azure/.gitignore
vendored
Normal file
3
extensions/account-provider-azure/.vscodeignore
Normal file
@@ -0,0 +1,3 @@
|
||||
src/**
|
||||
tsconfig.json
|
||||
npm-shrinkwrap.json
|
||||
348
extensions/account-provider-azure/npm-shrinkwrap.json
generated
Normal file
@@ -0,0 +1,348 @@
|
||||
{
|
||||
"name": "account-provider-azure",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "8.5.1",
|
||||
"from": "@types/node@>=8.0.47 <9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.1.tgz"
|
||||
},
|
||||
"adal-node": {
|
||||
"version": "0.1.25",
|
||||
"from": "adal-node@0.1.25",
|
||||
"resolved": "https://registry.npmjs.org/adal-node/-/adal-node-0.1.25.tgz"
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"from": "ansi-regex@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz"
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "2.2.1",
|
||||
"from": "ansi-styles@>=2.2.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz"
|
||||
},
|
||||
"asn1": {
|
||||
"version": "0.1.11",
|
||||
"from": "asn1@0.1.11",
|
||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz"
|
||||
},
|
||||
"assert-plus": {
|
||||
"version": "0.1.5",
|
||||
"from": "assert-plus@>=0.1.5 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz"
|
||||
},
|
||||
"async": {
|
||||
"version": "2.6.0",
|
||||
"from": "async@>=0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz"
|
||||
},
|
||||
"aws-sign2": {
|
||||
"version": "0.5.0",
|
||||
"from": "aws-sign2@>=0.5.0 <0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz"
|
||||
},
|
||||
"base64url": {
|
||||
"version": "2.0.0",
|
||||
"from": "base64url@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/base64url/-/base64url-2.0.0.tgz"
|
||||
},
|
||||
"bl": {
|
||||
"version": "1.0.3",
|
||||
"from": "bl@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-1.0.3.tgz"
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "2.11.0",
|
||||
"from": "bluebird@>=2.9.30 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz"
|
||||
},
|
||||
"boom": {
|
||||
"version": "2.10.1",
|
||||
"from": "boom@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz"
|
||||
},
|
||||
"buffer-equal-constant-time": {
|
||||
"version": "1.0.1",
|
||||
"from": "buffer-equal-constant-time@1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz"
|
||||
},
|
||||
"caseless": {
|
||||
"version": "0.11.0",
|
||||
"from": "caseless@>=0.11.0 <0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz"
|
||||
},
|
||||
"chalk": {
|
||||
"version": "1.1.3",
|
||||
"from": "chalk@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz"
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.5",
|
||||
"from": "combined-stream@>=1.0.1 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz"
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.12.2",
|
||||
"from": "commander@>=2.8.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz"
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"from": "core-util-is@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
|
||||
},
|
||||
"cryptiles": {
|
||||
"version": "2.0.5",
|
||||
"from": "cryptiles@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz"
|
||||
},
|
||||
"ctype": {
|
||||
"version": "0.5.3",
|
||||
"from": "ctype@0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz"
|
||||
},
|
||||
"date-utils": {
|
||||
"version": "1.2.21",
|
||||
"from": "date-utils@*",
|
||||
"resolved": "https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz"
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"from": "delayed-stream@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
|
||||
},
|
||||
"ecdsa-sig-formatter": {
|
||||
"version": "1.0.9",
|
||||
"from": "ecdsa-sig-formatter@1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.9.tgz"
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"from": "escape-string-regexp@>=1.0.2 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz"
|
||||
},
|
||||
"extend": {
|
||||
"version": "3.0.1",
|
||||
"from": "extend@>=3.0.0 <3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz"
|
||||
},
|
||||
"forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"from": "forever-agent@>=0.6.0 <0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz"
|
||||
},
|
||||
"form-data": {
|
||||
"version": "1.0.1",
|
||||
"from": "form-data@>=1.0.0-rc1 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.1.tgz"
|
||||
},
|
||||
"generate-function": {
|
||||
"version": "2.0.0",
|
||||
"from": "generate-function@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz"
|
||||
},
|
||||
"generate-object-property": {
|
||||
"version": "1.2.0",
|
||||
"from": "generate-object-property@>=1.1.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz"
|
||||
},
|
||||
"har-validator": {
|
||||
"version": "1.8.0",
|
||||
"from": "har-validator@>=1.6.1 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-1.8.0.tgz"
|
||||
},
|
||||
"has-ansi": {
|
||||
"version": "2.0.0",
|
||||
"from": "has-ansi@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz"
|
||||
},
|
||||
"hawk": {
|
||||
"version": "3.1.3",
|
||||
"from": "hawk@>=3.1.0 <3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz"
|
||||
},
|
||||
"hoek": {
|
||||
"version": "2.16.3",
|
||||
"from": "hoek@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz"
|
||||
},
|
||||
"http-signature": {
|
||||
"version": "0.11.0",
|
||||
"from": "http-signature@>=0.11.0 <0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.11.0.tgz"
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"from": "inherits@>=2.0.1 <2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
|
||||
},
|
||||
"is-my-json-valid": {
|
||||
"version": "2.17.1",
|
||||
"from": "is-my-json-valid@>=2.12.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.1.tgz"
|
||||
},
|
||||
"is-property": {
|
||||
"version": "1.0.2",
|
||||
"from": "is-property@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz"
|
||||
},
|
||||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"from": "isarray@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
|
||||
},
|
||||
"isstream": {
|
||||
"version": "0.1.2",
|
||||
"from": "isstream@>=0.1.1 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz"
|
||||
},
|
||||
"json-stringify-safe": {
|
||||
"version": "5.0.1",
|
||||
"from": "json-stringify-safe@>=5.0.0 <5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz"
|
||||
},
|
||||
"jsonpointer": {
|
||||
"version": "4.0.1",
|
||||
"from": "jsonpointer@>=4.0.0 <5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz"
|
||||
},
|
||||
"jwa": {
|
||||
"version": "1.1.5",
|
||||
"from": "jwa@>=1.1.4 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.5.tgz"
|
||||
},
|
||||
"jws": {
|
||||
"version": "3.1.4",
|
||||
"from": "jws@>=3.0.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-3.1.4.tgz"
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.4",
|
||||
"from": "lodash@>=4.14.0 <5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz"
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.30.0",
|
||||
"from": "mime-db@>=1.30.0 <1.31.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz"
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.17",
|
||||
"from": "mime-types@>=2.1.2 <2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz"
|
||||
},
|
||||
"oauth-sign": {
|
||||
"version": "0.8.2",
|
||||
"from": "oauth-sign@>=0.8.0 <0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz"
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "1.0.7",
|
||||
"from": "process-nextick-args@>=1.0.6 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz"
|
||||
},
|
||||
"punycode": {
|
||||
"version": "1.4.1",
|
||||
"from": "punycode@>=1.4.1 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz"
|
||||
},
|
||||
"qs": {
|
||||
"version": "5.1.0",
|
||||
"from": "qs@>=5.1.0 <5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-5.1.0.tgz"
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.0.6",
|
||||
"from": "readable-stream@>=2.0.5 <2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz"
|
||||
},
|
||||
"request": {
|
||||
"version": "2.63.0",
|
||||
"from": "request@2.63.0",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.63.0.tgz",
|
||||
"dependencies": {
|
||||
"node-uuid": {
|
||||
"version": "1.4.8",
|
||||
"from": "node-uuid@>=1.4.0 <1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.1",
|
||||
"from": "safe-buffer@>=5.0.1 <6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz"
|
||||
},
|
||||
"sntp": {
|
||||
"version": "1.0.9",
|
||||
"from": "sntp@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz"
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"from": "string_decoder@>=0.10.0 <0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
|
||||
},
|
||||
"stringstream": {
|
||||
"version": "0.0.5",
|
||||
"from": "stringstream@>=0.0.4 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz"
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"from": "strip-ansi@>=3.0.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz"
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "2.0.0",
|
||||
"from": "supports-color@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz"
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.3.3",
|
||||
"from": "tough-cookie@>=0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz"
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.4.3",
|
||||
"from": "tunnel-agent@>=0.4.0 <0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz"
|
||||
},
|
||||
"underscore": {
|
||||
"version": "1.8.3",
|
||||
"from": "underscore@>=1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz"
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"from": "util-deprecate@>=1.0.1 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.1.0",
|
||||
"from": "uuid@>=3.1.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz"
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "2.0.2",
|
||||
"from": "vscode-nls@2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-2.0.2.tgz"
|
||||
},
|
||||
"xmldom": {
|
||||
"version": "0.1.27",
|
||||
"from": "xmldom@>=0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz"
|
||||
},
|
||||
"xpath.js": {
|
||||
"version": "1.0.7",
|
||||
"from": "xpath.js@>=1.0.5 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.0.7.tgz"
|
||||
},
|
||||
"xtend": {
|
||||
"version": "4.0.1",
|
||||
"from": "xtend@>=4.0.0 <5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
55
extensions/account-provider-azure/package.json
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "account-provider-azure",
|
||||
"version": "0.0.1",
|
||||
"publisher": "Microsoft",
|
||||
"engines": { "vscode": "*" },
|
||||
"main": "./out/main",
|
||||
"activationEvents": [ "*" ],
|
||||
"scripts": {
|
||||
"compile": "gulp compile-extension:account-provider-azure"
|
||||
},
|
||||
"dependencies": {
|
||||
"adal-node": "0.1.25",
|
||||
"request": "2.63.0",
|
||||
"vscode-nls": "2.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^8.0.24"
|
||||
},
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "extension.clearTokenCache",
|
||||
"title": "%extension.clearTokenCache%",
|
||||
"category": "Azure Accounts"
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
"type": "object",
|
||||
"title": "Azure Account Configuration",
|
||||
"properties": {
|
||||
"accounts.azure.enablePublicCloud": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "%config.enablePublicCloudDescription%"
|
||||
}
|
||||
}
|
||||
},
|
||||
"account-type": [
|
||||
{
|
||||
"id": "microsoft",
|
||||
"icon": {
|
||||
"light": "./out/account-provider/media/microsoft_account_light.svg",
|
||||
"dark": "./out/account-provider/media/microsoft_account_dark.svg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "work_school",
|
||||
"icon": {
|
||||
"light": "./out/account-provider/media/work_school_account_light.svg",
|
||||
"dark": "./out/account-provider/media/work_school_account_dark.svg"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
7
extensions/account-provider-azure/package.nls.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extension.clearTokenCache": "Clear Azure Account Token Cache",
|
||||
"config.enablePublicCloudDescription": "Should Azure public cloud integration be enabled",
|
||||
"config.enableUsGovCloudDescription": "Should US Government Azure cloud (Fairfax) integration be enabled",
|
||||
"config.enableChinaCloudDescription": "Should Azure China integration be enabled",
|
||||
"config.enableGermanyCloudDescription": "Should Azure Germany integration be enabled"
|
||||
}
|
||||
@@ -5,16 +5,18 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as constants from '../constants';
|
||||
import * as data from 'data';
|
||||
import * as events from 'events';
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import CredentialServiceTokenCache from './tokenCache';
|
||||
import providerSettings from './providerSettings';
|
||||
import { AzureAccountProvider } from './azureAccountProvider';
|
||||
import { AzureAccountProviderMetadata, ProviderSettings } from './interfaces';
|
||||
import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
let localize = nls.loadMessageBundle();
|
||||
|
||||
export class AzureAccountProviderService implements vscode.Disposable {
|
||||
// CONSTANTS ///////////////////////////////////////////////////////////////
|
||||
@@ -75,14 +77,14 @@ export class AzureAccountProviderService implements vscode.Disposable {
|
||||
|
||||
return Promise.all(promises)
|
||||
.then(
|
||||
() => {
|
||||
let message = localize('clearTokenCacheSuccess', 'Token cache successfully cleared');
|
||||
vscode.window.showInformationMessage(`mssql: ${message}`);
|
||||
},
|
||||
err => {
|
||||
let message = localize('clearTokenCacheFailure', 'Failed to clear token cache');
|
||||
vscode.window.showErrorMessage(`mssql: ${message}: ${err}`);
|
||||
});
|
||||
() => {
|
||||
let message = localize('clearTokenCacheSuccess', 'Token cache successfully cleared');
|
||||
vscode.window.showInformationMessage(`${constants.extensionName}: ${message}`);
|
||||
},
|
||||
err => {
|
||||
let message = localize('clearTokenCacheFailure', 'Failed to clear token cache');
|
||||
vscode.window.showErrorMessage(`${constants.extensionName}: ${message}: ${err}`);
|
||||
});
|
||||
}
|
||||
|
||||
private onDidChangeConfiguration(): void {
|
||||
@@ -97,7 +99,7 @@ export class AzureAccountProviderService implements vscode.Disposable {
|
||||
|
||||
// Determine what providers need to be changed
|
||||
let providerChanges: Thenable<void>[] = [];
|
||||
for(let provider of providerSettings) {
|
||||
for (let provider of providerSettings) {
|
||||
// If the old config doesn't exist, then assume everything was disabled
|
||||
// There will always be a new config value
|
||||
let oldConfigValue = oldConfig
|
||||
@@ -138,7 +140,7 @@ export class AzureAccountProviderService implements vscode.Disposable {
|
||||
self._accountProviders[provider.metadata.id] = accountProvider;
|
||||
self._accountDisposals[provider.metadata.id] = data.accounts.registerAccountProvider(provider.metadata, accountProvider);
|
||||
resolve();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.error(`Failed to register account provider: ${e}`);
|
||||
reject(e);
|
||||
}
|
||||
@@ -154,7 +156,7 @@ export class AzureAccountProviderService implements vscode.Disposable {
|
||||
delete self._accountProviders[provider.metadata.id];
|
||||
delete self._accountDisposals[provider.metadata.id];
|
||||
resolve();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.error(`Failed to unregister account provider: ${e}`);
|
||||
reject(e);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 442 B |
|
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 400 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -32,6 +32,7 @@ const publicAzureSettings: ProviderSettings = {
|
||||
}
|
||||
};
|
||||
|
||||
/* Leaving for reference
|
||||
const usGovAzureSettings: ProviderSettings = {
|
||||
configKey: 'enableUsGovCloud',
|
||||
metadata: {
|
||||
@@ -97,6 +98,7 @@ const germanyAzureSettings: ProviderSettings = {
|
||||
}
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
// TODO: Enable China, Germany, and US Gov clouds: (#3031)
|
||||
export default <ProviderSettings[]>[publicAzureSettings, /*chinaAzureSettings, germanyAzureSettings, usGovAzureSettings*/];
|
||||
@@ -34,8 +34,8 @@ export default class TokenCache implements adal.TokenCache {
|
||||
.then(cache => self.addToCache(cache, entries))
|
||||
.then(updatedCache => self.writeCache(updatedCache))
|
||||
.then(
|
||||
() => callback(null, false),
|
||||
(err) => callback(err, true)
|
||||
() => callback(null, false),
|
||||
(err) => callback(err, true)
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -55,8 +55,8 @@ export default class TokenCache implements adal.TokenCache {
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(() => { return self._credentialProvider.deleteCredential(self._credentialServiceKey); })
|
||||
.then(() => {});
|
||||
.then(() => { return self._credentialProvider.deleteCredential(self._credentialServiceKey); })
|
||||
.then(() => { });
|
||||
}
|
||||
|
||||
public find(query: any, callback: (error: Error, results: any[]) => void): void {
|
||||
@@ -70,8 +70,8 @@ export default class TokenCache implements adal.TokenCache {
|
||||
);
|
||||
})
|
||||
.then(
|
||||
results => callback(null, results),
|
||||
(err) => callback(err, null)
|
||||
results => callback(null, results),
|
||||
(err) => callback(err, null)
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -104,8 +104,8 @@ export default class TokenCache implements adal.TokenCache {
|
||||
.then(cache => self.removeFromCache(cache, entries))
|
||||
.then(updatedCache => self.writeCache(updatedCache))
|
||||
.then(
|
||||
() => callback(null, null),
|
||||
(err) => callback(err, null)
|
||||
() => callback(null, null),
|
||||
(err) => callback(err, null)
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -189,7 +189,7 @@ export default class TokenCache implements adal.TokenCache {
|
||||
key: new Buffer(splitValues[0], 'hex'),
|
||||
initializationVector: new Buffer(splitValues[1], 'hex')
|
||||
};
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
// Swallow the error and fall through to generate new params
|
||||
console.warn('Failed to deserialize encryption params, new ones will be generated.');
|
||||
}
|
||||
@@ -204,7 +204,7 @@ export default class TokenCache implements adal.TokenCache {
|
||||
let serializedValues = `${encryptKey.toString('hex')}|${initializationVector.toString('hex')}`;
|
||||
return self._credentialProvider.saveCredential(self._credentialServiceKey, serializedValues)
|
||||
.then(() => {
|
||||
return <EncryptionParams> {
|
||||
return <EncryptionParams>{
|
||||
key: encryptKey,
|
||||
initializationVector: initializationVector
|
||||
};
|
||||
@@ -237,7 +237,7 @@ export default class TokenCache implements adal.TokenCache {
|
||||
}
|
||||
|
||||
return cacheObj;
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
})
|
||||
12
extensions/account-provider-azure/src/constants.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export const extensionName = localize('extensionName', 'Azure Accounts');
|
||||
35
extensions/account-provider-azure/src/main.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import { Utils } from 'extensions-modules';
|
||||
|
||||
import * as constants from './constants';
|
||||
import { AzureAccountProviderService } from './account-provider/azureAccountProviderService';
|
||||
|
||||
// EXTENSION ACTIVATION ////////////////////////////////////////////////////
|
||||
export function activate(context: vscode.ExtensionContext): void {
|
||||
// Create the folder for storing the token caches
|
||||
let storagePath = path.join(Utils.getDefaultLogLocation(), constants.extensionName);
|
||||
try {
|
||||
if (!fs.existsSync(storagePath)) {
|
||||
fs.mkdirSync(storagePath);
|
||||
console.log('Initialized Azure account extension storage.');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`Initialization of Azure account extension storage failed: ${e}`);
|
||||
console.error('Azure accounts will not be available');
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the provider service and activate
|
||||
const accountProviderService = new AzureAccountProviderService(context, storagePath);
|
||||
context.subscriptions.push(accountProviderService);
|
||||
accountProviderService.activate();
|
||||
}
|
||||
7
extensions/account-provider-azure/src/typings/ref.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path='../../../../src/vs/vscode.d.ts'/>
|
||||
/// <reference path='../../../../src/sql/data.d.ts'/>
|
||||
20
extensions/account-provider-azure/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"outDir": "./out",
|
||||
"lib": [
|
||||
"es6", "es2015.promise"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"exclude": [
|
||||
"./node_modules"
|
||||
]
|
||||
}
|
||||
2
extensions/mssql/.gitignore
vendored
@@ -1 +1 @@
|
||||
sqltoolsservice
|
||||
sqltoolsservice
|
||||
|
||||
4
extensions/mssql/.vscodeignore
Normal file
@@ -0,0 +1,4 @@
|
||||
client/src/**
|
||||
client/tsconfig.json
|
||||
npm-shrinkwrap.json
|
||||
test/**
|
||||
@@ -8,183 +8,158 @@ import vscode = require('vscode');
|
||||
import data = require('data');
|
||||
import { Constants } from '../models/constants';
|
||||
import { Serialization } from '../serialize/serialization';
|
||||
import { AzureResourceProvider } from '../resourceprovider/resourceprovider';
|
||||
import { AzureResourceProvider } from '../resourceProvider/resourceProvider';
|
||||
import { CredentialStore } from '../credentialstore/credentialstore';
|
||||
import {IExtensionConstants, Telemetry, SharedConstants, SqlToolsServiceClient, VscodeWrapper, Utils, PlatformInformation} from 'extensions-modules';
|
||||
import { IExtensionConstants, Telemetry, Constants as SharedConstants, SqlToolsServiceClient, VscodeWrapper, Utils, PlatformInformation } from 'extensions-modules';
|
||||
import { LanguageClient } from 'dataprotocol-client';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
|
||||
import { AzureAccountProviderService } from '../account-provider/azureAccountProviderService';
|
||||
|
||||
/**
|
||||
* The main controller class that initializes the extension
|
||||
*/
|
||||
export default class MainController implements vscode.Disposable {
|
||||
private _context: vscode.ExtensionContext;
|
||||
private _vscodeWrapper: VscodeWrapper;
|
||||
private _initialized: boolean = false;
|
||||
private _serialization: Serialization;
|
||||
private _credentialStore: CredentialStore;
|
||||
private static _extensionConstants: IExtensionConstants = new Constants();
|
||||
private _client: SqlToolsServiceClient;
|
||||
/**
|
||||
* The main controller constructor
|
||||
* @constructor
|
||||
*/
|
||||
constructor(context: vscode.ExtensionContext,
|
||||
vscodeWrapper?: VscodeWrapper) {
|
||||
this._context = context;
|
||||
this._vscodeWrapper = vscodeWrapper || new VscodeWrapper(MainController._extensionConstants);
|
||||
SqlToolsServiceClient.constants = MainController._extensionConstants;
|
||||
this._client = SqlToolsServiceClient.instance;
|
||||
this._credentialStore = new CredentialStore(this._client);
|
||||
this._serialization = new Serialization(this._client);
|
||||
}
|
||||
private _context: vscode.ExtensionContext;
|
||||
private _vscodeWrapper: VscodeWrapper;
|
||||
private _initialized: boolean = false;
|
||||
private _serialization: Serialization;
|
||||
private _credentialStore: CredentialStore;
|
||||
private static _extensionConstants: IExtensionConstants = new Constants();
|
||||
private _client: SqlToolsServiceClient;
|
||||
/**
|
||||
* The main controller constructor
|
||||
* @constructor
|
||||
*/
|
||||
constructor(context: vscode.ExtensionContext,
|
||||
vscodeWrapper?: VscodeWrapper) {
|
||||
this._context = context;
|
||||
this._vscodeWrapper = vscodeWrapper || new VscodeWrapper(MainController._extensionConstants);
|
||||
SqlToolsServiceClient.constants = MainController._extensionConstants;
|
||||
this._client = SqlToolsServiceClient.getInstance(path.join(__dirname, '../config.json'));
|
||||
this._credentialStore = new CredentialStore(this._client);
|
||||
this._serialization = new Serialization(this._client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposes the controller
|
||||
*/
|
||||
dispose(): void {
|
||||
this.deactivate();
|
||||
}
|
||||
/**
|
||||
* Disposes the controller
|
||||
*/
|
||||
dispose(): void {
|
||||
this.deactivate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivates the extension
|
||||
*/
|
||||
public deactivate(): void {
|
||||
Utils.logDebug(SharedConstants.extensionDeactivated, MainController._extensionConstants.extensionConfigSectionName);
|
||||
}
|
||||
/**
|
||||
* Deactivates the extension
|
||||
*/
|
||||
public deactivate(): void {
|
||||
Utils.logDebug(SharedConstants.extensionDeactivated, MainController._extensionConstants.extensionConfigSectionName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the extension
|
||||
*/
|
||||
public activate(): Promise<boolean> {
|
||||
return this.initialize();
|
||||
}
|
||||
/**
|
||||
* Initializes the extension
|
||||
*/
|
||||
public activate(): Promise<boolean> {
|
||||
return this.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a flag indicating if the extension is initialized
|
||||
*/
|
||||
public isInitialized(): boolean {
|
||||
return this._initialized;
|
||||
}
|
||||
/**
|
||||
* Returns a flag indicating if the extension is initialized
|
||||
*/
|
||||
public isInitialized(): boolean {
|
||||
return this._initialized;
|
||||
}
|
||||
|
||||
private createClient( executableFiles: string[]): Promise<LanguageClient> {
|
||||
return PlatformInformation.getCurrent(SqlToolsServiceClient.constants.getRuntimeId, SqlToolsServiceClient.constants.extensionName).then( platformInfo => {
|
||||
return SqlToolsServiceClient.instance.createClient(this._context, platformInfo.runtimeId, undefined, executableFiles);
|
||||
});
|
||||
}
|
||||
private createClient(executableFiles: string[]): Promise<LanguageClient> {
|
||||
return PlatformInformation.getCurrent(SqlToolsServiceClient.constants.getRuntimeId, SqlToolsServiceClient.constants.extensionName).then(platformInfo => {
|
||||
return SqlToolsServiceClient.getInstance(path.join(__dirname, '../config.json')).createClient(this._context, platformInfo.runtimeId, undefined, executableFiles);
|
||||
});
|
||||
}
|
||||
|
||||
private createCredentialClient(): Promise<LanguageClient> {
|
||||
return this.createClient(['MicrosoftSqlToolsCredentials.exe', 'MicrosoftSqlToolsCredentials']);
|
||||
}
|
||||
private createCredentialClient(): Promise<LanguageClient> {
|
||||
return this.createClient(['MicrosoftSqlToolsCredentials.exe', 'MicrosoftSqlToolsCredentials']);
|
||||
}
|
||||
|
||||
private createSerializationClient(): Promise<LanguageClient> {
|
||||
return this.createClient(['MicrosoftSqlToolsSerialization.exe', 'MicrosoftSqlToolsSerialization']);
|
||||
}
|
||||
private createSerializationClient(): Promise<LanguageClient> {
|
||||
return this.createClient(['MicrosoftSqlToolsSerialization.exe', 'MicrosoftSqlToolsSerialization']);
|
||||
}
|
||||
|
||||
private createResourceProviderClient(): Promise<LanguageClient> {
|
||||
return this.createClient(['SqlToolsResourceProviderService.exe', 'SqlToolsResourceProviderService']);
|
||||
}
|
||||
private createResourceProviderClient(): Promise<LanguageClient> {
|
||||
return this.createClient(['SqlToolsResourceProviderService.exe', 'SqlToolsResourceProviderService']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the extension
|
||||
*/
|
||||
public initialize(): Promise<boolean> {
|
||||
const self = this;
|
||||
/**
|
||||
* Initializes the extension
|
||||
*/
|
||||
public initialize(): Promise<boolean> {
|
||||
|
||||
// initialize language service client
|
||||
return new Promise<boolean>( (resolve, reject) => {
|
||||
// initialize language service client
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
const self = this;
|
||||
SqlToolsServiceClient.getInstance(path.join(__dirname, '../config.json')).initialize(self._context).then(serverResult => {
|
||||
|
||||
let constants = new Constants();
|
||||
// Initialize telemetry
|
||||
Telemetry.initialize(self._context, new Constants());
|
||||
|
||||
// Create the folder for storing the token caches
|
||||
let storagePath = path.join(Utils.getDefaultLogLocation(), constants.extensionName);
|
||||
try {
|
||||
if (!fs.existsSync(storagePath)) {
|
||||
fs.mkdirSync(storagePath);
|
||||
console.log('Initialized Azure account extension storage.');
|
||||
}
|
||||
} catch(e) {
|
||||
console.error(`Initialization of Azure account extension storage failed: ${e}`);
|
||||
console.error('Azure accounts will not be available');
|
||||
return;
|
||||
}
|
||||
// telemetry for activation
|
||||
Telemetry.sendTelemetryEvent('ExtensionActivated', {},
|
||||
{ serviceInstalled: serverResult.installedBeforeInitializing ? 1 : 0 }
|
||||
);
|
||||
|
||||
// Create the provider service and activate
|
||||
const accountProviderService = new AzureAccountProviderService(this._context, storagePath);
|
||||
this._context.subscriptions.push(accountProviderService);
|
||||
accountProviderService.activate();
|
||||
self.createSerializationClient().then(serializationClient => {
|
||||
// Serialization
|
||||
let serializationProvider: data.SerializationProvider = {
|
||||
handle: 0,
|
||||
saveAs(saveFormat: string, savePath: string, results: string, appendToFile: boolean): Thenable<data.SaveResultRequestResult> {
|
||||
return self._serialization.saveAs(saveFormat, savePath, results, appendToFile);
|
||||
}
|
||||
};
|
||||
data.serialization.registerProvider(serializationProvider);
|
||||
}, error => {
|
||||
Utils.logDebug('Cannot find Serialization executables. error: ' + error, MainController._extensionConstants.extensionConfigSectionName);
|
||||
});
|
||||
|
||||
const self = this;
|
||||
SqlToolsServiceClient.instance.initialize(self._context).then(serverResult => {
|
||||
self.createResourceProviderClient().then(rpClient => {
|
||||
let resourceProvider = new AzureResourceProvider(self._client, rpClient);
|
||||
data.resources.registerResourceProvider({
|
||||
displayName: 'Azure SQL Resource Provider', // TODO Localize
|
||||
id: 'Microsoft.Azure.SQL.ResourceProvider',
|
||||
settings: {
|
||||
|
||||
// Initialize telemetry
|
||||
Telemetry.initialize(self._context, new Constants());
|
||||
}
|
||||
}, resourceProvider);
|
||||
Utils.logDebug('resourceProvider registered', MainController._extensionConstants.extensionConfigSectionName);
|
||||
}, error => {
|
||||
Utils.logDebug('Cannot find ResourceProvider executables. error: ' + error, MainController._extensionConstants.extensionConfigSectionName);
|
||||
});
|
||||
|
||||
// telemetry for activation
|
||||
Telemetry.sendTelemetryEvent('ExtensionActivated', {},
|
||||
{ serviceInstalled: serverResult.installedBeforeInitializing ? 1 : 0 }
|
||||
);
|
||||
self.createCredentialClient().then(credentialClient => {
|
||||
|
||||
self.createSerializationClient().then(serializationClient => {
|
||||
let serialization = new Serialization(self._client, serializationClient);
|
||||
// Serialization
|
||||
let serializationProvider: data.SerializationProvider = {
|
||||
handle: 0,
|
||||
saveAs(saveFormat: string, savePath: string, results: string, appendToFile: boolean): Thenable<data.SaveResultRequestResult> {
|
||||
return self._serialization.saveAs(saveFormat, savePath, results, appendToFile);
|
||||
}
|
||||
};
|
||||
data.serialization.registerProvider(serializationProvider);
|
||||
}, error => {
|
||||
Utils.logDebug('Cannot find Serialization executables. error: ' + error , MainController._extensionConstants.extensionConfigSectionName);
|
||||
});
|
||||
self._credentialStore.languageClient = credentialClient;
|
||||
let credentialProvider: data.CredentialProvider = {
|
||||
handle: 0,
|
||||
saveCredential(credentialId: string, password: string): Thenable<boolean> {
|
||||
return self._credentialStore.saveCredential(credentialId, password);
|
||||
},
|
||||
readCredential(credentialId: string): Thenable<data.Credential> {
|
||||
return self._credentialStore.readCredential(credentialId);
|
||||
},
|
||||
deleteCredential(credentialId: string): Thenable<boolean> {
|
||||
return self._credentialStore.deleteCredential(credentialId);
|
||||
}
|
||||
};
|
||||
data.credentials.registerProvider(credentialProvider);
|
||||
Utils.logDebug('credentialProvider registered', MainController._extensionConstants.extensionConfigSectionName);
|
||||
}, error => {
|
||||
Utils.logDebug('Cannot find credentials executables. error: ' + error, MainController._extensionConstants.extensionConfigSectionName);
|
||||
});
|
||||
|
||||
self.createResourceProviderClient().then(rpClient => {
|
||||
let resourceProvider = new AzureResourceProvider(self._client, rpClient);
|
||||
data.resources.registerResourceProvider({
|
||||
displayName: 'Azure SQL Resource Provider', // TODO Localize
|
||||
id: 'Microsoft.Azure.SQL.ResourceProvider',
|
||||
settings: {
|
||||
|
||||
}
|
||||
}, resourceProvider);
|
||||
Utils.logDebug('resourceProvider registered', MainController._extensionConstants.extensionConfigSectionName);
|
||||
}, error => {
|
||||
Utils.logDebug('Cannot find ResourceProvider executables. error: ' + error , MainController._extensionConstants.extensionConfigSectionName);
|
||||
});
|
||||
|
||||
self.createCredentialClient().then(credentialClient => {
|
||||
|
||||
self._credentialStore.languageClient = credentialClient;
|
||||
let credentialProvider: data.CredentialProvider = {
|
||||
handle: 0,
|
||||
saveCredential(credentialId: string, password: string): Thenable<boolean> {
|
||||
return self._credentialStore.saveCredential(credentialId, password);
|
||||
},
|
||||
readCredential(credentialId: string): Thenable<data.Credential> {
|
||||
return self._credentialStore.readCredential(credentialId);
|
||||
},
|
||||
deleteCredential(credentialId: string): Thenable<boolean> {
|
||||
return self._credentialStore.deleteCredential(credentialId);
|
||||
}
|
||||
};
|
||||
data.credentials.registerProvider(credentialProvider);
|
||||
Utils.logDebug('credentialProvider registered', MainController._extensionConstants.extensionConfigSectionName);
|
||||
}, error => {
|
||||
Utils.logDebug('Cannot find credentials executables. error: ' + error , MainController._extensionConstants.extensionConfigSectionName);
|
||||
});
|
||||
|
||||
Utils.logDebug(SharedConstants.extensionActivated, MainController._extensionConstants.extensionConfigSectionName);
|
||||
self._initialized = true;
|
||||
resolve(true);
|
||||
}).catch(err => {
|
||||
Telemetry.sendTelemetryEventForException(err, 'initialize', MainController._extensionConstants.extensionConfigSectionName);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
Utils.logDebug(SharedConstants.extensionActivated, MainController._extensionConstants.extensionConfigSectionName);
|
||||
self._initialized = true;
|
||||
resolve(true);
|
||||
}).catch(err => {
|
||||
Telemetry.sendTelemetryEventForException(err, 'initialize', MainController._extensionConstants.extensionConfigSectionName);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as Contracts from '../models/contracts';
|
||||
import { ICredentialStore } from './icredentialstore';
|
||||
import { SqlToolsServiceClient, Utils } from 'extensions-modules';
|
||||
import { LanguageClient } from 'dataprotocol-client';
|
||||
import * as path from 'path';
|
||||
|
||||
/**
|
||||
* Implements a credential storage for Windows, Mac (darwin), or Linux.
|
||||
@@ -16,58 +17,58 @@ import { LanguageClient } from 'dataprotocol-client';
|
||||
*/
|
||||
export class CredentialStore implements ICredentialStore {
|
||||
|
||||
public languageClient: LanguageClient;
|
||||
public languageClient: LanguageClient;
|
||||
|
||||
constructor(private _client?: SqlToolsServiceClient) {
|
||||
if (!this._client) {
|
||||
this._client = SqlToolsServiceClient.instance;
|
||||
}
|
||||
}
|
||||
constructor(private _client?: SqlToolsServiceClient) {
|
||||
if (!this._client) {
|
||||
this._client = SqlToolsServiceClient.getInstance(path.join(__dirname, '../config.json'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a credential saved in the credential store
|
||||
*
|
||||
* @param {string} credentialId the ID uniquely identifying this credential
|
||||
* @returns {Promise<Credential>} Promise that resolved to the credential, or undefined if not found
|
||||
*/
|
||||
public readCredential(credentialId: string): Promise<Contracts.Credential> {
|
||||
Utils.logDebug(this.languageClient, 'MainController._extensionConstants');
|
||||
let self = this;
|
||||
let cred: Contracts.Credential = new Contracts.Credential();
|
||||
cred.credentialId = credentialId;
|
||||
return new Promise<Contracts.Credential>( (resolve, reject) => {
|
||||
self._client
|
||||
.sendRequest(Contracts.ReadCredentialRequest.type, cred, this.languageClient)
|
||||
.then(returnedCred => {
|
||||
resolve(<Contracts.Credential>returnedCred);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Gets a credential saved in the credential store
|
||||
*
|
||||
* @param {string} credentialId the ID uniquely identifying this credential
|
||||
* @returns {Promise<Credential>} Promise that resolved to the credential, or undefined if not found
|
||||
*/
|
||||
public readCredential(credentialId: string): Promise<Contracts.Credential> {
|
||||
Utils.logDebug(this.languageClient, 'MainController._extensionConstants');
|
||||
let self = this;
|
||||
let cred: Contracts.Credential = new Contracts.Credential();
|
||||
cred.credentialId = credentialId;
|
||||
return new Promise<Contracts.Credential>((resolve, reject) => {
|
||||
self._client
|
||||
.sendRequest(Contracts.ReadCredentialRequest.type, cred, this.languageClient)
|
||||
.then(returnedCred => {
|
||||
resolve(<Contracts.Credential>returnedCred);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
|
||||
public saveCredential(credentialId: string, password: any): Promise<boolean> {
|
||||
let self = this;
|
||||
let cred: Contracts.Credential = new Contracts.Credential();
|
||||
cred.credentialId = credentialId;
|
||||
cred.password = password;
|
||||
return new Promise<boolean>( (resolve, reject) => {
|
||||
self._client
|
||||
.sendRequest(Contracts.SaveCredentialRequest.type, cred, this.languageClient)
|
||||
.then(status => {
|
||||
resolve(<boolean>status);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
public saveCredential(credentialId: string, password: any): Promise<boolean> {
|
||||
let self = this;
|
||||
let cred: Contracts.Credential = new Contracts.Credential();
|
||||
cred.credentialId = credentialId;
|
||||
cred.password = password;
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
self._client
|
||||
.sendRequest(Contracts.SaveCredentialRequest.type, cred, this.languageClient)
|
||||
.then(status => {
|
||||
resolve(<boolean>status);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
|
||||
public deleteCredential(credentialId: string): Promise<boolean> {
|
||||
let self = this;
|
||||
let cred: Contracts.Credential = new Contracts.Credential();
|
||||
cred.credentialId = credentialId;
|
||||
return new Promise<boolean>( (resolve, reject) => {
|
||||
self._client
|
||||
.sendRequest(Contracts.DeleteCredentialRequest.type, cred, this.languageClient)
|
||||
.then(status => {
|
||||
resolve(<boolean>status);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
public deleteCredential(credentialId: string): Promise<boolean> {
|
||||
let self = this;
|
||||
let cred: Contracts.Credential = new Contracts.Credential();
|
||||
cred.credentialId = credentialId;
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
self._client
|
||||
.sendRequest(Contracts.DeleteCredentialRequest.type, cred, this.languageClient)
|
||||
.then(status => {
|
||||
resolve(<boolean>status);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import { Credential } from '../models/contracts';
|
||||
* @interface ICredentialStore
|
||||
*/
|
||||
export interface ICredentialStore {
|
||||
readCredential(credentialId: string): Promise<Credential>;
|
||||
saveCredential(credentialId: string, password: any): Promise<boolean>;
|
||||
deleteCredential(credentialId: string): Promise<boolean>;
|
||||
readCredential(credentialId: string): Promise<Credential>;
|
||||
saveCredential(credentialId: string, password: any): Promise<boolean>;
|
||||
deleteCredential(credentialId: string): Promise<boolean>;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import vscode = require('vscode');
|
||||
import MainController from './controllers/mainController';
|
||||
|
||||
let controller: MainController = undefined;
|
||||
export let controller: MainController;
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
controller = new MainController(context);
|
||||
@@ -17,14 +17,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
// this method is called when your extension is deactivated
|
||||
export function deactivate(): void {
|
||||
if (controller) {
|
||||
controller.deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposed for testing purposes
|
||||
*/
|
||||
export function getController(): MainController {
|
||||
return controller;
|
||||
if (controller) {
|
||||
controller.deactivate();
|
||||
}
|
||||
}
|
||||
@@ -3,315 +3,141 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import {IExtensionConstants} from 'extensions-modules/lib/models/contracts/contracts';
|
||||
import {Runtime, LinuxDistribution} from 'extensions-modules/lib/models/platform';
|
||||
import { IExtensionConstants } from 'extensions-modules/lib/models/contracts/contracts';
|
||||
import { Runtime, LinuxDistribution } from 'extensions-modules/lib/models/platform';
|
||||
|
||||
// constants
|
||||
export class Constants implements IExtensionConstants {
|
||||
public readonly languageId = 'sql';
|
||||
public readonly extensionName = 'mssql';
|
||||
public readonly extensionConfigSectionName = 'mssql';
|
||||
public readonly connectionApplicationName = 'vscode-mssql';
|
||||
public readonly outputChannelName = 'MSSQL';
|
||||
public readonly connectionConfigFilename = 'settings.json';
|
||||
public readonly connectionsArrayName = 'mssql.connections';
|
||||
public readonly cmdRunQuery = 'extension.runQuery';
|
||||
public readonly cmdCancelQuery = 'extension.cancelQuery';
|
||||
public readonly cmdConnect = 'extension.connect';
|
||||
public readonly cmdDisconnect = 'extension.disconnect';
|
||||
public readonly cmdChooseDatabase = 'extension.chooseDatabase';
|
||||
public readonly cmdShowReleaseNotes = 'extension.showReleaseNotes';
|
||||
public readonly cmdShowGettingStarted = 'extension.showGettingStarted';
|
||||
public readonly cmdNewQuery = 'extension.newQuery';
|
||||
public readonly cmdManageConnectionProfiles = 'extension.manageProfiles';
|
||||
public readonly sqlDbPrefix = '.database.windows.net';
|
||||
public readonly defaultConnectionTimeout = 15;
|
||||
public readonly azureSqlDbConnectionTimeout = 30;
|
||||
public readonly azureDatabase = 'Azure';
|
||||
public readonly defaultPortNumber = 1433;
|
||||
public readonly sqlAuthentication = 'SqlLogin';
|
||||
public readonly defaultDatabase = 'master';
|
||||
public readonly errorPasswordExpired = 18487;
|
||||
public readonly errorPasswordNeedsReset = 18488;
|
||||
public readonly maxDisplayedStatusTextLength = 50;
|
||||
public readonly outputContentTypeRoot = 'root';
|
||||
public readonly outputContentTypeMessages = 'messages';
|
||||
public readonly outputContentTypeResultsetMeta = 'resultsetsMeta';
|
||||
public readonly outputContentTypeColumns = 'columns';
|
||||
public readonly outputContentTypeRows = 'rows';
|
||||
public readonly outputContentTypeConfig = 'config';
|
||||
public readonly outputContentTypeSaveResults = 'saveResults';
|
||||
public readonly outputContentTypeOpenLink = 'openLink';
|
||||
public readonly outputContentTypeCopy = 'copyResults';
|
||||
public readonly outputContentTypeEditorSelection = 'setEditorSelection';
|
||||
public readonly outputContentTypeShowError = 'showError';
|
||||
public readonly outputContentTypeShowWarning = 'showWarning';
|
||||
public readonly outputServiceLocalhost = 'http://localhost:';
|
||||
public readonly msgContentProviderSqlOutputHtml = 'dist/html/sqlOutput.ejs';
|
||||
public readonly contentProviderMinFile = 'dist/js/app.min.js';
|
||||
public readonly configLogDebugInfo = 'logDebugInfo';
|
||||
public readonly providerId = 'MSSQL';
|
||||
public readonly installFolderName = 'sqltoolsservice';
|
||||
public readonly telemetryExtensionName = 'carbon-mssql';
|
||||
public readonly languageId = 'sql';
|
||||
public readonly extensionName = 'mssql';
|
||||
public readonly extensionConfigSectionName = 'mssql';
|
||||
public readonly outputChannelName = 'MSSQL';
|
||||
public readonly providerId = 'MSSQL';
|
||||
public readonly installFolderName = 'sqltoolsservice';
|
||||
public readonly telemetryExtensionName = 'carbon-mssql';
|
||||
|
||||
// localizable strings
|
||||
public readonly configMyConnectionsNoServerName = 'Missing server name in user preferences connection: ';
|
||||
public readonly msgLocalWebserviceStaticContent = 'LocalWebService: added static html content path: ';
|
||||
public readonly msgLocalWebserviceStarted = 'LocalWebService listening on port ';
|
||||
public readonly msgRunQueryAllBatchesExecuted = 'runQuery: all batches executed';
|
||||
public readonly msgStartedExecute = 'Started query execution for document "{0}"';
|
||||
public readonly msgFinishedExecute = 'Finished query execution for document "{0}"';
|
||||
public readonly msgRunQueryError = 'runQuery: error: ';
|
||||
public readonly msgRunQueryExecutingBatch = 'runQuery: executeBatch called with SQL: ';
|
||||
public readonly msgRunQueryAddBatchResultsets = 'runQuery: adding resultsets for batch: ';
|
||||
public readonly msgRunQueryAddBatchError = 'runQuery: adding error message for batch: ';
|
||||
public readonly msgRunQueryConnectionActive = 'runQuery: active connection is connected, using it to run query';
|
||||
public readonly msgRunQueryConnectionDisconnected = 'runQuery: active connection is disconnected, reconnecting';
|
||||
public readonly msgRunQueryNoConnection = 'runQuery: no active connection - prompting for user';
|
||||
public readonly msgRunQueryInProgress = 'A query is already running for this editor session. Please cancel this query or wait for its completion.';
|
||||
public readonly runQueryBatchStartMessage = 'Started executing query at ';
|
||||
public readonly runQueryBatchStartLine = 'Line {0}';
|
||||
public readonly msgCancelQueryFailed = 'Canceling the query failed: {0}';
|
||||
public readonly msgCancelQueryNotRunning = 'Cannot cancel query as no query is running.';
|
||||
public readonly msgCancelQuerySuccess = 'Successfully canceled the query.';
|
||||
public readonly msgContentProviderOnContentUpdated = 'Content provider: onContentUpdated called';
|
||||
public readonly msgContentProviderAssociationFailure = 'Content provider: Unable to associate status view for current file';
|
||||
public readonly msgContentProviderOnRootEndpoint = 'LocalWebService: Root end-point called';
|
||||
public readonly msgContentProviderOnResultsEndpoint = 'LocalWebService: ResultsetsMeta endpoint called';
|
||||
public readonly msgContentProviderOnMessagesEndpoint = 'LocalWebService: Messages end-point called';
|
||||
public readonly msgContentProviderOnColumnsEndpoint = 'LocalWebService: Columns end-point called for index = ';
|
||||
public readonly msgContentProviderOnRowsEndpoint = 'LocalWebService: Rows end-point called for index = ';
|
||||
public readonly msgContentProviderOnClear = 'Content provider: clear called';
|
||||
public readonly msgContentProviderOnUpdateContent = 'Content provider: updateContent called';
|
||||
public readonly msgContentProviderProvideContent = 'Content provider: provideTextDocumentContent called: ';
|
||||
public readonly msgChooseDatabaseNotConnected = 'No connection was found. Please connect to a server first.';
|
||||
public readonly msgChooseDatabasePlaceholder = 'Choose a database from the list below';
|
||||
public readonly msgConnectionError = 'Error {0}: {1}';
|
||||
public readonly msgConnectionError2 = 'Failed to connect: {0}';
|
||||
public readonly msgConnectionErrorPasswordExpired = 'Error {0}: {1} Please login as a different user and change the password using ALTER LOGIN.';
|
||||
public readonly connectionErrorChannelName = 'Connection Errors';
|
||||
public readonly msgPromptCancelConnect = 'Server connection in progress. Do you want to cancel?';
|
||||
public readonly msgPromptClearRecentConnections = 'Confirm to clear recent connections list';
|
||||
public readonly msgOpenSqlFile = 'To use this command, Open a .sql file -or- ' +
|
||||
'Change editor language to "SQL" -or- ' +
|
||||
'Select T-SQL text in the active SQL editor.';
|
||||
public readonly recentConnectionsPlaceholder = 'Choose a connection profile from the list below';
|
||||
public readonly msgNoConnectionsInSettings = 'To use this command, add connection profile to User Settings.';
|
||||
public readonly labelOpenGlobalSettings = 'Open Global Settings';
|
||||
public readonly labelOpenWorkspaceSettings = 'Open Workspace Settings';
|
||||
public readonly CreateProfileFromConnectionsListLabel = 'Create Connection Profile';
|
||||
public readonly CreateProfileLabel = 'Create';
|
||||
public readonly ClearRecentlyUsedLabel = 'Clear Recent Connections List';
|
||||
public readonly EditProfilesLabel = 'Edit';
|
||||
public readonly RemoveProfileLabel = 'Remove';
|
||||
public readonly ManageProfilesPrompt = 'Manage Connection Profiles';
|
||||
public readonly SampleServerName = '{{put-server-name-here}}';
|
||||
public readonly serverPrompt = 'Server name';
|
||||
public readonly serverPlaceholder = 'hostname\\instance or <server>.database.windows.net';
|
||||
public readonly databasePrompt = 'Database name';
|
||||
public readonly databasePlaceholder = '[Optional] Database to connect (press Enter to connect to <default> database)';
|
||||
public readonly databaseDefaultValue = 'master';
|
||||
public readonly authTypePrompt = 'Authentication Type';
|
||||
public readonly authTypeIntegrated = 'Integrated';
|
||||
public readonly authTypeSql = 'SQL Login';
|
||||
public readonly authTypeAdUniversal = 'Active Directory Universal';
|
||||
public readonly usernamePrompt = 'User name';
|
||||
public readonly usernamePlaceholder = 'User name (SQL Login)';
|
||||
public readonly passwordPrompt = 'Password';
|
||||
public readonly passwordPlaceholder = 'Password (SQL Login)';
|
||||
public readonly msgSavePassword = 'Save Password? If \'No\', password will be required each time you connect';
|
||||
public readonly profileNamePrompt = 'Profile Name';
|
||||
public readonly profileNamePlaceholder = '[Optional] Enter a name for this profile';
|
||||
public readonly filepathPrompt = 'File path';
|
||||
public readonly filepathPlaceholder = 'File name';
|
||||
public readonly filepathMessage = 'File name';
|
||||
public readonly overwritePrompt = 'A file with this name already exists. Do you want to replace the existing file?';
|
||||
public readonly overwritePlaceholder = 'A file with this name already exists';
|
||||
public readonly msgSaveResultInProgress = 'A save request is already executing. Please wait for its completion.';
|
||||
public readonly msgCannotOpenContent = 'Error occurred opening content in editor.';
|
||||
public readonly msgSaveStarted = 'Started saving results to ';
|
||||
public readonly msgSaveFailed = 'Failed to save results. ';
|
||||
public readonly msgSaveSucceeded = 'Successfully saved results to ';
|
||||
public readonly msgSelectProfile = 'Select connection profile';
|
||||
public readonly msgSelectProfileToRemove = 'Select profile to remove';
|
||||
public readonly confirmRemoveProfilePrompt = 'Confirm to remove this profile.';
|
||||
public readonly msgNoProfilesSaved = 'No connection profile to remove.';
|
||||
public readonly msgProfileRemoved = 'Profile removed successfully';
|
||||
public readonly msgProfileCreated = 'Profile created successfully';
|
||||
public readonly msgProfileCreatedAndConnected = 'Profile created and connected';
|
||||
public readonly msgClearedRecentConnections = 'Recent connections list cleared';
|
||||
public readonly msgSelectionIsRequired = 'Selection is required.';
|
||||
public readonly msgIsRequired = ' is required.';
|
||||
public readonly msgRetry = 'Retry';
|
||||
public readonly msgError = 'Error: ';
|
||||
public readonly msgYes = 'Yes';
|
||||
public readonly msgNo = 'No';
|
||||
public readonly defaultDatabaseLabel = '<default>';
|
||||
public readonly notConnectedLabel = 'Disconnected';
|
||||
public readonly notConnectedTooltip = 'Click to connect to a database';
|
||||
public readonly connectingLabel = 'Connecting';
|
||||
public readonly connectingTooltip = 'Connecting to: ';
|
||||
public readonly connectedLabel = 'Connected.';
|
||||
public readonly connectErrorLabel = 'Connection error';
|
||||
public readonly connectErrorTooltip = 'Error connecting to: ';
|
||||
public readonly connectErrorCode = 'Errorcode: ';
|
||||
public readonly connectErrorMessage = 'ErrorMessage: ';
|
||||
public readonly executeQueryLabel = 'Executing query ';
|
||||
public readonly cancelingQueryLabel = 'Canceling query ';
|
||||
public readonly updatingIntelliSenseLabel = 'Updating IntelliSense...';
|
||||
public readonly unfoundResult = 'Data was disposed when text editor was closed; to view data please reexecute query.';
|
||||
public readonly serviceCompatibleVersion = '1.0.0';
|
||||
public readonly serviceNotCompatibleError = 'Client is not compatible with the service layer';
|
||||
public readonly serviceInstallingTo = 'Installing SQL tools service to';
|
||||
public readonly serviceInitializing = 'Initializing SQL tools service for the mssql extension.';
|
||||
public readonly commandsNotAvailableWhileInstallingTheService = 'Note: mssql commands will be available after installing the service.';
|
||||
public readonly serviceInstalled = 'Sql Tools Service installed';
|
||||
public readonly serviceInstallationFailed = 'Failed to install Sql Tools Service';
|
||||
public readonly serviceLoadingFailed = 'Failed to load Sql Tools Service';
|
||||
public readonly invalidServiceFilePath = 'Invalid file path for Sql Tools Service';
|
||||
public readonly extensionNotInitializedError = 'Unable to execute the command while the extension is initializing. Please try again later.';
|
||||
public readonly untitledScheme = 'untitled';
|
||||
public readonly untitledSaveTimeThreshold = 10.0;
|
||||
public readonly renamedOpenTimeThreshold = 10.0;
|
||||
public readonly msgChangeLanguageMode = 'To use this command, you must set the language to \"SQL\". Confirm to change language mode.';
|
||||
public readonly timeToWaitForLanguageModeChange = 10000.0;
|
||||
public readonly msgChangedDatabaseContext = 'Changed database context to \"{0}\" for document \"{1}\"';
|
||||
public readonly msgPromptRetryCreateProfile = 'Error: Unable to connect using the connection information provided. Retry profile creation?';
|
||||
public readonly retryLabel = 'Retry';
|
||||
public readonly msgConnecting = 'Connecting to server \"{0}\" on document \"{1}\".';
|
||||
public readonly msgConnectedServerInfo = 'Connected to server \"{0}\" on document \"{1}\". Server information: {2}';
|
||||
public readonly msgConnectionFailed = 'Error connecting to server \"{0}\". Details: {1}';
|
||||
public readonly msgChangingDatabase = 'Changing database context to \"{0}\" on server \"{1}\" on document \"{2}\".';
|
||||
public readonly msgChangedDatabase = 'Changed database context to \"{0}\" on server \"{1}\" on document \"{2}\".';
|
||||
public readonly msgDisconnected = 'Disconnected on document \"{0}\"';
|
||||
public readonly msgErrorReadingConfigFile = 'Error: Unable to load connection profiles from [{0}]. Check if the file is formatted correctly.';
|
||||
public readonly msgErrorOpeningConfigFile = 'Error: Unable to open connection profile settings file.';
|
||||
public readonly extConfigResultKeys = ['shortcuts', 'messagesDefaultOpen'];
|
||||
public readonly extConfigResultFontFamily = 'resultsFontFamily';
|
||||
public readonly extConfigResultFontSize = 'resultsFontSize';
|
||||
public readonly titleResultsPane = 'Results: {0}';
|
||||
public readonly macOpenSslErrorMessage = `OpenSSL version >=1.0.1 is required to connect.`;
|
||||
public readonly macOpenSslHelpButton = 'Help';
|
||||
public readonly macOpenSslHelpLink = 'https://github.com/Microsoft/vscode-mssql/wiki/OpenSSL-Configuration';
|
||||
public readonly serviceName = 'SQLToolsService';
|
||||
public readonly serviceInitializingOutputChannelName = 'SqlToolsService Initialization';
|
||||
public readonly gettingStartedGuideLink = 'https://aka.ms/mssql-getting-started';
|
||||
public readonly serviceCrashMessage = 'SQL Tools Service component exited unexpectedly. Please restart SQL Operations Studio.';
|
||||
public readonly serviceCrashLink = 'https://github.com/Microsoft/vscode-mssql/wiki/SqlToolsService-Known-Issues';
|
||||
public readonly gettingDefinitionMessage = 'Getting definition ...';
|
||||
public readonly definitionRequestedStatus = 'DefinitionRequested';
|
||||
public readonly definitionRequestCompletedStatus = 'DefinitionRequestCompleted';
|
||||
public readonly updatingIntelliSenseStatus = 'updatingIntelliSense';
|
||||
public readonly intelliSenseUpdatedStatus = 'intelliSenseUpdated';
|
||||
// localizable strings
|
||||
public readonly serviceCompatibleVersion = '1.0.0';
|
||||
public readonly serviceInstallingTo = 'Installing SQL tools service to';
|
||||
public readonly serviceInitializing = 'Initializing SQL tools service for the mssql extension.';
|
||||
public readonly commandsNotAvailableWhileInstallingTheService = 'Note: mssql commands will be available after installing the service.';
|
||||
public readonly serviceInstalled = 'Sql Tools Service installed';
|
||||
public readonly serviceInstallationFailed = 'Failed to install Sql Tools Service';
|
||||
public readonly serviceLoadingFailed = 'Failed to load Sql Tools Service';
|
||||
public readonly invalidServiceFilePath = 'Invalid file path for Sql Tools Service';
|
||||
public readonly serviceName = 'SQLToolsService';
|
||||
public readonly serviceInitializingOutputChannelName = 'SqlToolsService Initialization';
|
||||
public readonly serviceCrashMessage = 'SQL Tools Service component exited unexpectedly. Please restart SQL Operations Studio.';
|
||||
public readonly serviceCrashLink = 'https://github.com/Microsoft/vscode-mssql/wiki/SqlToolsService-Known-Issues';
|
||||
|
||||
/**
|
||||
* Returns a supported .NET Core Runtime ID (RID) for the current platform. The list of Runtime IDs
|
||||
* is available at https://github.com/dotnet/corefx/tree/master/pkg/Microsoft.NETCore.Platforms.
|
||||
*/
|
||||
public getRuntimeId(platform: string, architecture: string, distribution: LinuxDistribution): Runtime {
|
||||
switch (platform) {
|
||||
case 'win32':
|
||||
switch (architecture) {
|
||||
case 'x86': return Runtime.Windows_86;
|
||||
case 'x86_64': return Runtime.Windows_64;
|
||||
default:
|
||||
}
|
||||
/**
|
||||
* Returns a supported .NET Core Runtime ID (RID) for the current platform. The list of Runtime IDs
|
||||
* is available at https://github.com/dotnet/corefx/tree/master/pkg/Microsoft.NETCore.Platforms.
|
||||
*/
|
||||
public getRuntimeId(platform: string, architecture: string, distribution: LinuxDistribution): Runtime {
|
||||
switch (platform) {
|
||||
case 'win32':
|
||||
switch (architecture) {
|
||||
case 'x86': return Runtime.Windows_86;
|
||||
case 'x86_64': return Runtime.Windows_64;
|
||||
default:
|
||||
}
|
||||
|
||||
throw new Error(`Unsupported Windows architecture: ${architecture}`);
|
||||
throw new Error(`Unsupported Windows architecture: ${architecture}`);
|
||||
|
||||
case 'darwin':
|
||||
if (architecture === 'x86_64') {
|
||||
// Note: We return the El Capitan RID for Sierra
|
||||
return Runtime.OSX;
|
||||
}
|
||||
case 'darwin':
|
||||
if (architecture === 'x86_64') {
|
||||
// Note: We return the El Capitan RID for Sierra
|
||||
return Runtime.OSX;
|
||||
}
|
||||
|
||||
throw new Error(`Unsupported macOS architecture: ${architecture}`);
|
||||
throw new Error(`Unsupported macOS architecture: ${architecture}`);
|
||||
|
||||
case 'linux':
|
||||
if (architecture === 'x86_64') {
|
||||
case 'linux':
|
||||
if (architecture === 'x86_64') {
|
||||
|
||||
// First try the distribution name
|
||||
let runtimeId = Constants.getRuntimeIdHelper(distribution.name, distribution.version);
|
||||
// First try the distribution name
|
||||
let runtimeId = Constants.getRuntimeIdHelper(distribution.name, distribution.version);
|
||||
|
||||
// If the distribution isn't one that we understand, but the 'ID_LIKE' field has something that we understand, use that
|
||||
//
|
||||
// NOTE: 'ID_LIKE' doesn't specify the version of the 'like' OS. So we will use the 'VERSION_ID' value. This will restrict
|
||||
// how useful ID_LIKE will be since it requires the version numbers to match up, but it is the best we can do.
|
||||
if (runtimeId === Runtime.UnknownRuntime && distribution.idLike && distribution.idLike.length > 0) {
|
||||
for (let id of distribution.idLike) {
|
||||
runtimeId = Constants.getRuntimeIdHelper(id, distribution.version);
|
||||
if (runtimeId !== Runtime.UnknownRuntime) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If the distribution isn't one that we understand, but the 'ID_LIKE' field has something that we understand, use that
|
||||
//
|
||||
// NOTE: 'ID_LIKE' doesn't specify the version of the 'like' OS. So we will use the 'VERSION_ID' value. This will restrict
|
||||
// how useful ID_LIKE will be since it requires the version numbers to match up, but it is the best we can do.
|
||||
if (runtimeId === Runtime.UnknownRuntime && distribution.idLike && distribution.idLike.length > 0) {
|
||||
for (let id of distribution.idLike) {
|
||||
runtimeId = Constants.getRuntimeIdHelper(id, distribution.version);
|
||||
if (runtimeId !== Runtime.UnknownRuntime) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (runtimeId !== Runtime.UnknownRuntime && runtimeId !== Runtime.UnknownVersion) {
|
||||
return runtimeId;
|
||||
}
|
||||
}
|
||||
if (runtimeId !== Runtime.UnknownRuntime && runtimeId !== Runtime.UnknownVersion) {
|
||||
return runtimeId;
|
||||
}
|
||||
}
|
||||
|
||||
// If we got here, this is not a Linux distro or architecture that we currently support.
|
||||
throw new Error(`Unsupported Linux distro: ${distribution.name}, ${distribution.version}, ${architecture}`);
|
||||
default :
|
||||
// If we got here, we've ended up with a platform we don't support like 'freebsd' or 'sunos'.
|
||||
// Chances are, VS Code doesn't support these platforms either.
|
||||
throw Error('Unsupported platform ' + platform);
|
||||
}
|
||||
}
|
||||
// If we got here, this is not a Linux distro or architecture that we currently support.
|
||||
throw new Error(`Unsupported Linux distro: ${distribution.name}, ${distribution.version}, ${architecture}`);
|
||||
default:
|
||||
// If we got here, we've ended up with a platform we don't support like 'freebsd' or 'sunos'.
|
||||
// Chances are, VS Code doesn't support these platforms either.
|
||||
throw Error('Unsupported platform ' + platform);
|
||||
}
|
||||
}
|
||||
|
||||
private static getRuntimeIdHelper(distributionName: string, distributionVersion: string): Runtime {
|
||||
switch (distributionName) {
|
||||
case 'ubuntu':
|
||||
if (distributionVersion.startsWith('14')) {
|
||||
// This also works for Linux Mint
|
||||
return Runtime.Ubuntu_14;
|
||||
} else if (distributionVersion.startsWith('16')) {
|
||||
return Runtime.Ubuntu_16;
|
||||
}
|
||||
private static getRuntimeIdHelper(distributionName: string, distributionVersion: string): Runtime {
|
||||
switch (distributionName) {
|
||||
case 'ubuntu':
|
||||
if (distributionVersion.startsWith('14')) {
|
||||
// This also works for Linux Mint
|
||||
return Runtime.Ubuntu_14;
|
||||
} else if (distributionVersion.startsWith('16')) {
|
||||
return Runtime.Ubuntu_16;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'elementary':
|
||||
case 'elementary OS':
|
||||
if (distributionVersion.startsWith('0.3')) {
|
||||
// Elementary OS 0.3 Freya is binary compatible with Ubuntu 14.04
|
||||
return Runtime.Ubuntu_14;
|
||||
} else if (distributionVersion.startsWith('0.4')) {
|
||||
// Elementary OS 0.4 Loki is binary compatible with Ubuntu 16.04
|
||||
return Runtime.Ubuntu_16;
|
||||
}
|
||||
break;
|
||||
case 'elementary':
|
||||
case 'elementary OS':
|
||||
if (distributionVersion.startsWith('0.3')) {
|
||||
// Elementary OS 0.3 Freya is binary compatible with Ubuntu 14.04
|
||||
return Runtime.Ubuntu_14;
|
||||
} else if (distributionVersion.startsWith('0.4')) {
|
||||
// Elementary OS 0.4 Loki is binary compatible with Ubuntu 16.04
|
||||
return Runtime.Ubuntu_16;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'linuxmint':
|
||||
if (distributionVersion.startsWith('18')) {
|
||||
// Linux Mint 18 is binary compatible with Ubuntu 16.04
|
||||
return Runtime.Ubuntu_16;
|
||||
}
|
||||
break;
|
||||
case 'linuxmint':
|
||||
if (distributionVersion.startsWith('18')) {
|
||||
// Linux Mint 18 is binary compatible with Ubuntu 16.04
|
||||
return Runtime.Ubuntu_16;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'centos':
|
||||
case 'ol':
|
||||
// Oracle Linux is binary compatible with CentOS
|
||||
return Runtime.CentOS_7;
|
||||
case 'fedora':
|
||||
return Runtime.Fedora_23;
|
||||
case 'opensuse':
|
||||
return Runtime.OpenSUSE_13_2;
|
||||
case 'sles':
|
||||
return Runtime.SLES_12_2;
|
||||
case 'rhel':
|
||||
return Runtime.RHEL_7;
|
||||
case 'debian':
|
||||
return Runtime.Debian_8;
|
||||
case 'galliumos':
|
||||
if (distributionVersion.startsWith('2.0')) {
|
||||
return Runtime.Ubuntu_16;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return Runtime.UnknownRuntime;
|
||||
}
|
||||
break;
|
||||
case 'centos':
|
||||
case 'ol':
|
||||
// Oracle Linux is binary compatible with CentOS
|
||||
return Runtime.CentOS_7;
|
||||
case 'fedora':
|
||||
return Runtime.Fedora_23;
|
||||
case 'opensuse':
|
||||
return Runtime.OpenSUSE_13_2;
|
||||
case 'sles':
|
||||
return Runtime.SLES_12_2;
|
||||
case 'rhel':
|
||||
return Runtime.RHEL_7;
|
||||
case 'debian':
|
||||
return Runtime.Debian_8;
|
||||
case 'galliumos':
|
||||
if (distributionVersion.startsWith('2.0')) {
|
||||
return Runtime.Ubuntu_16;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return Runtime.UnknownRuntime;
|
||||
}
|
||||
|
||||
return Runtime.UnknownVersion;
|
||||
}
|
||||
return Runtime.UnknownVersion;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import {RequestType} from 'dataprotocol-client';
|
||||
import { RequestType } from 'dataprotocol-client';
|
||||
import * as data from 'data';
|
||||
|
||||
// DEV-NOTE: Still finalizing what we'll need as part of this interface
|
||||
@@ -16,37 +16,35 @@ import * as data from 'data';
|
||||
* @param {boolean} appendToFile Whether we should append or overwrite the file in savePath
|
||||
*/
|
||||
export class SaveResultsInfo {
|
||||
|
||||
|
||||
constructor(public saveFormat: string, public savePath: string, public results: string,
|
||||
public appendToFile: boolean) {
|
||||
}
|
||||
constructor(public saveFormat: string, public savePath: string, public results: string,
|
||||
public appendToFile: boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
export namespace SaveAsRequest {
|
||||
export const type: RequestType<SaveResultsInfo, data.SaveResultRequestResult, void> = { get method(): string { return 'query/saveAs'; } };
|
||||
export const type: RequestType<SaveResultsInfo, data.SaveResultRequestResult, void> = { get method(): string { return 'query/saveAs'; } };
|
||||
}
|
||||
|
||||
// --------------------------------- < Read Credential Request > -------------------------------------------------
|
||||
|
||||
// Read Credential request message callback declaration
|
||||
export namespace ReadCredentialRequest {
|
||||
export const type: RequestType<Credential, Credential, void> = { get method(): string { return 'credential/read'; } };
|
||||
export const type: RequestType<Credential, Credential, void> = { get method(): string { return 'credential/read'; } };
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters to initialize a connection to a database
|
||||
*/
|
||||
export class Credential {
|
||||
/**
|
||||
* Unique ID identifying the credential
|
||||
*/
|
||||
public credentialId: string;
|
||||
/**
|
||||
* Unique ID identifying the credential
|
||||
*/
|
||||
public credentialId: string;
|
||||
|
||||
/**
|
||||
* password
|
||||
*/
|
||||
public password: string;
|
||||
/**
|
||||
* password
|
||||
*/
|
||||
public password: string;
|
||||
}
|
||||
|
||||
// --------------------------------- </ Read Credential Request > -------------------------------------------------
|
||||
@@ -55,7 +53,7 @@ export class Credential {
|
||||
|
||||
// Save Credential request message callback declaration
|
||||
export namespace SaveCredentialRequest {
|
||||
export const type: RequestType<Credential, boolean, void> = { get method(): string { return 'credential/save'; } };
|
||||
export const type: RequestType<Credential, boolean, void> = { get method(): string { return 'credential/save'; } };
|
||||
}
|
||||
// --------------------------------- </ Save Credential Request > -------------------------------------------------
|
||||
|
||||
@@ -64,7 +62,7 @@ export namespace SaveCredentialRequest {
|
||||
|
||||
// Delete Credential request message callback declaration
|
||||
export namespace DeleteCredentialRequest {
|
||||
export const type: RequestType<Credential, boolean, void> = { get method(): string { return 'credential/delete'; } };
|
||||
export const type: RequestType<Credential, boolean, void> = { get method(): string { return 'credential/delete'; } };
|
||||
}
|
||||
// --------------------------------- </ Delete Credential Request > -------------------------------------------------
|
||||
|
||||
@@ -101,4 +99,3 @@ export interface HandleFirewallRuleResponse {
|
||||
result: boolean;
|
||||
ipAddress: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as Contracts from '../models/contracts';
|
||||
import { SqlToolsServiceClient } from 'extensions-modules';
|
||||
import { LanguageClient } from 'dataprotocol-client';
|
||||
import * as data from 'data';
|
||||
import * as path from 'path';
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,47 +18,47 @@ import * as data from 'data';
|
||||
*/
|
||||
export class AzureResourceProvider implements data.ResourceProvider {
|
||||
|
||||
public languageClient: LanguageClient;
|
||||
public languageClient: LanguageClient;
|
||||
|
||||
constructor(private _client?: SqlToolsServiceClient, langClient?: LanguageClient) {
|
||||
if (!this._client) {
|
||||
this._client = SqlToolsServiceClient.instance;
|
||||
}
|
||||
this.languageClient = langClient;
|
||||
}
|
||||
constructor(private _client?: SqlToolsServiceClient, langClient?: LanguageClient) {
|
||||
if (!this._client) {
|
||||
this._client = SqlToolsServiceClient.getInstance(path.join(__dirname, '../config.json'));
|
||||
}
|
||||
this.languageClient = langClient;
|
||||
}
|
||||
|
||||
public createFirewallRule(account: data.Account, firewallruleInfo: data.FirewallRuleInfo): Thenable<data.CreateFirewallRuleResponse> {
|
||||
let self = this;
|
||||
return new Promise<data.CreateFirewallRuleResponse>((resolve, reject) => {
|
||||
self._client.
|
||||
sendRequest(Contracts.CreateFirewallRuleRequest.type, self.asCreateFirewallRuleParams(account, firewallruleInfo), self.languageClient)
|
||||
.then(response => {
|
||||
resolve(response);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
public createFirewallRule(account: data.Account, firewallruleInfo: data.FirewallRuleInfo): Thenable<data.CreateFirewallRuleResponse> {
|
||||
let self = this;
|
||||
return new Promise<data.CreateFirewallRuleResponse>((resolve, reject) => {
|
||||
self._client.
|
||||
sendRequest(Contracts.CreateFirewallRuleRequest.type, self.asCreateFirewallRuleParams(account, firewallruleInfo), self.languageClient)
|
||||
.then(response => {
|
||||
resolve(response);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
|
||||
public handleFirewallRule(errorCode: number, errorMessage: string, connectionTypeId: string): Thenable<data.HandleFirewallRuleResponse> {
|
||||
let self = this;
|
||||
return new Promise<data.HandleFirewallRuleResponse>((resolve, reject) => {
|
||||
let params: Contracts.HandleFirewallRuleParams = { errorCode: errorCode, errorMessage: errorMessage, connectionTypeId: connectionTypeId };
|
||||
public handleFirewallRule(errorCode: number, errorMessage: string, connectionTypeId: string): Thenable<data.HandleFirewallRuleResponse> {
|
||||
let self = this;
|
||||
return new Promise<data.HandleFirewallRuleResponse>((resolve, reject) => {
|
||||
let params: Contracts.HandleFirewallRuleParams = { errorCode: errorCode, errorMessage: errorMessage, connectionTypeId: connectionTypeId };
|
||||
|
||||
self._client.
|
||||
sendRequest(Contracts.HandleFirewallRuleRequest.type, params, self.languageClient)
|
||||
.then(response => {
|
||||
resolve(response);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
self._client.
|
||||
sendRequest(Contracts.HandleFirewallRuleRequest.type, params, self.languageClient)
|
||||
.then(response => {
|
||||
resolve(response);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
|
||||
private asCreateFirewallRuleParams(account: data.Account, params: data.FirewallRuleInfo): Contracts.CreateFirewallRuleParams {
|
||||
return {
|
||||
account: account,
|
||||
serverName: params.serverName,
|
||||
startIpAddress: params.startIpAddress,
|
||||
endIpAddress: params.endIpAddress,
|
||||
securityTokenMappings: params.securityTokenMappings
|
||||
};
|
||||
}
|
||||
private asCreateFirewallRuleParams(account: data.Account, params: data.FirewallRuleInfo): Contracts.CreateFirewallRuleParams {
|
||||
return {
|
||||
account: account,
|
||||
serverName: params.serverName,
|
||||
startIpAddress: params.startIpAddress,
|
||||
endIpAddress: params.endIpAddress,
|
||||
securityTokenMappings: params.securityTokenMappings
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { SaveResultsInfo } from '../models/contracts';
|
||||
import * as data from 'data';
|
||||
|
||||
/**
|
||||
@@ -14,5 +13,5 @@ import * as data from 'data';
|
||||
* @interface ISerialization
|
||||
*/
|
||||
export interface ISerialization {
|
||||
saveAs(saveFormat: string, savePath: string, results: string, appendToFile: boolean): Promise<data.SaveResultRequestResult>;
|
||||
saveAs(saveFormat: string, savePath: string, results: string, appendToFile: boolean): Promise<data.SaveResultRequestResult>;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as Contracts from '../models/contracts';
|
||||
@@ -9,33 +9,34 @@ import { ISerialization } from './iserialization';
|
||||
import { SqlToolsServiceClient } from 'extensions-modules';
|
||||
import * as data from 'data';
|
||||
import { LanguageClient } from 'dataprotocol-client';
|
||||
import * as path from 'path';
|
||||
|
||||
/**
|
||||
* Implements serializer for query results
|
||||
*/
|
||||
export class Serialization implements ISerialization {
|
||||
|
||||
constructor(private _client?: SqlToolsServiceClient, private _languageClient?: LanguageClient) {
|
||||
if (!this._client) {
|
||||
this._client = SqlToolsServiceClient.instance;
|
||||
}
|
||||
}
|
||||
constructor(private _client?: SqlToolsServiceClient, private _languageClient?: LanguageClient) {
|
||||
if (!this._client) {
|
||||
this._client = SqlToolsServiceClient.getInstance(path.join(__dirname, '../config.json'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves results as a specified path
|
||||
*
|
||||
* @param {string} credentialId the ID uniquely identifying this credential
|
||||
* @returns {Promise<ISaveResultsInfo>} Promise that resolved to the credential, or undefined if not found
|
||||
*/
|
||||
public saveAs(saveFormat: string, savePath: string, results: string, appendToFile: boolean): Promise<data.SaveResultRequestResult> {
|
||||
let self = this;
|
||||
let resultsInfo: Contracts.SaveResultsInfo = new Contracts.SaveResultsInfo(saveFormat, savePath, results, appendToFile);
|
||||
return new Promise<data.SaveResultRequestResult>( (resolve, reject) => {
|
||||
self._client
|
||||
.sendRequest(Contracts.SaveAsRequest.type, resultsInfo, this._languageClient)
|
||||
.then(result => {
|
||||
resolve(<data.SaveResultRequestResult>result);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Saves results as a specified path
|
||||
*
|
||||
* @param {string} credentialId the ID uniquely identifying this credential
|
||||
* @returns {Promise<ISaveResultsInfo>} Promise that resolved to the credential, or undefined if not found
|
||||
*/
|
||||
public saveAs(saveFormat: string, savePath: string, results: string, appendToFile: boolean): Promise<data.SaveResultRequestResult> {
|
||||
let self = this;
|
||||
let resultsInfo: Contracts.SaveResultsInfo = new Contracts.SaveResultsInfo(saveFormat, savePath, results, appendToFile);
|
||||
return new Promise<data.SaveResultRequestResult>((resolve, reject) => {
|
||||
self._client
|
||||
.sendRequest(Contracts.SaveAsRequest.type, resultsInfo, this._languageClient)
|
||||
.then(result => {
|
||||
resolve(<data.SaveResultRequestResult>result);
|
||||
}, err => reject(err));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
3
extensions/mssql/client/src/typings/ref.d.ts
vendored
@@ -4,4 +4,5 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
|
||||
/// <reference path='../../../../../src/sql/data.d.ts'/>
|
||||
/// <reference path='../../../../../src/sql/data.d.ts'/>
|
||||
/// <reference types='@types/node'/>
|
||||
2230
extensions/mssql/npm-shrinkwrap.json
generated
@@ -9,13 +9,14 @@
|
||||
"activationEvents": [
|
||||
"*"
|
||||
],
|
||||
"main": "./client/out/mssqlMain",
|
||||
"main": "./client/out/main",
|
||||
"extensionDependencies": [
|
||||
"vscode.sql"
|
||||
],
|
||||
"scripts": {
|
||||
"compile": "gulp compile-extension:mssql-client",
|
||||
"postinstall": "node ./node_modules/vscode/bin/install"
|
||||
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||
"update-grammar": "node ../../build/npm/update-grammar.js Microsoft/vscode-mssql syntaxes/SQL.plist ./syntaxes/sql.tmLanguage.json"
|
||||
},
|
||||
"contributes": {
|
||||
"languages": [
|
||||
@@ -26,15 +27,7 @@
|
||||
],
|
||||
"aliases": [
|
||||
"SQL"
|
||||
],
|
||||
"configuration": "./syntaxes/sql.configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "sql",
|
||||
"scopeName": "source.sql",
|
||||
"path": "./syntaxes/SQL.plist"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputChannels": [
|
||||
@@ -46,38 +39,10 @@
|
||||
"path": "./snippets/mssql.json"
|
||||
}
|
||||
],
|
||||
"commands": [
|
||||
{
|
||||
"command": "extension.clearTokenCache",
|
||||
"title": "%extension.clearTokenCache%",
|
||||
"category": "Azure Accounts"
|
||||
}
|
||||
],
|
||||
"account-type": [
|
||||
{
|
||||
"id": "microsoft",
|
||||
"icon": {
|
||||
"light": "./out/account-provider/media/microsoft_account_light.svg",
|
||||
"dark": "./out/account-provider/media/microsoft_account_dark.svg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "work_school",
|
||||
"icon": {
|
||||
"light": "./out/account-provider/media/work_school_account_light.svg",
|
||||
"dark": "./out/account-provider/media/work_school_account_dark.svg"
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
"type": "object",
|
||||
"title": "MSSQL configuration",
|
||||
"properties": {
|
||||
"accounts.azure.enablePublicCloud": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "%config.enablePublicCloudDescription%"
|
||||
},
|
||||
"mssql.query.displayBitAsNumber": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
@@ -227,18 +192,9 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"dataprotocol-client": "file:../../dataprotocol-node/client",
|
||||
"extensions-modules": "file:../../extensions-modules",
|
||||
"adal-node": "0.1.25",
|
||||
"decompress": "^4.0.0",
|
||||
"fs-extra-promise": "^1.0.1",
|
||||
"opener": "1.4.3",
|
||||
"request": "2.63.0",
|
||||
"vscode-extension-telemetry": "^0.0.8",
|
||||
"vscode-nls": "2.0.2"
|
||||
"dataprotocol-client": "file:../../dataprotocol-node/client"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vscode": "1.0.1",
|
||||
"@types/node": "^8.0.24"
|
||||
"vscode": "1.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"extension.clearTokenCache": "Clear Azure Account Token Cache",
|
||||
"config.enablePublicCloudDescription": "Should Azure public cloud integration be enabled",
|
||||
"config.enableUsGovCloudDescription": "Should US Government Azure cloud (Fairfax) integration be enabled",
|
||||
"config.enableChinaCloudDescription": "Should Azure China integration be enabled",
|
||||
"config.enableGermanyCloudDescription": "Should Azure Germany integration be enabled"
|
||||
"json.schemas.desc": "Associate schemas to JSON files in the current project",
|
||||
"json.schemas.url.desc": "A URL to a schema or a relative path to a schema in the current directory",
|
||||
"json.schemas.fileMatch.desc": "An array of file patterns to match against when resolving JSON files to schemas.",
|
||||
"json.schemas.fileMatch.item.desc": "A file pattern that can contain '*' to match against when resolving JSON files to schemas.",
|
||||
"json.schemas.schema.desc": "The schema definition for the given URL. The schema only needs to be provided to avoid accesses to the schema URL.",
|
||||
"json.format.enable.desc": "Enable/disable default JSON formatter (requires restart)"
|
||||
}
|
||||
@@ -208,10 +208,10 @@
|
||||
"body": [
|
||||
"-- Get a list of tables and views in the current database",
|
||||
"SELECT table_catalog [database], table_schema [schema], table_name name, table_type type",
|
||||
"FROM INFORMATION_SCHEMA.TABLES",
|
||||
"FROM information_schema.tables",
|
||||
"GO"
|
||||
],
|
||||
"description": "List tables and views in the current database"
|
||||
"description": "List tables and vies in the current database"
|
||||
},
|
||||
|
||||
"List databases": {
|
||||
@@ -229,15 +229,15 @@
|
||||
"body": [
|
||||
"-- List columns in all tables whose name is like '${1:TableName}'",
|
||||
"SELECT ",
|
||||
"\tTableName = tbl.TABLE_SCHEMA + '.' + tbl.TABLE_NAME, ",
|
||||
"\tColumnName = col.COLUMN_NAME, ",
|
||||
"\tColumnDataType = col.DATA_TYPE",
|
||||
"FROM INFORMATION_SCHEMA.TABLES tbl",
|
||||
"INNER JOIN INFORMATION_SCHEMA.COLUMNS col ",
|
||||
"\tON col.TABLE_NAME = tbl.TABLE_NAME",
|
||||
"\tAND col.TABLE_SCHEMA = tbl.TABLE_SCHEMA",
|
||||
"\tTableName = tbl.table_schema + '.' + tbl.table_name, ",
|
||||
"\tColumnName = col.column_name, ",
|
||||
"\tColumnDataType = col.data_type",
|
||||
"FROM information_schema.tables tbl",
|
||||
"INNER JOIN information_schema.columns col ",
|
||||
"\tON col.table_name = tbl.table_name",
|
||||
"\tAND col.table_schema = tbl.table_schema",
|
||||
"",
|
||||
"WHERE tbl.TABLE_TYPE = 'BASE TABLE' and tbl.TABLE_NAME like '%${1:TableName}%'",
|
||||
"WHERE tbl.table_type = 'base table' and tbl.table_name like '%${1:TableName}%'",
|
||||
"GO"
|
||||
],
|
||||
"description": "Lists all the columns and their types for tables matching a LIKE statement"
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
|
||||
}
|
||||
11
extensions/npm-shrinkwrap.json
generated
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"name": "vscode-extensions",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"typescript": {
|
||||
"version": "2.6.1",
|
||||
"from": "typescript@2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.1.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,8 @@
|
||||
"version": "0.0.1",
|
||||
"description": "Dependencies shared by all extensions",
|
||||
"dependencies": {
|
||||
"typescript": "2.6.1"
|
||||
"typescript": "2.6.1",
|
||||
"extensions-modules": "file:../extensions-modules"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node ./postinstall"
|
||||
|
||||