Refactor extension to support just graph explorer

This commit is contained in:
Eric Jizba 2020-03-13 16:17:21 -07:00
Родитель bfb62f47c5
Коммит a469b97f45
29 изменённых файлов: 130 добавлений и 2293 удалений

3
.vscode/extensions.json поставляемый
Просмотреть файл

@ -1,7 +1,6 @@
{
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin",
"ms-vscode.azure-account",
"mike-lischke.vscode-antlr4"
"ms-vscode.azure-account"
]
}

45
.vscode/launch.json поставляемый
Просмотреть файл

@ -18,7 +18,7 @@
],
"preLaunchTask": "npm: compile",
"env": {
"AZCODE_COSMOSDB_IGNORE_BUNDLE": "1",
"AZCODE_COSMOSDB_GRAPH_IGNORE_BUNDLE": "1",
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
@ -43,7 +43,7 @@
"MOCHA_fgrep": "", // Search string of tests to run (empty for all)
"MOCHA_grep": "", // RegExp of tests to run (empty for all)
"MOCHA_enableTimeouts": "0", // Disable time-outs
"AZCODE_COSMOSDB_IGNORE_BUNDLE": "1",
"AZCODE_COSMOSDB_GRAPH_IGNORE_BUNDLE": "1",
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
@ -90,47 +90,6 @@
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
},
{
"type": "node",
"request": "attach",
"name": "Attach to Language Server",
"protocol": "inspector",
"port": 6005,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
]
},
{
"type": "node",
"request": "attach",
"name": "Attach to Extension Host",
"protocol": "inspector",
"port": 5870,
"sourceMaps": true,
"restart": true,
"outFiles": [
"${workspaceFolder}/out/src"
]
},
{
// INSTRUCTIONS
// 1) Point 'input' to a debugging input file and set "input" below to the file's path
// 2) *** IMPORTANT*** Make a whitespace change in mongo.g4 and then save it. This forces debugging info to be generated.
// If this works, you'll see a warning in the Output window.
// 3) Launch this configuration
// 4) See Debug Console output
// 5) In mongo.g4 file, in the editor context menu, you should see options for generating graphs
"name": "Debug Mongo grammar",
"type": "antlr-debug",
"request": "launch",
// This doesn't seem to work: "input": "${workspaceFolder}/${command:AskForTestInput}",
"input": "c:/temp/debugger-input.mongo",
"grammar": "grammar/mongo.g4",
"startRule": "mongoCommands",
"printParseTree": true,
"visualParseTree": true
}
]
}

6
.vscode/settings.json поставляемый
Просмотреть файл

@ -13,12 +13,6 @@
"**/node_modules": true,
".vscode-test": true
},
"antlr4.generation": {
// Settings for "ANTLR4 grammar syntax support" extension
"mode": "internal",
"listeners": true,
"visitors": false
},
"editor.codeActionsOnSave": {
"source.fixAll.tslint": true,
},

Просмотреть файл

@ -19,8 +19,6 @@ gulp*
webpack.config*
stats.json
*.tgz
grammar/*.md
grammar/*.g4
build
*.ts
*.zip

Просмотреть файл

@ -1,253 +1,3 @@
# Change Log
All notable changes to the "azure-cosmosdb" extension will be documented in this file.
## 0.12.2 - 2020-03-10
### Fixed
- Language client is not ready yet [#1334](https://github.com/microsoft/vscode-cosmosdb/issues/1334)
## 0.12.1 - 2020-01-22
### Fixed
- When updating a Mongo document, the operation would fail with the following error: `update operation document must contain atomic operators.` [#1298](https://github.com/microsoft/vscode-cosmosdb/issues/1298)
- When importing a `.json` document into a Mongo collection, it would throw the following error: `Error: r.insertedIds is not iterable` [#1307](https://github.com/microsoft/vscode-cosmosdb/issues/1307)
## 0.12.0 - 2020-01-16
### Added
- Support for Private Endpoint Connections
- Collapse All button for Cosmos DB explorer
### Fixed
- When using `find()` in MongoScrapbooks, it would not work properly with chained commands [#981](https://github.com/microsoft/vscode-cosmosdb/issues/981)
- [Bugs fixed](https://github.com/microsoft/vscode-cosmosdb/milestone/18?closed=1)
## 0.11.0 - 2019-09-03
### Added
- Add `mongo.shell.args` setting to allow passing arguments to mongo shell [#1104](https://github.com/Microsoft/vscode-cosmosdb/issues/1104), [#1126](https://github.com/Microsoft/vscode-cosmosdb/issues/1126)
### Changed
- Due to a change in the Azure Cosmos DB Emulator, users must explicitly enable the Mongo DB port when starting the emulator. Updated error messages to point to debugging tips at https://aka.ms/AA5zah5. [#1137](https://github.com/microsoft/vscode-cosmosdb/issues/1137), [#1000](https://github.com/microsoft/vscode-cosmosdb/issues/1000)
### Fixed
- Better shell error handling, add mongo.shell.args setting [#1101](https://github.com/Microsoft/vscode-cosmosdb/issues/1101), [#1092](https://github.com/Microsoft/vscode-cosmosdb/issues/1092), [#1071](https://github.com/Microsoft/vscode-cosmosdb/issues/1071), [#988](https://github.com/Microsoft/vscode-cosmosdb/issues/988), [#838](https://github.com/Microsoft/vscode-cosmosdb/issues/838), [#820](https://github.com/Microsoft/vscode-cosmosdb/issues/820)
- Increase mongo.shell.timeout default value from 5 to 30 [#1115](https://github.com/Microsoft/vscode-cosmosdb/issues/1115)
- Fix document save prompt message [#1021](https://github.com/Microsoft/vscode-cosmosdb/issues/1021)
## 0.10.2 - 2019-05-01
### Fixed
- Handle opening resources to use native vscode APIs
- Running the extension in older versions of VS Code
- Report an issue opening a blank webpage due to a large stack frame
## 0.10.1 - 2019-03-26
### Added
- Wizards are more informative and allow you to redo some steps
### Fixed
- Graph views moved from using previewHtml (deprecated) to Webview API
## 0.10.0 - 2019-02-13
### Added
* Improved startup and installation performance
### Fixed
* Accounts created in portal are not recognized as graph/mongo by the extension [#1018](https://github.com/Microsoft/vscode-cosmosdb/issues/1018)
* Confusing error message when running 'Import Document into a Collection' with no Workspace opened [#961](https://github.com/Microsoft/vscode-cosmosdb/issues/961)
* Improve emulator connection error messages [#1016](https://github.com/Microsoft/vscode-cosmosdb/issues/1016)
## 0.9.1 - 2018-11-28
### Added
- API support for integration with [App Service extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice)
- Multiple documents, collections, or stored procedures can be viewed/edited at once (thanks [@tec-goblin](https://github.com/tec-goblin))
### [Fixed](https://github.com/Microsoft/vscode-cosmosdb/issues?q=is%3Aissue+milestone%3A0.9.1+label%3Abug+is%3Aclosed)
- Refresh button doesn't refresh attached accounts [#904](https://github.com/Microsoft/vscode-cosmosdb/issues/904)
- Some scrapbook parse errors were causing an error alert [#959](https://github.com/Microsoft/vscode-cosmosdb/pull/959)
- Downgrade event-stream version due to [event-stream#116](https://github.com/dominictarr/event-stream/issues/116)
## 0.9.0 - 2018-11-05
### Added
- Mongo
- Support for [ObjectId, ISODate](https://github.com/Microsoft/vscode-cosmosdb/issues/769) and [regular expression](https://github.com/Microsoft/vscode-cosmosdb/issues/786) [(/pattern/flag)](https://github.com/Microsoft/vscode-cosmosdb/issues/667) syntax in the scrapbook
- Support for [method chaining](https://github.com/Microsoft/vscode-cosmosdb/issues/785).
- Ability to [change timeout](https://github.com/Microsoft/vscode-cosmosdb/issues/809) for commands in scrapbook
- Support [importing documents](https://github.com/Microsoft/vscode-cosmosdb/issues/404) into CosmosDB and Mongo databases.
- Support for [soveriegn clouds](https://github.com/Microsoft/vscode-cosmosdb/commit/5b573f535cdeba109d7ff037b914575e0172c6bd)
- Support creation of fixed collections and graphs [#295](https://github.com/Microsoft/vscode-cosmosdb/issues/295) and [#504](https://github.com/Microsoft/vscode-cosmosdb/issues/504)
### Fixed
- Collections having two documents of the same id will render properly [#588](https://github.com/Microsoft/vscode-cosmosdb/issues/588) and [#892](https://github.com/Microsoft/vscode-cosmosdb/issues/892)
- Some UI fixes [#576](https://github.com/Microsoft/vscode-cosmosdb/issues/576) and [#873](https://github.com/Microsoft/vscode-cosmosdb/issues/873)
- [Additional bugs fixed](https://github.com/Microsoft/vscode-cosmosdb/milestone/16?closed=1)
### Thank you
A big thank you to the following contributors that helped make the extension even better!
- [Nicolas Kyriazopuolos-Panagiotopoulos @tec-goblin](https://github.com/tec-goblin):
- Updates to a collection now update the corresponding tree item [PR#856](https://github.com/Microsoft/vscode-cosmosdb/pull/856)
- Uploading a document by closing it no longer tries to update the closed editor [PR#818](https://github.com/Microsoft/vscode-cosmosdb/pull/818)
- Fixing tslint issues [PR#829](https://github.com/Microsoft/vscode-cosmosdb/pull/829)
- Use consistent language for various commands [PR#828](https://github.com/Microsoft/vscode-cosmosdb/pull/828)
- Fix some typos [PR#810](https://github.com/Microsoft/vscode-cosmosdb/pull/810) and [PR#816](https://github.com/Microsoft/vscode-cosmosdb/pull/816)
- [Nguyen Long Nhat @torn4dom4n](https://github.com/torn4dom4n), for updating our tasks [PR#887](https://github.com/Microsoft/vscode-cosmosdb/pull/887)
## 0.8.0 - 2018-07-05
### Added
- Improved scrapbook experience with better error handling. We now [highlight errors on the scrapbook as you type](https://github.com/Microsoft/vscode-cosmosdb/issues/471)!
- See your [stored procedures for graph accounts](https://github.com/Microsoft/vscode-cosmosdb/issues/422) too!
- [Document labels](https://github.com/Microsoft/vscode-cosmosdb/issues/381) in the tree view are now more descriptive.
### Fixed
- Scrapbook: can now parse commands with [single quotes](https://github.com/Microsoft/vscode-cosmosdb/issues/467) or [no quotes](https://github.com/Microsoft/vscode-cosmosdb/issues/467). Examples from the mongo docs should now work when directly pasted.
- Fewer timeout errors on [running commands in the emulator](https://github.com/Microsoft/vscode-cosmosdb/pull/731).
- We correctly parse [collection names with dots](https://github.com/Microsoft/vscode-cosmosdb/issues/666)
- Invalid database accounts will not [prevent the tree from loading](https://github.com/Microsoft/vscode-cosmosdb/issues/628)
- [Additional bugs fixed](https://github.com/Microsoft/vscode-cosmosdb/issues?page=1&q=is%3Aissue+milestone%3A0.8.0+is%3Aclosed)
## 0.7.2 - 2018-06-08
### Added
- [Support DNS Seedlist Connection Format](https://github.com/Microsoft/vscode-cosmosdb/pull/670) for mongo connection strings (mongodb+srv://). Thanks [@plusn-nuri](https://github.com/plusn-nuri)!
### Fixed
- [Support for Extended JSON in scrapbook queries](https://github.com/Microsoft/vscode-cosmosdb/issues/621)
- [Updating mongo documents without an ObjectID in the ID field ](https://github.com/Microsoft/vscode-cosmosdb/issues/534)
- [Log of fixed bugs](https://github.com/Microsoft/vscode-cosmosdb/issues?q=is%3Aissue+milestone%3A0.7.2+is%3Aclosed)
## 0.7.1 - 2018-05-10
### [Fixed](https://github.com/Microsoft/vscode-cosmosdb/issues?q=is%3Aissue+milestone%3A%220.7.1%22+is%3Aclosed+label%3Abug)
- Fixed error "Unexpected Experience Value" when retrieving database accounts
## 0.7.0 - 2018-05-04
### Added
- Mongo
- CodeLens support for scrapbook
- Execute all commands in a scrapbook, allowing you to use scrapbooks as scripts
- Support for ObjectIDs, ISODate, and extended JSON data types in document views
- SQL
- View, open, edit and update Stored Procedures
- Miscellaneous
- Error messages are now modal
- Open newly created docs in editor
### Changed
- Moved Azure CosmosDB Explorer to new Azure view container instead of file explorer
### Fixed
- [Better error messages for connection strings](https://github.com/Microsoft/vscode-cosmosdb/pull/600)
- [Don't throw errors on dropping non-existent collections](https://github.com/Microsoft/vscode-cosmosdb/pull/541)
- [Errors no longer written to output in the middle of writing a scrapbook command](https://github.com/Microsoft/vscode-cosmosdb/issues/516)
- [Additional bugs fixed](https://github.com/Microsoft/vscode-cosmosdb/issues?q=is%3Aissue+milestone%3A%220.7.0%22+is%3Aclosed+label%3Abug)
## 0.6.0 - 2018-04-09
### Added
- Mongo
- mongo.shell.path setting no longer required if shell is in system path
- Allow mongo.shell.path to be specified in workspace settings as well as user settings
- No longer asking for an id for new documents
- Connected database is now persisted between sessions
- Improvements to scrapbook setup and error handling
- Azure subscriptions
- New "filter" button on subscription nodes
- New "Open in Portal" menu item for subscriptions
- Miscellaneous
- New "Report an Issue" button on error dialogs
### Fixed
- [Allow access to multi-tenant mongo server](https://github.com/Microsoft/vscode-cosmosdb/issues/473)
- [Can only run the first command in a Mongo Scrapbook on Windows](https://github.com/Microsoft/vscode-cosmosdb/issues/386)
- [Projections Not Working In Mongo Scrapbooks](https://github.com/Microsoft/vscode-cosmosdb/issues/214)
- [Additional bugs fixed](https://github.com/Microsoft/vscode-cosmosdb/issues?q=is%3Aissue+milestone%3A%220.6.0%22+is%3Aclosed+label%3Abug)
## 0.5.1 - 2018-03-23
### Fixed
- [Bug fixed](https://github.com/Microsoft/vscode-cosmosdb/issues/372)
## 0.5.0 - 2018-03-05
### Fixed
- [Bugs fixed](https://github.com/Microsoft/vscode-cosmosdb/issues?q=is%3Aissue+milestone%3A%220.5.0%22+is%3Aclosed+label%3Abug)
### Added
- DocumentDB and Mongo
- Allow updating documents and collections re-opened from a previous VS Code session
- Mongo
- Delete databases
## 0.4.0 - 2018-01-25
### Added
- Attach to Cosmos DB emulator
- Run commands from the command palette
### Fixed
- [Bugs fixed](https://github.com/Microsoft/vscode-cosmosdb/issues?q=is%3Aissue+milestone%3A%220.4.0%22+is%3Aclosed+label%3Abug)
## 0.3.0 - 2017-12-15
### Added
- Attach Cosmos DB accounts by connection string
- Graph:
- Customize the color and display text of vertices through VS Code [settings](README.md#graphSettings)
- By default display vertex IDs and labels and choose vertex color based on label
- Honor current VS Code theme
### Fixed
- [Bugs fixed](https://github.com/Microsoft/vscode-cosmosdb/issues?q=is%3Aissue+milestone%3A%220.3.0%22+is%3Aclosed+label%3Abug)
## 0.2.2 - 2017-12-04
### Added
- View, edit, and persist a Mongo collection
- Edit and persist the result of a Mongo command
## 0.2.1 - 2017-11-16
### Fixed
- [Graph bugs fixed](https://github.com/Microsoft/vscode-cosmosdb/issues?q=is%3Aissue+milestone%3A%220.2.1%22+is%3Aclosed+label%3Abug)
- Source to target arrows are backwards
- Side effects from executing a Gremlin query can occur twice
- Duplicate vertices can show up in graph viewer
- Query performance improved for large graphs
## 0.2.0 - 2017-11-10
### Added
- Graph:
- View/Create/Delete databases and graphs
- Click on a graph to visualize data
- Query graph using [Gremlin](https://docs.microsoft.com/azure/cosmos-db/gremlin-support)
- DocumentDB:
- View/Create/Delete databases, collections, and documents
- Mongo
- View documents in the explorer
- DocumentDB and Mongo:
- Click on a document to open in the editor
- Edit a document and persist changes to the cloud
### Removed
- View Mongo documents in 'result.json' by clicking on a collection in the explorer
- Edit and persist the result of a Mongo scrapbook command
### Fixed
- [Bugs fixed](https://github.com/Microsoft/vscode-cosmosdb/issues?q=is%3Aissue+milestone%3A%220.2.0%22+is%3Aclosed+label%3Abug)
## 0.1.1 - 2017-09-19
### Changed
- Correctly set version to preview
## 0.1.0 - 2017-09-19
### Added
- Cosmos DB UI component (sash)
- Connect to local MongoDB
- Create Cosmos DB (with MongoDB adaptor)
- Connect to Cosmos DB via MongoDB adaptor
- Command to launch the `mongo` shell
- Rich MongoDB intellisense in scrapbooks
## 0.1.0 - TBD

Просмотреть файл

@ -1,51 +1,9 @@
# Cosmos DB Support for VS Code (Preview)
# Cosmos DB Graph Support for VS Code (Preview)
[![Version](https://vsmarketplacebadge.apphb.com/version/ms-azuretools.vscode-cosmosdb.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-cosmosdb) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/ms-azuretools.vscode-cosmosdb.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-cosmosdb) [![Build Status](https://dev.azure.com/ms-azuretools/AzCode/_apis/build/status/vscode-cosmosdb)](https://dev.azure.com/ms-azuretools/AzCode/_build/latest?definitionId=7)
[![Version](https://vsmarketplacebadge.apphb.com/version/ms-azuretools.vscode-cosmosdbgraph.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-cosmosdbgraph) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/ms-azuretools.vscode-cosmosdbgraph.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-cosmosdbgraph) [![Build Status](https://dev.azure.com/ms-azuretools/AzCode/_apis/build/status/vscode-cosmosdbgraph)](https://dev.azure.com/ms-azuretools/AzCode/_build/latest?definitionId=TODO)
Browse and query your MongoDB databases both locally and in the cloud using [_scrapbooks_](#mongo-scrapbooks) with rich Intellisense then connect to Azure to manage your Cosmos DB databases with support for MongoDB, Graph (Gremlin), and SQL (previously known as DocumentDB).
![Cosmos DB Extension](resources/features.png)
# Prerequisites
- Some less-common commands in the Mongo [scrapbook](#mongo-scrapbooks) and use of the Mongo shell require installing [Mongo DB and Mongo shell](https://docs.mongodb.com/manual/installation/).
# Features
## Cosmos DB Explorer
- Create a Cosmos DB account by clicking the `+` button in the title
- View Azure Cosmos DB accounts and open directly in the portal
- View/Create/Delete databases, collections, graphs, stored procedures, and documents
- Click on a document or stored procedure to open in the editor
- Click on a graph to visualize data
- Query graph using [Gremlin](https://docs.microsoft.com/azure/cosmos-db/gremlin-support)
- Edit a document and persist changes to the cloud
- Attach a Mongo server by clicking the plug icon in the title
![Browse CosmosDB and MongoDB databases](resources/Browse.png)
## Mongo Scrapbooks
### Run Mongo Commands with Rich Intellisense
- View your MongoDB database account by [signing in to Azure](#managing-azure-subscriptions) or using "Attach Database Account" to connect via a connection string
- Optionally configure the settings `mongo.shell.path` and `mongo.shell.args` if your mongo executable is not already on your system's PATH (many of the common commands have built-in support and do not require the Mongo shell to be installed - see [Prerequisites](#prerequisites))
- Click on "New Mongo Scrapbook" in the tree title bar
- Click on "Connect to a database" to indicate which database to run the commands against
- Enter your commands and/or comments, eg: `db.<collectionName>.find()`
- IntelliSense (auto-completions) will be provided
- Click on "Execute" above a command to execute it, or press `CMD+"` (Mac) or `CTRL+"` (Windows and Linux) to execute the line with the cursor
- To run all commands, click on "Execute All", or press `CMD+:` or `Ctrl+:`
- Save and re-use later
![Mongo Scrapbook](resources/Scrapbook.gif)
## Import into Cosmos DB
- You can now import documents from your workspace into CosmosDB. Use the context menu of a collection or a document file (json) to get started!
![Import documents](resources/import_documents.gif)
## Use [Gremlin](https://docs.microsoft.com/azure/cosmos-db/gremlin-support) to query graphs
Use [Gremlin](https://docs.microsoft.com/azure/cosmos-db/gremlin-support) to query Cosmos DB graphs.
![Query Graphs](resources/Graph.gif)
@ -76,42 +34,10 @@ Browse and query your MongoDB databases both locally and in the cloud using [_sc
]
```
## Create a Cosmos DB Account
![Create Cosmos DB Account](resources/create.gif)
## Attach to the Cosmos DB Emulator
* Install and run the [Cosmos DB Emulator](https://docs.microsoft.com/azure/cosmos-db/local-emulator) on your local machine
* Right click 'Attached Database Accounts' and select 'Attach Emulator'
![Attach Emulator](resources/attachEmulator.png)
## Managing Azure Subscriptions
If you are not signed in to Azure, you will see a "Sign in to Azure..." link. Alternatively, you can select "View->Command Palette" in the VS Code menu, and search for "Azure: Sign In".
![Sign in to Azure](resources/SignIn.gif)
If you don't have an Azure Account, you can sign up for one today for free and receive $200 in credits by selecting "Create a Free Azure Account..." or selecting "View->Command Palette" and searching for "Azure: Create an Account".
You may sign out of Azure by selecting "View->Command Palette" and searching for "Azure: Sign Out".
To select which subscriptions show up in the extension's explorer, click on the "Select Subscriptions..." button on any subscription node (indicated by a "filter" icon when you hover over it), or select "View->Command Palette" and search for "Azure: Select Subscriptions". Note that this selection affects all VS Code extensions that support the [Azure Account and Sign-In](https://github.com/Microsoft/vscode-azure-account) extension.
![Select Azure Subscriptions](resources/SelectSubscriptions.gif)
## Known Issues
- Azure no longer supports gremlin queries on pre-GA graph accounts. If you see the error "Could not find a valid gremlin endpoint for *graph*", then choose "Open Portal" on the graph node and check the "Gremlin Endpoint" in the Overview tab. If it does not take the form of '...[graph-name].***gremlin***.cosmosdb.azure.com...', then you will need to create a new graph account using the Azure portal or the current version of the extension.
- Graphs are not currently supported with the emulator
- Viewing/editing tables is not currently supported
- Support for escapes in the scrapbooks is preliminary. We currently do not support escaped characters as is inside a string - the characters need to be double escaped. For example, newlines in the string should be '\\\\n' instead of '\\n' to be recognized correctly. If you find any issues with how the scrapbook handles escapes, please add to issue [#937](https://github.com/Microsoft/vscode-cosmosdb/issues/937).
# Contributing
There are several ways you can contribute to our [repo](https://github.com/Microsoft/vscode-cosmosdb):
There are several ways you can contribute to our [repo](https://github.com/Microsoft/vscode-cosmosdbgraph):
- **Ideas, feature requests and bugs**: We are open to all ideas and we want to get rid of bugs! Use the [Issues](https://github.com/Microsoft/vscode-cosmosdb/issues) section to report a new issue, provide your ideas or contribute to existing threads.
- **Ideas, feature requests and bugs**: We are open to all ideas and we want to get rid of bugs! Use the [Issues](https://github.com/Microsoft/vscode-cosmosdbgraph/issues) section to report a new issue, provide your ideas or contribute to existing threads.
- **Documentation**: Found a typo or strangely worded sentences? Submit a PR!
- **Code**: Contribute bug fixes, features or design changes:

Просмотреть файл

@ -12,31 +12,14 @@
// Export activate/deactivate for main.js
// The tests use instanceof against these and therefore we need to make sure we're using the same version of the bson module in the tests as in the bundle,
// so export it from the bundle itself.
export { ObjectID, ObjectId } from 'bson';
// Exports for tests
// The tests are not packaged with the webpack bundle and therefore only have access to code exported from this file.
//
// The tests should import '../extension.bundle.ts'. At design-time they live in tests/ and so will pick up this file (extension.bundle.ts).
// At runtime the tests live in dist/tests and will therefore pick up the main webpack bundle at dist/extension.bundle.js.
export * from 'vscode-azureextensionui';
export { parseError } from 'vscode-azureextensionui';
export { emulatorPassword, isWindows } from './src/constants';
export { parseDocDBConnectionString } from './src/docdb/docDBConnectionStrings';
export { activateInternal, deactivateInternal } from './src/extension';
export { ext } from './src/extensionVariables';
export { connectToMongoClient } from './src/mongo/connectToMongoClient';
export { MongoCommand } from './src/mongo/MongoCommand';
export { addDatabaseToAccountConnectionString, getDatabaseNameFromConnectionString } from './src/mongo/mongoConnectionStrings';
export { getAllCommandsFromText, getCommandFromTextAtLocation } from './src/mongo/MongoScrapbook';
export { MongoShell } from './src/mongo/MongoShell';
export { IDatabaseInfo } from './src/mongo/tree/MongoAccountTreeItem';
export { AttachedAccountsTreeItem, MONGO_CONNECTION_EXPECTED } from './src/tree/AttachedAccountsTreeItem';
export { AzureAccountTreeItemWithAttached } from './src/tree/AzureAccountTreeItemWithAttached';
export * from './src/extension';
export * from './src/extensionVariables';
export * from './src/utils/array';
export { improveError } from './src/utils/improveError';
export { randomUtils } from './src/utils/randomUtils';
export { rejectOnTimeout, valueOnTimeout } from './src/utils/timeout';
export { getDocumentTreeItemLabel, IDisposable } from './src/utils/vscodeUtils';
export { wrapError } from './src/utils/wrapError';
// NOTE: The auto-fix action "source.organizeImports" does weird things with this file, but there doesn't seem to be a way to disable it on a per-file basis so we'll just let it happen

Просмотреть файл

@ -3,10 +3,13 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// tslint:disable:no-implicit-dependencies (this allows the use of dev dependencies)
import * as cp from 'child_process';
import * as gulp from 'gulp';
import * as path from 'path';
import { gulp_installAzureAccount, gulp_webpack } from 'vscode-azureextensiondev';
import { Stream } from "stream";
import { gulp_installAzureAccount, gulp_installVSCodeExtension, gulp_webpack } from 'vscode-azureextensiondev';
function test(): cp.ChildProcess {
const env = process.env;
@ -16,6 +19,10 @@ function test(): cp.ChildProcess {
return cp.spawn('node', ['./node_modules/vscode/bin/test'], { stdio: 'inherit', env });
}
function gulp_installCosmosDBExtension(): Promise<void> | Stream {
return gulp_installVSCodeExtension('0.12.2', 'ms-azuretools', 'cosmosdb');
}
exports['webpack-dev'] = () => gulp_webpack('development');
exports['webpack-prod'] = () => gulp_webpack('production');
exports.test = gulp.series(gulp_installAzureAccount, test);
exports.test = gulp.series(gulp_installAzureAccount, gulp_installCosmosDBExtension, test);

Просмотреть файл

@ -16,7 +16,7 @@ let perfStats = {
Object.defineProperty(exports, "__esModule", { value: true });
const ignoreBundle = !/^(false|0)?$/i.test(process.env.AZCODE_COSMOSDB_IGNORE_BUNDLE || '');
const ignoreBundle = !/^(false|0)?$/i.test(process.env.AZCODE_COSMOSDB_GRAPH_IGNORE_BUNDLE || '');
const extensionPath = ignoreBundle ? "./out/src/extension" : "./dist/extension.bundle";
const extension = require(extensionPath);

424
package-lock.json сгенерированный
Просмотреть файл

@ -1,30 +1,9 @@
{
"name": "vscode-cosmosdb",
"version": "0.12.3-alpha",
"name": "vscode-cosmosdbgraph",
"version": "0.1.0-alpha",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/bluebird": {
"version": "3.5.29",
"resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.29.tgz",
"integrity": "sha512-kmVtnxTuUuhCET669irqQmPAez4KFnFVKvpleVRyfC3g+SHD1hIkFZcWLim9BVcwUBLO59o8VZE4yGCmTif8Yw==",
"dev": true
},
"@types/bson": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.0.tgz",
"integrity": "sha512-pq/rqJwJWkbS10crsG5bgnrisL8pML79KlMKQMoQwLUjlPAkrUHMvHJ3oGwE7WHR61Lv/nadMwXVAD2b+fpD8Q==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/caseless": {
"version": "0.12.2",
"resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.2.tgz",
"integrity": "sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w==",
"dev": true
},
"@types/d3": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@types/d3/-/d3-5.0.0.tgz",
@ -285,21 +264,6 @@
"@types/d3-selection": "*"
}
},
"@types/documentdb": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/@types/documentdb/-/documentdb-1.10.5.tgz",
"integrity": "sha512-FHQV9Nc1ffrLkQxO0zFlDCRPyHZtuKmAAuJIi278COhtkKBuBRuKOzoO3JlT0yfUrivPjAzNae+gh9fS++r0Ag==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/events": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz",
"integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==",
"dev": true
},
"@types/fs-extra": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-4.0.8.tgz",
@ -315,86 +279,18 @@
"integrity": "sha512-MHmwBtCb7OCv1DSivz2UNJXPGU/1btAWRKlqJ2saEhVJkpkvqHMMaOpKg0v4sAbDWSQekHGvPVMM8nQ+Jen03Q==",
"dev": true
},
"@types/glob": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
"integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==",
"dev": true,
"requires": {
"@types/events": "*",
"@types/minimatch": "*",
"@types/node": "*"
}
},
"@types/keytar": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/keytar/-/keytar-4.0.1.tgz",
"integrity": "sha512-loKBID6UL4QjhD2scuvv6oAPlQ/WAY7aYTDyKlKo7fIgriLS8EZExqT567cHL5CY6si51MRoX1+r3mitD3eYrA==",
"dev": true
},
"@types/minimatch": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
"dev": true
},
"@types/mocha": {
"version": "5.2.5",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz",
"integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==",
"dev": true
},
"@types/mongodb": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.3.3.tgz",
"integrity": "sha512-ymI6OZB4kqaSgLDFn7PYGNC+BmwbKPuw88F+gr9SGyAltcSKI6nYf+rj8hrHEsypnjtT5rA+dnmjXdPSgXgSgQ==",
"dev": true,
"requires": {
"@types/bson": "*",
"@types/node": "*"
}
},
"@types/node": {
"version": "10.17.17",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.17.tgz",
"integrity": "sha512-gpNnRnZP3VWzzj5k3qrpRC6Rk3H/uclhAVo1aIvwzK5p5cOrs9yEyQ8H/HBsBY0u5rrWxXEiVPQ0dEB6pkjE8Q==",
"dev": true
},
"@types/request": {
"version": "2.48.3",
"resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.3.tgz",
"integrity": "sha512-3Wo2jNYwqgXcIz/rrq18AdOZUQB8cQ34CXZo+LUwPJNpvRAL86+Kc2wwI8mqpz9Cr1V+enIox5v+WZhy/p3h8w==",
"dev": true,
"requires": {
"@types/caseless": "*",
"@types/node": "*",
"@types/tough-cookie": "*",
"form-data": "^2.5.0"
},
"dependencies": {
"form-data": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
"dev": true,
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
}
}
}
},
"@types/request-promise": {
"version": "4.1.44",
"resolved": "https://registry.npmjs.org/@types/request-promise/-/request-promise-4.1.44.tgz",
"integrity": "sha512-RId7eFsUKxfal1LirDDIcOp9u3MM3NXFDBcC3sqIMcmu7f4U6DsCEMD8RbLZtnPrQlN5Jc79di/WPsIEDO4keg==",
"dev": true,
"requires": {
"@types/bluebird": "*",
"@types/request": "*"
}
},
"@types/socket.io": {
"version": "1.4.40",
"resolved": "https://registry.npmjs.org/@types/socket.io/-/socket.io-1.4.40.tgz",
@ -410,12 +306,6 @@
"integrity": "sha512-Vs55Kq8F+OWvy1RLA31rT+cAyemzgm0EWNeax6BWF8H7QiiOYMJIdcwSDdm5LVgfEkoepsWkS+40+WNb7BUMbg==",
"dev": true
},
"@types/tough-cookie": {
"version": "2.3.5",
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.5.tgz",
"integrity": "sha512-SCcK7mvGi3+ZNz833RRjFIxrn4gI1PPR3NtuIS+6vMkvmsGjosqTJwRt5bAEFLRz+wtJMWv8+uOnZf2hi2QXTg==",
"dev": true
},
"@webassemblyjs/ast": {
"version": "1.7.11",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.7.11.tgz",
@ -600,15 +490,6 @@
"integrity": "sha512-FZdkNBDqBRHKQ2MEbSC17xnPFOhZxeJ2YGSfr2BKf3sujG49Qe3bB+rGCwQfIaA7WHnGeGkSijX4FuBCdrzW/g==",
"dev": true
},
"JSONStream": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz",
"integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==",
"requires": {
"jsonparse": "^1.2.0",
"through": ">=2.2.7 <3"
}
},
"accepts": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz",
@ -619,9 +500,9 @@
}
},
"acorn": {
"version": "5.7.3",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz",
"integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==",
"version": "5.7.4",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz",
"integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==",
"dev": true
},
"acorn-dynamic-import": {
@ -754,17 +635,6 @@
"integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=",
"dev": true
},
"antlr4ts": {
"version": "0.4.1-alpha.0",
"resolved": "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.4.1-alpha.0.tgz",
"integrity": "sha1-rFcX8w8++jYXsATo/0+GC5x9TSA="
},
"antlr4ts-cli": {
"version": "0.4.0-canary.37504efa",
"resolved": "https://registry.npmjs.org/antlr4ts-cli/-/antlr4ts-cli-0.4.0-canary.37504efa.tgz",
"integrity": "sha512-Z97vuqOzUmuHq+6pDU3bKIL6LYvs4uWs0eBWi3Ju/mt2UzKQRqchxalRgceJR6RtPieARxWJoBhCU2kOGmiJ2Q==",
"dev": true
},
"anymatch": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz",
@ -1229,15 +1099,6 @@
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
},
"azure-arm-cosmosdb": {
"version": "1.1.2",
"resolved": "http://registry.npmjs.org/azure-arm-cosmosdb/-/azure-arm-cosmosdb-1.1.2.tgz",
"integrity": "sha512-NdjUeSoNzV2Ljajomy7mQW8WrbysGg6jPpTGztlpyLgGCBFMO9llvzKCoRTNMs9Van50lrJrmcbhbJNFn3PPjw==",
"requires": {
"ms-rest": "^2.3.2",
"ms-rest-azure": "^2.5.5"
}
},
"azure-arm-resource": {
"version": "3.0.0-preview",
"resolved": "https://registry.npmjs.org/azure-arm-resource/-/azure-arm-resource-3.0.0-preview.tgz",
@ -1398,11 +1259,6 @@
"callsite": "1.0.0"
}
},
"big-integer": {
"version": "1.6.40",
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.40.tgz",
"integrity": "sha512-CjhtJp0BViLzP1ZkEnoywjgtFQXS2pomKjAJtIISTCnuHILkLcAXLdFLG/nxsHc4s9kJfc+82Xpg8WNyhfACzQ=="
},
"big.js": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
@ -1415,11 +1271,6 @@
"integrity": "sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==",
"dev": true
},
"binary-search-bounds": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/binary-search-bounds/-/binary-search-bounds-2.0.3.tgz",
"integrity": "sha1-X/hhbW3SylOIvIWy1iZuK52lAtw="
},
"bl": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
@ -1584,11 +1435,6 @@
"pako": "~1.0.5"
}
},
"bson": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/bson/-/bson-1.1.3.tgz",
"integrity": "sha512-TdiJxMVnodVS7r0BdL42y/pqC9cL2iKynVwA0Ho3qbsQYr428veL3l7BQyuqiw+Q5SqqoT0m4srSY/BlZ9AxXg=="
},
"buffer": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz",
@ -2471,14 +2317,6 @@
"resolved": "https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz",
"integrity": "sha1-YfsWzcEnSzyayq/+n8ad+HIKK2Q="
},
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
@ -2732,28 +2570,6 @@
"path-type": "^3.0.0"
}
},
"documentdb": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/documentdb/-/documentdb-1.15.0.tgz",
"integrity": "sha512-a9Ji9ST4xypzQSKmohxsURQRz+Hg4E3KgmaJmAJf3s4IcNt7I7Ln5TyAhXTwPtGo1UjjHxV6L0COosnlG7eVCA==",
"requires": {
"big-integer": "^1.6.25",
"binary-search-bounds": "2.0.3",
"debug": "^4.1.0",
"int64-buffer": "^0.1.9",
"priorityqueuejs": "1.0.0",
"semaphore": "1.0.5",
"tunnel": "0.0.5",
"underscore": "1.8.3"
},
"dependencies": {
"underscore": {
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
"integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI="
}
}
},
"dom-serializer": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz",
@ -3130,6 +2946,7 @@
"version": "3.3.4",
"resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz",
"integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=",
"dev": true,
"requires": {
"duplexer": "~0.1.1",
"from": "~0",
@ -3581,7 +3398,8 @@
"from": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz",
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4="
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=",
"dev": true
},
"from2": {
"version": "2.3.0",
@ -5097,11 +4915,6 @@
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"dev": true
},
"int64-buffer": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/int64-buffer/-/int64-buffer-0.1.10.tgz",
"integrity": "sha1-J3siiofZWtd30HwTgyAiQGpHNCM="
},
"interpret": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz",
@ -5465,11 +5278,6 @@
}
}
},
"jsonc-parser": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.0.2.tgz",
"integrity": "sha512-TSU435K5tEKh3g7bam1AFf+uZrISheoDsLlpmAo6wWZYqjsnd09lHYK1Qo+moK4Ikifev1Gdpa69g4NELKnCrQ=="
},
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
@ -5478,11 +5286,6 @@
"graceful-fs": "^4.1.6"
}
},
"jsonparse": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz",
"integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA="
},
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
@ -5520,9 +5323,9 @@
}
},
"kind-of": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
"dev": true
},
"last-run": {
@ -5670,22 +5473,12 @@
"integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=",
"dev": true
},
"lodash.isfunction": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz",
"integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw=="
},
"lodash.isplainobject": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
"integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=",
"dev": true
},
"lodash.transform": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.transform/-/lodash.transform-4.6.0.tgz",
"integrity": "sha1-EjBkIvYzJK7YSD0/ODMrX2cFR6A="
},
"lodash.union": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz",
@ -5744,7 +5537,8 @@
"map-stream": {
"version": "0.1.0",
"resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz",
"integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ="
"integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=",
"dev": true
},
"map-visit": {
"version": "1.0.0",
@ -6115,76 +5909,6 @@
"resolved": "https://registry.npmjs.org/moment/-/moment-2.23.0.tgz",
"integrity": "sha512-3IE39bHVqFbWWaPOMHZF98Q9c3LDKGTmypMiTM2QygGXXElkFWIH7GxfmlwmY2vwa+wmNsoYZmG2iusf1ZjJoA=="
},
"mongodb": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.3.2.tgz",
"integrity": "sha512-fqJt3iywelk4yKu/lfwQg163Bjpo5zDKhXiohycvon4iQHbrfflSAz9AIlRE6496Pm/dQKQK5bMigdVo2s6gBg==",
"requires": {
"bson": "^1.1.1",
"require_optional": "^1.0.1",
"safe-buffer": "^5.1.2"
},
"dependencies": {
"bson": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/bson/-/bson-1.1.1.tgz",
"integrity": "sha512-jCGVYLoYMHDkOsbwJZBCqwMHyH4c+wzgI9hG7Z6SZJRXWr+x58pdIbm2i9a/jFGCkRJqRUr8eoI7lDWa0hTkxg=="
}
}
},
"mongodb-extended-json": {
"version": "1.10.1",
"resolved": "https://registry.npmjs.org/mongodb-extended-json/-/mongodb-extended-json-1.10.1.tgz",
"integrity": "sha512-2J+MMnahqaqBXSIVYwEUV9qwJKRtkOlr6qEKPs4aHKvOpyfucjdBWORXinn/Ez1Nwa5sVXak+r8lfGliXd2UPg==",
"requires": {
"JSONStream": "^1.1.1",
"async": "^2.0.1",
"bson": "^1.0.1",
"event-stream": "^4.0.1",
"lodash.isfunction": "^3.0.6",
"lodash.transform": "^4.6.0",
"moment": "^2.10.6",
"raf": "^3.1.0"
},
"dependencies": {
"event-stream": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-4.0.1.tgz",
"integrity": "sha512-qACXdu/9VHPBzcyhdOWR5/IahhGMf0roTeZJfzz077GwylcDd90yOHLouhmv7GJ5XzPi6ekaQWd8AvPP2nOvpA==",
"requires": {
"duplexer": "^0.1.1",
"from": "^0.1.7",
"map-stream": "0.0.7",
"pause-stream": "^0.0.11",
"split": "^1.0.1",
"stream-combiner": "^0.2.2",
"through": "^2.3.8"
}
},
"map-stream": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz",
"integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg="
},
"split": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
"requires": {
"through": "2"
}
},
"stream-combiner": {
"version": "0.2.2",
"resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
"integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=",
"requires": {
"duplexer": "~0.1.1",
"through": "~2.3.4"
}
}
}
},
"move-concurrently": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
@ -6202,7 +5926,8 @@
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
"dev": true
},
"ms-rest": {
"version": "2.3.8",
@ -6402,11 +6127,6 @@
}
}
},
"node-uuid": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz",
"integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc="
},
"node.extend": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.1.8.tgz",
@ -6928,6 +6648,7 @@
"version": "0.0.11",
"resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
"integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=",
"dev": true,
"requires": {
"through": "~2.3"
}
@ -7021,11 +6742,6 @@
"integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=",
"dev": true
},
"priorityqueuejs": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/priorityqueuejs/-/priorityqueuejs-1.0.0.tgz",
"integrity": "sha1-LuTyPCVgkT4IwHzlzN1t498sWvg="
},
"process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@ -7138,14 +6854,6 @@
"inherits": "~2.0.0"
}
},
"raf": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
"integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==",
"requires": {
"performance-now": "^2.1.0"
}
},
"randomatic": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz",
@ -7396,27 +7104,6 @@
"uuid": "^3.3.2"
}
},
"request-promise": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.5.tgz",
"integrity": "sha512-ZgnepCykFdmpq86fKGwqntyTiUrHycALuGggpyCZwMvGaZWgxW6yagT0FHkgo5LzYvOaCNvxYwWYIjevSH1EDg==",
"dev": true,
"requires": {
"bluebird": "^3.5.0",
"request-promise-core": "1.1.3",
"stealthy-require": "^1.1.1",
"tough-cookie": "^2.3.3"
}
},
"request-promise-core": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz",
"integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==",
"dev": true,
"requires": {
"lodash": "^4.17.15"
}
},
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@ -7429,15 +7116,6 @@
"integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
"dev": true
},
"require_optional": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz",
"integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==",
"requires": {
"resolve-from": "^2.0.0",
"semver": "^5.1.0"
}
},
"requires-port": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
@ -7480,11 +7158,6 @@
"global-modules": "^1.0.0"
}
},
"resolve-from": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz",
"integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c="
},
"resolve-options": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-1.1.0.tgz",
@ -7573,11 +7246,6 @@
"commander": "~2.8.1"
}
},
"semaphore": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/semaphore/-/semaphore-1.0.5.tgz",
"integrity": "sha1-tJJXbmavGT25XWXiXsU/Xxl5jWA="
},
"semver": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
@ -8016,6 +7684,7 @@
"version": "0.3.3",
"resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz",
"integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=",
"dev": true,
"requires": {
"through": "2"
}
@ -8098,12 +7767,6 @@
}
}
},
"stealthy-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
"integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=",
"dev": true
},
"stream-browserify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz",
@ -8118,6 +7781,7 @@
"version": "0.0.4",
"resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz",
"integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=",
"dev": true,
"requires": {
"duplexer": "~0.1.1"
}
@ -9882,53 +9546,6 @@
"applicationinsights": "1.4.0"
}
},
"vscode-json-languageservice": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-3.2.1.tgz",
"integrity": "sha512-ee9MJ70/xR55ywvm0bZsDLhA800HCRE27AYgMNTU14RSg20Y+ngHdQnUt6OmiTXrQDI/7sne6QUOtHIN0hPQYA==",
"requires": {
"jsonc-parser": "^2.0.2",
"vscode-languageserver-types": "^3.13.0",
"vscode-nls": "^4.0.0",
"vscode-uri": "^1.0.6"
}
},
"vscode-jsonrpc": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz",
"integrity": "sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg=="
},
"vscode-languageclient": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-4.4.2.tgz",
"integrity": "sha512-9TUzsg1UM6n1UEyPlWbDf7tK1wJAK7UGFRmGDN8sz4KmbbDiVRh6YicaB/5oRSVTpuV47PdJpYlOl3SJ0RiK1Q==",
"requires": {
"vscode-languageserver-protocol": "^3.10.3"
}
},
"vscode-languageserver": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-4.4.2.tgz",
"integrity": "sha512-61y8Raevi9EigDgg9NelvT9cUAohiEbUl1LOwQQgOCAaNX62yKny/ddi0uC+FUTm4CzsjhBu+06R+vYgfCYReA==",
"requires": {
"vscode-languageserver-protocol": "^3.10.3",
"vscode-uri": "^1.0.5"
}
},
"vscode-languageserver-protocol": {
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz",
"integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==",
"requires": {
"vscode-jsonrpc": "^4.0.0",
"vscode-languageserver-types": "3.14.0"
}
},
"vscode-languageserver-types": {
"version": "3.14.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz",
"integrity": "sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A=="
},
"vscode-nls": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-4.0.0.tgz",
@ -9944,11 +9561,6 @@
"https-proxy-agent": "^2.2.1"
}
},
"vscode-uri": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.6.tgz",
"integrity": "sha512-sLI2L0uGov3wKVb9EB+vIQBl9tVP90nqRvxSoJ35vI3NjxE8jfsE5DSOhWgSunHSZmKS4OCi2jrtfxK7uyp2ww=="
},
"vso-node-api": {
"version": "6.1.2-preview",
"resolved": "https://registry.npmjs.org/vso-node-api/-/vso-node-api-6.1.2-preview.tgz",

Просмотреть файл

@ -1,10 +1,10 @@
{
"name": "vscode-cosmosdb",
"version": "0.12.3-alpha",
"name": "vscode-cosmosdbgraph",
"version": "0.1.0-alpha",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"publisher": "ms-azuretools",
"displayName": "Azure Cosmos DB",
"description": "Create, browse, and update globally distributed, multi-model databases in Azure.",
"displayName": "Azure Cosmos DB Graph",
"description": "View Cosmos DB Graph databases in Azure.",
"engines": {
"vscode": "^1.31.0"
},
@ -18,786 +18,26 @@
],
"keywords": [
"Cosmos DB",
"DocumentDB",
"Graph",
"Gremlin",
"MongoDB"
"Gremlin"
],
"preview": true,
"homepage": "https://github.com/microsoft/vscode-cosmosdb/blob/master/README.md",
"homepage": "https://github.com/microsoft/vscode-cosmosdbgraph/blob/master/README.md",
"bugs": {
"url": "https://github.com/microsoft/vscode-cosmosdb/issues"
"url": "https://github.com/microsoft/vscode-cosmosdbgraph/issues"
},
"license": "SEE LICENSE IN LICENSE.md",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode-cosmosdb"
"url": "https://github.com/microsoft/vscode-cosmosdbgraph"
},
"main": "./main",
"activationEvents": [
"onLanguage:mongo",
"onView:cosmosDBExplorer",
"onCommand:cosmosDB.attachDatabaseAccount",
"onCommand:cosmosDB.attachEmulator",
"onCommand:cosmosDB.createAccount",
"onCommand:cosmosDB.deleteAccount",
"onCommand:cosmosDB.detachDatabaseAccount",
"onCommand:cosmosDB.createMongoDatabase",
"onCommand:cosmosDB.createMongoCollection",
"onCommand:cosmosDB.createMongoDocument",
"onCommand:cosmosDB.createDocDBDatabase",
"onCommand:cosmosDB.createDocDBCollection",
"onCommand:cosmosDB.createDocDBDocument",
"onCommand:cosmosDB.createDocDBStoredProcedure",
"onCommand:cosmosDB.createGraphDatabase",
"onCommand:cosmosDB.createGraph",
"onCommand:cosmosDB.connectMongoDB",
"onCommand:cosmosDB.deleteMongoDB",
"onCommand:cosmosDB.deleteMongoCollection",
"onCommand:cosmosDB.deleteMongoDocument",
"onCommand:cosmosDB.deleteDocDBDatabase",
"onCommand:cosmosDB.deleteDocDBCollection",
"onCommand:cosmosDB.deleteDocDBDocument",
"onCommand:cosmosDB.deleteGraphDatabase",
"onCommand:cosmosDB.deleteGraph",
"onCommand:cosmosDB.executeAllMongoCommands",
"onCommand:cosmosDB.executeMongoCommand",
"onCommand:cosmosDB.importDocument",
"onCommand:cosmosDB.newMongoScrapbook",
"onCommand:cosmosDB.update",
"onCommand:cosmosDB.openDocument",
"onCommand:cosmosDB.openStoredProcedure",
"onCommand:cosmosDB.openCollection",
"onCommand:cosmosDB.loadMore",
"onCommand:cosmosDB.refresh",
"onCommand:cosmosDB.openInPortal",
"onCommand:cosmosDB.copyConnectionString",
"onCommand:cosmosDB.launchMongoShell",
"onCommand:cosmosDB.openGraphExplorer"
],
"activationEvents": [],
"contributes": {
"viewsContainers": {
"activitybar": [
{
"id": "azure",
"title": "Azure",
"icon": "resources/azure.svg"
}
]
},
"views": {
"azure": [
{
"id": "cosmosDBExplorer",
"name": "Cosmos DB",
"when": "config.cosmosDB.showExplorer == true"
}
]
},
"languages": [
{
"id": "mongo",
"aliases": [
"Mongo Scrapbook",
"mongo"
],
"extensions": [
".mongo"
],
"firstLine": "^#!/.*\\bmongo*\\b",
"configuration": "./grammar/configuration.json"
}
],
"grammars": [
{
"language": "mongo",
"scopeName": "source.mongo.js",
"path": "./grammar/JavaScript.tmLanguage.json"
},
{
"scopeName": "source.mongo.js.regexp",
"path": "./grammar/Regular Expressions (JavaScript).tmLanguage"
}
],
"commands": [
{
"command": "cosmosDB.selectSubscriptions",
"title": "Select Subscriptions...",
"icon": {
"light": "resources/icons/light/filter.svg",
"dark": "resources/icons/dark/filter.svg"
}
},
{
"category": "MongoDB",
"command": "cosmosDB.executeMongoCommand",
"title": "Execute MongoDB Command"
},
{
"category": "MongoDB",
"command": "cosmosDB.executeAllMongoCommands",
"title": "Execute All MongoDB Commands"
},
{
"category": "MongoDB",
"command": "cosmosDB.launchMongoShell",
"title": "Launch Shell"
},
{
"category": "Cosmos DB",
"command": "cosmosDB.attachDatabaseAccount",
"title": "Attach Database Account...",
"icon": {
"light": "resources/icons/light/plug.svg",
"dark": "resources/icons/dark/plug.svg"
}
},
{
"category": "Cosmos DB",
"command": "cosmosDB.attachEmulator",
"title": "Attach Emulator..."
},
{
"category": "Cosmos DB",
"command": "cosmosDB.createAccount",
"title": "Create Account...",
"icon": {
"light": "resources/icons/light/add.svg",
"dark": "resources/icons/dark/add.svg"
}
},
{
"category": "Cosmos DB",
"command": "cosmosDB.deleteAccount",
"title": "Delete Account..."
},
{
"category": "MongoDB",
"command": "cosmosDB.createMongoDatabase",
"title": "Create Database..."
},
{
"category": "MongoDB",
"command": "cosmosDB.createMongoCollection",
"title": "Create Collection..."
},
{
"category": "MongoDB",
"command": "cosmosDB.createMongoDocument",
"title": "Create Document"
},
{
"category": "Core (SQL)",
"command": "cosmosDB.createDocDBDatabase",
"title": "Create Database..."
},
{
"category": "MongoDB",
"command": "cosmosDB.openCollection",
"title": "Open Collection"
},
{
"category": "Core (SQL)",
"command": "cosmosDB.createDocDBCollection",
"title": "Create Collection..."
},
{
"category": "Core (SQL)",
"command": "cosmosDB.createDocDBDocument",
"title": "Create Document..."
},
{
"category": "Core (SQL)",
"command": "cosmosDB.createDocDBStoredProcedure",
"title": "Create Stored Procedure..."
},
{
"category": "Graph (Gremlin)",
"command": "cosmosDB.createGraphDatabase",
"title": "Create Database..."
},
{
"category": "Graph (Gremlin)",
"command": "cosmosDB.createGraph",
"title": "Create Graph..."
},
{
"category": "Cosmos DB",
"command": "cosmosDB.detachDatabaseAccount",
"title": "Detach"
},
{
"category": "MongoDB",
"command": "cosmosDB.connectMongoDB",
"title": "Connect"
},
{
"category": "MongoDB",
"command": "cosmosDB.deleteMongoDB",
"title": "Delete Database..."
},
{
"category": "MongoDB",
"command": "cosmosDB.deleteMongoCollection",
"title": "Delete Collection..."
},
{
"category": "MongoDB",
"command": "cosmosDB.deleteMongoDocument",
"title": "Delete Document..."
},
{
"category": "Core (SQL)",
"command": "cosmosDB.deleteDocDBDatabase",
"title": "Delete Database..."
},
{
"category": "Core (SQL)",
"command": "cosmosDB.deleteDocDBCollection",
"title": "Delete Collection..."
},
{
"category": "Core (SQL)",
"command": "cosmosDB.deleteDocDBDocument",
"title": "Delete Document..."
},
{
"category": "Core (SQL)",
"command": "cosmosDB.deleteDocDBStoredProcedure",
"title": "Delete Stored Procedure..."
},
{
"category": "Graph (Gremlin)",
"command": "cosmosDB.deleteGraphDatabase",
"title": "Delete Database..."
},
{
"category": "Graph (Gremlin)",
"command": "cosmosDB.deleteGraph",
"title": "Delete Graph..."
},
{
"category": "Graph (Gremlin)",
"command": "cosmosDB.openGraphExplorer",
"title": "Open Graph Explorer"
},
{
"category": "Cosmos DB",
"command": "cosmosDB.newMongoScrapbook",
"title": "New Mongo Scrapbook",
"icon": {
"light": "resources/icons/light/new-file.svg",
"dark": "resources/icons/dark/new-file.svg"
}
},
{
"category": "Cosmos DB",
"command": "cosmosDB.refresh",
"title": "Refresh",
"icon": {
"light": "resources/icons/light/refresh.svg",
"dark": "resources/icons/dark/refresh.svg"
}
},
{
"category": "Cosmos DB",
"command": "cosmosDB.openInPortal",
"title": "Open in Portal"
},
{
"category": "Cosmos DB",
"command": "cosmosDB.copyConnectionString",
"title": "Copy Connection String"
},
{
"category": "Cosmos DB",
"command": "cosmosDB.update",
"title": "Update to Cloud",
"icon": {
"light": "/resources/icons/theme-agnostic/UpdateOutline.svg",
"dark": "/resources/icons/theme-agnostic/UpdateOutline.svg"
}
},
{
"category": "Core (SQL)",
"command": "cosmosDB.loadMore",
"title": "Load More"
},
{
"category": "Cosmos DB",
"command": "cosmosDB.openDocument",
"title": "Open Document"
},
{
"category": "Cosmos DB",
"command": "cosmosDB.importDocument",
"title": "Import Document into a Collection..."
},
{
"category": "Cosmos DB",
"command": "cosmosDB.openStoredProcedure",
"title": "Open Stored Procedure"
}
],
"menus": {
"editor/context": [
{
"command": "cosmosDB.executeMongoCommand",
"when": "resourceLangId==mongo"
},
{
"command": "cosmosDB.executeAllMongoCommands",
"when": "resourceLangId==mongo"
},
{
"command": "cosmosDB.update",
"when": "resourceFilename==cosmos-result.json"
},
{
"command": "cosmosDB.update",
"when": "resourceFilename=~/(.*cosmos-document[.]json)/"
},
{
"command": "cosmosDB.update",
"when": "resourceFilename=~/(.*cosmos-collection[.]json)/"
},
{
"command": "cosmosDB.update",
"when": "resourceFilename=~/(.*cosmos-stored-procedure[.]js)/"
},
{
"command": "cosmosDB.importDocument",
"when": "resourceLangId==json"
}
],
"editor/title": [
{
"command": "cosmosDB.update",
"when": "resourceFilename==cosmos-result.json",
"group": "navigation"
},
{
"command": "cosmosDB.update",
"when": "resourceFilename=~/(.*cosmos-document[.]json)/",
"group": "navigation"
},
{
"command": "cosmosDB.update",
"when": "resourceFilename=~/(.*cosmos-collection[.]json)/",
"group": "navigation"
},
{
"command": "cosmosDB.update",
"when": "resourceFilename=~/(.*cosmos-stored-procedure[.]js)/",
"group": "navigation"
}
],
"view/title": [
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer",
"group": "navigation"
},
{
"command": "cosmosDB.createAccount",
"when": "view == cosmosDBExplorer",
"group": "navigation"
},
{
"command": "cosmosDB.attachDatabaseAccount",
"when": "view == cosmosDBExplorer",
"group": "navigation"
},
{
"command": "cosmosDB.newMongoScrapbook",
"when": "view == cosmosDBExplorer",
"group": "navigation"
}
],
"view/item/context": [
{
"command": "cosmosDB.selectSubscriptions",
"when": "view == cosmosDBExplorer && viewItem == azureextensionui.azureSubscription",
"group": "inline"
},
{
"command": "cosmosDB.createAccount",
"when": "view == cosmosDBExplorer && viewItem == azureextensionui.azureSubscription",
"group": "1@1"
},
{
"command": "cosmosDB.openInPortal",
"when": "view == cosmosDBExplorer && viewItem == azureextensionui.azureSubscription",
"group": "1@2"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == azureextensionui.azureSubscription",
"group": "2@1"
},
{
"command": "cosmosDB.deleteAccount",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBMongoServer"
},
{
"command": "cosmosDB.deleteAccount",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentServer"
},
{
"command": "cosmosDB.deleteAccount",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphAccount"
},
{
"command": "cosmosDB.deleteAccount",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBTableAccount"
},
{
"command": "cosmosDB.createMongoDatabase",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBMongoServerAttached"
},
{
"command": "cosmosDB.createMongoDatabase",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBMongoServer"
},
{
"command": "cosmosDB.createMongoDocument",
"when": "view == cosmosDBExplorer && viewItem == MongoCollection"
},
{
"command": "cosmosDB.createMongoCollection",
"when": "view == cosmosDBExplorer && viewItem == mongoDb"
},
{
"command": "cosmosDB.createDocDBDocument",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentsGroup"
},
{
"command": "cosmosDB.createDocDBStoredProcedure",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBStoredProceduresGroup"
},
{
"command": "cosmosDB.createDocDBCollection",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentDatabase"
},
{
"command": "cosmosDB.createDocDBDatabase",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentServer"
},
{
"command": "cosmosDB.createDocDBDatabase",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentServerAttached"
},
{
"command": "cosmosDB.createGraphDatabase",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphAccount"
},
{
"command": "cosmosDB.createGraphDatabase",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphAccountAttached"
},
{
"command": "cosmosDB.createGraph",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphDatabase"
},
{
"command": "cosmosDB.detachDatabaseAccount",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBMongoServerAttached"
},
{
"command": "cosmosDB.detachDatabaseAccount",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphAccountAttached"
},
{
"command": "cosmosDB.detachDatabaseAccount",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentServerAttached"
},
{
"command": "cosmosDB.detachDatabaseAccount",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBTableAccountAttached"
},
{
"command": "cosmosDB.connectMongoDB",
"when": "view == cosmosDBExplorer && viewItem == mongoDb"
},
{
"command": "cosmosDB.deleteMongoDB",
"when": "view == cosmosDBExplorer && viewItem == mongoDb"
},
{
"command": "cosmosDB.deleteMongoCollection",
"when": "view == cosmosDBExplorer && viewItem == MongoCollection"
},
{
"command": "cosmosDB.deleteMongoDocument",
"when": "view == cosmosDBExplorer && viewItem == MongoDocument"
},
{
"command": "cosmosDB.deleteDocDBCollection",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentCollection"
},
{
"command": "cosmosDB.deleteDocDBDocument",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocument"
},
{
"command": "cosmosDB.deleteDocDBStoredProcedure",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBStoredProcedure"
},
{
"command": "cosmosDB.deleteDocDBDatabase",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentDatabase"
},
{
"command": "cosmosDB.deleteGraphDatabase",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphDatabase"
},
{
"command": "cosmosDB.deleteGraph",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraph"
},
{
"command": "cosmosDB.attachDatabaseAccount",
"when": "view == cosmosDBExplorer && viewItem =~ /^cosmosDBAttachedAccounts/"
},
{
"command": "cosmosDB.attachEmulator",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBAttachedAccountsWithEmulator"
},
{
"command": "cosmosDB.openInPortal",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBMongoServer"
},
{
"command": "cosmosDB.openInPortal",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBTableAccount"
},
{
"command": "cosmosDB.openInPortal",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentServer"
},
{
"command": "cosmosDB.openInPortal",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphAccount"
},
{
"command": "cosmosDB.openCollection",
"when": "view == cosmosDBExplorer && viewItem == MongoCollection"
},
{
"command": "cosmosDB.copyConnectionString",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBMongoServer"
},
{
"command": "cosmosDB.copyConnectionString",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphAccount"
},
{
"command": "cosmosDB.copyConnectionString",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentServer"
},
{
"command": "cosmosDB.copyConnectionString",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBTableAccount"
},
{
"command": "cosmosDB.copyConnectionString",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBMongoServerAttached"
},
{
"command": "cosmosDB.copyConnectionString",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphAccountAttached"
},
{
"command": "cosmosDB.copyConnectionString",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentServerAttached"
},
{
"command": "cosmosDB.copyConnectionString",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBTableAccountAttached"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBMongoServer"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentCollection"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentDatabase"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentsGroup"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBStoredProceduresGroup"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentServer"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentServerAttached"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphAccount"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphAccountAttached"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBGraphDatabase"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBMongoServerAttached"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == mongoDb"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem == MongoCollection"
},
{
"command": "cosmosDB.refresh",
"when": "view == cosmosDBExplorer && viewItem =~ /^cosmosDBAttachedAccounts/"
},
{
"command": "cosmosDB.importDocument",
"when": "view == cosmosDBExplorer && viewItem == MongoCollection"
},
{
"command": "cosmosDB.importDocument",
"when": "view == cosmosDBExplorer && viewItem == cosmosDBDocumentCollection"
}
],
"explorer/context": [
{
"command": "cosmosDB.importDocument",
"when": "resourceLangId == json"
}
],
"commandPalette": [
{
"command": "cosmosDB.selectSubscriptions",
"when": "never"
},
{
"command": "cosmosDB.refresh",
"when": "never"
},
{
"command": "cosmosDB.loadMore",
"when": "never"
},
{
"command": "cosmosDB.update",
"when": "never"
},
{
"command": "cosmosDB.executeAllMongoCommands",
"when": "editorLangId == 'mongo'"
},
{
"command": "cosmosDB.executeMongoCommand",
"when": "editorLangId == 'mongo'"
}
]
},
"keybindings": [
{
"command": "cosmosDB.executeMongoCommand",
"key": "ctrl+shift+'",
"mac": "cmd+shift+'",
"when": "editorLangId == 'mongo' && editorTextFocus"
},
{
"command": "cosmosDB.executeAllMongoCommands",
"key": "ctrl+shift+;",
"mac": "cmd+shift+;",
"when": "editorLangId == 'mongo' && editorTextFocus"
},
{
"command": "workbench.view.extension.azure",
"key": "ctrl+shift+a",
"mac": "cmd+shift+a"
}
],
"commands": [],
"configuration": {
"title": "Cosmos DB",
"properties": {
"mongo.shell.path": {
"type": [
"string",
"null"
],
"description": "Full path to folder and executable to start the Mongo shell, needed by some Mongo scrapbook commands. The default is to search in the system path for 'mongo'.",
"default": null
},
"mongo.shell.args": {
"type": "array",
"items": {
"type": "string"
},
"description": "Arguments to pass when starting the Mongo shell.",
"default": [
"--quiet"
]
},
"mongo.shell.timeout": {
"type": "number",
"description": "The duration allowed (in seconds) for the Mongo shell to execute a command. Default value is 30 seconds.",
"default": 30
},
"cosmosDB.showExplorer": {
"type": "boolean",
"default": true,
"description": "Show or hide the Cosmos DB Explorer"
},
"cosmosDB.documentLabelFields": {
"type": "array",
"default": [
"name",
"Name",
"NAME",
"ID",
"UUID",
"Id",
"id",
"_id",
"uuid"
],
"description": "The field values to display as labels in the treeview for Cosmos DB and MongoDB documents, in priority order"
},
"cosmosDB.showSavePrompt": {
"type": "boolean",
"default": true,
"description": "Show warning dialog when uploading a document to the cloud."
},
"cosmosDB.enableOutputTimestamps": {
"type": "boolean",
"default": true,
"description": "Prepends each line displayed in the output channel with a timestamp."
},
"cosmosDB.emulator.mongoPort": {
"type": "integer",
"default": 10255,
"description": "Port to use when connecting to a CosmosDB Mongo Emulator instance"
},
"cosmosDB.emulator.port": {
"type": "integer",
"default": 8081,
"description": "Port to use when connecting to a CosmosDB Emulator instance"
},
"cosmosDB.graph.maxVertices": {
"type": "integer",
"default": 300,
@ -887,7 +127,6 @@
"postinstall": "node ./node_modules/vscode/bin/install",
"pretest": "npm run webpack-prod",
"test": "gulp test",
"update-grammar": "antlr4ts -visitor ./grammar/mongo.g4 -o ./src/mongo/grammar",
"webpack": "npm run build && gulp webpack-dev",
"webpack-prod": "npm run build && gulp webpack-prod",
"webpack-profile": "webpack --profile --json --mode production > webpack-stats.json && echo Use http://webpack.github.io/analyse to analyze the stats",
@ -895,26 +134,17 @@
},
"devDependencies": {
"@types/d3": "5.0.0",
"@types/documentdb": "^1.10.2",
"@types/fs-extra": "^4.0.3",
"@types/glob": "^7.1.1",
"@types/keytar": "4.0.1",
"@types/mocha": "^5.2.5",
"@types/mongodb": "^3.3.2",
"@types/node": "^10.0.0",
"@types/request-promise": "^4.1.44",
"@types/socket.io": "^1.4.32",
"@types/socket.io-client": "^1.4.32",
"antlr4ts-cli": "^0.4.0-alpha.4",
"copy-webpack-plugin": "^4.5.4",
"glob": "^7.1.3",
"gulp": "^4.0.0",
"mocha": "^5.2.0",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi-reporters": "^1.1.7",
"request-promise": "^4.2.4",
"string-replace-webpack-plugin": "^0.1.3",
"ts-loader": "^5.3.0",
"ts-node": "^7.0.1",
"tslint": "^5.7.0",
"tslint-microsoft-contrib": "5.0.1",
@ -926,31 +156,16 @@
"webpack-cli": "^3.1.2"
},
"dependencies": {
"antlr4ts": "^0.4.1-alpha.0",
"azure-arm-cosmosdb": "^1.1.2",
"azure-arm-resource": "^3.0.0-preview",
"bson": "^1.1.3",
"d3": "^3.0.0",
"documentdb": "^1.14.2",
"event-stream": "3.3.4",
"fs-extra": "^4.0.2",
"gremlin": "^2.6.0",
"mongodb": "^3.3.2",
"mongodb-extended-json": "^1.10.0",
"ms-rest": "^2.2.1",
"ms-rest-azure": "^2.3.1",
"node-uuid": "1.4.8",
"socket.io": "^1.7.3",
"socket.io-client": "^1.7.3",
"underscore": "^1.8.3",
"vscode-azureextensionui": "^0.29.9",
"vscode-json-languageservice": "^3.0.8",
"vscode-languageclient": "^4.4.0",
"vscode-languageserver": "^4.4.0",
"vscode-nls": "^4.0.0",
"vscode-uri": "^1.0.1"
"vscode-nls": "^4.0.0"
},
"extensionDependencies": [
"ms-vscode.azure-account"
"ms-vscode.azure-account",
"ms-azuretools.vscode-cosmosdb"
]
}

Двоичные данные
resources/cosmos.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 21 KiB

Просмотреть файл

@ -0,0 +1,14 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { callWithTelemetryAndErrorHandling, IActionContext } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { IGraphConfiguration } from "../../vscode-cosmosdbgraph.api";
export async function openGraphExplorer(config: IGraphConfiguration): Promise<void> {
return await callWithTelemetryAndErrorHandling('api.openGraphExplorer', async (_context: IActionContext) => {
await ext.graphViewsManager.showGraphViewer(config);
});
}

Просмотреть файл

@ -3,79 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export const isWindows: boolean = /^win/.test(process.platform);
import * as assert from 'assert';
import * as fs from 'fs';
import * as path from 'path';
import { ext } from './extensionVariables';
export namespace Links {
export const LocalConnectionDebuggingTips: string = 'https://aka.ms/AA5zah5';
}
export interface IThemedIconPath {
light: string;
dark: string;
}
export function getThemedIconPath(iconName: string): IThemedIconPath {
const a = {
light: path.join(getResourcesPath(), 'icons', 'light', iconName),
dark: path.join(getResourcesPath(), 'icons', 'dark', iconName)
};
assert(fs.existsSync(a.light));
return a;
}
export function getThemeAgnosticIconPath(iconName: string): IThemedIconPath {
const a = {
light: path.join(getResourcesPath(), 'icons', 'theme-agnostic', iconName),
dark: path.join(getResourcesPath(), 'icons', 'theme-agnostic', iconName)
};
assert(fs.existsSync(a.light));
return a;
}
// tslint:disable-next-line: export-name
export function getResourcesPath(): string {
return ext.context.asAbsolutePath('resources');
}
export const defaultBatchSize: number = 50;
export const doubleClickDebounceDelay = 500; //milliseconds
export const defaultStoredProcedure =
`function sample(prefix) {
var collection = getContext().getCollection();
// Query documents and take 1st item.
var isAccepted = collection.queryDocuments(
collection.getSelfLink(),
'SELECT * FROM root r',
function (err, feed, options) {
if (err) throw err;
// Check the feed and if empty, set the body to 'no docs found',
// else take 1st element from feed
if (!feed || !feed.length) {
var response = getContext().getResponse();
response.setBody('no docs found');
}
else {
var response = getContext().getResponse();
var body = { prefix: prefix, feed: feed[0] };
response.setBody(JSON.stringify(body));
}
});
if (!isAccepted) throw new Error('The query was not accepted by the server.');
};` ;
export const emptyPartitionKeyValue = {};
export let emulatorPassword = 'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==';
// https://docs.mongodb.com/manual/mongo/#working-with-the-mongo-shell
export const testDb: string = 'test';

Просмотреть файл

@ -6,171 +6,35 @@
'use strict';
import * as vscode from 'vscode';
import { AzExtTreeDataProvider, AzExtTreeItem, AzureTreeItem, AzureUserInput, callWithTelemetryAndErrorHandling, createApiProvider, createAzExtOutputChannel, createTelemetryReporter, IActionContext, registerCommand, registerEvent, registerUIExtensionVariables } from 'vscode-azureextensionui';
import { AzureUserInput, callWithTelemetryAndErrorHandling, createApiProvider, createAzExtOutputChannel, createTelemetryReporter, IActionContext, registerUIExtensionVariables } from 'vscode-azureextensionui';
import { AzureExtensionApi, AzureExtensionApiProvider } from 'vscode-azureextensionui/api';
import { findTreeItem } from './commands/api/findTreeItem';
import { pickTreeItem } from './commands/api/pickTreeItem';
import { revealTreeItem } from './commands/api/revealTreeItem';
import { importDocuments } from './commands/importDocuments';
import { doubleClickDebounceDelay } from './constants';
import { CosmosEditorManager } from './CosmosEditorManager';
import { DocDBDocumentNodeEditor } from './docdb/editors/DocDBDocumentNodeEditor';
import { registerDocDBCommands } from './docdb/registerDocDBCommands';
import { DocDBAccountTreeItem } from './docdb/tree/DocDBAccountTreeItem';
import { DocDBAccountTreeItemBase } from './docdb/tree/DocDBAccountTreeItemBase';
import { DocDBCollectionTreeItem } from './docdb/tree/DocDBCollectionTreeItem';
import { DocDBDocumentTreeItem } from './docdb/tree/DocDBDocumentTreeItem';
import { openGraphExplorer } from './commands/api/openGraphExplorer';
import { ext } from './extensionVariables';
import { registerGraphCommands } from './graph/registerGraphCommands';
import { GraphAccountTreeItem } from './graph/tree/GraphAccountTreeItem';
import { MongoDocumentNodeEditor } from './mongo/editors/MongoDocumentNodeEditor';
import { registerMongoCommands } from './mongo/registerMongoCommands';
import { setConnectedNode } from './mongo/setConnectedNode';
import { MongoAccountTreeItem } from './mongo/tree/MongoAccountTreeItem';
import { MongoCollectionTreeItem } from './mongo/tree/MongoCollectionTreeItem';
import { MongoDocumentTreeItem } from './mongo/tree/MongoDocumentTreeItem';
import { TableAccountTreeItem } from './table/tree/TableAccountTreeItem';
import { AttachedAccountSuffix } from './tree/AttachedAccountsTreeItem';
import { AzureAccountTreeItemWithAttached } from './tree/AzureAccountTreeItemWithAttached';
import { SubscriptionTreeItem } from './tree/SubscriptionTreeItem';
import { GraphViewsManager } from './graph/GraphViewsManager';
// tslint:disable-next-line: max-func-body-length
export async function activateInternal(context: vscode.ExtensionContext, perfStats: { loadStartTime: number, loadEndTime: number }): Promise<AzureExtensionApiProvider> {
ext.context = context;
ext.reporter = createTelemetryReporter(context);
ext.ui = new AzureUserInput(context.globalState);
const extensionPrefix: string = 'cosmosDB';
ext.outputChannel = createAzExtOutputChannel("Azure Cosmos DB", extensionPrefix);
ext.outputChannel = createAzExtOutputChannel("Azure Cosmos DB Graph", ext.prefix);
context.subscriptions.push(ext.outputChannel);
registerUIExtensionVariables(ext);
// tslint:disable-next-line: max-func-body-length
await callWithTelemetryAndErrorHandling('cosmosDB.activate', async (activateContext: IActionContext) => {
await callWithTelemetryAndErrorHandling('cosmosDBGraph.activate', async (activateContext: IActionContext) => {
activateContext.telemetry.properties.isActivationEvent = 'true';
activateContext.telemetry.measurements.mainFileLoad = (perfStats.loadEndTime - perfStats.loadStartTime) / 1000;
ext.azureAccountTreeItem = new AzureAccountTreeItemWithAttached();
context.subscriptions.push(ext.azureAccountTreeItem);
ext.tree = new AzExtTreeDataProvider(ext.azureAccountTreeItem, 'cosmosDB.loadMore');
ext.treeView = vscode.window.createTreeView('cosmosDBExplorer', { treeDataProvider: ext.tree, showCollapseAll: true });
context.subscriptions.push(ext.treeView);
const editorManager: CosmosEditorManager = new CosmosEditorManager(context.globalState);
registerDocDBCommands(editorManager);
registerGraphCommands();
const codeLensProvider = registerMongoCommands(editorManager);
const accountContextValues: string[] = [GraphAccountTreeItem.contextValue, DocDBAccountTreeItem.contextValue, TableAccountTreeItem.contextValue, MongoAccountTreeItem.contextValue];
registerCommand('cosmosDB.selectSubscriptions', () => vscode.commands.executeCommand("azure-account.selectSubscriptions"));
registerCommand('cosmosDB.createAccount', async (actionContext: IActionContext, node?: SubscriptionTreeItem) => {
if (!node) {
node = await ext.tree.showTreeItemPicker(SubscriptionTreeItem.contextValue, actionContext);
}
await node.createChild(actionContext);
});
registerCommand('cosmosDB.deleteAccount', async (actionContext: IActionContext, node?: AzureTreeItem) => {
if (!node) {
node = await ext.tree.showTreeItemPicker(accountContextValues, actionContext);
}
await node.deleteTreeItem(actionContext);
});
registerCommand('cosmosDB.attachDatabaseAccount', async () => {
await ext.attachedAccountsNode.attachNewAccount();
await ext.tree.refresh(ext.attachedAccountsNode);
});
registerCommand('cosmosDB.attachEmulator', async () => {
await ext.attachedAccountsNode.attachEmulator();
await ext.tree.refresh(ext.attachedAccountsNode);
});
registerCommand('cosmosDB.refresh', async (_actionContext: IActionContext, node?: AzExtTreeItem) => await ext.tree.refresh(node));
registerCommand('cosmosDB.detachDatabaseAccount', async (actionContext: IActionContext, node?: AzureTreeItem) => {
if (!node) {
node = await ext.tree.showTreeItemPicker(accountContextValues.map((val: string) => val += AttachedAccountSuffix), actionContext);
}
if (node instanceof MongoAccountTreeItem) {
if (ext.connectedMongoDB && node.fullId === ext.connectedMongoDB.parent.fullId) {
setConnectedNode(undefined, codeLensProvider);
await node.refresh();
}
}
await ext.attachedAccountsNode.detach(node);
await ext.tree.refresh(ext.attachedAccountsNode);
});
registerCommand('cosmosDB.importDocument', async (actionContext: IActionContext, selectedNode: vscode.Uri | MongoCollectionTreeItem | DocDBCollectionTreeItem, uris: vscode.Uri[]) => {
if (selectedNode instanceof vscode.Uri) {
await importDocuments(actionContext, uris || [selectedNode], undefined);
} else {
await importDocuments(actionContext, undefined, selectedNode);
}
});
registerCommand('cosmosDB.openInPortal', async (actionContext: IActionContext, node?: AzureTreeItem) => {
if (!node) {
node = await ext.tree.showTreeItemPicker(accountContextValues, actionContext);
}
await node.openInPortal();
});
registerCommand('cosmosDB.copyConnectionString', async (actionContext: IActionContext, node?: MongoAccountTreeItem | DocDBAccountTreeItemBase) => {
const message = 'The connection string has been copied to the clipboard';
if (!node) {
node = await ext.tree.showTreeItemPicker(accountContextValues, actionContext);
}
await copyConnectionString(node);
vscode.window.showInformationMessage(message);
});
registerCommand('cosmosDB.openDocument', async (actionContext: IActionContext, node?: MongoDocumentTreeItem | DocDBDocumentTreeItem) => {
if (!node) {
node = await ext.tree.showTreeItemPicker([MongoDocumentTreeItem.contextValue, DocDBDocumentTreeItem.contextValue], actionContext);
}
const editorTabName = node.label + "-cosmos-document.json";
if (node instanceof MongoDocumentTreeItem) {
await editorManager.showDocument(actionContext, new MongoDocumentNodeEditor(node), editorTabName);
} else {
await editorManager.showDocument(actionContext, new DocDBDocumentNodeEditor(node), editorTabName);
}
// tslint:disable-next-line:align
}, doubleClickDebounceDelay);
registerCommand('cosmosDB.update', async (actionContext: IActionContext, uri: vscode.Uri) => await editorManager.updateMatchingNode(actionContext, uri));
registerCommand('cosmosDB.loadMore', async (actionContext: IActionContext, node?: AzExtTreeItem) => await ext.tree.loadMore(node, actionContext));
registerEvent(
'cosmosDB.CosmosEditorManager.onDidSaveTextDocument',
vscode.workspace.onDidSaveTextDocument,
async (actionContext: IActionContext, doc: vscode.TextDocument) => await editorManager.onDidSaveTextDocument(actionContext, doc)
);
registerEvent(
'cosmosDB.onDidChangeConfiguration',
vscode.workspace.onDidChangeConfiguration,
async (actionContext: IActionContext, event: vscode.ConfigurationChangeEvent) => {
actionContext.telemetry.properties.isActivationEvent = "true";
actionContext.errorHandling.suppressDisplay = true;
if (event.affectsConfiguration(ext.settingsKeys.documentLabelFields)) {
await vscode.commands.executeCommand("cosmosDB.refresh");
}
});
ext.graphViewsManager = new GraphViewsManager();
});
return createApiProvider([<AzureExtensionApi>{
findTreeItem,
pickTreeItem,
revealTreeItem,
apiVersion: '1.1.0'
openGraphExplorer,
apiVersion: '1.0.0'
}]);
}
async function copyConnectionString(node: MongoAccountTreeItem | DocDBAccountTreeItemBase): Promise<void> {
await vscode.env.clipboard.writeText(node.connectionString);
}
// this method is called when your extension is deactivated
// tslint:disable-next-line:no-empty
export function deactivateInternal(): void {
// NOOP
}

Просмотреть файл

@ -3,36 +3,20 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ExtensionContext, TreeView } from "vscode";
import { AzExtTreeDataProvider, AzExtTreeItem, IAzExtOutputChannel, IAzureUserInput, ITelemetryReporter } from "vscode-azureextensionui";
import { MongoDatabaseTreeItem } from "./mongo/tree/MongoDatabaseTreeItem";
import { AttachedAccountsTreeItem } from "./tree/AttachedAccountsTreeItem";
import { AzureAccountTreeItemWithAttached } from "./tree/AzureAccountTreeItemWithAttached";
import { ExtensionContext } from "vscode";
import { IAzExtOutputChannel, IAzureUserInput, ITelemetryReporter } from "vscode-azureextensionui";
import { GraphViewsManager } from "./graph/GraphViewsManager";
/**
* Namespace for common variables used throughout the extension. They must be initialized in the activate() method of extension.ts
*/
export namespace ext {
export let connectedMongoDB: MongoDatabaseTreeItem | undefined;
export let ui: IAzureUserInput;
export let context: ExtensionContext;
export let outputChannel: IAzExtOutputChannel;
export let reporter: ITelemetryReporter;
export let tree: AzExtTreeDataProvider;
export let treeView: TreeView<AzExtTreeItem>;
export let attachedAccountsNode: AttachedAccountsTreeItem;
// tslint:disable-next-line: strict-boolean-expressions
export let ignoreBundle: boolean = !/^(false|0)?$/i.test(process.env.AZCODE_COSMOSDB_IGNORE_BUNDLE || '');
export let azureAccountTreeItem: AzureAccountTreeItemWithAttached;
export namespace settingsKeys {
export const mongoShellPath = 'mongo.shell.path';
export const mongoShellArgs = 'mongo.shell.args';
export const documentLabelFields = 'cosmosDB.documentLabelFields';
export const mongoShellTimeout = 'mongo.shell.timeout';
export namespace vsCode {
export const proxyStrictSSL = "http.proxyStrictSSL";
}
}
export let ignoreBundle: boolean = !/^(false|0)?$/i.test(process.env.AZCODE_COSMOSDB_GRAPH_IGNORE_BUNDLE || '');
export let graphViewsManager: GraphViewsManager;
export const prefix: string = 'cosmosDB'; // Intentionally using same prefix as Cosmos DB to maintain backwards compatability of settings
}

Просмотреть файл

@ -1,25 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IGremlinEndpoint } from "./gremlinEndpoints";
export interface GraphConfiguration {
// e.g. https://graphaccount.documents.azure.com:443
documentEndpoint: string;
gremlinEndpoint?: IGremlinEndpoint;
possibleGremlinEndpoints: IGremlinEndpoint[];
key: string;
databaseName: string;
graphName: string;
}
export function areConfigsEqual(config1: GraphConfiguration, config2: GraphConfiguration): boolean {
// Don't compare gremlin endpoints, documentEndpoint is enough to guarantee uniqueness
return config1.documentEndpoint === config2.documentEndpoint &&
config1.databaseName === config2.databaseName &&
config1.graphName === config2.graphName;
}

Просмотреть файл

@ -11,9 +11,8 @@ import * as io from 'socket.io';
import * as vscode from 'vscode';
import { callWithTelemetryAndErrorHandling, IActionContext } from 'vscode-azureextensionui';
import { removeDuplicatesById } from "../utils/array";
import { GraphConfiguration } from './GraphConfiguration';
import { IGraphConfiguration, IGremlinEndpoint } from '../vscode-cosmosdbgraph.api';
import { GraphViewServerSocket } from "./GraphViewServerSocket";
import { IGremlinEndpoint } from "./gremlinEndpoints";
// grandfathered in
// tslint:disable:typedef
@ -50,7 +49,7 @@ export class GraphViewServer extends EventEmitter {
private _socket: GraphViewServerSocket;
private _pageState: PageState;
constructor(private _configuration: GraphConfiguration) {
constructor(private _configuration: IGraphConfiguration) {
super();
this._pageState = {
query: undefined,
@ -62,7 +61,7 @@ export class GraphViewServer extends EventEmitter {
};
}
public get configuration(): GraphConfiguration {
public get configuration(): IGraphConfiguration {
return this._configuration;
}

Просмотреть файл

@ -9,7 +9,7 @@ import * as vscode from 'vscode';
import { parseError } from 'vscode-azureextensionui';
import { getResourcesPath } from '../constants';
import { ext } from '../extensionVariables';
import { areConfigsEqual, GraphConfiguration } from './GraphConfiguration';
import { IGraphConfiguration } from '../vscode-cosmosdbgraph.api';
import { GraphViewServer } from './GraphViewServer';
// grandfathered in
@ -27,10 +27,7 @@ export class GraphViewsManager implements IServerProvider { //Graphviews Panel
private readonly _panels = new Map<number, vscode.WebviewPanel>(); // map of id -> webview panel
private readonly _panelViewType: string = "CosmosDB.GraphExplorer";
public async showGraphViewer(
tabTitle: string,
config: GraphConfiguration
): Promise<void> {
public async showGraphViewer(config: IGraphConfiguration): Promise<void> {
let id: number;
try {
id = await this.getOrCreateServer(config);
@ -50,7 +47,7 @@ export class GraphViewsManager implements IServerProvider { //Graphviews Panel
retainContextWhenHidden: true,
localResourceRoots: [vscode.Uri.file(ext.context.extensionPath)]
};
const panel = vscode.window.createWebviewPanel(this._panelViewType, tabTitle, { viewColumn: column, preserveFocus: true }, options);
const panel = vscode.window.createWebviewPanel(this._panelViewType, config.tabTitle, { viewColumn: column, preserveFocus: true }, options);
const contentProvider = new WebviewContentProvider(this);
panel.webview.html = await contentProvider.provideHtmlContent(id);
this._panels.set(id, panel);
@ -70,7 +67,7 @@ export class GraphViewsManager implements IServerProvider { //Graphviews Panel
return this._servers.get(id);
}
private async getOrCreateServer(config: GraphConfiguration): Promise<number> {
private async getOrCreateServer(config: IGraphConfiguration): Promise<number> {
let existingServer: GraphViewServer = null;
let existingId: number;
this._servers.forEach((svr, key) => {
@ -123,3 +120,10 @@ class WebviewContentProvider {
}
}
function areConfigsEqual(config1: IGraphConfiguration, config2: IGraphConfiguration): boolean {
// Don't compare gremlin endpoints, documentEndpoint is enough to guarantee uniqueness
return config1.documentEndpoint === config2.documentEndpoint &&
config1.databaseName === config2.databaseName &&
config1.graphName === config2.graphName;
}

Просмотреть файл

@ -1,62 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CosmosDBManagementClient } from 'azure-arm-cosmosdb';
export interface IGremlinEndpoint {
host: string;
port: number;
ssl: boolean;
}
export async function TryGetGremlinEndpointFromAzure(client: CosmosDBManagementClient, resourceGroup: string, account: string): Promise<IGremlinEndpoint | undefined> {
return new Promise<IGremlinEndpoint>((resolve, reject) => {
// Use the callback version of get because the Promise one currently doesn't expose gremlinEndpoint (https://github.com/Azure/azure-documentdb-node/issues/227)
client.databaseAccounts.get(resourceGroup, account, (error, _result, _httpRequest, response) => {
if (error) {
reject(error);
} else {
const body = <{ properties: { gremlinEndpoint: string } }>JSON.parse((<{ body?: string }>response).body);
const endpointUri = body.properties.gremlinEndpoint;
if (endpointUri) {
resolve(parseEndpointUrl(endpointUri));
} else {
// If it doesn't have gremlinEndpoint in its properties, it must be a pre-GA endpoint
resolve(undefined);
}
}
});
});
}
export function getPossibleGremlinEndpoints(documentEndpoint: string): IGremlinEndpoint[] {
// E.g., given a document endpoint from Azure such as https://<graphname>.documents.azure.com:443/
const documentSuffix = '.documents.azure.com';
if (documentEndpoint.indexOf(documentSuffix) >= 0) {
// Pre-GA style (Dec 2017)
const preGAEndpoint = documentEndpoint.replace(documentSuffix, '.graphs.azure.com');
// Post-GA style (Dec 2017)
const postGAEndpoint = documentEndpoint.replace(documentSuffix, '.gremlin.cosmosdb.azure.com');
return [parseEndpointUrl(postGAEndpoint), parseEndpointUrl(preGAEndpoint)];
} else {
console.warn(`Unexpected document URL format: ${documentEndpoint}`);
return [parseEndpointUrl(documentEndpoint)];
}
}
/**
* Parses a IGremlinPoint from a URL
* @param url An account URL such as 'https://<graphname>.documents.azure.com:443/'
*/
function parseEndpointUrl(url: string): IGremlinEndpoint {
const [, protocol, host, , portString] = url.match(/^([^:]+):\/\/([^:]+)(:([0-9]+))?\/?$/);
console.assert(!!protocol && !!host, "Unexpected endpoint format");
const port = parseInt(portString || "443", 10);
console.assert(port > 0, "Unexpected port");
return { host, port, ssl: protocol.toLowerCase() === "https" };
}

Просмотреть файл

@ -1,49 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IActionContext, registerCommand } from "vscode-azureextensionui";
import { doubleClickDebounceDelay } from '../constants';
import { ext } from '../extensionVariables';
import { GraphViewsManager } from "./GraphViewsManager";
import { GraphAccountTreeItem } from "./tree/GraphAccountTreeItem";
import { GraphCollectionTreeItem } from "./tree/GraphCollectionTreeItem";
import { GraphDatabaseTreeItem } from "./tree/GraphDatabaseTreeItem";
import { GraphTreeItem } from "./tree/GraphTreeItem";
export function registerGraphCommands(): void {
const graphViewsManager = new GraphViewsManager();
registerCommand('cosmosDB.createGraphDatabase', async (context: IActionContext, node?: GraphAccountTreeItem) => {
if (!node) {
node = <GraphAccountTreeItem>await ext.tree.showTreeItemPicker(GraphAccountTreeItem.contextValue, context);
}
await node.createChild(context);
});
registerCommand('cosmosDB.createGraph', async (context: IActionContext, node?: GraphDatabaseTreeItem) => {
if (!node) {
node = <GraphDatabaseTreeItem>await ext.tree.showTreeItemPicker(GraphDatabaseTreeItem.contextValue, context);
}
await node.createChild(context);
});
registerCommand('cosmosDB.deleteGraphDatabase', async (context: IActionContext, node?: GraphDatabaseTreeItem) => {
if (!node) {
node = <GraphDatabaseTreeItem>await ext.tree.showTreeItemPicker(GraphDatabaseTreeItem.contextValue, context);
}
await node.deleteTreeItem(context);
});
registerCommand('cosmosDB.deleteGraph', async (context: IActionContext, node?: GraphCollectionTreeItem) => {
if (!node) {
node = <GraphCollectionTreeItem>await ext.tree.showTreeItemPicker(GraphCollectionTreeItem.contextValue, context);
}
await node.deleteTreeItem(context);
});
registerCommand('cosmosDB.openGraphExplorer', async (context: IActionContext, node: GraphTreeItem) => {
if (!node) {
node = <GraphTreeItem>await ext.tree.showTreeItemPicker(GraphTreeItem.contextValue, context);
}
await node.showExplorer(graphViewsManager);
// tslint:disable-next-line:align
}, doubleClickDebounceDelay);
}

Просмотреть файл

@ -1,41 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { DatabaseAccount } from 'azure-arm-cosmosdb/lib/models';
import { DatabaseMeta } from 'documentdb';
import { AzureParentTreeItem } from 'vscode-azureextensionui';
import { DocDBAccountTreeItemBase } from '../../docdb/tree/DocDBAccountTreeItemBase';
import { DocDBStoredProceduresTreeItem } from '../../docdb/tree/DocDBStoredProceduresTreeItem';
import { DocDBStoredProcedureTreeItem } from '../../docdb/tree/DocDBStoredProcedureTreeItem';
import { IGremlinEndpoint } from '../gremlinEndpoints';
import { GraphCollectionTreeItem } from './GraphCollectionTreeItem';
import { GraphDatabaseTreeItem } from './GraphDatabaseTreeItem';
import { GraphTreeItem } from './GraphTreeItem';
export class GraphAccountTreeItem extends DocDBAccountTreeItemBase {
public static contextValue: string = "cosmosDBGraphAccount";
public contextValue: string = GraphAccountTreeItem.contextValue;
constructor(parent: AzureParentTreeItem, id: string, label: string, documentEndpoint: string, private _gremlinEndpoint: IGremlinEndpoint | undefined, masterKey: string, isEmulator: boolean, readonly databaseAccount?: DatabaseAccount) {
super(parent, id, label, documentEndpoint, masterKey, isEmulator, databaseAccount);
}
public initChild(database: DatabaseMeta): GraphDatabaseTreeItem {
return new GraphDatabaseTreeItem(this, this._gremlinEndpoint, database);
}
public isAncestorOfImpl(contextValue: string): boolean {
switch (contextValue) {
case GraphDatabaseTreeItem.contextValue:
case GraphCollectionTreeItem.contextValue:
case DocDBStoredProceduresTreeItem.contextValue:
case DocDBStoredProcedureTreeItem.contextValue:
case GraphTreeItem.contextValue:
return true;
default:
return false;
}
}
}

Просмотреть файл

@ -1,85 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CollectionMeta } from 'documentdb';
import * as vscode from 'vscode';
import { AzureParentTreeItem, AzureTreeItem, DialogResponses, UserCancelledError } from 'vscode-azureextensionui';
import { getThemeAgnosticIconPath } from '../../constants';
import { DocDBStoredProceduresTreeItem } from '../../docdb/tree/DocDBStoredProceduresTreeItem';
import { DocDBStoredProcedureTreeItem } from '../../docdb/tree/DocDBStoredProcedureTreeItem';
import { IDocDBTreeRoot } from '../../docdb/tree/IDocDBTreeRoot';
import { GraphDatabaseTreeItem } from './GraphDatabaseTreeItem';
import { GraphTreeItem } from './GraphTreeItem';
export class GraphCollectionTreeItem extends AzureParentTreeItem<IDocDBTreeRoot> {
public static contextValue: string = "cosmosDBGraph";
public readonly contextValue: string = GraphCollectionTreeItem.contextValue;
public readonly parent: GraphDatabaseTreeItem;
private readonly _graphTreeItem: GraphTreeItem;
private readonly _storedProceduresTreeItem: DocDBStoredProceduresTreeItem;
private readonly _collection: CollectionMeta;
constructor(parent: GraphDatabaseTreeItem, collection: CollectionMeta) {
super(parent);
this._collection = collection;
this._graphTreeItem = new GraphTreeItem(this, this._collection);
this._storedProceduresTreeItem = new DocDBStoredProceduresTreeItem(this);
}
public get id(): string {
return this._collection.id;
}
public get label(): string {
return this._collection.id;
}
public get link(): string {
return this._collection._self;
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return getThemeAgnosticIconPath('Collection.svg');
}
public async loadMoreChildrenImpl(_clearCache: boolean): Promise<AzureTreeItem<IDocDBTreeRoot>[]> {
return [this._graphTreeItem, this._storedProceduresTreeItem];
}
public hasMoreChildrenImpl(): boolean {
return false;
}
public async deleteTreeItemImpl(): Promise<void> {
const message: string = `Are you sure you want to delete graph '${this.label}' and its contents?`;
const result = await vscode.window.showWarningMessage(message, { modal: true }, DialogResponses.deleteResponse, DialogResponses.cancel);
if (result === DialogResponses.deleteResponse) {
const client = this.root.getDocumentClient();
await new Promise((resolve, reject) => {
client.deleteCollection(this.link, err => err ? reject(err) : resolve());
});
} else {
throw new UserCancelledError();
}
}
public pickTreeItemImpl(expectedContextValues: (string | RegExp)[]): AzureTreeItem<IDocDBTreeRoot> | undefined {
for (const expectedContextValue of expectedContextValues) {
switch (expectedContextValue) {
case GraphTreeItem.contextValue:
return this._graphTreeItem;
case DocDBStoredProceduresTreeItem.contextValue:
case DocDBStoredProcedureTreeItem.contextValue:
return this._storedProceduresTreeItem;
default:
}
}
return undefined;
}
}

Просмотреть файл

@ -1,33 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CollectionMeta, DatabaseMeta } from 'documentdb';
import { DocDBDatabaseTreeItemBase } from '../../docdb/tree/DocDBDatabaseTreeItemBase';
import { getPossibleGremlinEndpoints, IGremlinEndpoint } from '../gremlinEndpoints';
import { GraphAccountTreeItem } from './GraphAccountTreeItem';
import { GraphCollectionTreeItem } from './GraphCollectionTreeItem';
export class GraphDatabaseTreeItem extends DocDBDatabaseTreeItemBase {
public static contextValue: string = "cosmosDBGraphDatabase";
public readonly contextValue: string = GraphDatabaseTreeItem.contextValue;
public readonly childTypeLabel: string = 'Graph';
constructor(parent: GraphAccountTreeItem, private _gremlinEndpoint: IGremlinEndpoint | undefined, database: DatabaseMeta) {
super(parent, database);
}
public initChild(collection: CollectionMeta): GraphCollectionTreeItem {
return new GraphCollectionTreeItem(this, collection);
}
// Gremlin endpoint, if definitely known
get gremlinEndpoint(): IGremlinEndpoint | undefined {
return this._gremlinEndpoint;
}
get possibleGremlinEndpoints(): IGremlinEndpoint[] {
return getPossibleGremlinEndpoints(this.root.documentEndpoint);
}
}

Просмотреть файл

@ -1,56 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CollectionMeta } from 'documentdb';
import * as vscode from 'vscode';
import { AzureTreeItem } from 'vscode-azureextensionui';
import { getThemeAgnosticIconPath } from '../../constants';
import { IDocDBTreeRoot } from '../../docdb/tree/IDocDBTreeRoot';
import { GraphConfiguration } from '../GraphConfiguration';
import { GraphViewsManager } from '../GraphViewsManager';
import { GraphCollectionTreeItem } from './GraphCollectionTreeItem';
import { GraphDatabaseTreeItem } from './GraphDatabaseTreeItem';
export class GraphTreeItem extends AzureTreeItem<IDocDBTreeRoot> {
public static contextValue: string = "cosmosDBGraphGraph";
public readonly contextValue: string = GraphTreeItem.contextValue;
public readonly commandId: string = 'cosmosDB.openGraphExplorer';
public readonly parent: GraphCollectionTreeItem;
private readonly _collection: CollectionMeta;
constructor(parent: GraphCollectionTreeItem, collection: CollectionMeta) {
super(parent);
this._collection = collection;
}
public get id(): string {
return this._collection.id;
}
public get label(): string {
return "Graph";
}
public get link(): string {
return this._collection._self;
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return getThemeAgnosticIconPath('Collection.svg');
}
public async showExplorer(graphViewsManager: GraphViewsManager): Promise<void> {
const databaseTreeItem: GraphDatabaseTreeItem = this.parent.parent;
await graphViewsManager.showGraphViewer(this._collection.id, <GraphConfiguration>{
documentEndpoint: databaseTreeItem.root.documentEndpoint,
gremlinEndpoint: databaseTreeItem.gremlinEndpoint,
possibleGremlinEndpoints: databaseTreeItem.possibleGremlinEndpoints,
databaseName: databaseTreeItem.label,
graphName: this._collection.id,
key: databaseTreeItem.root.masterKey
});
}
}

Просмотреть файл

@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// tslint:disable-next-line: export-name
export function removeDuplicatesById<T extends { id: string }>(entries: T[]): T[] {
const mapById = new Map<string, T>();
entries.forEach(n => {
@ -11,13 +12,3 @@ export function removeDuplicatesById<T extends { id: string }>(entries: T[]): T[
return [...mapById.values()];
}
// tslint:disable-next-line:no-any
export function filterType<T>(arr: Object[], genericConstructor: new(...args: any[]) => T): T[] {
return <T[]>arr.filter(element => element instanceof genericConstructor);
}
// tslint:disable-next-line:no-any
export function findType<T>(arr: Object[], genericConstructor: new(...args: any[]) => T): T {
return <T>arr.find(element => element instanceof genericConstructor);
}

29
src/vscode-cosmosdbgraph.api.d.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,29 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export interface CosmosDBGraphExtensionApi {
apiVersion: string;
openGraphExplorer(config: IGraphConfiguration): Promise<void>;
}
export interface IGremlinEndpoint {
host: string;
port: number;
ssl: boolean;
}
export interface IGraphConfiguration {
// e.g. https://graphaccount.documents.azure.com:443
documentEndpoint: string;
gremlinEndpoint?: IGremlinEndpoint;
possibleGremlinEndpoints: IGremlinEndpoint[];
key: string;
databaseName: string;
graphName: string;
tabTitle: string;
}

Просмотреть файл

@ -15,7 +15,10 @@ export const testUserInput: TestUserInput = new TestUserInput(vscode);
// Runs before all tests
suiteSetup(async function (this: IHookCallbackContext): Promise<void> {
this.timeout(2 * 60 * 1000);
await vscode.commands.executeCommand('cosmosDB.refresh'); // activate the extension before tests begin
const extension = vscode.extensions.getExtension('ms-azuretools.vscode-cosmosdbgraph');
await extension.activate();
ext.outputChannel = new TestOutputChannel();
ext.ui = testUserInput;
});

Просмотреть файл

@ -10,7 +10,6 @@
'use strict';
const process = require('process');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const StringReplacePlugin = require("string-replace-webpack-plugin");
const dev = require("vscode-azureextensiondev");
@ -25,21 +24,14 @@ let config = dev.getDefaultWebpackConfig({
// Modules that we can't easily webpack for some reason.
// These and their dependencies will be copied into node_modules rather than placed in the bundle
// Keep this list small, because all the subdependencies will also be excluded
'require_optional',
'gremlin',
'socket.io',
'mongodb',
// Needed by graphClient.html
'd3'
],
entries: {
// Note: Each entry is a completely separate Node.js application that cannot interact with any
// of the others, and that individually includes all dependencies necessary (i.e. common
// dependencies will have a copy in each entry file, no sharing).
// Create a separate module bundle for the mongo language server (doesn't share any code with extension.bundle.js)
'./mongo-languageServer.bundle': './src/mongo/languageServer.ts'
},
externals:
@ -48,80 +40,15 @@ let config = dev.getDefaultWebpackConfig({
// and 'ws' module.
// These files are not in node_modules and so will fail normally at runtime and instead use fallbacks.
// Make them as external so webpack doesn't try to process them, and they'll simply fail at runtime as before.
'../build/Release/validation': 'commonjs ../build/Release/validation',
'../build/default/validation': 'commonjs ../build/default/validation',
'../build/Release/bufferutil': 'commonjs ../build/Release/bufferutil',
'../build/default/bufferutil': 'commonjs ../build/default/bufferutil',
'bufferutil': 'commonjs bufferutil',
'utf-8-validate': 'commonjs utf-8-validate',
// Fix "module not found" error in node_modules/es6-promise/dist/es6-promise.js
'vertx': 'commonjs vertx',
// ./getCoreNodeModule.js (path from keytar.ts) uses a dynamic require which can't be webpacked // ./getCoreNodeModule.js (path from keytar.ts) uses a dynamic require which can't be webpacked
'./getCoreNodeModule': 'commonjs getCoreNodeModule',
}, // end of externals
loaderRules: [
{
// Fix error:
// > WARNING in ./node_modules/engine.io/lib/server.js 67:43-65
// > Critical dependency: the request of a dependency is an expression
// in this code:
// var WebSocketServer = (this.wsEngine ? require(this.wsEngine) : require('ws')).Server;
test: /engine\.io[/\\]lib[/\\]server.js$/,
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /var WebSocketServer = \(this.wsEngine \? require\(this\.wsEngine\) : require\('ws'\)\)\.Server;/ig,
replacement: function (match, offset, string) {
// Since we're not using the wsEngine option, we'll just require it to not be set and use only the `require('ws')` call.
return `if (!!this.wsEngine) {
throw new Error('wsEngine option not supported with current webpack settings');
}
var WebSocketServer = require('ws').Server;`;
}
}
]
})
},
{
// Fix warning:
// > WARNING in ./node_modules/cross-spawn/index.js
// > Module not found: Error: Can't resolve 'spawn-sync' in 'C:\Users\<user>\Repos\vscode-cosmosdb\node_modules\cross-spawn'
// > @ ./node_modules/cross-spawn/index.js
// in this code:
// cpSpawnSync = require('spawn-sync'); // eslint-disable-line global-require
test: /cross-spawn[/\\]index\.js$/,
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /cpSpawnSync = require\('spawn-sync'\);/ig,
replacement: function (match, offset, string) {
// The code in question only applies to Node 0.10 or less (see comments in code), so just throw an error
return `throw new Error("This shouldn't happen"); // MODIFIED`;
}
}
]
})
}
], // end of loaderRules
plugins: [
// Replace vscode-languageserver/lib/files.js with a modified version that doesn't have webpack issues
new webpack.NormalModuleReplacementPlugin(
/[/\\]vscode-languageserver[/\\]lib[/\\]files\.js/,
require.resolve('./build/vscode-languageserver-files-stub.js')
),
// Copy files to dist folder where the runtime can find them
new CopyWebpackPlugin([
// getCoreNodeModule.js -> dist/node_modules/getCoreNodeModule.js
{ from: './out/src/utils/getCoreNodeModule.js', to: 'node_modules' },
// graphClient.js -> dist, which is used by graphClient.html
{ from: './out/src/graph/client/graphClient.js', to: 'graphClient.js' }
]),