├── .DS_Store ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── question.md └── workflows │ └── main.yml ├── .gitignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── README_CN.md ├── backlog.md ├── build.js ├── i18n.js ├── image ├── README │ └── 1708594027208.png └── README_CN │ └── 1708593458624.png ├── images ├── 1611910592756.png ├── 1638342622208.png ├── 1735021652688.png ├── Backup.jpg ├── QueryTable.jpg ├── connection.jpg ├── filter.gif ├── history.jpg ├── mockData.jpg ├── newquery.jpg └── run.jpg ├── package.json ├── package.nls.json ├── package.nls.zh-cn.json ├── postcss.config.js ├── public ├── icon.png ├── index.html ├── js │ └── oldCompatible.js ├── logo.png ├── logo_dark.png └── theme │ ├── auto.css │ ├── fonts │ └── element-icons.woff │ └── umyui.css ├── resources ├── icon │ ├── cloud-sync.svg │ ├── connection.svg │ ├── database-container.svg │ ├── diagram-node.svg │ ├── diagram.svg │ ├── dropper.svg │ ├── elasticsearch.svg │ ├── mongodb-icon.svg │ ├── mssql_server.png │ ├── mysql.svg │ ├── pg_server.svg │ ├── query.svg │ ├── sqlite-icon.svg │ └── state.svg ├── image │ ├── other-container.png │ ├── redis_connection.png │ ├── redis_folder.svg │ ├── terminal_dark.svg │ └── terminal_light.png ├── logo.png └── ssh │ ├── console.svg │ ├── file.svg │ ├── folder-core.svg │ ├── forward.svg │ ├── html.svg │ ├── java.svg │ ├── javascript.svg │ ├── json.svg │ ├── key.svg │ ├── log.svg │ ├── settings.svg │ ├── sql.svg │ ├── typescript.svg │ ├── xml.svg │ ├── yaml.svg │ └── zip.svg ├── sqlite └── sqlite-v3.26.0-win32-x86.exe ├── src ├── .DS_Store ├── bin │ ├── mockjs.js │ ├── node-xlsx.js │ └── tedious.js ├── common │ ├── Console.ts │ ├── constants.ts │ ├── filesManager.ts │ ├── global.ts │ ├── state.ts │ ├── trans.ts │ ├── typeDef.ts │ ├── util.ts │ ├── viewManager.ts │ └── wrapper.js ├── extension.ts ├── model │ ├── database │ │ ├── catalogNode.ts │ │ ├── connectionNode.ts │ │ ├── schemaNode.ts │ │ ├── userGroup.ts │ │ └── userNode.ts │ ├── es │ │ ├── esRequest.ts │ │ ├── esUtil.ts │ │ ├── model │ │ │ ├── esColumnNode.ts │ │ │ ├── esConnectionNode.ts │ │ │ ├── esIndexGroupNode.ts │ │ │ ├── esIndexNode.ts │ │ │ └── esTemplate.ts │ │ └── provider │ │ │ ├── ElasticCodeLensProvider.ts │ │ │ ├── ElasticCompletionItemProvider.ts │ │ │ ├── ElasticMatch.ts │ │ │ ├── ElasticMatches.ts │ │ │ ├── documentFinder.ts │ │ │ ├── main.ts │ │ │ └── rest-spec │ │ │ ├── index.ts │ │ │ ├── json.d.ts │ │ │ └── v6_0_0 │ │ │ ├── _common.json │ │ │ ├── bulk.json │ │ │ ├── cat.aliases.json │ │ │ ├── cat.allocation.json │ │ │ ├── cat.count.json │ │ │ ├── cat.fielddata.json │ │ │ ├── cat.health.json │ │ │ ├── cat.help.json │ │ │ ├── cat.indices.json │ │ │ ├── cat.master.json │ │ │ ├── cat.nodeattrs.json │ │ │ ├── cat.nodes.json │ │ │ ├── cat.pending_tasks.json │ │ │ ├── cat.plugins.json │ │ │ ├── cat.recovery.json │ │ │ ├── cat.repositories.json │ │ │ ├── cat.segments.json │ │ │ ├── cat.shards.json │ │ │ ├── cat.snapshots.json │ │ │ ├── cat.tasks.json │ │ │ ├── cat.templates.json │ │ │ ├── cat.thread_pool.json │ │ │ ├── clear_scroll.json │ │ │ ├── cluster.allocation_explain.json │ │ │ ├── cluster.get_settings.json │ │ │ ├── cluster.health.json │ │ │ ├── cluster.pending_tasks.json │ │ │ ├── cluster.put_settings.json │ │ │ ├── cluster.reroute.json │ │ │ ├── cluster.state.json │ │ │ ├── cluster.stats.json │ │ │ ├── count.json │ │ │ ├── create.json │ │ │ ├── delete.json │ │ │ ├── delete_by_query.json │ │ │ ├── delete_script.json │ │ │ ├── exists.json │ │ │ ├── exists_source.json │ │ │ ├── explain.json │ │ │ ├── field_caps.json │ │ │ ├── get.json │ │ │ ├── get_script.json │ │ │ ├── get_source.json │ │ │ ├── index.json │ │ │ ├── index.ts │ │ │ ├── indices.analyze.json │ │ │ ├── indices.clear_cache.json │ │ │ ├── indices.close.json │ │ │ ├── indices.create.json │ │ │ ├── indices.delete.json │ │ │ ├── indices.delete_alias.json │ │ │ ├── indices.delete_template.json │ │ │ ├── indices.exists.json │ │ │ ├── indices.exists_alias.json │ │ │ ├── indices.exists_template.json │ │ │ ├── indices.exists_type.json │ │ │ ├── indices.flush.json │ │ │ ├── indices.flush_synced.json │ │ │ ├── indices.forcemerge.json │ │ │ ├── indices.get.json │ │ │ ├── indices.get_alias.json │ │ │ ├── indices.get_field_mapping.json │ │ │ ├── indices.get_mapping.json │ │ │ ├── indices.get_settings.json │ │ │ ├── indices.get_template.json │ │ │ ├── indices.get_upgrade.json │ │ │ ├── indices.open.json │ │ │ ├── indices.put_alias.json │ │ │ ├── indices.put_mapping.json │ │ │ ├── indices.put_settings.json │ │ │ ├── indices.put_template.json │ │ │ ├── indices.recovery.json │ │ │ ├── indices.refresh.json │ │ │ ├── indices.rollover.json │ │ │ ├── indices.segments.json │ │ │ ├── indices.shard_stores.json │ │ │ ├── indices.shrink.json │ │ │ ├── indices.stats.json │ │ │ ├── indices.update_aliases.json │ │ │ ├── indices.upgrade.json │ │ │ ├── indices.validate_query.json │ │ │ ├── info.json │ │ │ ├── ingest.delete_pipeline.json │ │ │ ├── ingest.get_pipeline.json │ │ │ ├── ingest.processor.grok.json │ │ │ ├── ingest.put_pipeline.json │ │ │ ├── ingest.simulate.json │ │ │ ├── mget.json │ │ │ ├── msearch.json │ │ │ ├── msearch_template.json │ │ │ ├── mtermvectors.json │ │ │ ├── nodes.hot_threads.json │ │ │ ├── nodes.info.json │ │ │ ├── nodes.stats.json │ │ │ ├── nodes.usage.json │ │ │ ├── ping.json │ │ │ ├── put_script.json │ │ │ ├── reindex.json │ │ │ ├── reindex_rethrottle.json │ │ │ ├── remote.info.json │ │ │ ├── render_search_template.json │ │ │ ├── scroll.json │ │ │ ├── search.json │ │ │ ├── search_shards.json │ │ │ ├── search_template.json │ │ │ ├── snapshot.create.json │ │ │ ├── snapshot.create_repository.json │ │ │ ├── snapshot.delete.json │ │ │ ├── snapshot.delete_repository.json │ │ │ ├── snapshot.get.json │ │ │ ├── snapshot.get_repository.json │ │ │ ├── snapshot.restore.json │ │ │ ├── snapshot.status.json │ │ │ ├── snapshot.verify_repository.json │ │ │ ├── tasks.cancel.json │ │ │ ├── tasks.get.json │ │ │ ├── tasks.list.json │ │ │ ├── termvectors.json │ │ │ ├── update.json │ │ │ └── update_by_query.json │ ├── ftp │ │ ├── ftpBaseNode.ts │ │ ├── ftpConnectionNode.ts │ │ ├── ftpFileNode.ts │ │ └── lib │ │ │ ├── connection.js │ │ │ └── parser.js │ ├── interface │ │ ├── copyAble.ts │ │ ├── node.ts │ │ └── sshConfig.ts │ ├── main │ │ ├── function.ts │ │ ├── functionGroup.ts │ │ ├── procedure.ts │ │ ├── procedureGroup.ts │ │ ├── tableGroup.ts │ │ ├── tableNode.ts │ │ ├── trigger.ts │ │ ├── triggerGroup.ts │ │ ├── viewGroup.ts │ │ └── viewNode.ts │ ├── mongo │ │ ├── mongoBaseNode.ts │ │ ├── mongoTableGroup.ts │ │ └── mongoTableNode.ts │ ├── nodeUtil.ts │ ├── other │ │ ├── columnNode.ts │ │ └── infoNode.ts │ ├── query │ │ ├── queryGroup.ts │ │ └── queryNode.ts │ ├── redis │ │ ├── folderNode.ts │ │ ├── keyNode.ts │ │ ├── redisBaseNode.ts │ │ └── redisConnectionNode.ts │ └── ssh │ │ ├── connectionProvider.ts │ │ ├── fileNode.ts │ │ ├── linkNode.ts │ │ └── sshConnectionNode.ts ├── provider │ ├── codelen │ │ ├── highlightCreator.ts │ │ └── sqlCodeLensProvider.ts │ ├── complete │ │ ├── chain │ │ │ ├── baseChain.ts │ │ │ ├── columnChain.ts │ │ │ ├── ddlChain.ts │ │ │ ├── dmlChain.ts │ │ │ ├── keywordChain.ts │ │ │ ├── tableChain.ts │ │ │ └── tableDetecherChain.ts │ │ ├── complectionContext.ts │ │ ├── completionProvider.ts │ │ └── nodeFinder.ts │ ├── history │ │ ├── historyNode.ts │ │ └── historyProvider.ts │ ├── parser │ │ ├── sqlBlcok.ts │ │ ├── sqlParser.ts │ │ └── tokenContext.ts │ ├── sqlFormattingProvider.ts │ ├── sqlSymbolProvide.ts │ ├── tableInfoHoverProvider.ts │ └── treeDataProvider.ts ├── service │ ├── .DS_Store │ ├── common │ │ ├── databaseCache.ts │ │ ├── delimiterHolder.ts │ │ └── historyRecorder.ts │ ├── connect │ │ ├── config │ │ │ └── connnetionConfig.ts │ │ ├── connectService.ts │ │ ├── connection.ts │ │ ├── convert │ │ │ ├── mysqlTypeCast.ts │ │ │ └── resolveType.ts │ │ ├── esConnection.ts │ │ ├── exasolConnection.ts │ │ ├── ftpConnection.ts │ │ ├── mongoConnection.ts │ │ ├── mssql │ │ │ └── connection-pool.js │ │ ├── mssqlConnection.ts │ │ ├── mysqlConnection.ts │ │ ├── pool │ │ │ ├── connectionPool.ts │ │ │ └── poolConnection.ts │ │ ├── postgreSqlConnection.ts │ │ ├── redisConnection.ts │ │ ├── sqlite │ │ │ ├── common │ │ │ │ ├── index.ts │ │ │ │ └── utils.ts │ │ │ ├── index.ts │ │ │ ├── resultSetParser.ts │ │ │ ├── sqliteCommandValidation.ts │ │ │ └── streamParser.ts │ │ └── sqliteConnection.ts │ ├── connectionManager.ts │ ├── dialect │ │ ├── esDialect.ts │ │ ├── exasolDialect.ts │ │ ├── mongoDialect.ts │ │ ├── mssqlDIalect.ts │ │ ├── mysqlDialect.ts │ │ ├── param │ │ │ ├── createIndexParam.ts │ │ │ ├── updateColumnParam.ts │ │ │ └── updateTableParam.ts │ │ ├── postgreSqlDialect.ts │ │ ├── sqlDialect.ts │ │ └── sqliteDialect.ts │ ├── diff │ │ └── diffService.ts │ ├── dump │ │ ├── dumpService.ts │ │ ├── generateDocument.ts │ │ ├── mysql │ │ │ ├── getDataDump.ts │ │ │ ├── getFunctionDump.ts │ │ │ ├── getProcedureDump.ts │ │ │ ├── getTableDump.ts │ │ │ ├── getTriggerDump.ts │ │ │ ├── getViewDump.ts │ │ │ ├── interfaces │ │ │ │ └── Options.ts │ │ │ ├── main.ts │ │ │ └── sessionVariables.ts │ │ └── mysqlDumpService.ts │ ├── export │ │ ├── exportContext.ts │ │ └── exportService.ts │ ├── format │ │ ├── core │ │ │ ├── Formatter.js │ │ │ ├── Indentation.js │ │ │ ├── InlineBlock.js │ │ │ ├── Params.js │ │ │ ├── Tokenizer.js │ │ │ └── tokenTypes.js │ │ ├── languages │ │ │ ├── PlSqlFormatter.js │ │ │ └── StandardSqlFormatter.js │ │ └── sqlFormatter.js │ ├── import │ │ ├── importService.ts │ │ ├── mongoImportService.ts │ │ ├── mysqlImportService.ts │ │ ├── postgresqlImortService.ts │ │ └── sqlServerImportService.ts │ ├── mock │ │ ├── mockModel.ts │ │ └── mockRunner.ts │ ├── page │ │ ├── esPageService.ts │ │ ├── mongoPageService.ts │ │ ├── mssqlPageService.ts │ │ ├── mysqlPageSerivce.ts │ │ ├── pageService.ts │ │ └── postgreSqlPageService.ts │ ├── queryUnit.ts │ ├── result │ │ ├── query.ts │ │ └── queryResponse.ts │ ├── serviceManager.ts │ ├── setting │ │ ├── MysqlSettingService.ts │ │ └── settingService.ts │ ├── ssh │ │ ├── clientManager.ts │ │ ├── forward │ │ │ ├── forwardService.ts │ │ │ ├── lib │ │ │ │ └── config.js │ │ │ └── tunnel.js │ │ └── terminal │ │ │ ├── classicTerminalService.ts │ │ │ ├── constant.ts │ │ │ ├── terminalService.ts │ │ │ └── xtermTerminalService.ts │ ├── status │ │ ├── abstractStatusService.ts │ │ ├── mysqlStatusService.ts │ │ └── statusService.ts │ └── tunnel │ │ ├── config.js │ │ ├── sshTunnelService.ts │ │ └── tunnel-ssh.js └── vue │ ├── App.vue │ ├── connect │ ├── component │ │ ├── ElasticSearch.vue │ │ ├── FTP.vue │ │ ├── SQLServer.vue │ │ ├── SQLite.vue │ │ ├── SSH.vue │ │ └── SSL.vue │ └── index.vue │ ├── design │ ├── ColumnPanel.vue │ ├── IndexPanel.vue │ ├── InfoPanel.vue │ └── index.vue │ ├── forward │ └── index.vue │ ├── main.js │ ├── mixin │ └── vscodeInject.js │ ├── redis │ ├── keyView.vue │ ├── redisStatus.vue │ └── terminal.vue │ ├── result │ ├── App.vue │ ├── component │ │ ├── Contextmenu │ │ │ ├── components │ │ │ │ ├── Contextmenu.vue │ │ │ │ └── Submenu.vue │ │ │ ├── constant.js │ │ │ ├── index.js │ │ │ └── util.js │ │ ├── EditDialog │ │ │ ├── CellEditor.vue │ │ │ └── index.vue │ │ ├── ExportDialog.vue │ │ ├── Row │ │ │ ├── Controller.vue │ │ │ ├── Header.vue │ │ │ └── index.vue │ │ └── Toolbar │ │ │ └── index.vue │ ├── icon │ │ ├── iconfont.css │ │ └── iconfont.woff │ ├── main.js │ ├── mixin │ │ └── util.js │ └── view.css │ ├── status │ └── index.vue │ ├── structDiff │ └── index.vue │ ├── util │ └── vscode.js │ └── xterm │ ├── index.vue │ ├── theme │ └── auto.js │ └── xterm-addon-search-bar.js ├── syntaxes ├── es.configuration.json ├── es.tmLanguage.json ├── language-configuration.json ├── mysql.tmLanguage.json └── snippets.json ├── tailwind.config.js ├── test └── word.js ├── tsconfig.json ├── types └── mysql2.d.ts ├── webpack.config.js └── webpack.config.lib.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/.DS_Store -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | - Database type and version: 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Ask about extensions 4 | title: '' 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: [ master,webpack ] 5 | pull_request: 6 | branches: [ master,webpack ] 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - uses: actions/setup-node@v1 13 | with: 14 | node-version: 14.x 15 | - run: npm i 16 | - run: | 17 | echo ">>> Start compile vscode-mysql." 18 | npm run build 19 | echo ">>> Compile vscode-mysql sucess!" 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | .idea/ 4 | .vscode-test/ 5 | *.vsix 6 | package-lock.json 7 | .prettierrc 8 | yarn.lock -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ], 11 | "stopOnEntry": false, 12 | "sourceMaps": true, 13 | "outFiles": [ "${workspaceRoot}/out/**/*.js" ], 14 | "preLaunchTask": "webpack-dev" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false // set this to true to hide the "out" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "out": true // set this to false to include "out" folder in search results 8 | } 9 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "webpack-dev", 8 | "type": "npm", 9 | "script": "dev", 10 | "isBackground": true, 11 | "group": { 12 | "kind": "build", 13 | "isDefault": true 14 | }, 15 | "problemMatcher": [ 16 | { 17 | "pattern": [ 18 | { 19 | "regexp": ".", 20 | "file": 1, 21 | "location": 2, 22 | "message": 3 23 | } 24 | ], 25 | "background": { 26 | "activeOnStart": true, 27 | "beginsPattern": { 28 | "regexp": "webpack is watching the files" 29 | }, 30 | "endsPattern": { 31 | "regexp": "Entrypoint HtmlWebpackPlugin_0" 32 | } 33 | } 34 | } 35 | ] 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/test/** 4 | out/**/*.map 5 | .idea/** 6 | src/** 7 | images/** 8 | .gitignore 9 | tsconfig.json 10 | vsc-extension-quickstart.md 11 | node_modules/ 12 | webpack.config.js 13 | tslint.json 14 | .github/ 15 | public/ 16 | types/ 17 | webpack.config.lib.js 18 | tailwind.config.js 19 | backlog.md 20 | i18n.js 21 | postcss.config.js -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2021 Weijan Chen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /backlog.md: -------------------------------------------------------------------------------- 1 | # Dialect or differenct database 2 | 3 | 1. `export interface SqlDialect` 4 | 2. `export interface IConnection` 5 | 3. `export abstract class AbstractDumpService` 6 | 4. `export interface ImportService` 7 | 5. `PageService`(mysql、postgresql) 8 | 6. `export interface StatusService` (mysql only now) 9 | -------------------------------------------------------------------------------- /build.js: -------------------------------------------------------------------------------- 1 | const { build } = require("esbuild") 2 | 3 | build({ 4 | entryPoints: ['./src/extension.ts'], 5 | format: 'cjs', 6 | bundle: true, 7 | outfile: "out/extension.js", 8 | platform: 'node', 9 | logLevel: 'error', 10 | metafile: true, 11 | sourcemap:'external', 12 | sourceRoot:__dirname, 13 | minify:false, 14 | watch:false, 15 | external: ['vscode', 'pg-native', 'cardinal', 'aws4', 'mongodb-client-encryption'], 16 | plugins: [ 17 | { 18 | name: 'build notice', 19 | setup(build) { 20 | console.log('build') 21 | }, 22 | }, 23 | ], 24 | }) -------------------------------------------------------------------------------- /i18n.js: -------------------------------------------------------------------------------- 1 | const p=require('./package.json') 2 | const content={} 3 | for (const command of p.contributes.commands) { 4 | const key = command.command.replace("mysql", 'command'); 5 | content[key]=command.title; 6 | command.title=`%${key}%` 7 | } 8 | console.log(JSON.stringify(content)) 9 | console.log('--------------------------------------------') 10 | console.log(JSON.stringify(p.contributes.commands)) -------------------------------------------------------------------------------- /image/README/1708594027208.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/image/README/1708594027208.png -------------------------------------------------------------------------------- /image/README_CN/1708593458624.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/image/README_CN/1708593458624.png -------------------------------------------------------------------------------- /images/1611910592756.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/1611910592756.png -------------------------------------------------------------------------------- /images/1638342622208.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/1638342622208.png -------------------------------------------------------------------------------- /images/1735021652688.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/1735021652688.png -------------------------------------------------------------------------------- /images/Backup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/Backup.jpg -------------------------------------------------------------------------------- /images/QueryTable.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/QueryTable.jpg -------------------------------------------------------------------------------- /images/connection.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/connection.jpg -------------------------------------------------------------------------------- /images/filter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/filter.gif -------------------------------------------------------------------------------- /images/history.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/history.jpg -------------------------------------------------------------------------------- /images/mockData.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/mockData.jpg -------------------------------------------------------------------------------- /images/newquery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/newquery.jpg -------------------------------------------------------------------------------- /images/run.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/images/run.jpg -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('tailwindcss') 4 | ], 5 | }; 6 | -------------------------------------------------------------------------------- /public/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/public/icon.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | -------------------------------------------------------------------------------- /public/js/oldCompatible.js: -------------------------------------------------------------------------------- 1 | try { 2 | localStorage.getItem('') 3 | } catch (error) { 4 | delete localStorage 5 | window.localStorage={ setItem:()=>{}, getItem:()=>{}, } 6 | delete sessionStorage 7 | window.sessionStorage={ setItem:()=>{}, getItem:()=>{}, } 8 | } -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/public/logo.png -------------------------------------------------------------------------------- /public/logo_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/public/logo_dark.png -------------------------------------------------------------------------------- /public/theme/fonts/element-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/public/theme/fonts/element-icons.woff -------------------------------------------------------------------------------- /resources/icon/connection.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/icon/database-container.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /resources/icon/diagram-node.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/icon/diagram.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/icon/elasticsearch.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/icon/mssql_server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/resources/icon/mssql_server.png -------------------------------------------------------------------------------- /resources/icon/query.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/icon/sqlite-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/icon/state.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /resources/image/other-container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/resources/image/other-container.png -------------------------------------------------------------------------------- /resources/image/redis_connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/resources/image/redis_connection.png -------------------------------------------------------------------------------- /resources/image/redis_folder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /resources/image/terminal_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/resources/image/terminal_light.png -------------------------------------------------------------------------------- /resources/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/resources/logo.png -------------------------------------------------------------------------------- /resources/ssh/console.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/ssh/file.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/ssh/folder-core.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/ssh/forward.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /resources/ssh/html.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/ssh/java.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/ssh/javascript.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/ssh/json.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/ssh/key.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/ssh/log.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /resources/ssh/settings.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/ssh/sql.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/ssh/xml.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /resources/ssh/yaml.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/ssh/zip.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /sqlite/sqlite-v3.26.0-win32-x86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/sqlite/sqlite-v3.26.0-win32-x86.exe -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/src/.DS_Store -------------------------------------------------------------------------------- /src/common/Console.ts: -------------------------------------------------------------------------------- 1 | "user strict"; 2 | import * as vscode from "vscode"; 3 | import format = require('date-format'); 4 | 5 | export class Console { 6 | public static log(value: any) { 7 | if (this.outputChannel == null) { 8 | this.outputChannel = vscode.window.createOutputChannel("MySQL"); 9 | } 10 | if(value instanceof Error){ 11 | console.trace(value) 12 | } 13 | this.outputChannel.show(true); 14 | const begin = format('yyyy-MM-dd hh:mm:ss', new Date()); 15 | this.outputChannel.appendLine(`${begin} ${value}`); 16 | } 17 | 18 | public static ling(){ 19 | if (this.outputChannel == null) { 20 | this.outputChannel = vscode.window.createOutputChannel("MySQL"); 21 | } 22 | this.outputChannel.appendLine("-----------------------------------------------------------------------------------------"); 23 | } 24 | 25 | private static outputChannel: vscode.OutputChannel; 26 | } 27 | -------------------------------------------------------------------------------- /src/common/state.ts: -------------------------------------------------------------------------------- 1 | import { Global } from "./global"; 2 | import * as vscode from "vscode"; 3 | 4 | export class GlobalState { 5 | public static update(key: string, value: any): Thenable { 6 | key = getKey(key) 7 | return Global.context.globalState.update(key, value) 8 | } 9 | 10 | public static get(key: string, defaultValue?: T): T { 11 | key = getKey(key) 12 | return Global.context.globalState.get(key, defaultValue) 13 | } 14 | } 15 | 16 | export class WorkState { 17 | 18 | public static update(key: string, value: any): Thenable { 19 | key = getKey(key) 20 | return Global.context.workspaceState.update(key, value) 21 | } 22 | 23 | public static get(key: string, defaultValue?: T): T { 24 | key = getKey(key) 25 | return Global.context.workspaceState.get(key, defaultValue) 26 | } 27 | 28 | } 29 | export function getKey(key: string): string { 30 | 31 | if (vscode.env.remoteName == "ssh-remote" && key.indexOf("ssh-remote") == -1) { 32 | return key + "ssh-remote"; 33 | } 34 | 35 | return key; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/common/trans.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * avoid run send after date on query result. 3 | */ 4 | export class Trans { 5 | public static transId: string; 6 | public static begin() { 7 | this.transId=new Date().getTime()+"query"; 8 | } 9 | } -------------------------------------------------------------------------------- /src/common/wrapper.js: -------------------------------------------------------------------------------- 1 | /** 2 | * wrap origin with ` if is unusual identifier 3 | * @param origin any string 4 | */ 5 | export function wrapByDb(origin, databaseType) { 6 | if (origin == null) { return origin; } 7 | if (databaseType == 'PostgreSQL') { 8 | return origin.split(".").map(text => `"${text}"`).join(".") 9 | } 10 | if (databaseType == 'MongoDB') { 11 | return origin; 12 | } 13 | 14 | if (origin.match(/\b[-\s]+\b/ig) || origin.match(/^( |if|key|desc|length|group|order)$/i)) { 15 | if (databaseType == 'SqlServer') { 16 | return origin.split(".").map(text => `[${text}]`).join(".") 17 | } 18 | return `\`${origin}\``; 19 | } 20 | 21 | return origin; 22 | } -------------------------------------------------------------------------------- /src/model/database/userGroup.ts: -------------------------------------------------------------------------------- 1 | import * as path from "path"; 2 | import { ThemeIcon } from "vscode"; 3 | import { Constants, ModelType } from "../../common/constants"; 4 | import { QueryUnit } from "../../service/queryUnit"; 5 | import { Node } from "../interface/node"; 6 | import { InfoNode } from "../other/infoNode"; 7 | import { SchemaNode } from "./schemaNode"; 8 | import { UserNode } from "./userNode"; 9 | 10 | export class UserGroup extends SchemaNode { 11 | 12 | public contextValue: string = ModelType.USER_GROUP; 13 | public iconPath =new ThemeIcon("account") 14 | constructor(readonly name: string, readonly parent: Node) { 15 | super(name,parent) 16 | this.init(parent) 17 | // fix switch database fail. 18 | this.schema = null 19 | this.database = null 20 | } 21 | 22 | public async getChildren(isRresh: boolean = false): Promise { 23 | let userNodes = this.getChildCache(); 24 | if (userNodes && !isRresh) { 25 | return userNodes; 26 | } 27 | return this.execute(this.dialect.showUsers()) 28 | .then((tables) => { 29 | userNodes = tables.map((table) => { 30 | return new UserNode(table.user, table.host, this); 31 | }); 32 | this.setChildCache(userNodes) 33 | return userNodes; 34 | }) 35 | .catch((err) => { 36 | return [new InfoNode(err)]; 37 | }); 38 | } 39 | 40 | public async createTemplate() { 41 | 42 | QueryUnit.showSQLTextDocument(this, this.dialect.createUser(), 'create-user-template.sql') 43 | 44 | } 45 | 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/model/es/esRequest.ts: -------------------------------------------------------------------------------- 1 | 2 | export class EsRequest { 3 | 4 | constructor(public type: string, public path: string, public body: string) { } 5 | 6 | public static build(request: string, callback: (body: EsQuery) => void): string { 7 | const esReq = this.parse(request) 8 | const obj = JSON.parse(esReq.body) 9 | callback(obj) 10 | return `${esReq.type} ${esReq.path}\n${JSON.stringify(obj)}` 11 | } 12 | 13 | public static parse(request: string): EsRequest { 14 | 15 | const splitIndex = request.indexOf('\n') 16 | let [type, path] = (splitIndex == -1 ? request : request.substring(0, splitIndex)).split(' ') 17 | if (path?.charAt(0) != "/") { 18 | path = "/" + path 19 | } 20 | const body = splitIndex == -1 ? null : request.substring(splitIndex + 1) + "\n" 21 | 22 | return new EsRequest(type, path, body) 23 | } 24 | 25 | } 26 | 27 | export interface EsQuery { 28 | from?: number; 29 | size?: number; 30 | query?: any; 31 | sort?: any[]; 32 | stored_fields?: any; 33 | highlight?: any; 34 | } -------------------------------------------------------------------------------- /src/model/es/esUtil.ts: -------------------------------------------------------------------------------- 1 | import { FileManager, FileModel } from "@/common/filesManager"; 2 | import { ConnectionManager } from "@/service/connectionManager"; 3 | import { QueryUnit } from "@/service/queryUnit"; 4 | import * as vscode from 'vscode'; 5 | import { Node } from "../interface/node"; 6 | import { ElasticMatch } from "./provider/ElasticMatch"; 7 | 8 | export class EsUtil { 9 | 10 | public static async executeEsQueryFile(em: ElasticMatch, parse: boolean) { 11 | const node = ConnectionManager.getByActiveFile() as Node; 12 | if (node == null) { 13 | vscode.window.showErrorMessage("Not active es server found!") 14 | return; 15 | } 16 | if (parse) { 17 | QueryUnit.runQuery(`${em.Method.Text} ${em.Path.Text}\n${em.Body.Text}`, node, { split: true }) 18 | return; 19 | } 20 | (await node.getConnection()).query(`${em.Method.Text} ${em.Path.Text}\n${em.Body.Text}`, 'dontParse', async (err, data) => { 21 | const response = err?.message || JSON.stringify(data, null, 2); 22 | vscode.window.showTextDocument( 23 | await vscode.workspace.openTextDocument(await FileManager.record(`${node.getConnectId()}#result.json`, response, FileModel.WRITE)), 24 | vscode.ViewColumn.Two, true 25 | ) 26 | }) 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/model/es/model/esColumnNode.ts: -------------------------------------------------------------------------------- 1 | import { Constants, ModelType } from "@/common/constants"; 2 | import * as path from "path"; 3 | import { Node } from "../../interface/node"; 4 | 5 | export class EsColumnNode extends Node { 6 | 7 | public iconPath: string = path.join(Constants.RES_PATH, "icon/b_props.png"); 8 | public contextValue: string = ModelType.ES_COLUMN; 9 | private type:string; 10 | constructor(name: string, property: any, readonly parent: Node) { 11 | super(name) 12 | this.description=property.type 13 | this.type=property.type; 14 | this.init(parent) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/model/es/model/esIndexGroupNode.ts: -------------------------------------------------------------------------------- 1 | import { Node } from "@/model/interface/node"; 2 | import { TableGroup } from "@/model/main/tableGroup"; 3 | import { InfoNode } from "@/model/other/infoNode"; 4 | import { QueryUnit } from "@/service/queryUnit"; 5 | import { ThemeIcon } from "vscode"; 6 | import { ESIndexNode } from "./esIndexNode"; 7 | 8 | export class EsIndexGroup extends TableGroup { 9 | public iconPath = new ThemeIcon("type-hierarchy"); 10 | constructor(readonly parent: Node) { 11 | super(parent) 12 | this.label = "Index" 13 | } 14 | 15 | async getChildren(): Promise { 16 | return this.execute(`get /_cat/indices`).then((res: string) => { 17 | let indexes = []; 18 | const results = res.match(/[^\r\n]+/g); 19 | if(!results){ 20 | return [new InfoNode("This server has no index!")] 21 | } 22 | for (const result of results) { 23 | indexes.push(new ESIndexNode(result, this)) 24 | } 25 | return indexes; 26 | }) 27 | } 28 | 29 | public async createTemplate() { 30 | 31 | QueryUnit.showSQLTextDocument(this, this.dialect.tableTemplate(), 'create-index-template.es') 32 | 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/model/es/model/esTemplate.ts: -------------------------------------------------------------------------------- 1 | export class EsTemplate { 2 | public static query = `GET /myIndex/_search 3 | { 4 | "_source": { 5 | "includes":[$fields] 6 | }, 7 | "query": { 8 | "bool": { 9 | "must": [ 10 | { 11 | "match_all": {} 12 | } 13 | ], 14 | "filter": [], 15 | "should": [], 16 | "must_not": [] 17 | } 18 | }, 19 | "sort": [ 20 | { 21 | "_score": { 22 | "order": "desc" 23 | } 24 | } 25 | ], 26 | "highlight": { 27 | "pre_tags": [ 28 | "" 29 | ], 30 | "post_tags": [ 31 | "" 32 | ], 33 | "fields": { 34 | "*": {} 35 | }, 36 | "fragment_size": 2147483647 37 | } 38 | } 39 | 40 | POST /myIndex/_doc 41 | { 42 | "id": 1, 43 | "name": "test" 44 | }`; 45 | } -------------------------------------------------------------------------------- /src/model/es/provider/ElasticMatches.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { ElasticMatch } from './ElasticMatch'; 3 | 4 | export class ElasticMatches { 5 | Editor: vscode.TextEditor 6 | Matches: ElasticMatch[] 7 | Selection: ElasticMatch 8 | 9 | public constructor(editor: vscode.TextEditor) { 10 | 11 | if (!editor) { 12 | console.error("updateDecorations(): no active text editor."); 13 | this.Matches = [] 14 | return 15 | } 16 | this.Editor = editor 17 | this.Matches = [] 18 | 19 | var matched = false 20 | 21 | for (var i = 0; i < editor.document.lineCount; i++) { 22 | var line = editor.document.lineAt(i) 23 | var text = line.text.trim() 24 | if (text.length == 0) 25 | continue 26 | 27 | if (matched && text.startsWith('{')) 28 | this.Matches[this.Matches.length - 1].HasBody = true 29 | 30 | matched = false 31 | var match = ElasticMatch.RegexMatch.exec(text); 32 | 33 | if (match != null) { 34 | matched = true 35 | let em = new ElasticMatch(line, match); 36 | this.Matches.push(em) 37 | } 38 | } 39 | 40 | this.UpdateSelection(editor) 41 | } 42 | 43 | public UpdateSelection(editor) { 44 | this.Editor = editor 45 | this.Matches.forEach(element => { 46 | element.Selected = element.Range.contains(editor.selection) 47 | if (element.Selected) 48 | this.Selection = element 49 | }); 50 | } 51 | } -------------------------------------------------------------------------------- /src/model/es/provider/documentFinder.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | const url = require('url'); 3 | 4 | export class DocumentFinder { 5 | 6 | private static documentMap = { 7 | "_count": "search-count", 8 | "_search": "search-search", 9 | "_stats": "indices-stats", 10 | } 11 | 12 | public static find(path: string) { 13 | return this.documentMap[url.parse(path).pathname.replace("/", '')] 14 | } 15 | 16 | public static open(path: string) { 17 | 18 | const docuemntPath = this.find(path) 19 | if (!docuemntPath) { 20 | vscode.window.showErrorMessage("Not doucment found!") 21 | return; 22 | } 23 | 24 | vscode.env.openExternal(vscode.Uri.parse(`https://www.elastic.co/guide/en/elasticsearch/reference/master/${docuemntPath}.html`)); 25 | 26 | 27 | } 28 | 29 | 30 | } -------------------------------------------------------------------------------- /src/model/es/provider/main.ts: -------------------------------------------------------------------------------- 1 | import { stringify } from 'comment-json'; 2 | import * as vscode from 'vscode'; 3 | import { EsUtil } from '../esUtil'; 4 | import { DocumentFinder } from './documentFinder'; 5 | import { ElasticCodeLensProvider } from './ElasticCodeLensProvider'; 6 | import { ElasticCompletionItemProvider } from './ElasticCompletionItemProvider'; 7 | import { ElasticMatch } from './ElasticMatch'; 8 | 9 | export async function activeEs(context: vscode.ExtensionContext) { 10 | const languages = { language: 'es' }; 11 | context.subscriptions.push( 12 | vscode.languages.registerCompletionItemProvider(languages, new ElasticCompletionItemProvider(), '/', '?', '&', '"'), 13 | vscode.languages.registerCodeLensProvider(languages, new ElasticCodeLensProvider(context)), 14 | vscode.commands.registerCommand('mysql.elastic.document', (em: ElasticMatch) => { DocumentFinder.open(em.Path.Text) }), 15 | vscode.commands.registerCommand('mysql.elastic.execute', EsUtil.executeEsQueryFile), 16 | vscode.commands.registerCommand('mysql.elastic.lint', (em: ElasticMatch) => { 17 | if (em && em.HasBody) { 18 | vscode.window.activeTextEditor.edit(editBuilder => { 19 | editBuilder.replace(em.Body.Range, stringify(em.Body.obj, null, 2)) 20 | }); 21 | } 22 | }), 23 | ); 24 | } -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/index.ts: -------------------------------------------------------------------------------- 1 | import * as v6_0_0 from './v6_0_0'; 2 | 3 | export default { 4 | '6.0.0': v6_0_0 5 | } -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/json.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.json" { const value: any; export default value; } -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/_common.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Parameters that are accepted by all API endpoints.", 3 | "documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html", 4 | "params": { 5 | "pretty": { 6 | "type": "boolean", 7 | "description": "Pretty format the returned JSON response.", 8 | "default": false 9 | }, 10 | "human": { 11 | "type": "boolean", 12 | "description": "Return human readable values for statistics.", 13 | "default": true 14 | }, 15 | "error_trace": { 16 | "type": "boolean", 17 | "description": "Include the stack trace of returned errors.", 18 | "default": false 19 | }, 20 | "source": { 21 | "type": "string", 22 | "description": "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests." 23 | }, 24 | "filter_path": { 25 | "type": "list", 26 | "description": "A comma-separated list of filters used to reduce the respone." 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cat.aliases.json: -------------------------------------------------------------------------------- 1 | { 2 | "cat.aliases": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cat/aliases", 7 | "paths": ["/_cat/aliases", "/_cat/aliases/{name}"], 8 | "parts": { 9 | "name": { 10 | "type" : "list", 11 | "description" : "A comma-separated list of alias names to return" 12 | } 13 | }, 14 | "params": { 15 | "format": { 16 | "type" : "string", 17 | "description" : "a short version of the Accept header, e.g. json, yaml" 18 | }, 19 | "local": { 20 | "type" : "boolean", 21 | "description" : "Return local information, do not retrieve the state from master node (default: false)" 22 | }, 23 | "master_timeout": { 24 | "type" : "time", 25 | "description" : "Explicit operation timeout for connection to master node" 26 | }, 27 | "h": { 28 | "type": "list", 29 | "description" : "Comma-separated list of column names to display" 30 | }, 31 | "help": { 32 | "type": "boolean", 33 | "description": "Return help information", 34 | "default": false 35 | }, 36 | "s": { 37 | "type": "list", 38 | "description" : "Comma-separated list of column names or column aliases to sort by" 39 | }, 40 | "v": { 41 | "type": "boolean", 42 | "description": "Verbose mode. Display column headers", 43 | "default": false 44 | } 45 | } 46 | }, 47 | "body": null 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cat.health.json: -------------------------------------------------------------------------------- 1 | { 2 | "cat.health": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cat/health", 7 | "paths": ["/_cat/health"], 8 | "parts": { 9 | }, 10 | "params": { 11 | "format": { 12 | "type" : "string", 13 | "description" : "a short version of the Accept header, e.g. json, yaml" 14 | }, 15 | "local": { 16 | "type" : "boolean", 17 | "description" : "Return local information, do not retrieve the state from master node (default: false)" 18 | }, 19 | "master_timeout": { 20 | "type" : "time", 21 | "description" : "Explicit operation timeout for connection to master node" 22 | }, 23 | "h": { 24 | "type": "list", 25 | "description" : "Comma-separated list of column names to display" 26 | }, 27 | "help": { 28 | "type": "boolean", 29 | "description": "Return help information", 30 | "default": false 31 | }, 32 | "s": { 33 | "type": "list", 34 | "description" : "Comma-separated list of column names or column aliases to sort by" 35 | }, 36 | "ts": { 37 | "type": "boolean", 38 | "description": "Set to false to disable timestamping", 39 | "default": true 40 | }, 41 | "v": { 42 | "type": "boolean", 43 | "description": "Verbose mode. Display column headers", 44 | "default": false 45 | } 46 | } 47 | }, 48 | "body": null 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cat.help.json: -------------------------------------------------------------------------------- 1 | { 2 | "cat.help": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cat", 7 | "paths": ["/_cat"], 8 | "parts": { 9 | }, 10 | "params": { 11 | "help": { 12 | "type": "boolean", 13 | "description": "Return help information", 14 | "default": false 15 | }, 16 | "s": { 17 | "type": "list", 18 | "description" : "Comma-separated list of column names or column aliases to sort by" 19 | } 20 | } 21 | }, 22 | "body": null 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cat.master.json: -------------------------------------------------------------------------------- 1 | { 2 | "cat.master": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cat/master", 7 | "paths": ["/_cat/master"], 8 | "parts": { 9 | }, 10 | "params": { 11 | "format": { 12 | "type" : "string", 13 | "description" : "a short version of the Accept header, e.g. json, yaml" 14 | }, 15 | "local": { 16 | "type" : "boolean", 17 | "description" : "Return local information, do not retrieve the state from master node (default: false)" 18 | }, 19 | "master_timeout": { 20 | "type" : "time", 21 | "description" : "Explicit operation timeout for connection to master node" 22 | }, 23 | "h": { 24 | "type": "list", 25 | "description" : "Comma-separated list of column names to display" 26 | }, 27 | "help": { 28 | "type": "boolean", 29 | "description": "Return help information", 30 | "default": false 31 | }, 32 | "s": { 33 | "type": "list", 34 | "description" : "Comma-separated list of column names or column aliases to sort by" 35 | }, 36 | "v": { 37 | "type": "boolean", 38 | "description": "Verbose mode. Display column headers", 39 | "default": false 40 | } 41 | } 42 | }, 43 | "body": null 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cat.nodeattrs.json: -------------------------------------------------------------------------------- 1 | { 2 | "cat.nodeattrs": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cat/nodeattrs", 7 | "paths": ["/_cat/nodeattrs"], 8 | "parts": { 9 | }, 10 | "params": { 11 | "format": { 12 | "type" : "string", 13 | "description" : "a short version of the Accept header, e.g. json, yaml" 14 | }, 15 | "local": { 16 | "type" : "boolean", 17 | "description" : "Return local information, do not retrieve the state from master node (default: false)" 18 | }, 19 | "master_timeout": { 20 | "type" : "time", 21 | "description" : "Explicit operation timeout for connection to master node" 22 | }, 23 | "h": { 24 | "type": "list", 25 | "description" : "Comma-separated list of column names to display" 26 | }, 27 | "help": { 28 | "type": "boolean", 29 | "description": "Return help information", 30 | "default": false 31 | }, 32 | "s": { 33 | "type": "list", 34 | "description" : "Comma-separated list of column names or column aliases to sort by" 35 | }, 36 | "v": { 37 | "type": "boolean", 38 | "description": "Verbose mode. Display column headers", 39 | "default": false 40 | } 41 | } 42 | }, 43 | "body": null 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cat.nodes.json: -------------------------------------------------------------------------------- 1 | { 2 | "cat.nodes": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cat/nodes", 7 | "paths": ["/_cat/nodes"], 8 | "parts": { 9 | }, 10 | "params": { 11 | "format": { 12 | "type" : "string", 13 | "description" : "a short version of the Accept header, e.g. json, yaml" 14 | }, 15 | "full_id": { 16 | "type" : "boolean", 17 | "description" : "Return the full node ID instead of the shortened version (default: false)" 18 | }, 19 | "local": { 20 | "type" : "boolean", 21 | "description" : "Return local information, do not retrieve the state from master node (default: false)" 22 | }, 23 | "master_timeout": { 24 | "type" : "time", 25 | "description" : "Explicit operation timeout for connection to master node" 26 | }, 27 | "h": { 28 | "type": "list", 29 | "description" : "Comma-separated list of column names to display" 30 | }, 31 | "help": { 32 | "type": "boolean", 33 | "description": "Return help information", 34 | "default": false 35 | }, 36 | "s": { 37 | "type": "list", 38 | "description" : "Comma-separated list of column names or column aliases to sort by" 39 | }, 40 | "v": { 41 | "type": "boolean", 42 | "description": "Verbose mode. Display column headers", 43 | "default": false 44 | } 45 | } 46 | }, 47 | "body": null 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cat.pending_tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "cat.pending_tasks": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cat/pending_tasks", 7 | "paths": ["/_cat/pending_tasks"], 8 | "parts": { 9 | }, 10 | "params": { 11 | "format": { 12 | "type" : "string", 13 | "description" : "a short version of the Accept header, e.g. json, yaml" 14 | }, 15 | "local": { 16 | "type" : "boolean", 17 | "description" : "Return local information, do not retrieve the state from master node (default: false)" 18 | }, 19 | "master_timeout": { 20 | "type" : "time", 21 | "description" : "Explicit operation timeout for connection to master node" 22 | }, 23 | "h": { 24 | "type": "list", 25 | "description" : "Comma-separated list of column names to display" 26 | }, 27 | "help": { 28 | "type": "boolean", 29 | "description": "Return help information", 30 | "default": false 31 | }, 32 | "s": { 33 | "type": "list", 34 | "description" : "Comma-separated list of column names or column aliases to sort by" 35 | }, 36 | "v": { 37 | "type": "boolean", 38 | "description": "Verbose mode. Display column headers", 39 | "default": false 40 | } 41 | } 42 | }, 43 | "body": null 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cat.plugins.json: -------------------------------------------------------------------------------- 1 | { 2 | "cat.plugins": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cat/plugins", 7 | "paths": ["/_cat/plugins"], 8 | "params": { 9 | "format": { 10 | "type" : "string", 11 | "description" : "a short version of the Accept header, e.g. json, yaml" 12 | }, 13 | "local": { 14 | "type" : "boolean", 15 | "description" : "Return local information, do not retrieve the state from master node (default: false)" 16 | }, 17 | "master_timeout": { 18 | "type" : "time", 19 | "description" : "Explicit operation timeout for connection to master node" 20 | }, 21 | "h": { 22 | "type": "list", 23 | "description" : "Comma-separated list of column names to display" 24 | }, 25 | "help": { 26 | "type": "boolean", 27 | "description": "Return help information", 28 | "default": false 29 | }, 30 | "s": { 31 | "type": "list", 32 | "description" : "Comma-separated list of column names or column aliases to sort by" 33 | }, 34 | "v": { 35 | "type": "boolean", 36 | "description": "Verbose mode. Display column headers", 37 | "default": false 38 | } 39 | } 40 | }, 41 | "body": null 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cat.repositories.json: -------------------------------------------------------------------------------- 1 | { 2 | "cat.repositories": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cat/repositories", 7 | "paths": ["/_cat/repositories"], 8 | "parts": { 9 | }, 10 | "params": { 11 | "format": { 12 | "type" : "string", 13 | "description" : "a short version of the Accept header, e.g. json, yaml" 14 | }, 15 | "local": { 16 | "type" : "boolean", 17 | "description" : "Return local information, do not retrieve the state from master node", 18 | "default": false 19 | }, 20 | "master_timeout": { 21 | "type" : "time", 22 | "description" : "Explicit operation timeout for connection to master node" 23 | }, 24 | "h": { 25 | "type": "list", 26 | "description" : "Comma-separated list of column names to display" 27 | }, 28 | "help": { 29 | "type": "boolean", 30 | "description": "Return help information", 31 | "default": false 32 | }, 33 | "s": { 34 | "type": "list", 35 | "description" : "Comma-separated list of column names or column aliases to sort by" 36 | }, 37 | "v": { 38 | "type": "boolean", 39 | "description": "Verbose mode. Display column headers", 40 | "default": false 41 | } 42 | } 43 | }, 44 | "body": null 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cat.segments.json: -------------------------------------------------------------------------------- 1 | { 2 | "cat.segments": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cat/segments", 7 | "paths": ["/_cat/segments", "/_cat/segments/{index}"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "description": "A comma-separated list of index names to limit the returned information" 12 | } 13 | }, 14 | "params": { 15 | "format": { 16 | "type" : "string", 17 | "description" : "a short version of the Accept header, e.g. json, yaml" 18 | }, 19 | "bytes": { 20 | "type": "enum", 21 | "description" : "The unit in which to display byte values", 22 | "options": [ "b", "k", "kb", "m", "mb", "g", "gb", "t", "tb", "p", "pb" ] 23 | }, 24 | "h": { 25 | "type": "list", 26 | "description" : "Comma-separated list of column names to display" 27 | }, 28 | "help": { 29 | "type": "boolean", 30 | "description": "Return help information", 31 | "default": false 32 | }, 33 | "s": { 34 | "type": "list", 35 | "description" : "Comma-separated list of column names or column aliases to sort by" 36 | }, 37 | "v": { 38 | "type": "boolean", 39 | "description": "Verbose mode. Display column headers", 40 | "default": false 41 | } 42 | } 43 | }, 44 | "body": null 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/clear_scroll.json: -------------------------------------------------------------------------------- 1 | { 2 | "clear_scroll": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html", 4 | "methods": ["DELETE"], 5 | "url": { 6 | "path": "/_search/scroll/{scroll_id}", 7 | "paths": ["/_search/scroll/{scroll_id}", "/_search/scroll"], 8 | "parts": { 9 | "scroll_id": { 10 | "type" : "list", 11 | "description" : "A comma-separated list of scroll IDs to clear" 12 | } 13 | }, 14 | "params": {} 15 | }, 16 | "body": { 17 | "description": "A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cluster.allocation_explain.json: -------------------------------------------------------------------------------- 1 | { 2 | "cluster.allocation_explain": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html", 4 | "methods": ["GET", "POST"], 5 | "url": { 6 | "path": "/_cluster/allocation/explain", 7 | "paths": ["/_cluster/allocation/explain"], 8 | "parts": {}, 9 | "params": { 10 | "include_yes_decisions": { 11 | "type": "boolean", 12 | "description": "Return 'YES' decisions in explanation (default: false)" 13 | }, 14 | "include_disk_info": { 15 | "type": "boolean", 16 | "description": "Return information about disk usage and shard sizes (default: false)" 17 | } 18 | } 19 | }, 20 | "body": { 21 | "description": "The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard'" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cluster.get_settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cluster.get_settings": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cluster/settings", 7 | "paths": ["/_cluster/settings"], 8 | "parts": {}, 9 | "params": { 10 | "flat_settings": { 11 | "type": "boolean", 12 | "description": "Return settings in flat format (default: false)" 13 | }, 14 | "master_timeout": { 15 | "type" : "time", 16 | "description" : "Explicit operation timeout for connection to master node" 17 | }, 18 | "timeout": { 19 | "type" : "time", 20 | "description" : "Explicit operation timeout" 21 | }, 22 | "include_defaults": { 23 | "type": "boolean", 24 | "description": "Whether to return all default clusters setting.", 25 | "default": false 26 | } 27 | } 28 | }, 29 | "body": null 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cluster.pending_tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "cluster.pending_tasks": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cluster/pending_tasks", 7 | "paths": ["/_cluster/pending_tasks"], 8 | "parts": { 9 | }, 10 | "params": { 11 | "local": { 12 | "type": "boolean", 13 | "description": "Return local information, do not retrieve the state from master node (default: false)" 14 | }, 15 | "master_timeout": { 16 | "type": "time", 17 | "description": "Specify timeout for connection to master" 18 | } 19 | } 20 | }, 21 | "body": null 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cluster.put_settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cluster.put_settings": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html", 4 | "methods": ["PUT"], 5 | "url": { 6 | "path": "/_cluster/settings", 7 | "paths": ["/_cluster/settings"], 8 | "parts": {}, 9 | "params": { 10 | "flat_settings": { 11 | "type": "boolean", 12 | "description": "Return settings in flat format (default: false)" 13 | }, 14 | "master_timeout": { 15 | "type" : "time", 16 | "description" : "Explicit operation timeout for connection to master node" 17 | }, 18 | "timeout": { 19 | "type" : "time", 20 | "description" : "Explicit operation timeout" 21 | } 22 | } 23 | }, 24 | "body": { 25 | "description": "The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart)." 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cluster.reroute.json: -------------------------------------------------------------------------------- 1 | { 2 | "cluster.reroute": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html", 4 | "methods": ["POST"], 5 | "url": { 6 | "path": "/_cluster/reroute", 7 | "paths": ["/_cluster/reroute"], 8 | "parts": { 9 | }, 10 | "params": { 11 | "dry_run": { 12 | "type" : "boolean", 13 | "description" : "Simulate the operation only and return the resulting state" 14 | }, 15 | "explain": { 16 | "type" : "boolean", 17 | "description" : "Return an explanation of why the commands can or cannot be executed" 18 | }, 19 | "retry_failed": { 20 | "type" : "boolean", 21 | "description" : "Retries allocation of shards that are blocked due to too many subsequent allocation failures" 22 | }, 23 | "metric": { 24 | "type": "list", 25 | "options": ["_all", "blocks", "metadata", "nodes", "routing_table", "master_node", "version"], 26 | "description": "Limit the information returned to the specified metrics. Defaults to all but metadata" 27 | }, 28 | "master_timeout": { 29 | "type" : "time", 30 | "description" : "Explicit operation timeout for connection to master node" 31 | }, 32 | "timeout": { 33 | "type" : "time", 34 | "description" : "Explicit operation timeout" 35 | } 36 | } 37 | }, 38 | "body": { 39 | "description" : "The definition of `commands` to perform (`move`, `cancel`, `allocate`)" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/cluster.stats.json: -------------------------------------------------------------------------------- 1 | { 2 | "cluster.stats": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_cluster/stats", 7 | "paths": ["/_cluster/stats", "/_cluster/stats/nodes/{node_id}"], 8 | "parts": { 9 | "node_id": { 10 | "type" : "list", 11 | "description" : "A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes" 12 | } 13 | }, 14 | "params": { 15 | "flat_settings": { 16 | "type": "boolean", 17 | "description": "Return settings in flat format (default: false)" 18 | }, 19 | "timeout": { 20 | "type" : "time", 21 | "description" : "Explicit operation timeout" 22 | } 23 | } 24 | }, 25 | "body": null 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/delete_script.json: -------------------------------------------------------------------------------- 1 | { 2 | "delete_script": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html", 4 | "methods": ["DELETE"], 5 | "url": { 6 | "path": "/_scripts/{id}", 7 | "paths": [ "/_scripts/{id}" ], 8 | "parts": { 9 | "id": { 10 | "type" : "string", 11 | "description" : "Script ID", 12 | "required" : true 13 | } 14 | }, 15 | "params" : { 16 | "timeout": { 17 | "type" : "time", 18 | "description" : "Explicit operation timeout" 19 | }, 20 | "master_timeout": { 21 | "type" : "time", 22 | "description" : "Specify timeout for connection to master" 23 | } 24 | } 25 | }, 26 | "body": null 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/field_caps.json: -------------------------------------------------------------------------------- 1 | { 2 | "field_caps": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html", 4 | "methods": ["GET", "POST"], 5 | "url": { 6 | "path": "/_field_caps", 7 | "paths": [ 8 | "/_field_caps", 9 | "/{index}/_field_caps" 10 | ], 11 | "parts": { 12 | "index": { 13 | "type" : "list", 14 | "description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" 15 | } 16 | }, 17 | "params": { 18 | "fields": { 19 | "type" : "list", 20 | "description" : "A comma-separated list of field names" 21 | }, 22 | "ignore_unavailable": { 23 | "type" : "boolean", 24 | "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)" 25 | }, 26 | "allow_no_indices": { 27 | "type" : "boolean", 28 | "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" 29 | }, 30 | "expand_wildcards": { 31 | "type" : "enum", 32 | "options" : ["open","closed","none","all"], 33 | "default" : "open", 34 | "description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both." 35 | } 36 | } 37 | }, 38 | "body": { 39 | "description": "Field json objects containing an array of field names", 40 | "required": false 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/get_script.json: -------------------------------------------------------------------------------- 1 | { 2 | "get_script": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_scripts/{id}", 7 | "paths": [ "/_scripts/{id}" ], 8 | "parts": { 9 | "id": { 10 | "type" : "string", 11 | "description" : "Script ID", 12 | "required" : true 13 | } 14 | }, 15 | "params" : { 16 | } 17 | }, 18 | "body": null 19 | } 20 | } -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.analyze.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.analyze": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html", 4 | "methods": ["GET", "POST"], 5 | "url": { 6 | "path": "/_analyze", 7 | "paths": ["/_analyze", "/{index}/_analyze"], 8 | "parts": { 9 | "index": { 10 | "type" : "string", 11 | "description" : "The name of the index to scope the operation" 12 | } 13 | }, 14 | "params": { 15 | "index": { 16 | "type" : "string", 17 | "description" : "The name of the index to scope the operation" 18 | }, 19 | "prefer_local": { 20 | "type" : "boolean", 21 | "description" : "With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true)" 22 | }, 23 | "format": { 24 | "type": "enum", 25 | "options" : ["detailed","text"], 26 | "default": "detailed", 27 | "description": "Format of the output" 28 | } 29 | } 30 | }, 31 | "body": { 32 | "description" : "Define analyzer/tokenizer parameters and the text on which the analysis should be performed" 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.close.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.close": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html", 4 | "methods": ["POST"], 5 | "url": { 6 | "path": "/{index}/_close", 7 | "paths": ["/{index}/_close"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "required" : true, 12 | "description" : "A comma separated list of indices to close" 13 | } 14 | }, 15 | "params": { 16 | "timeout": { 17 | "type" : "time", 18 | "description" : "Explicit operation timeout" 19 | }, 20 | "master_timeout": { 21 | "type" : "time", 22 | "description" : "Specify timeout for connection to master" 23 | }, 24 | "ignore_unavailable": { 25 | "type" : "boolean", 26 | "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)" 27 | }, 28 | "allow_no_indices": { 29 | "type" : "boolean", 30 | "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" 31 | }, 32 | "expand_wildcards": { 33 | "type" : "enum", 34 | "options" : ["open","closed","none","all"], 35 | "default" : "open", 36 | "description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both." 37 | } 38 | } 39 | }, 40 | "body": null 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.create.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.create": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html", 4 | "methods": ["PUT"], 5 | "url": { 6 | "path": "/{index}", 7 | "paths": ["/{index}"], 8 | "parts": { 9 | "index": { 10 | "type" : "string", 11 | "required" : true, 12 | "description" : "The name of the index" 13 | } 14 | }, 15 | "params": { 16 | "wait_for_active_shards": { 17 | "type" : "string", 18 | "description" : "Set the number of active shards to wait for before the operation returns." 19 | }, 20 | "timeout": { 21 | "type" : "time", 22 | "description" : "Explicit operation timeout" 23 | }, 24 | "master_timeout": { 25 | "type" : "time", 26 | "description" : "Specify timeout for connection to master" 27 | }, 28 | "update_all_types": { 29 | "type": "boolean", 30 | "description": "Whether to update the mapping for all fields with the same name across all types or not" 31 | } 32 | } 33 | }, 34 | "body": { 35 | "description" : "The configuration for the index (`settings` and `mappings`)" 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.delete": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html", 4 | "methods": ["DELETE"], 5 | "url": { 6 | "path": "/{index}", 7 | "paths": ["/{index}"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "required" : true, 12 | "description" : "A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices" 13 | } 14 | }, 15 | "params": { 16 | "timeout": { 17 | "type" : "time", 18 | "description" : "Explicit operation timeout" 19 | }, 20 | "master_timeout": { 21 | "type" : "time", 22 | "description" : "Specify timeout for connection to master" 23 | }, 24 | "ignore_unavailable": { 25 | "type": "boolean", 26 | "description": "Ignore unavailable indexes (default: false)" 27 | }, 28 | "allow_no_indices": { 29 | "type": "boolean", 30 | "description": "Ignore if a wildcard expression resolves to no concrete indices (default: false)" 31 | }, 32 | "expand_wildcards": { 33 | "type": "enum", 34 | "options": [ "open", "closed", "none", "all" ], 35 | "default": "open", 36 | "description": "Whether wildcard expressions should get expanded to open or closed indices (default: open)" 37 | } 38 | } 39 | }, 40 | "body": null 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.delete_alias.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.delete_alias": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html", 4 | "methods": ["DELETE"], 5 | "url": { 6 | "path": "/{index}/_alias/{name}", 7 | "paths": ["/{index}/_alias/{name}", "/{index}/_aliases/{name}"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "required" : true, 12 | "description" : "A comma-separated list of index names (supports wildcards); use `_all` for all indices" 13 | }, 14 | "name": { 15 | "type" : "list", 16 | "required" : true, 17 | "description" : "A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices." 18 | } 19 | }, 20 | "params": { 21 | "timeout": { 22 | "type" : "time", 23 | "description" : "Explicit timestamp for the document" 24 | }, 25 | "master_timeout": { 26 | "type" : "time", 27 | "description" : "Specify timeout for connection to master" 28 | } 29 | } 30 | }, 31 | "body": null 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.delete_template.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.delete_template": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", 4 | "methods": ["DELETE"], 5 | "url": { 6 | "path": "/_template/{name}", 7 | "paths": ["/_template/{name}"], 8 | "parts": { 9 | "name": { 10 | "type" : "string", 11 | "required" : true, 12 | "description" : "The name of the template" 13 | } 14 | }, 15 | "params": { 16 | "timeout": { 17 | "type" : "time", 18 | "description" : "Explicit operation timeout" 19 | }, 20 | "master_timeout": { 21 | "type" : "time", 22 | "description" : "Specify timeout for connection to master" 23 | } 24 | } 25 | }, 26 | "body": null 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.exists_alias.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.exists_alias": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html", 4 | "methods": ["HEAD"], 5 | "url": { 6 | "path": "/_alias/{name}", 7 | "paths": ["/_alias/{name}", "/{index}/_alias/{name}"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "description" : "A comma-separated list of index names to filter aliases" 12 | }, 13 | "name": { 14 | "type" : "list", 15 | "description" : "A comma-separated list of alias names to return" 16 | } 17 | }, 18 | "params": { 19 | "ignore_unavailable": { 20 | "type" : "boolean", 21 | "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)" 22 | }, 23 | "allow_no_indices": { 24 | "type" : "boolean", 25 | "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" 26 | }, 27 | "expand_wildcards": { 28 | "type" : "enum", 29 | "options" : ["open","closed","none","all"], 30 | "default" : "all", 31 | "description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both." 32 | }, 33 | "local": { 34 | "type": "boolean", 35 | "description": "Return local information, do not retrieve the state from master node (default: false)" 36 | } 37 | } 38 | }, 39 | "body": null 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.exists_template.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.exists_template": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", 4 | "methods": ["HEAD"], 5 | "url": { 6 | "path": "/_template/{name}", 7 | "paths": [ "/_template/{name}" ], 8 | "parts": { 9 | "name": { 10 | "type": "list", 11 | "required": true, 12 | "description": "The comma separated names of the index templates" 13 | } 14 | }, 15 | "params": { 16 | "flat_settings": { 17 | "type": "boolean", 18 | "description": "Return settings in flat format (default: false)" 19 | }, 20 | "master_timeout": { 21 | "type": "time", 22 | "description": "Explicit operation timeout for connection to master node" 23 | }, 24 | "local": { 25 | "type": "boolean", 26 | "description": "Return local information, do not retrieve the state from master node (default: false)" 27 | } 28 | } 29 | }, 30 | "body": null 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.flush_synced.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.flush_synced": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush.html", 4 | "methods": ["POST", "GET"], 5 | "url": { 6 | "path": "/_flush/synced", 7 | "paths": [ 8 | "/_flush/synced", 9 | "/{index}/_flush/synced" 10 | ], 11 | "parts": { 12 | "index": { 13 | "type" : "list", 14 | "description" : "A comma-separated list of index names; use `_all` or empty string for all indices" 15 | } 16 | }, 17 | "params": { 18 | "ignore_unavailable": { 19 | "type": "boolean", 20 | "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed)" 21 | }, 22 | "allow_no_indices": { 23 | "type": "boolean", 24 | "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" 25 | }, 26 | "expand_wildcards": { 27 | "type": "enum", 28 | "options": [ 29 | "open", 30 | "closed", 31 | "none", 32 | "all" 33 | ], 34 | "default": "open", 35 | "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both." 36 | } 37 | } 38 | }, 39 | "body": null 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.get_mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.get_mapping": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_mapping", 7 | "paths": ["/_mapping", "/{index}/_mapping", "/_mapping/{type}", "/{index}/_mapping/{type}"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "description" : "A comma-separated list of index names" 12 | }, 13 | "type": { 14 | "type" : "list", 15 | "description" : "A comma-separated list of document types" 16 | } 17 | }, 18 | "params": { 19 | "ignore_unavailable": { 20 | "type" : "boolean", 21 | "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)" 22 | }, 23 | "allow_no_indices": { 24 | "type" : "boolean", 25 | "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" 26 | }, 27 | "expand_wildcards": { 28 | "type" : "enum", 29 | "options" : ["open","closed","none","all"], 30 | "default" : "open", 31 | "description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both." 32 | }, 33 | "local": { 34 | "type": "boolean", 35 | "description": "Return local information, do not retrieve the state from master node (default: false)" 36 | } 37 | } 38 | }, 39 | "body": null 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.get_template.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.get_template": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_template/{name}", 7 | "paths": [ 8 | "/_template", 9 | "/_template/{name}" 10 | ], 11 | "parts": { 12 | "name": { 13 | "type": "list", 14 | "required": false, 15 | "description": "The comma separated names of the index templates" 16 | } 17 | }, 18 | "params": { 19 | "flat_settings": { 20 | "type": "boolean", 21 | "description": "Return settings in flat format (default: false)" 22 | }, 23 | "master_timeout": { 24 | "type": "time", 25 | "description": "Explicit operation timeout for connection to master node" 26 | }, 27 | "local": { 28 | "type": "boolean", 29 | "description": "Return local information, do not retrieve the state from master node (default: false)" 30 | } 31 | } 32 | }, 33 | "body": null 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.get_upgrade.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.get_upgrade": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_upgrade", 7 | "paths": ["/_upgrade", "/{index}/_upgrade"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" 12 | } 13 | }, 14 | "params": { 15 | "ignore_unavailable": { 16 | "type" : "boolean", 17 | "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)" 18 | }, 19 | "allow_no_indices": { 20 | "type" : "boolean", 21 | "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" 22 | }, 23 | "expand_wildcards": { 24 | "type" : "enum", 25 | "options" : ["open","closed","none","all"], 26 | "default" : "open", 27 | "description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both." 28 | } 29 | } 30 | }, 31 | "body": null 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.open.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.open": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html", 4 | "methods": ["POST"], 5 | "url": { 6 | "path": "/{index}/_open", 7 | "paths": ["/{index}/_open"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "required" : true, 12 | "description" : "A comma separated list of indices to open" 13 | } 14 | }, 15 | "params": { 16 | "timeout": { 17 | "type" : "time", 18 | "description" : "Explicit operation timeout" 19 | }, 20 | "master_timeout": { 21 | "type" : "time", 22 | "description" : "Specify timeout for connection to master" 23 | }, 24 | "ignore_unavailable": { 25 | "type" : "boolean", 26 | "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)" 27 | }, 28 | "allow_no_indices": { 29 | "type" : "boolean", 30 | "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" 31 | }, 32 | "expand_wildcards": { 33 | "type" : "enum", 34 | "options" : ["open","closed","none","all"], 35 | "default" : "closed", 36 | "description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both." 37 | } 38 | } 39 | }, 40 | "body": null 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.put_alias.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.put_alias": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html", 4 | "methods": ["PUT", "POST"], 5 | "url": { 6 | "path": "/{index}/_alias/{name}", 7 | "paths": ["/{index}/_alias/{name}", "/{index}/_aliases/{name}"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "required" : true, 12 | "description" : "A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices." 13 | }, 14 | "name": { 15 | "type" : "string", 16 | "required" : true, 17 | "description" : "The name of the alias to be created or updated" 18 | } 19 | }, 20 | "params": { 21 | "timeout": { 22 | "type" : "time", 23 | "description" : "Explicit timestamp for the document" 24 | }, 25 | "master_timeout": { 26 | "type" : "time", 27 | "description" : "Specify timeout for connection to master" 28 | } 29 | } 30 | }, 31 | "body": { 32 | "description" : "The settings for the alias, such as `routing` or `filter`", 33 | "required" : false 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.put_template.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.put_template": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", 4 | "methods": ["PUT", "POST"], 5 | "url": { 6 | "path": "/_template/{name}", 7 | "paths": ["/_template/{name}"], 8 | "parts": { 9 | "name": { 10 | "type" : "string", 11 | "required" : true, 12 | "description" : "The name of the template" 13 | } 14 | }, 15 | "params": { 16 | "order": { 17 | "type" : "number", 18 | "description" : "The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)" 19 | }, 20 | "create" : { 21 | "type" : "boolean", 22 | "description" : "Whether the index template should only be added if new or can also replace an existing one", 23 | "default" : false 24 | }, 25 | "timeout": { 26 | "type" : "time", 27 | "description" : "Explicit operation timeout" 28 | }, 29 | "master_timeout": { 30 | "type" : "time", 31 | "description" : "Specify timeout for connection to master" 32 | }, 33 | "flat_settings": { 34 | "type": "boolean", 35 | "description": "Return settings in flat format (default: false)" 36 | } 37 | } 38 | }, 39 | "body": { 40 | "description" : "The template definition", 41 | "required" : true 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.recovery.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.recovery" : { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_recovery", 7 | "paths": ["/_recovery", "/{index}/_recovery"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" 12 | } 13 | }, 14 | "params": { 15 | "detailed" : { 16 | "type": "boolean", 17 | "description": "Whether to display detailed information about shard recovery", 18 | "default": false 19 | }, 20 | "active_only" : { 21 | "type": "boolean", 22 | "description": "Display only those recoveries that are currently on-going", 23 | "default": false 24 | } 25 | } 26 | }, 27 | "body": null 28 | } 29 | } -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.refresh.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.refresh": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html", 4 | "methods": ["POST", "GET"], 5 | "url": { 6 | "path": "/_refresh", 7 | "paths": ["/_refresh", "/{index}/_refresh"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" 12 | } 13 | }, 14 | "params": { 15 | "ignore_unavailable": { 16 | "type" : "boolean", 17 | "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)" 18 | }, 19 | "allow_no_indices": { 20 | "type" : "boolean", 21 | "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" 22 | }, 23 | "expand_wildcards": { 24 | "type" : "enum", 25 | "options" : ["open","closed","none","all"], 26 | "default" : "open", 27 | "description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both." 28 | } 29 | } 30 | }, 31 | "body": null 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.rollover.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.rollover": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html", 4 | "methods": ["POST"], 5 | "url": { 6 | "path": "/{alias}/_rollover", 7 | "paths": ["/{alias}/_rollover", "/{alias}/_rollover/{new_index}"], 8 | "parts": { 9 | "alias": { 10 | "type" : "string", 11 | "required" : true, 12 | "description" : "The name of the alias to rollover" 13 | }, 14 | "new_index": { 15 | "type" : "string", 16 | "required" : false, 17 | "description" : "The name of the rollover index" 18 | } 19 | }, 20 | "params": { 21 | "timeout": { 22 | "type" : "time", 23 | "description" : "Explicit operation timeout" 24 | }, 25 | "dry_run": { 26 | "type" : "boolean", 27 | "description" : "If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false" 28 | }, 29 | "master_timeout": { 30 | "type" : "time", 31 | "description" : "Specify timeout for connection to master" 32 | }, 33 | "wait_for_active_shards": { 34 | "type" : "string", 35 | "description" : "Set the number of active shards to wait for on the newly created rollover index before the operation returns." 36 | } 37 | } 38 | }, 39 | "body": { 40 | "description" : "The conditions that needs to be met for executing rollover" 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.segments.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.segments": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_segments", 7 | "paths": ["/_segments", "/{index}/_segments"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" 12 | } 13 | }, 14 | "params": { 15 | "ignore_unavailable": { 16 | "type" : "boolean", 17 | "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)" 18 | }, 19 | "allow_no_indices": { 20 | "type" : "boolean", 21 | "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" 22 | }, 23 | "expand_wildcards": { 24 | "type" : "enum", 25 | "options" : ["open","closed","none","all"], 26 | "default" : "open", 27 | "description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both." 28 | }, 29 | "operation_threading": { 30 | "description" : "TODO: ?" 31 | }, 32 | "verbose": { 33 | "type": "boolean", 34 | "description": "Includes detailed memory usage by Lucene.", 35 | "default": false 36 | } 37 | } 38 | }, 39 | "body": null 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.shrink.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.shrink": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html", 4 | "methods": ["PUT", "POST"], 5 | "url": { 6 | "path": "/{index}/_shrink/{target}", 7 | "paths": ["/{index}/_shrink/{target}"], 8 | "parts": { 9 | "index": { 10 | "type" : "string", 11 | "required" : true, 12 | "description" : "The name of the source index to shrink" 13 | }, 14 | "target": { 15 | "type" : "string", 16 | "required" : true, 17 | "description" : "The name of the target index to shrink into" 18 | } 19 | }, 20 | "params": { 21 | "timeout": { 22 | "type" : "time", 23 | "description" : "Explicit operation timeout" 24 | }, 25 | "master_timeout": { 26 | "type" : "time", 27 | "description" : "Specify timeout for connection to master" 28 | }, 29 | "wait_for_active_shards": { 30 | "type" : "string", 31 | "description" : "Set the number of active shards to wait for on the shrunken index before the operation returns." 32 | } 33 | } 34 | }, 35 | "body": { 36 | "description" : "The configuration for the target index (`settings` and `aliases`)" 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/indices.update_aliases.json: -------------------------------------------------------------------------------- 1 | { 2 | "indices.update_aliases": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html", 4 | "methods": ["POST"], 5 | "url": { 6 | "path": "/_aliases", 7 | "paths": ["/_aliases"], 8 | "parts": { 9 | }, 10 | "params": { 11 | "timeout": { 12 | "type" : "time", 13 | "description" : "Request timeout" 14 | }, 15 | "master_timeout": { 16 | "type" : "time", 17 | "description" : "Specify timeout for connection to master" 18 | } 19 | } 20 | }, 21 | "body": { 22 | "description" : "The definition of `actions` to perform", 23 | "required" : true 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "documentation": "http://www.elastic.co/guide/", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/", 7 | "paths": ["/"], 8 | "parts": { 9 | }, 10 | "params": { 11 | } 12 | }, 13 | "body": null 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/ingest.delete_pipeline.json: -------------------------------------------------------------------------------- 1 | { 2 | "ingest.delete_pipeline": { 3 | "documentation": "https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html", 4 | "methods": [ "DELETE" ], 5 | "url": { 6 | "path": "/_ingest/pipeline/{id}", 7 | "paths": [ "/_ingest/pipeline/{id}" ], 8 | "parts": { 9 | "id": { 10 | "type" : "string", 11 | "description" : "Pipeline ID", 12 | "required" : true 13 | } 14 | }, 15 | "params": { 16 | "master_timeout": { 17 | "type" : "time", 18 | "description" : "Explicit operation timeout for connection to master node" 19 | }, 20 | "timeout": { 21 | "type" : "time", 22 | "description" : "Explicit operation timeout" 23 | } 24 | } 25 | }, 26 | "body": null 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/ingest.get_pipeline.json: -------------------------------------------------------------------------------- 1 | { 2 | "ingest.get_pipeline": { 3 | "documentation": "https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html", 4 | "methods": [ "GET" ], 5 | "url": { 6 | "path": "/_ingest/pipeline/{id}", 7 | "paths": [ "/_ingest/pipeline", "/_ingest/pipeline/{id}" ], 8 | "parts": { 9 | "id": { 10 | "type" : "string", 11 | "description" : "Comma separated list of pipeline ids. Wildcards supported" 12 | } 13 | }, 14 | "params": { 15 | "master_timeout": { 16 | "type" : "time", 17 | "description" : "Explicit operation timeout for connection to master node" 18 | } 19 | } 20 | }, 21 | "body": null 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/ingest.processor.grok.json: -------------------------------------------------------------------------------- 1 | { 2 | "ingest.processor.grok": { 3 | "documentation": "https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html", 4 | "methods": [ "GET" ], 5 | "url": { 6 | "path": "/_ingest/processor/grok", 7 | "paths": ["/_ingest/processor/grok"], 8 | "parts": { 9 | }, 10 | "params": { 11 | } 12 | }, 13 | "body": null 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/ingest.put_pipeline.json: -------------------------------------------------------------------------------- 1 | { 2 | "ingest.put_pipeline": { 3 | "documentation": "https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html", 4 | "methods": [ "PUT" ], 5 | "url": { 6 | "path": "/_ingest/pipeline/{id}", 7 | "paths": [ "/_ingest/pipeline/{id}" ], 8 | "parts": { 9 | "id": { 10 | "type" : "string", 11 | "description" : "Pipeline ID", 12 | "required" : true 13 | } 14 | }, 15 | "params": { 16 | "master_timeout": { 17 | "type" : "time", 18 | "description" : "Explicit operation timeout for connection to master node" 19 | }, 20 | "timeout": { 21 | "type" : "time", 22 | "description" : "Explicit operation timeout" 23 | } 24 | } 25 | }, 26 | "body": { 27 | "description" : "The ingest definition", 28 | "required" : true 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/ingest.simulate.json: -------------------------------------------------------------------------------- 1 | { 2 | "ingest.simulate": { 3 | "documentation": "https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html", 4 | "methods": [ "GET", "POST" ], 5 | "url": { 6 | "path": "/_ingest/pipeline/_simulate", 7 | "paths": [ "/_ingest/pipeline/_simulate", "/_ingest/pipeline/{id}/_simulate" ], 8 | "parts": { 9 | "id": { 10 | "type" : "string", 11 | "description" : "Pipeline ID", 12 | "required" : false 13 | } 14 | }, 15 | "params": { 16 | "verbose": { 17 | "type" : "boolean", 18 | "description" : "Verbose mode. Display data output for each processor in executed pipeline", 19 | "default" : false 20 | } 21 | } 22 | }, 23 | "body": { 24 | "description" : "The simulate definition", 25 | "required" : true 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/msearch_template.json: -------------------------------------------------------------------------------- 1 | { 2 | "msearch_template": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html", 4 | "methods": ["GET", "POST"], 5 | "url": { 6 | "path": "/_msearch/template", 7 | "paths": ["/_msearch/template", "/{index}/_msearch/template", "/{index}/{type}/_msearch/template"], 8 | "parts": { 9 | "index": { 10 | "type" : "list", 11 | "description" : "A comma-separated list of index names to use as default" 12 | }, 13 | "type": { 14 | "type" : "list", 15 | "description" : "A comma-separated list of document types to use as default" 16 | } 17 | }, 18 | "params": { 19 | "search_type": { 20 | "type" : "enum", 21 | "options" : ["query_then_fetch", "query_and_fetch", "dfs_query_then_fetch", "dfs_query_and_fetch"], 22 | "description" : "Search operation type" 23 | }, 24 | "typed_keys": { 25 | "type" : "boolean", 26 | "description" : "Specify whether aggregation and suggester names should be prefixed by their respective types in the response" 27 | }, 28 | "max_concurrent_searches" : { 29 | "type" : "number", 30 | "description" : "Controls the maximum number of concurrent searches the multi search api will execute" 31 | } 32 | } 33 | }, 34 | "body": { 35 | "description": "The request definitions (metadata-search request definition pairs), separated by newlines", 36 | "required" : true, 37 | "serialize" : "bulk" 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/nodes.info.json: -------------------------------------------------------------------------------- 1 | { 2 | "nodes.info": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_nodes", 7 | "paths": ["/_nodes", "/_nodes/{node_id}", "/_nodes/{metric}", "/_nodes/{node_id}/{metric}"], 8 | "parts": { 9 | "node_id": { 10 | "type": "list", 11 | "description": "A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes" 12 | }, 13 | "metric": { 14 | "type": "list", 15 | "options": ["settings", "os", "process", "jvm", "thread_pool", "transport", "http", "plugins", "ingest"], 16 | "description": "A comma-separated list of metrics you wish returned. Leave empty to return all." 17 | } 18 | }, 19 | "params": { 20 | "flat_settings": { 21 | "type": "boolean", 22 | "description": "Return settings in flat format (default: false)" 23 | }, 24 | "timeout": { 25 | "type" : "time", 26 | "description" : "Explicit operation timeout" 27 | } 28 | } 29 | }, 30 | "body": null 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/nodes.usage.json: -------------------------------------------------------------------------------- 1 | { 2 | "nodes.usage": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_nodes/usage", 7 | "paths": [ 8 | "/_nodes/usage", 9 | "/_nodes/{node_id}/usage", 10 | "/_nodes/usage/{metric}", 11 | "/_nodes/{node_id}/usage/{metric}" 12 | ], 13 | "parts": { 14 | "metric" : { 15 | "type" : "list", 16 | "options" : ["_all", "rest_actions"], 17 | "description" : "Limit the information returned to the specified metrics" 18 | }, 19 | "node_id": { 20 | "type" : "list", 21 | "description" : "A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes" 22 | } 23 | }, 24 | "params": { 25 | "human": { 26 | "type": "boolean", 27 | "description": "Whether to return time and byte values in human-readable format.", 28 | "default": false 29 | }, 30 | "timeout": { 31 | "type" : "time", 32 | "description" : "Explicit operation timeout" 33 | } 34 | } 35 | }, 36 | "body": null 37 | } 38 | } -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/ping.json: -------------------------------------------------------------------------------- 1 | { 2 | "ping": { 3 | "documentation": "http://www.elastic.co/guide/", 4 | "methods": ["HEAD"], 5 | "url": { 6 | "path": "/", 7 | "paths": ["/"], 8 | "parts": { 9 | }, 10 | "params": { 11 | } 12 | }, 13 | "body": null 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/put_script.json: -------------------------------------------------------------------------------- 1 | { 2 | "put_script": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html", 4 | "methods": ["PUT", "POST"], 5 | "url": { 6 | "path": "/_scripts/{id}", 7 | "paths": [ "/_scripts/{id}", "/_scripts/{id}/{context}" ], 8 | "parts": { 9 | "id": { 10 | "type" : "string", 11 | "description" : "Script ID", 12 | "required" : true 13 | }, 14 | "context" : { 15 | "type" : "string", 16 | "description" : "Script context" 17 | } 18 | }, 19 | "params" : { 20 | "timeout": { 21 | "type" : "time", 22 | "description" : "Explicit operation timeout" 23 | }, 24 | "master_timeout": { 25 | "type" : "time", 26 | "description" : "Specify timeout for connection to master" 27 | }, 28 | "context": { 29 | "type" : "string", 30 | "description" : "Context name to compile script against" 31 | } 32 | } 33 | }, 34 | "body": { 35 | "description" : "The document", 36 | "required" : true 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/reindex_rethrottle.json: -------------------------------------------------------------------------------- 1 | { 2 | "reindex_rethrottle": { 3 | "documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html", 4 | "methods": ["POST"], 5 | "url": { 6 | "path": "/_reindex/{task_id}/_rethrottle", 7 | "paths": ["/_reindex/{task_id}/_rethrottle", "/_update_by_query/{task_id}/_rethrottle", "/_delete_by_query/{task_id}/_rethrottle"], 8 | "parts": { 9 | "task_id": { 10 | "type": "string", 11 | "description": "The task id to rethrottle" 12 | } 13 | }, 14 | "params": { 15 | "requests_per_second": { 16 | "type": "number", 17 | "required": true, 18 | "description": "The throttle to set on this request in floating sub-requests per second. -1 means set no throttle." 19 | } 20 | } 21 | }, 22 | "body": null 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/remote.info.json: -------------------------------------------------------------------------------- 1 | { 2 | "remote.info": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_remote/info", 7 | "paths": ["/_remote/info"], 8 | "params": {} 9 | }, 10 | "body": null 11 | } 12 | } -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/render_search_template.json: -------------------------------------------------------------------------------- 1 | { 2 | "render_search_template": { 3 | "documentation": "http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html", 4 | "methods": ["GET", "POST"], 5 | "url": { 6 | "path": "/_render/template", 7 | "paths": [ "/_render/template", "/_render/template/{id}" ], 8 | "parts": { 9 | "id": { 10 | "type" : "string", 11 | "description" : "The id of the stored search template" 12 | } 13 | } 14 | }, 15 | "body": { 16 | "description": "The search definition template and its params" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/scroll.json: -------------------------------------------------------------------------------- 1 | { 2 | "scroll": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html", 4 | "methods": ["GET", "POST"], 5 | "url": { 6 | "path": "/_search/scroll", 7 | "paths": ["/_search/scroll", "/_search/scroll/{scroll_id}"], 8 | "parts": { 9 | "scroll_id": { 10 | "type" : "string", 11 | "description" : "The scroll ID" 12 | } 13 | }, 14 | "params": { 15 | "scroll": { 16 | "type" : "time", 17 | "description" : "Specify how long a consistent view of the index should be maintained for scrolled search" 18 | }, 19 | "scroll_id": { 20 | "type" : "string", 21 | "description" : "The scroll ID for scrolled search" 22 | } 23 | } 24 | }, 25 | "body": { 26 | "description": "The scroll ID if not passed by URL or query parameter." 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/snapshot.create.json: -------------------------------------------------------------------------------- 1 | { 2 | "snapshot.create": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", 4 | "methods": ["PUT", "POST"], 5 | "url": { 6 | "path": "/_snapshot/{repository}/{snapshot}", 7 | "paths": ["/_snapshot/{repository}/{snapshot}"], 8 | "parts": { 9 | "repository": { 10 | "type": "string", 11 | "required" : true, 12 | "description": "A repository name" 13 | }, 14 | "snapshot": { 15 | "type": "string", 16 | "required" : true, 17 | "description": "A snapshot name" 18 | } 19 | }, 20 | "params": { 21 | "master_timeout": { 22 | "type" : "time", 23 | "description" : "Explicit operation timeout for connection to master node" 24 | }, 25 | "wait_for_completion": { 26 | "type": "boolean", 27 | "description": "Should this request wait until the operation has completed before returning", 28 | "default": false 29 | } 30 | } 31 | }, 32 | "body" : { 33 | "description" : "The snapshot definition", 34 | "required" : false 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/snapshot.create_repository.json: -------------------------------------------------------------------------------- 1 | { 2 | "snapshot.create_repository": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", 4 | "methods": ["PUT", "POST"], 5 | "url": { 6 | "path": "/_snapshot/{repository}", 7 | "paths": ["/_snapshot/{repository}"], 8 | "parts": { 9 | "repository": { 10 | "type": "string", 11 | "required" : true, 12 | "description": "A repository name" 13 | } 14 | }, 15 | "params": { 16 | "master_timeout": { 17 | "type" : "time", 18 | "description" : "Explicit operation timeout for connection to master node" 19 | }, 20 | "timeout": { 21 | "type" : "time", 22 | "description" : "Explicit operation timeout" 23 | }, 24 | "verify": { 25 | "type" : "boolean", 26 | "description" : "Whether to verify the repository after creation" 27 | } 28 | } 29 | }, 30 | "body": { 31 | "description" : "The repository definition", 32 | "required" : true 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/snapshot.delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "snapshot.delete": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", 4 | "methods": ["DELETE"], 5 | "url": { 6 | "path": "/_snapshot/{repository}/{snapshot}", 7 | "paths": ["/_snapshot/{repository}/{snapshot}"], 8 | "parts": { 9 | "repository": { 10 | "type": "string", 11 | "required" : true, 12 | "description": "A repository name" 13 | }, 14 | "snapshot": { 15 | "type": "string", 16 | "required" : true, 17 | "description": "A snapshot name" 18 | } 19 | }, 20 | "params": { 21 | "master_timeout": { 22 | "type" : "time", 23 | "description" : "Explicit operation timeout for connection to master node" 24 | } 25 | } 26 | }, 27 | "body": null 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/snapshot.delete_repository.json: -------------------------------------------------------------------------------- 1 | { 2 | "snapshot.delete_repository": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", 4 | "methods": ["DELETE"], 5 | "url": { 6 | "path": "/_snapshot/{repository}", 7 | "paths": ["/_snapshot/{repository}"], 8 | "parts": { 9 | "repository": { 10 | "type": "list", 11 | "required" : true, 12 | "description": "A comma-separated list of repository names" 13 | } 14 | }, 15 | "params": { 16 | "master_timeout": { 17 | "type" : "time", 18 | "description" : "Explicit operation timeout for connection to master node" 19 | }, 20 | "timeout": { 21 | "type" : "time", 22 | "description" : "Explicit operation timeout" 23 | } 24 | } 25 | }, 26 | "body": null 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/snapshot.get.json: -------------------------------------------------------------------------------- 1 | { 2 | "snapshot.get": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_snapshot/{repository}/{snapshot}", 7 | "paths": ["/_snapshot/{repository}/{snapshot}"], 8 | "parts": { 9 | "repository": { 10 | "type": "string", 11 | "required" : true, 12 | "description": "A repository name" 13 | }, 14 | "snapshot": { 15 | "type": "list", 16 | "required" : true, 17 | "description": "A comma-separated list of snapshot names" 18 | } 19 | }, 20 | "params": { 21 | "master_timeout": { 22 | "type" : "time", 23 | "description" : "Explicit operation timeout for connection to master node" 24 | }, 25 | "ignore_unavailable": { 26 | "type": "boolean", 27 | "description": "Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown" 28 | }, 29 | "verbose": { 30 | "type": "boolean", 31 | "description": "Whether to show verbose snapshot info or only show the basic info found in the repository index blob" 32 | } 33 | } 34 | }, 35 | "body": null 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/snapshot.get_repository.json: -------------------------------------------------------------------------------- 1 | { 2 | "snapshot.get_repository": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_snapshot", 7 | "paths": ["/_snapshot", "/_snapshot/{repository}"], 8 | "parts": { 9 | "repository": { 10 | "type": "list", 11 | "description": "A comma-separated list of repository names" 12 | } 13 | }, 14 | "params": { 15 | "master_timeout": { 16 | "type" : "time", 17 | "description" : "Explicit operation timeout for connection to master node" 18 | }, 19 | "local": { 20 | "type": "boolean", 21 | "description": "Return local information, do not retrieve the state from master node (default: false)" 22 | } 23 | } 24 | }, 25 | "body": null 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/snapshot.restore.json: -------------------------------------------------------------------------------- 1 | { 2 | "snapshot.restore": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", 4 | "methods": ["POST"], 5 | "url": { 6 | "path": "/_snapshot/{repository}/{snapshot}/_restore", 7 | "paths": ["/_snapshot/{repository}/{snapshot}/_restore"], 8 | "parts": { 9 | "repository": { 10 | "type": "string", 11 | "required" : true, 12 | "description": "A repository name" 13 | }, 14 | "snapshot": { 15 | "type": "string", 16 | "required" : true, 17 | "description": "A snapshot name" 18 | } 19 | }, 20 | "params": { 21 | "master_timeout": { 22 | "type" : "time", 23 | "description" : "Explicit operation timeout for connection to master node" 24 | }, 25 | "wait_for_completion": { 26 | "type": "boolean", 27 | "description": "Should this request wait until the operation has completed before returning", 28 | "default": false 29 | } 30 | } 31 | }, 32 | "body" : { 33 | "description" : "Details of what to restore", 34 | "required" : false 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/snapshot.status.json: -------------------------------------------------------------------------------- 1 | { 2 | "snapshot.status": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_snapshot/_status", 7 | "paths": ["/_snapshot/_status", "/_snapshot/{repository}/_status", "/_snapshot/{repository}/{snapshot}/_status"], 8 | "parts": { 9 | "repository": { 10 | "type": "string", 11 | "description": "A repository name" 12 | }, 13 | "snapshot": { 14 | "type": "list", 15 | "description": "A comma-separated list of snapshot names" 16 | } 17 | }, 18 | "params": { 19 | "master_timeout": { 20 | "type" : "time", 21 | "description" : "Explicit operation timeout for connection to master node" 22 | }, 23 | "ignore_unavailable": { 24 | "type": "boolean", 25 | "description": "Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown" 26 | } 27 | } 28 | }, 29 | "body": null 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/snapshot.verify_repository.json: -------------------------------------------------------------------------------- 1 | { 2 | "snapshot.verify_repository": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", 4 | "methods": ["POST"], 5 | "url": { 6 | "path": "/_snapshot/{repository}/_verify", 7 | "paths": ["/_snapshot/{repository}/_verify"], 8 | "parts": { 9 | "repository": { 10 | "type": "string", 11 | "required" : true, 12 | "description": "A repository name" 13 | } 14 | }, 15 | "params": { 16 | "master_timeout": { 17 | "type" : "time", 18 | "description" : "Explicit operation timeout for connection to master node" 19 | }, 20 | "timeout": { 21 | "type" : "time", 22 | "description" : "Explicit operation timeout" 23 | } 24 | } 25 | }, 26 | "body": null 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/tasks.cancel.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks.cancel": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html", 4 | "methods": ["POST"], 5 | "url": { 6 | "path": "/_tasks", 7 | "paths": ["/_tasks/_cancel", "/_tasks/{task_id}/_cancel"], 8 | "parts": { 9 | "task_id": { 10 | "type": "string", 11 | "description": "Cancel the task with specified task id (node_id:task_number)" 12 | } 13 | }, 14 | "params": { 15 | "nodes": { 16 | "type": "list", 17 | "description": "A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes" 18 | }, 19 | "actions": { 20 | "type": "list", 21 | "description": "A comma-separated list of actions that should be cancelled. Leave empty to cancel all." 22 | }, 23 | "parent_node": { 24 | "type": "string", 25 | "description": "Cancel tasks with specified parent node." 26 | }, 27 | "parent_task_id": { 28 | "type" : "string", 29 | "description" : "Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all." 30 | } 31 | } 32 | }, 33 | "body": null 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/model/es/provider/rest-spec/v6_0_0/tasks.get.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks.get": { 3 | "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html", 4 | "methods": ["GET"], 5 | "url": { 6 | "path": "/_tasks/{task_id}", 7 | "paths": ["/_tasks/{task_id}"], 8 | "parts": { 9 | "task_id": { 10 | "type": "string", 11 | "description": "Return the task with specified id (node_id:task_number)" 12 | } 13 | }, 14 | "params": { 15 | "wait_for_completion": { 16 | "type": "boolean", 17 | "description": "Wait for the matching tasks to complete (default: false)" 18 | } 19 | } 20 | }, 21 | "body": null 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/model/ftp/ftpBaseNode.ts: -------------------------------------------------------------------------------- 1 | import { FTPConnection } from "@/service/connect/ftpConnection"; 2 | import { ConnectionManager } from "@/service/connectionManager"; 3 | import * as Client from '@/model/ftp/lib/connection' 4 | import { Node } from "../interface/node"; 5 | 6 | export class FtpBaseNode extends Node { 7 | 8 | constructor(label: string) { 9 | super(label) 10 | } 11 | 12 | public async getClient(): Promise { 13 | const ftpConnection = await ConnectionManager.getConnection(this.parent) as FTPConnection 14 | return ftpConnection.getClient() 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /src/model/interface/copyAble.ts: -------------------------------------------------------------------------------- 1 | export interface CopyAble { 2 | 3 | copyName(): void; 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/model/interface/sshConfig.ts: -------------------------------------------------------------------------------- 1 | export interface SSHConfig { 2 | /** 3 | * local tunnel port 4 | */ 5 | tunnelPort: number; 6 | host: string; 7 | port: number; 8 | username: string; 9 | password?: string; 10 | /** 11 | * password privateKey native 12 | */ 13 | type?: string; 14 | privateKeyPath?: string; 15 | watingTime?: number; 16 | /** 17 | * only support private keys generated by ssh-keygen, which means pkcs8 is not support. 18 | */ 19 | privateKey?: Buffer; 20 | passphrase?: string; 21 | algorithms?: Algorithms; 22 | /** 23 | * only ssh connection 24 | */ 25 | key: string; 26 | } 27 | 28 | export interface Algorithms { 29 | cipher?: string[]; 30 | } -------------------------------------------------------------------------------- /src/model/main/functionGroup.ts: -------------------------------------------------------------------------------- 1 | import { ThemeIcon } from "vscode"; 2 | import { ModelType } from "../../common/constants"; 3 | import { QueryUnit } from "../../service/queryUnit"; 4 | import { Node } from "../interface/node"; 5 | import { InfoNode } from "../other/infoNode"; 6 | import { FunctionNode } from "./function"; 7 | 8 | export class FunctionGroup extends Node { 9 | 10 | public contextValue = ModelType.FUNCTION_GROUP; 11 | public iconPath = new ThemeIcon("symbol-function") 12 | constructor(readonly parent: Node) { 13 | super("Function") 14 | this.init(parent) 15 | } 16 | 17 | public async getChildren(isRresh: boolean = false): Promise { 18 | 19 | let tableNodes = this.getChildCache(); 20 | if (tableNodes && !isRresh) { 21 | return tableNodes; 22 | } 23 | return this.execute(this.dialect.showFunctions(this.schema)) 24 | .then((tables) => { 25 | tableNodes = tables.map((table) => { 26 | return new FunctionNode(table.ROUTINE_NAME, this); 27 | }); 28 | if (tableNodes.length == 0) { 29 | tableNodes = [new InfoNode("This schema has no function")]; 30 | } 31 | this.setChildCache(tableNodes); 32 | return tableNodes; 33 | }) 34 | .catch((err) => { 35 | return [new InfoNode(err)]; 36 | }); 37 | } 38 | 39 | public async createTemplate() { 40 | 41 | QueryUnit.showSQLTextDocument(this, this.dialect.functionTemplate(), 'create-function-template.sql') 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/model/main/procedureGroup.ts: -------------------------------------------------------------------------------- 1 | import { ThemeIcon } from "vscode"; 2 | import { ModelType } from "../../common/constants"; 3 | import { QueryUnit } from "../../service/queryUnit"; 4 | import { Node } from "../interface/node"; 5 | import { InfoNode } from "../other/infoNode"; 6 | import { ProcedureNode } from "./procedure"; 7 | 8 | export class ProcedureGroup extends Node { 9 | 10 | public contextValue = ModelType.PROCEDURE_GROUP 11 | public iconPath =new ThemeIcon("gear") 12 | constructor(readonly parent: Node) { 13 | super("Procedure") 14 | this.init(parent) 15 | } 16 | 17 | public async getChildren(isRresh: boolean = false): Promise { 18 | 19 | let tableNodes = this.getChildCache(); 20 | if (tableNodes && !isRresh) { 21 | return tableNodes; 22 | } 23 | return this.execute(this.dialect.showProcedures(this.schema)) 24 | .then((tables) => { 25 | tableNodes = tables.map((table) => { 26 | return new ProcedureNode(table.ROUTINE_NAME, this); 27 | }); 28 | if (tableNodes.length == 0) { 29 | tableNodes = [new InfoNode("This schema has no procedure")]; 30 | } 31 | this.setChildCache(tableNodes); 32 | return tableNodes; 33 | }) 34 | .catch((err) => { 35 | return [new InfoNode(err)]; 36 | }); 37 | } 38 | 39 | public async createTemplate() { 40 | 41 | QueryUnit.showSQLTextDocument(this, this.dialect.procedureTemplate(), 'create-procedure-template.sql') 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/model/main/viewNode.ts: -------------------------------------------------------------------------------- 1 | import sqlFormatter from "@/service/format/sqlFormatter"; 2 | import * as vscode from "vscode"; 3 | import { ModelType } from "../../common/constants"; 4 | import { Util } from "../../common/util"; 5 | import { DbTreeDataProvider } from "../../provider/treeDataProvider"; 6 | import { QueryUnit } from "../../service/queryUnit"; 7 | import { TableNode } from "./tableNode"; 8 | 9 | export class ViewNode extends TableNode { 10 | 11 | public contextValue: string = ModelType.VIEW; 12 | 13 | public async showSource(open = true) { 14 | const sourceResule = await this.execute(this.dialect.showViewSource(this.schema, this.table)) 15 | const sql = `DROP VIEW ${this.table};${sourceResule[0]['Create View']}` 16 | if(open){ 17 | QueryUnit.showSQLTextDocument(this, sqlFormatter.format(sql)); 18 | } 19 | return null; 20 | } 21 | 22 | public drop() { 23 | 24 | Util.confirm(`Are you sure you want to drop view ${this.table} ? `, async () => { 25 | this.execute(`DROP view ${this.wrap(this.table)}`).then(() => { 26 | this.parent.setChildCache(null) 27 | DbTreeDataProvider.refresh(this.parent); 28 | vscode.window.showInformationMessage(`Drop view ${this.table} success!`); 29 | }); 30 | }) 31 | 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/model/mongo/mongoBaseNode.ts: -------------------------------------------------------------------------------- 1 | import { MongoConnection } from "@/service/connect/mongoConnection"; 2 | import { ConnectionManager } from "@/service/connectionManager"; 3 | import { MongoClient } from "mongodb"; 4 | import { Node } from "../interface/node"; 5 | 6 | export class MonggoBaseNode extends Node{ 7 | 8 | public async getClient(): Promise { 9 | const mongo = (await ConnectionManager.getConnection(this)) as MongoConnection 10 | return new Promise(res => { mongo.run(res) }) 11 | } 12 | 13 | 14 | } -------------------------------------------------------------------------------- /src/model/mongo/mongoTableGroup.ts: -------------------------------------------------------------------------------- 1 | import { ModelType } from "@/common/constants"; 2 | import { TableMeta } from "@/common/typeDef"; 3 | import { ThemeIcon } from "vscode"; 4 | import { Node } from "../interface/node"; 5 | import { TableNode } from "../main/tableNode"; 6 | import { MonggoBaseNode } from "./mongoBaseNode"; 7 | import { MongoTableNode } from "./mongoTableNode"; 8 | 9 | export class MongoTableGroup extends MonggoBaseNode { 10 | 11 | contextValue = ModelType.TABLE_GROUP; 12 | public iconPath = new ThemeIcon("list-flat") 13 | constructor(readonly parent: Node) { 14 | super("COLLECTION") 15 | this.uid = `${parent.getConnectId()}_${parent.database}_${ModelType.TABLE_GROUP}`; 16 | this.init(parent) 17 | } 18 | 19 | 20 | public async getChildren() { 21 | 22 | const client = await this.getClient() 23 | 24 | try { 25 | const tables = await client.db(this.database).listCollections().toArray() 26 | 27 | const tableNodes = tables.map((table) => { 28 | const mongoNode: TableNode = new MongoTableNode({ name: table.name } as TableMeta, this); 29 | mongoNode.schema = mongoNode.database 30 | return mongoNode; 31 | }); 32 | return tableNodes; 33 | } catch (error) { 34 | client.close() 35 | throw error; 36 | } 37 | } 38 | 39 | 40 | } -------------------------------------------------------------------------------- /src/model/mongo/mongoTableNode.ts: -------------------------------------------------------------------------------- 1 | import { ModelType } from "@/common/constants"; 2 | import { TableMeta } from "@/common/typeDef"; 3 | import { MongoConnection } from "@/service/connect/mongoConnection"; 4 | import { ConnectionManager } from "@/service/connectionManager"; 5 | import { MongoClient } from "mongodb"; 6 | import { TreeItemCollapsibleState } from "vscode"; 7 | import { TableNode } from "../main/tableNode"; 8 | 9 | export class MongoTableNode extends TableNode { 10 | contextValue = ModelType.MONGO_TABLE; 11 | collapsibleState=TreeItemCollapsibleState.None; 12 | public async getChildren() { 13 | return []; 14 | } 15 | 16 | 17 | public async getClient(): Promise { 18 | const redis = (await ConnectionManager.getConnection(this)) as MongoConnection 19 | return new Promise(res => { redis.run(res) }) 20 | } 21 | 22 | 23 | } -------------------------------------------------------------------------------- /src/model/nodeUtil.ts: -------------------------------------------------------------------------------- 1 | import { Node } from "./interface/node"; 2 | import { ConnectionManager } from "../service/connectionManager"; 3 | import { SqlDialect } from "@/service/dialect/sqlDialect"; 4 | import { ServiceManager } from "@/service/serviceManager"; 5 | 6 | export abstract class NodeUtil { 7 | public static of(node: any): Node { 8 | if (!node) { 9 | return null; 10 | } 11 | if(isNaN(node.port)){ 12 | node.port=null; 13 | } 14 | if (node && !(node instanceof Node)) { 15 | node.__proto__ = Node.prototype 16 | } 17 | if (node.dialect && !(node.dialect instanceof SqlDialect)) { 18 | node.dialect = ServiceManager.getDialect(node.dbType) 19 | } 20 | return node; 21 | } 22 | 23 | public static removeParent(nodes: any): any { 24 | if (!nodes) return null; 25 | // if is node instance 26 | if (nodes instanceof Node || nodes.uid) { 27 | return NodeUtil.of( { ...nodes, parent: null, provider: null, context: null, command: null }) 28 | } 29 | if (nodes instanceof Array) { 30 | return nodes.map(this.removeParent) 31 | } 32 | // if is node object map 33 | let result = {}; 34 | for (const nodeKey of Object.keys(nodes)) { 35 | if (!nodes[nodeKey]) continue; 36 | result[nodeKey] = this.removeParent(nodes[nodeKey]) 37 | } 38 | return result; 39 | } 40 | 41 | public static getTunnelPort(connectId: string): number { 42 | return ConnectionManager.getActiveConnectByKey(connectId).ssh.tunnelPort 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /src/model/other/infoNode.ts: -------------------------------------------------------------------------------- 1 | import { ModelType } from "../../common/constants"; 2 | import { Node } from "../interface/node"; 3 | 4 | export class InfoNode extends Node { 5 | public iconPath: string; 6 | public contextValue: string = ModelType.INFO; 7 | constructor(readonly label: string) { 8 | super(label) 9 | if((label as any) instanceof Error){ 10 | this.label=(label as any).message 11 | } 12 | } 13 | 14 | public async getChildren(): Promise { 15 | return []; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/model/redis/redisBaseNode.ts: -------------------------------------------------------------------------------- 1 | import { Node } from "@/model/interface/node"; 2 | import { RedisConnection } from "@/service/connect/redisConnection"; 3 | import { ConnectionManager } from "@/service/connectionManager"; 4 | import {Redis} from "ioredis"; 5 | 6 | 7 | export default abstract class RedisBaseNode extends Node { 8 | pattern = "*"; 9 | level = 0; 10 | 11 | abstract getChildren(): Promise; 12 | 13 | public async getClient(): Promise { 14 | 15 | const redis = (await ConnectionManager.getConnection(this)) as RedisConnection 16 | return new Promise(res => { redis.run(res) }) 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /src/model/ssh/connectionProvider.ts: -------------------------------------------------------------------------------- 1 | import { CodeCommand } from '@/common/constants'; 2 | import { ClientManager } from '@/service/ssh/clientManager'; 3 | import * as path from 'path'; 4 | import * as vscode from 'vscode'; 5 | import { SSHConfig } from '../interface/sshConfig'; 6 | 7 | 8 | export default class ConnectionProvider { 9 | public static tempRemoteMap = new Map() 10 | 11 | constructor() { 12 | vscode.workspace.onDidSaveTextDocument(e => { 13 | const tempPath = path.resolve(e.fileName); 14 | const data = ConnectionProvider.tempRemoteMap.get(tempPath) 15 | if (data) { 16 | this.saveFile(tempPath, data.remote, data.sshConfig) 17 | } 18 | }) 19 | } 20 | 21 | async saveFile(tempPath: string, remotePath: string, sshConfig: SSHConfig) { 22 | const { sftp } = await ClientManager.getSSH(sshConfig) 23 | sftp.fastPut(tempPath, remotePath, async (err) => { 24 | if (err) { 25 | vscode.window.showErrorMessage(err.message) 26 | } else { 27 | vscode.commands.executeCommand(CodeCommand.Refresh) 28 | vscode.window.showInformationMessage("Update to remote success!") 29 | } 30 | }) 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/model/ssh/linkNode.ts: -------------------------------------------------------------------------------- 1 | import { ModelType } from "@/common/constants"; 2 | import { ThemeIcon, TreeItemCollapsibleState } from "vscode"; 3 | import { Node } from "../interface/node"; 4 | 5 | export class LinkNode extends Node { 6 | contextValue = ModelType.Link; 7 | constructor(info: string) { 8 | super(info) 9 | this.iconPath=new ThemeIcon("link") 10 | this.collapsibleState = TreeItemCollapsibleState.None 11 | } 12 | getChildren(): Promise { 13 | return null; 14 | } 15 | } -------------------------------------------------------------------------------- /src/provider/codelen/sqlCodeLensProvider.ts: -------------------------------------------------------------------------------- 1 | import { ConfigKey } from '@/common/constants'; 2 | import { Global } from '@/common/global'; 3 | import * as vscode from 'vscode'; 4 | import { SQLParser } from '../parser/sqlParser'; 5 | 6 | export class SqlCodeLensProvider implements vscode.CodeLensProvider { 7 | 8 | 9 | onDidChangeCodeLenses?: vscode.Event; 10 | provideCodeLenses(document: vscode.TextDocument, token: vscode.CancellationToken): vscode.ProviderResult { 11 | return this.parseCodeLens(document) 12 | } 13 | resolveCodeLens?(codeLens: vscode.CodeLens, token: vscode.CancellationToken): vscode.ProviderResult { 14 | throw new Error('Method not implemented.'); 15 | } 16 | 17 | public parseCodeLens(document: vscode.TextDocument): vscode.ProviderResult { 18 | if (Global.getConfig(ConfigKey.DISABLE_SQL_CODELEN)) { 19 | return [] 20 | } 21 | 22 | return SQLParser.parseBlocks(document).map(block => 23 | new vscode.CodeLens(block.range, { command: "mysql.codeLens.run", title: "▶ Run SQL", arguments: [block.sql], }) 24 | ) 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /src/provider/complete/chain/keywordChain.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import { ComplectionChain, ComplectionContext } from "../complectionContext"; 3 | 4 | export class KeywordChain implements ComplectionChain { 5 | 6 | private keywordList: string[] = ["SCHEMA","JOIN", "AND", "OR", "SELECT", "SET", "UPDATE", "DELETE", "TABLE", "INSERT", "INTO", "VALUES", "FROM", "WHERE", "IS","NULL","DATABASE", 7 | "GROUP BY", "ORDER BY", "HAVING", "LIMIT", "ALTER", "CREATE", "DROP", "FUNCTION", "CASE", "PROCEDURE", "TRIGGER", "INDEX", "CHANGE", "COLUMN", "BETWEEN","RLIKE", 8 | "ADD", 'SHOW', "PRIVILEGES", "IDENTIFIED", "VIEW", "CURSOR", "EXPLAIN", "ROLLBACK", "COMMENT", "COMMIT", "BEGIN", "DELIMITER", "CALL", "REPLACE","TEMPORARY", 9 | "REFERENCES", "USING", "END", "BEFORE", "AFTER", "GRANT", "RETURNS", "SOME", "ANY", "ASC", "DESC", "UNIQUE", "UNION", "ALL", "ON","REGEXP", 10 | "OUTER", "INNER", "EXEC", "EXISTS", "NOT", "FOREIGN", "FULL", "LIKE", "IN", "PRIMARY", "KEY", "RIGHT", "LEFT", "TRUNCATE", "IGNORE", "DISTINCT","SOURCE"]; 11 | private keywordComplectionItems: vscode.CompletionItem[] = []; 12 | 13 | constructor() { 14 | this.keywordList.forEach((keyword) => { 15 | const keywordComplectionItem = new vscode.CompletionItem(keyword); 16 | keywordComplectionItem.kind = vscode.CompletionItemKind.Keyword; 17 | this.keywordComplectionItems.push(keywordComplectionItem); 18 | }); 19 | 20 | } 21 | 22 | public getComplection(complectionContext: ComplectionContext): vscode.CompletionItem[] { 23 | return this.keywordComplectionItems; 24 | } 25 | 26 | public stop(): boolean { 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/provider/complete/chain/tableDetecherChain.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import { ComplectionChain, ComplectionContext } from "../complectionContext"; 3 | import { Pattern } from "../../../common/constants"; 4 | 5 | export class TableDetecherChain implements ComplectionChain { 6 | 7 | public getComplection(context: ComplectionContext): vscode.CompletionItem[] | Promise { 8 | 9 | const tableMatch = new RegExp(Pattern.TABLE_PATTERN + " *((\\w)*)?", 'ig'); 10 | if (context.previousToken?.content?.match(/\b(select|HAVING|\(|on|where|and|,|=|<|>)\b/ig) 11 | || context.currentToken?.content?.match(/(<|>|,|=)$/) 12 | ) { 13 | const completionItem = []; 14 | let result = tableMatch.exec(context.sqlBlock.sql); 15 | while (result != null) { 16 | const alias = result[4]; 17 | if (alias) { 18 | completionItem.push(new vscode.CompletionItem(alias, vscode.CompletionItemKind.Interface)); 19 | } else { 20 | const tableName = result[2].replace(/\w*?\./, ""); 21 | completionItem.push(new vscode.CompletionItem(tableName, vscode.CompletionItemKind.Interface)); 22 | } 23 | result = tableMatch.exec(context.sqlBlock.sql); 24 | } 25 | 26 | return completionItem; 27 | } 28 | 29 | return null; 30 | } 31 | 32 | public stop(): boolean { 33 | return true; 34 | } 35 | 36 | 37 | 38 | } -------------------------------------------------------------------------------- /src/provider/history/historyNode.ts: -------------------------------------------------------------------------------- 1 | import { FileManager, FileModel } from "@/common/filesManager"; 2 | import * as vscode from "vscode"; 3 | import { ThemeIcon, TreeItem } from "vscode"; 4 | 5 | export class HistoryNode extends TreeItem { 6 | public iconPath = new ThemeIcon("history") 7 | constructor(public sql: string, public date: string, public costTime: number) { 8 | super(sql.replace("\n"," ")) 9 | this.tooltip = `Date: ${date}` 10 | this.description = `${costTime}ms` 11 | this.command = { 12 | command: "mysql.history.view", 13 | title: "View History", 14 | arguments: [this, true], 15 | } 16 | } 17 | 18 | public async view() { 19 | const content = `/* ${this.date} [${this.costTime} ms] */\n${this.sql}`; 20 | const sqlDocument = await vscode.workspace.openTextDocument(await FileManager.record(`history_view.sql`, content, FileModel.WRITE)) 21 | await vscode.window.showTextDocument(sqlDocument); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/provider/parser/sqlBlcok.ts: -------------------------------------------------------------------------------- 1 | import { Position, Range } from "vscode"; 2 | 3 | export class SQLBlock { 4 | sql: string; 5 | range: Range; 6 | tokens: SQLToken[]; 7 | scopes: Range[] = []; 8 | } 9 | 10 | export class SQLToken { 11 | content: string; 12 | type?: string = 'text'; 13 | range: Range; 14 | } 15 | -------------------------------------------------------------------------------- /src/provider/sqlFormattingProvider.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import sqlFormatter from "@/service/format/sqlFormatter"; 3 | 4 | export class SqlFormattingProvider implements vscode.DocumentRangeFormattingEditProvider { 5 | 6 | public provideDocumentRangeFormattingEdits(document: vscode.TextDocument, range: vscode.Range, options: vscode.FormattingOptions, token: vscode.CancellationToken): 7 | vscode.ProviderResult { 8 | 9 | return [new vscode.TextEdit(range, sqlFormatter.format(document.getText(range)))]; 10 | } 11 | 12 | 13 | } -------------------------------------------------------------------------------- /src/provider/sqlSymbolProvide.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { SQLParser } from './parser/sqlParser'; 3 | 4 | export class SQLSymbolProvide implements vscode.DocumentSymbolProvider { 5 | 6 | provideDocumentSymbols(document: vscode.TextDocument, token: vscode.CancellationToken): vscode.ProviderResult { 7 | 8 | return SQLParser.parseBlocks(document).map(block => { 9 | return new vscode.SymbolInformation(block.sql, vscode.SymbolKind.Function, null, 10 | new vscode.Location(document.uri, block.range.start) 11 | ) 12 | }) 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/service/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/src/service/.DS_Store -------------------------------------------------------------------------------- /src/service/connect/config/connnetionConfig.ts: -------------------------------------------------------------------------------- 1 | import { Node } from "@/model/interface/node"; 2 | 3 | export class ConnnetionConfig { 4 | database: ConnectionTarget; 5 | nosql: ConnectionTarget; 6 | } 7 | 8 | export class ConnectionTarget { 9 | global: { [key: string]: Node }; 10 | workspace: { [key: string]: Node }; 11 | } -------------------------------------------------------------------------------- /src/service/connect/connection.ts: -------------------------------------------------------------------------------- 1 | import { EventEmitter } from "events"; 2 | import { FieldInfo } from "@/common/typeDef"; 3 | import * as sqlstring from 'sqlstring'; 4 | 5 | export abstract class IConnection { 6 | public dumpMode: boolean = false; 7 | public dead: boolean = false; 8 | abstract query(sql: string, callback?: queryCallback): void | EventEmitter; 9 | abstract query(sql: string, values: any, callback?: queryCallback): void | EventEmitter; 10 | abstract connect(callback: (err: Error) => void): void; 11 | abstract beginTransaction(callback: (err: Error) => void): void; 12 | abstract rollback(): void; 13 | abstract commit(): void; 14 | abstract end(): void; 15 | abstract isAlive(): boolean; 16 | convertToDump(row: any): any { 17 | for (const key in row) { 18 | const element = row[key]; 19 | if (!element) { 20 | row[key] = 'NULL' 21 | } else { 22 | row[key] = sqlstring.escape(element) 23 | } 24 | } 25 | return row; 26 | } 27 | } 28 | 29 | 30 | /** 31 | * fieldInfo, need name/orgTable 32 | */ 33 | export type queryCallback = (err: Error | null, results?: any, fields?: FieldInfo[], total?: number) => void; 34 | 35 | export interface QueryFunction { 36 | 37 | (options: string, callback?: queryCallback); 38 | 39 | (options: string, values: any, callback?: queryCallback); 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/service/connect/convert/resolveType.ts: -------------------------------------------------------------------------------- 1 | const numberTypes = new Set([ 2 | 'DECIMAL', 3 | 'TINY', 4 | 'SHORT', 5 | 'LONG', 6 | 'FLOAT', 7 | 'DOUBLE', 8 | 'NULL', 9 | 'NEWDECIMAL', 10 | 'LONGLONG', 11 | 'INT24' 12 | ]); 13 | const stringTypes = new Set([ 14 | 'TIMESTAMP', 15 | 'TIME', 16 | 'DATETIME', 17 | 'YEAR', 18 | 'NEWDATE', 19 | 'VARCHAR', 20 | 'JSON', 21 | 'ENUM', 22 | 'SET', 23 | 'VAR_STRING', 24 | 'STRING', 25 | ]); 26 | const bitTypes = new Set(['BIT']); 27 | const hexTypes = new Set([ 28 | 'TINY_BLOB', 29 | 'MEDIUM_BLOB', 30 | 'LONG_BLOB', 31 | 'BLOB', 32 | ]); 33 | const geometryTypes = new Set([ 34 | 'GEOMETRY', 35 | ]); 36 | 37 | 38 | export { numberTypes, bitTypes, geometryTypes, stringTypes, hexTypes }; 39 | -------------------------------------------------------------------------------- /src/service/connect/pool/poolConnection.ts: -------------------------------------------------------------------------------- 1 | 2 | export enum pcStatus { 3 | PEENDING="PEENDING", FREE="FREE", BUSY="BUSY" 4 | } 5 | 6 | export class IpoolConnection { 7 | public actual?: T; 8 | constructor(public id: number, public status: pcStatus) { 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /src/service/connect/sqlite/common/index.ts: -------------------------------------------------------------------------------- 1 | import { FieldInfo } from "@/common/typeDef"; 2 | 3 | export type ResultSet = Array; 4 | 5 | export interface Result { 6 | stmt: string; 7 | header: string[]; 8 | rows: string[][]; 9 | } 10 | 11 | export interface ResultNew { 12 | sql: string; 13 | fields: FieldInfo[]; 14 | rows: object[]; 15 | } -------------------------------------------------------------------------------- /src/service/connect/sqlite/common/utils.ts: -------------------------------------------------------------------------------- 1 | export function replaceEscapedOctetsWithChar(s: string) { 2 | return s.replace(/(?:^|[^\\])((?:\\[0-9]{3})+)/g, (substring: string, ...args: any[]) => { 3 | let capgroup: string = args[0].toString(); 4 | let prevChar: string = ''; 5 | if (substring.length > capgroup.length) { 6 | prevChar = substring[0]; 7 | } 8 | let octal = capgroup.split('\\').filter(s => s.trim() !== ""); 9 | try { 10 | let chars = octalToChars(octal); 11 | return prevChar + chars; 12 | } catch(err) { 13 | return substring; 14 | } 15 | }); 16 | } 17 | 18 | export function octalToChars(octal: Array) { 19 | let hex: string = octal.map(octet => convertFromBaseToBase(octet, 8, 16)).join(''); 20 | let s = new Buffer(hex, 'hex').toString('utf8'); 21 | for(let i=0; i { 4 | push: (chunk: string) => void; 5 | done: () => T; 6 | } 7 | 8 | export class StreamParser extends Writable { 9 | 10 | constructor(private parser: ChunksParser) { 11 | super(); 12 | 13 | this.once('finish', () => { 14 | this.emit('done', parser.done()); 15 | }); 16 | } 17 | 18 | _write(chunk: any, encoding: string, callback: (err?: Error) => void) { 19 | let data = chunk.toString(); 20 | this.parser.push(data); 21 | callback(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/service/dialect/param/createIndexParam.ts: -------------------------------------------------------------------------------- 1 | export interface CreateIndexParam{ 2 | table:string; 3 | column:string; 4 | type:string; 5 | indexType:string; 6 | } -------------------------------------------------------------------------------- /src/service/dialect/param/updateColumnParam.ts: -------------------------------------------------------------------------------- 1 | export interface UpdateColumnParam { 2 | table: string; 3 | comment: string; 4 | columnName: string; 5 | newColumnName: string; 6 | columnType: string; 7 | nullable: boolean; 8 | } -------------------------------------------------------------------------------- /src/service/dialect/param/updateTableParam.ts: -------------------------------------------------------------------------------- 1 | export class UpdateTableParam { 2 | database?: string; 3 | table: string; 4 | newTableName: string; 5 | comment: string; 6 | newComment: string; 7 | } -------------------------------------------------------------------------------- /src/service/dump/mysql/getFunctionDump.ts: -------------------------------------------------------------------------------- 1 | import { FunctionDumpOptions } from './interfaces/Options'; 2 | import { Node } from '@/model/interface/node'; 3 | 4 | interface ShowFunctions { 5 | Name: string; 6 | sql_mode: string; 7 | definer: string; 8 | character_set_client: string; 9 | coallation_connection: string; 10 | 'Database Collation': string; 11 | } 12 | interface ShowCreateFunction { 13 | Function: string; 14 | sql_mode: string; 15 | 'Create Function': string; 16 | character_set_client: string; 17 | coallation_connection: string; 18 | 'Database Collation': string; 19 | } 20 | 21 | async function getFunctionDump(node: Node, sessionId: string, options: Required, functions: Array): Promise { 22 | if (functions.length == 0) { 23 | return ""; 24 | } 25 | const output = functions.map(async fun => { 26 | try { 27 | const r = await node.execute(node.dialect.showFunctionSource(node.schema, fun), sessionId) 28 | const res = r[0] 29 | let sql = `${res['Create Function']}`; 30 | if (!options || !options.definer) { 31 | sql = sql.replace(/CREATE DEFINER=.+?@.+? /, 'CREATE '); 32 | } 33 | if (!options || options.dropIfExist) { 34 | sql = `DROP Function IF EXISTS ${res.Function};\n${sql}`; 35 | } 36 | return `${sql};`; 37 | } catch (error) { 38 | return false 39 | } 40 | }); 41 | 42 | return (await Promise.all(output)).filter(s => s).join("\n\n"); 43 | } 44 | 45 | export { ShowFunctions, ShowCreateFunction, getFunctionDump }; -------------------------------------------------------------------------------- /src/service/dump/mysql/getProcedureDump.ts: -------------------------------------------------------------------------------- 1 | import { Node } from '@/model/interface/node'; 2 | import { ProcedureDumpOptions } from './interfaces/Options'; 3 | 4 | interface ShowProcedures { 5 | Name: string; 6 | sql_mode: string; 7 | definer: string; 8 | character_set_client: string; 9 | coallation_connection: string; 10 | 'Database Collation': string; 11 | } 12 | interface ShowCreateProcedure { 13 | Procedure: string; 14 | sql_mode: string; 15 | 'Create Procedure': string; 16 | character_set_client: string; 17 | coallation_connection: string; 18 | 'Database Collation': string; 19 | } 20 | 21 | async function getProcedureDump(node: Node, sessionId: string, options: Required, procedures: Array): Promise { 22 | if (procedures.length == 0) { 23 | return ""; 24 | } 25 | const output = procedures.map(async procedure => { 26 | try { 27 | const r = await node.execute(node.dialect.showProcedureSource(node.schema, procedure), sessionId) 28 | const res = r[0] 29 | let sql = `${res['Create Procedure']}`; 30 | if (!options || !options.definer) { 31 | sql = sql.replace(/CREATE DEFINER=.+?@.+? /, 'CREATE '); 32 | } 33 | if (!options || options.dropIfExist) { 34 | sql = `DROP PROCEDURE IF EXISTS ${res.Procedure};\n${sql}`; 35 | } 36 | return `${sql};`; 37 | } catch (error) { 38 | return false; 39 | } 40 | }); 41 | 42 | return (await Promise.all(output)).filter(s => s).join("\n\n"); 43 | } 44 | 45 | export { ShowProcedures, ShowCreateProcedure, getProcedureDump }; 46 | -------------------------------------------------------------------------------- /src/service/dump/mysql/getTableDump.ts: -------------------------------------------------------------------------------- 1 | import { Node } from '@/model/interface/node'; 2 | import { TableNode } from '@/model/main/tableNode'; 3 | import { table } from 'console'; 4 | import { SchemaDumpOptions } from './interfaces/Options'; 5 | 6 | export interface ShowCreateTable { 7 | Table: string; 8 | 'Create Table': string; 9 | } 10 | 11 | export async function getTableDump(node: Node, sessionId: string, options: Required, tables: Array): Promise { 12 | if (tables.length == 0) return ''; 13 | const createStatements = tables.map(async (table) => { 14 | let schema = await node.getByRegion(table).showSource(false); 15 | if (!options.engine) { 16 | schema = schema.replace(/ENGINE\s*=\s*\w+ /, ''); 17 | } 18 | if (options.table.dropIfExist) { 19 | schema = schema.replace( 20 | /^CREATE TABLE/, 21 | `DROP TABLE IF EXISTS ${table};\nCREATE TABLE`, 22 | ); 23 | } else if (options.table.ifNotExist) { 24 | schema = schema.replace( 25 | /^CREATE TABLE/, 26 | 'CREATE TABLE IF NOT EXISTS', 27 | ); 28 | } 29 | return `${schema};`; 30 | }); 31 | return (await Promise.all(createStatements)).join("\n\n"); 32 | } -------------------------------------------------------------------------------- /src/service/dump/mysql/sessionVariables.ts: -------------------------------------------------------------------------------- 1 | const HEADER_VARIABLES = [ 2 | '/*!40101 SET NAMES utf8 */;', 3 | '/*!40014 SET FOREIGN_KEY_CHECKS=0 */;', 4 | "/*!40101 SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;", 5 | '/*!40111 SET SQL_NOTES=0 */;' 6 | ].join('\n'); 7 | export { HEADER_VARIABLES }; -------------------------------------------------------------------------------- /src/service/export/exportContext.ts: -------------------------------------------------------------------------------- 1 | import { Node } from "@/model/interface/node"; 2 | 3 | export class ExportContext { 4 | dbOption: Node; 5 | type: ExportType; 6 | withOutLimit: boolean; 7 | table:string; 8 | sql: string; 9 | /** 10 | * es only 11 | */ 12 | request?: any; 13 | exportPath: string; 14 | /** 15 | * intenel: fields 16 | */ 17 | fields: any[]; 18 | /** 19 | * intenel: result 20 | */ 21 | rows:any; 22 | /** 23 | * intenel: trigger when export done 24 | */ 25 | done: (value?: any) => void; 26 | } 27 | 28 | export enum ExportType { 29 | excel = "xlsx", sql = "sql", csv = "csv",json = "json" 30 | } -------------------------------------------------------------------------------- /src/service/format/core/Params.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Handles placeholder replacement with given params. 3 | */ 4 | export default class Params { 5 | /** 6 | * @param {Object} params 7 | */ 8 | constructor(params) { 9 | this.params = params; 10 | this.index = 0; 11 | } 12 | 13 | /** 14 | * Returns param value that matches given placeholder with param key. 15 | * @param {Object} token 16 | * @param {String} token.key Placeholder key 17 | * @param {String} token.value Placeholder value 18 | * @return {String} param or token.value when params are missing 19 | */ 20 | get({key, value}) { 21 | if (!this.params) { 22 | return value; 23 | } 24 | if (key) { 25 | return this.params[key]; 26 | } 27 | return this.params[this.index ++]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/service/format/core/tokenTypes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Constants for token types 3 | */ 4 | export default { 5 | WHITESPACE: "whitespace", 6 | WORD: "word", 7 | STRING: "string", 8 | RESERVED: "reserved", 9 | RESERVED_TOPLEVEL: "reserved-toplevel", 10 | RESERVED_NEWLINE: "reserved-newline", 11 | OPERATOR: "operator", 12 | OPEN_PAREN: "open-paren", 13 | CLOSE_PAREN: "close-paren", 14 | LINE_COMMENT: "line-comment", 15 | BLOCK_COMMENT: "block-comment", 16 | NUMBER: "number", 17 | PLACEHOLDER: "placeholder" 18 | }; 19 | -------------------------------------------------------------------------------- /src/service/format/sqlFormatter.js: -------------------------------------------------------------------------------- 1 | import PlSqlFormatter from "./languages/PlSqlFormatter"; 2 | import StandardSqlFormatter from "./languages/StandardSqlFormatter"; 3 | 4 | export default { 5 | /** 6 | * Format whitespaces in a query to make it easier to read. 7 | * 8 | * @param {String} query 9 | * @param {Object} cfg 10 | * @param {String} cfg.language Query language, default is Standard SQL 11 | * @param {String} cfg.indent Characters used for indentation, default is " " (2 spaces) 12 | * @param {Object} cfg.params Collection of params for placeholder replacement 13 | * @return {String} 14 | */ 15 | format: (query, cfg) => { 16 | cfg = cfg || {}; 17 | 18 | switch (cfg.language) { 19 | case "pl/sql": 20 | return new PlSqlFormatter(cfg).format(query); 21 | case "sql": 22 | case undefined: 23 | return new StandardSqlFormatter(cfg).format(query); 24 | default: 25 | throw Error(`Unsupported SQL dialect: ${cfg.language}`); 26 | } 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /src/service/import/importService.ts: -------------------------------------------------------------------------------- 1 | import { Util } from "@/common/util"; 2 | import { readFileSync } from "fs"; 3 | import { window } from "vscode"; 4 | import { Node } from "../../model/interface/node"; 5 | import { DelimiterHolder } from "../common/delimiterHolder"; 6 | import { ConnectionManager } from "../connectionManager"; 7 | 8 | export abstract class ImportService { 9 | 10 | public importSql(importPath: string, node: Node): void { 11 | 12 | let sql = readFileSync(importPath, 'utf8') 13 | const parseResult = DelimiterHolder.parseBatch(sql, node.getConnectId()) 14 | sql = parseResult.sql 15 | Util.process(`Importing sql file ${importPath}`, async done => { 16 | try { 17 | const importSessionId = `import_${new Date().getTime()}`; 18 | await node.execute(sql, importSessionId) 19 | ConnectionManager.removeConnection(importSessionId) 20 | window.showInformationMessage(`Import sql file ${importPath} success!`) 21 | } finally { 22 | done() 23 | } 24 | }) 25 | 26 | } 27 | 28 | public filter():any { 29 | return { Sql: ['sql'] }; 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /src/service/import/mongoImportService.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import { Console } from "@/common/Console"; 3 | import { Node } from "@/model/interface/node"; 4 | import { NodeUtil } from "@/model/nodeUtil"; 5 | import { exec } from "child_process"; 6 | import { ImportService } from "./importService"; 7 | var commandExistsSync = require('command-exists').sync; 8 | 9 | export class MongoImportService extends ImportService { 10 | 11 | public importSql(importPath: string, node: Node): void { 12 | 13 | if (commandExistsSync('mongoimport')) { 14 | NodeUtil.of(node) 15 | const host = node.usingSSH ? "127.0.0.1" : node.host 16 | const port = node.usingSSH ? NodeUtil.getTunnelPort(node.getConnectId()) : node.port; 17 | const command = `mongoimport -h ${host}:${port} --db ${node.database} --jsonArray -c identitycounters --type json ${importPath}` 18 | Console.log(`Executing: ${command}`); 19 | exec(command, (err,stdout,stderr) => { 20 | if (err) { 21 | Console.log(err); 22 | }else if(stderr){ 23 | Console.log(stderr); 24 | } else { 25 | Console.log(`Import Success!`); 26 | } 27 | }) 28 | } else { 29 | vscode.window.showErrorMessage("Command mongoimport not found!") 30 | } 31 | 32 | } 33 | 34 | public filter() { 35 | return { json: ['json'] } 36 | } 37 | 38 | 39 | } -------------------------------------------------------------------------------- /src/service/import/mysqlImportService.ts: -------------------------------------------------------------------------------- 1 | import { Node } from "../../model/interface/node"; 2 | import { exec } from "child_process"; 3 | import { Console } from "../../common/Console"; 4 | import { NodeUtil } from "../../model/nodeUtil"; 5 | import { ImportService } from "./importService"; 6 | var commandExistsSync = require('command-exists').sync; 7 | 8 | export class MysqlImportService extends ImportService { 9 | 10 | public importSql(importPath: string, node: Node): void { 11 | 12 | if (commandExistsSync('mysql')) { 13 | NodeUtil.of(node) 14 | const host = node.usingSSH ? "127.0.0.1" : node.host 15 | const port = node.usingSSH ? NodeUtil.getTunnelPort(node.getConnectId()) : node.port; 16 | const command = `mysql -h ${host} -P ${port} -u ${node.user} ${node.password ? `-p${node.password}` : ""} ${node.schema || ""} < ${importPath}` 17 | Console.log(`Executing: ${command.replace(/-p.+? /, "-p****** ")}`); 18 | const cp=exec(command, (err,stdout,stderr) => { 19 | Console.log(err||stdout||stderr); 20 | }) 21 | cp.on("close",(code,singal)=>{ 22 | Console.log(code===0?'Import Done.':"Import Occur Error!"); 23 | }) 24 | } else { 25 | super.importSql(importPath,node) 26 | } 27 | 28 | 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /src/service/import/postgresqlImortService.ts: -------------------------------------------------------------------------------- 1 | import { Console } from "@/common/Console"; 2 | import { Node } from "@/model/interface/node"; 3 | import { NodeUtil } from "@/model/nodeUtil"; 4 | import { exec } from "child_process"; 5 | import { platform } from "os"; 6 | import { ImportService } from "./importService"; 7 | var commandExistsSync = require('command-exists').sync; 8 | 9 | export class PostgresqlImortService extends ImportService { 10 | public importSql(importPath: string, node: Node): void { 11 | 12 | if (commandExistsSync('psql')) { 13 | NodeUtil.of(node) 14 | const host = node.usingSSH ? "127.0.0.1" : node.host 15 | const port = node.usingSSH ? NodeUtil.getTunnelPort(node.getConnectId()) : node.port; 16 | const command = `psql -h ${host} -p ${port} -U ${node.user} -d ${node.database} < ${importPath}` 17 | Console.log(`Executing: ${command}`); 18 | let prefix = platform() == 'win32' ? 'set' : 'export'; 19 | exec(`${prefix} "PGPASSWORD=${node.password}" && ${command}`, (err,stdout,stderr) => { 20 | if (err) { 21 | Console.log(err); 22 | }else if(stderr){ 23 | Console.log(stderr); 24 | } else { 25 | Console.log(`Import Success!`); 26 | } 27 | }) 28 | } else { 29 | super.importSql(importPath, node) 30 | } 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /src/service/import/sqlServerImportService.ts: -------------------------------------------------------------------------------- 1 | import { ImportService } from "./importService"; 2 | 3 | export class SqlServerImportService extends ImportService{ 4 | 5 | } -------------------------------------------------------------------------------- /src/service/mock/mockModel.ts: -------------------------------------------------------------------------------- 1 | export interface MockModel { 2 | schema: string; 3 | mockValueReference: string; 4 | table: string; 5 | mockStartIndex: number|string; 6 | mockCount: number; 7 | mock: { 8 | [key: string]: { 9 | type: string, 10 | value: any, 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/service/page/esPageService.ts: -------------------------------------------------------------------------------- 1 | import { EsRequest } from "@/model/es/esRequest"; 2 | import { AbstractPageSerivce } from "./pageService"; 3 | 4 | export class EsPageService extends AbstractPageSerivce { 5 | 6 | protected buildPageSql(sql: string, start: number, limit: number): string { 7 | return EsRequest.build(sql, body => { 8 | body.from = start; 9 | body.size = limit; 10 | }) 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/service/page/mongoPageService.ts: -------------------------------------------------------------------------------- 1 | import { AbstractPageSerivce } from "./pageService"; 2 | 3 | export class MongoPageService extends AbstractPageSerivce{ 4 | protected buildPageSql(sql: string, start: number, limit: number): string { 5 | if (sql.match(/\.skip.+?\)/i)) { 6 | return sql.replace(/\.skip.+?\)/i, `.skip(${start})`) 7 | } 8 | return sql.replace(/(\.find.+?\))/,`$1.skip(${start})`); 9 | } 10 | 11 | protected pageMatch() { 12 | return /limit\((\d+)\)/i; 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/service/page/mssqlPageService.ts: -------------------------------------------------------------------------------- 1 | import { AbstractPageSerivce } from "./pageService"; 2 | 3 | export class MssqlPageService extends AbstractPageSerivce{ 4 | protected buildPageSql(sql: string, start: number, limit: number): string { 5 | throw new Error("Method not implemented."); 6 | } 7 | 8 | } -------------------------------------------------------------------------------- /src/service/page/mysqlPageSerivce.ts: -------------------------------------------------------------------------------- 1 | import { AbstractPageSerivce } from "./pageService"; 2 | 3 | export class MysqlPageSerivce extends AbstractPageSerivce { 4 | 5 | protected buildPageSql(sql: string, start: number, limit: number): string { 6 | 7 | const paginationSql = `LIMIT ${start},${limit}`; 8 | if (sql.match(/\blimit\b/i)) { 9 | return sql.replace(/\blimit\b.+/ig, paginationSql) 10 | } 11 | 12 | return `${sql} ${paginationSql}` 13 | 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /src/service/page/pageService.ts: -------------------------------------------------------------------------------- 1 | import { ConfigKey } from "@/common/constants"; 2 | import { Global } from "@/common/global"; 3 | 4 | export interface PageService { 5 | /** 6 | * build page sql 7 | * @param sql 8 | * @param page 9 | * @param pageSize 10 | * @return paginationSql 11 | */ 12 | build(sql: string, page: number, pageSize: number): string; 13 | 14 | getPageSize(sql: string): number; 15 | 16 | } 17 | 18 | export abstract class AbstractPageSerivce implements PageService { 19 | 20 | public build(sql: string, page: number, pageSize: number): string { 21 | 22 | if (!sql) { 23 | throw new Error("Not support empty sql!"); 24 | } 25 | 26 | if (!pageSize) { 27 | pageSize = 100; 28 | } 29 | 30 | let start = 0; 31 | if (page) { 32 | start = (page - 1) * pageSize; 33 | } 34 | 35 | return this.buildPageSql(sql, start, pageSize) 36 | } 37 | 38 | public getPageSize(sql: string): number { 39 | 40 | const limitBlock = sql.match(this.pageMatch()) 41 | if (limitBlock) { 42 | return parseInt(limitBlock[1]) 43 | } 44 | 45 | return Global.getConfig(ConfigKey.DEFAULT_LIMIT); 46 | } 47 | 48 | protected pageMatch() { 49 | return /limit\s*(\d+)/i; 50 | } 51 | 52 | protected abstract buildPageSql(sql: string, start: number, limit: number): string; 53 | 54 | } -------------------------------------------------------------------------------- /src/service/page/postgreSqlPageService.ts: -------------------------------------------------------------------------------- 1 | import { AbstractPageSerivce } from "./pageService"; 2 | 3 | export class PostgreSqlPageService extends AbstractPageSerivce{ 4 | protected buildPageSql(sql: string, start: number, limit: number): string { 5 | const paginationSql = `LIMIT ${limit} OFFSET ${start}`; 6 | if (sql.match(/\blimit\b/i)) { 7 | return sql.replace(/\blimit\b.+/ig, paginationSql) 8 | } 9 | 10 | return `${sql} ${paginationSql}` 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/service/result/queryResponse.ts: -------------------------------------------------------------------------------- 1 | import { ColumnMeta, FieldInfo } from "@/common/typeDef"; 2 | 3 | export class RunResponse { 4 | public sql: string; 5 | } 6 | 7 | export class MessageResponse { 8 | public message: string; 9 | public success: boolean; 10 | } 11 | 12 | export class DataResponse { 13 | public sql: string; 14 | public costTime: number; 15 | public primaryKey: string; 16 | public columnList: ColumnMeta[]; 17 | public primaryKeyList: ColumnMeta[]; 18 | public database?: string; 19 | public table: string | null; 20 | public data: any[]; 21 | public fields: FieldInfo[]; 22 | public pageSize: number; 23 | public tableCount: number; 24 | public total?: number; 25 | } 26 | 27 | export class ErrorResponse { 28 | public sql: string; 29 | public costTime: number; 30 | public message: string; 31 | } 32 | 33 | export class DMLResponse { 34 | public sql: string; 35 | public costTime: number; 36 | public message?: string; 37 | public affectedRows: number; 38 | public isInsert: boolean; 39 | } 40 | 41 | /** 42 | * Elastic Search Response 43 | */ 44 | 45 | export class EsDataResponse extends DataResponse{ 46 | public request?: any; 47 | } -------------------------------------------------------------------------------- /src/service/setting/MysqlSettingService.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import * as fs from "fs"; 3 | import process = require('process'); 4 | import { SettingService } from "./settingService"; 5 | 6 | export class MysqlSettingService implements SettingService { 7 | private x64 = "C:\\Program Files\\MySQL"; 8 | private x86 = "C:\\Program Files (x86)\\MySQL"; 9 | public open() { 10 | if (!process.platform.match(/win/ig)) { 11 | vscode.window.showErrorMessage("Only Support Windows OS."); 12 | return; 13 | } 14 | let isOpen = this.check(this.x86); 15 | if (!isOpen) { 16 | isOpen = this.check(this.x64); 17 | if (!isOpen) { 18 | vscode.window.showErrorMessage("Cannot find mysql setting in your machine."); 19 | } 20 | } 21 | } 22 | 23 | private check(param): boolean { 24 | for (const fileName of fs.readdirSync(param)) { 25 | const serverPath = param + "\\" + fileName; 26 | if (fs.statSync(serverPath).isDirectory) { 27 | vscode.workspace.openTextDocument(vscode.Uri.file(`${serverPath}\\my.ini`)).then((doc) => { 28 | vscode.window.showTextDocument(doc); 29 | }); 30 | return true; 31 | } 32 | } 33 | return false; 34 | } 35 | 36 | 37 | } -------------------------------------------------------------------------------- /src/service/setting/settingService.ts: -------------------------------------------------------------------------------- 1 | export interface SettingService { 2 | open(): void; 3 | } -------------------------------------------------------------------------------- /src/service/ssh/forward/lib/config.js: -------------------------------------------------------------------------------- 1 | var util = require('util'); 2 | var defaults = require('lodash.defaults'); 3 | 4 | var ConfigError = function (message, extra) { 5 | Error.captureStackTrace(this, this.constructor); 6 | this.name = this.constructor.name; 7 | this.message = message; 8 | this.extra = extra; 9 | }; 10 | 11 | util.inherits(ConfigError, Error); 12 | 13 | function createConfig(config) { 14 | var env = process.env; 15 | 16 | defaults(config || {}, { 17 | username: env.TUNNELSSH_USER || env.USER || env.USERNAME || 'root', 18 | port: 22, 19 | host: null, 20 | srcPort: 0, 21 | srcHost: '127.0.0.1', 22 | dstPort: null, 23 | dstHost: '127.0.0.1', 24 | localHost: '127.0.0.1', 25 | localPort: config.dstPort, 26 | agent: process.env.SSH_AUTH_SOCK 27 | }); 28 | 29 | if (!config.host) { 30 | throw new ConfigError('host not set'); 31 | } 32 | 33 | if (!config.dstPort) { 34 | throw new ConfigError('dstPort not set'); 35 | } 36 | 37 | return config; 38 | } 39 | 40 | module.exports = createConfig; 41 | -------------------------------------------------------------------------------- /src/service/ssh/terminal/classicTerminalService.ts: -------------------------------------------------------------------------------- 1 | import { SSHConfig } from '@/model/interface/sshConfig'; 2 | import * as vscode from 'vscode'; 3 | import { TerminalService } from "./terminalService"; 4 | 5 | export class ClassicTerminal implements TerminalService { 6 | openPath(sshConfig: SSHConfig,fullPath: string): void { 7 | if (!vscode.window.activeTerminal) { 8 | vscode.window.showErrorMessage("You must open terminal.") 9 | } else { 10 | vscode.window.activeTerminal.sendText(`cd ${fullPath}`) 11 | } 12 | } 13 | 14 | openMethod(sshConfig: SSHConfig): void { 15 | 16 | const sendConfirm = "SEND PASSWORD"; 17 | const sshterm = vscode.window.activeTerminal ? vscode.window.activeTerminal : vscode.window.createTerminal(sshConfig.username + "@" + sshConfig.host); 18 | sshterm.sendText(`ssh ${sshConfig.username}@${sshConfig.host} -o StrictHostKeyChecking=no ${sshConfig.privateKeyPath ? ` -i ${sshConfig.privateKeyPath}` : ''} `); 19 | sshterm.show(); 20 | const auth = sshConfig.password || sshConfig.passphrase; 21 | if (auth) { 22 | vscode.window.showQuickPick([sendConfirm], { ignoreFocusOut: true }).then(res => { 23 | if (res == sendConfirm) { 24 | sshterm.sendText(sshConfig.password) 25 | } 26 | }) 27 | } 28 | 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /src/service/ssh/terminal/constant.ts: -------------------------------------------------------------------------------- 1 | export enum TerminalTitle{ 2 | connectionName="connectionName",usernameAndHost="user@host" 3 | 4 | } -------------------------------------------------------------------------------- /src/service/ssh/terminal/terminalService.ts: -------------------------------------------------------------------------------- 1 | import { SSHConfig } from "@/model/interface/sshConfig"; 2 | 3 | export interface TerminalService { 4 | openPath(sshConfig: SSHConfig, fullPath: string): void; 5 | openMethod(sshConfig: SSHConfig): void; 6 | } -------------------------------------------------------------------------------- /src/service/status/statusService.ts: -------------------------------------------------------------------------------- 1 | import { ConnectionNode } from "../../model/database/connectionNode"; 2 | 3 | export interface StatusService { 4 | show(connectionNode: ConnectionNode): void | Promise; 5 | } -------------------------------------------------------------------------------- /src/service/tunnel/config.js: -------------------------------------------------------------------------------- 1 | var util = require('util'); 2 | var defaults = require('lodash.defaults'); 3 | 4 | var ConfigError = function (message, extra) { 5 | Error.captureStackTrace(this, this.constructor); 6 | this.name = this.constructor.name; 7 | this.message = message; 8 | this.extra = extra; 9 | }; 10 | 11 | util.inherits(ConfigError, Error); 12 | 13 | function createConfig(config) { 14 | var env = process.env; 15 | 16 | defaults(config || {}, { 17 | username: env.TUNNELSSH_USER || env.USER || env.USERNAME || 'root', 18 | port: 22, 19 | host: null, 20 | srcPort: 0, 21 | srcHost: '127.0.0.1', 22 | dstPort: null, 23 | dstHost: '127.0.0.1', 24 | localHost: '127.0.0.1', 25 | localPort: config.dstPort, 26 | agent: process.env.SSH_AUTH_SOCK 27 | }); 28 | 29 | if (!config.host) { 30 | throw new ConfigError('host not set'); 31 | } 32 | 33 | if (!config.dstPort) { 34 | throw new ConfigError('dstPort not set'); 35 | } 36 | return config; 37 | } 38 | 39 | module.exports = createConfig; -------------------------------------------------------------------------------- /src/vue/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 27 | -------------------------------------------------------------------------------- /src/vue/connect/component/FTP.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/vue/connect/component/SQLite.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/vue/connect/component/SSL.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/vue/mixin/vscodeInject.js: -------------------------------------------------------------------------------- 1 | import { getVscodeEvent } from "../util/vscode"; 2 | 3 | export const inject = { 4 | data() { 5 | return { 6 | vscodeEvent: null 7 | } 8 | }, 9 | mounted() { 10 | this.vscodeEvent = getVscodeEvent() 11 | }, 12 | methods: { 13 | init() { 14 | this.vscodeEvent.emit("route-" + this.$route.name); 15 | }, on(event, callback) { 16 | this.vscodeEvent.on(event, callback) 17 | return this; 18 | }, 19 | emit(event, data) { 20 | this.vscodeEvent.emit(event, data) 21 | return this; 22 | } 23 | }, 24 | destroyed() { 25 | this.vscodeEvent.destroy(); 26 | }, 27 | } -------------------------------------------------------------------------------- /src/vue/result/component/Contextmenu/constant.js: -------------------------------------------------------------------------------- 1 | export const SUBMENU_X_OFFSET = 3; 2 | export const SUBMENU_Y_OFFSET = -8; 3 | export const SUBMENU_OPEN_TREND_LEFT = "left"; 4 | export const SUBMENU_OPEN_TREND_RIGHT = "right"; 5 | export const COMPONENT_NAME = "contextmenu-submenu"; 6 | -------------------------------------------------------------------------------- /src/vue/result/component/Contextmenu/index.js: -------------------------------------------------------------------------------- 1 | 2 | import Vue from 'vue'; 3 | import Contextmenu from "./components/Contextmenu"; 4 | import Submenu from "./components/Submenu"; 5 | import { COMPONENT_NAME } from "./constant"; 6 | 7 | const ContextmenuConstructor = Vue.extend(Contextmenu); 8 | Vue.component(COMPONENT_NAME, Submenu); 9 | 10 | function install(Vue) { 11 | let lastInstance = null; 12 | const ContextmenuProxy = function (options) { 13 | let instance = new ContextmenuConstructor(); 14 | instance.items = options.items; 15 | instance.position.x = options.x || 0; 16 | instance.position.y = options.y || 0; 17 | if (options.event) { 18 | instance.position.x = options.event.clientX; 19 | instance.position.y = options.event.clientY; 20 | } 21 | instance.customClass = options.customClass; 22 | options.minWidth && (instance.style.minWidth = options.minWidth); 23 | options.zIndex && (instance.style.zIndex = options.zIndex); 24 | ContextmenuProxy.destroy(); 25 | lastInstance = instance; 26 | instance.$mount(); 27 | } 28 | ContextmenuProxy.destroy = function () { 29 | if (lastInstance) { 30 | lastInstance.$destroy(); 31 | lastInstance = null; 32 | } 33 | } 34 | Vue.prototype.$contextmenu = ContextmenuProxy; 35 | } 36 | 37 | if (window && window.Vue) { 38 | install(window.Vue) 39 | } 40 | 41 | export default { 42 | install 43 | } 44 | -------------------------------------------------------------------------------- /src/vue/result/component/Contextmenu/util.js: -------------------------------------------------------------------------------- 1 | export function hasClass(el, className) { 2 | if (!className) { 3 | return true; 4 | } 5 | if (!el || !el.className || typeof el.className !== 'string') { 6 | return false; 7 | } 8 | for (let cn of el.className.split(/\s+/)) { 9 | if (cn === className) { 10 | return true; 11 | } 12 | } 13 | return false; 14 | } 15 | 16 | export function getElementsByClassName(className) { 17 | let els = []; 18 | for (let el of document.getElementsByClassName(className) || []) { 19 | els.push(el); 20 | } 21 | return els; 22 | } 23 | 24 | export function uuid() { 25 | return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { 26 | var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); 27 | return v.toString(16); 28 | }); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/vue/result/component/EditDialog/CellEditor.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 32 | 33 | -------------------------------------------------------------------------------- /src/vue/result/component/ExportDialog.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 42 | 43 | -------------------------------------------------------------------------------- /src/vue/result/component/Row/Controller.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 23 | 24 | -------------------------------------------------------------------------------- /src/vue/result/component/Row/Header.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /src/vue/result/icon/iconfont.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: "iconfont"; /* Project id 2598912 */ 3 | src: url('iconfont.woff?t=1623116621438') format('woff'); 4 | } 5 | 6 | [class*=" icon-"], [class^=icon-] { 7 | font-family: "iconfont" !important; 8 | speak: none; 9 | font-style: normal; 10 | font-weight: 400; 11 | font-variant: normal; 12 | text-transform: none; 13 | line-height: 1; 14 | vertical-align: baseline; 15 | display: inline-block; 16 | -webkit-font-smoothing: antialiased; 17 | -moz-osx-font-smoothing: grayscale 18 | } 19 | 20 | .icon-github:before { 21 | content: "\e601"; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/vue/result/icon/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cweijan/vscode-database-client/da698b512cbf113f9db6e3b4c893ab4b4e84c33f/src/vue/result/icon/iconfont.woff -------------------------------------------------------------------------------- /src/vue/result/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | import ElementUI from 'element-ui'; 4 | import locale from 'element-ui/lib/locale/lang/en' 5 | Vue.use(ElementUI, { locale }); 6 | import Contextmenu from "./component/Contextmenu" 7 | Vue.use(Contextmenu); 8 | import UmyTable from 'umy-table' 9 | import 'umy-table/lib/theme-chalk/index.css'; 10 | import '@/../public/theme/auto.css' 11 | import '@/../public/theme/umyui.css' 12 | import './view.css' 13 | import './icon/iconfont.css' 14 | Vue.use(UmyTable); 15 | 16 | Vue.config.productionTip = false 17 | 18 | new Vue({ 19 | el: '#app', 20 | components: { App }, 21 | template: '' 22 | }) 23 | -------------------------------------------------------------------------------- /src/vue/result/view.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: var(--vscode-font-family); 3 | padding: 0; 4 | } 5 | 6 | .hint { 7 | box-sizing: border-box; 8 | padding-left: 5px; 9 | font-size: 1.1em; 10 | color: #444; 11 | width: 95vw; 12 | display: inline-block; 13 | margin-top: 8px; 14 | } 15 | 16 | .plx-header--column.col--checkbox > .plx-cell .plx-cell--title{ 17 | overflow: unset; 18 | } 19 | 20 | .sql-pannel{ 21 | width:100%; 22 | font-size: var(--vscode-font-size); 23 | } 24 | .sql-pannel textarea{ 25 | font-family: var(--vscode-editor-font-family); 26 | padding-top: 0; 27 | padding-left: 10px; 28 | } 29 | 30 | .hint { 31 | color: var(--editor-color); 32 | } 33 | 34 | .info-panel { 35 | color: #444; 36 | font-size: var(--vscode-font-size); 37 | border: 1px solid #dcdfe6; 38 | border-radius: 5px; 39 | padding: 10px; 40 | margin-left: 6px; 41 | } 42 | 43 | .el-popover__reference{ 44 | background-color: #409EFF; 45 | } 46 | -------------------------------------------------------------------------------- /src/vue/util/vscode.js: -------------------------------------------------------------------------------- 1 | const vscode = typeof (acquireVsCodeApi) != "undefined" ? acquireVsCodeApi() : null; 2 | const postMessage = (message) => { if (vscode) { vscode.postMessage(message) } } 3 | 4 | export const getVscodeEvent = () => { 5 | let events = {} 6 | let init = false; 7 | function receive({ data }) { 8 | if (!data) 9 | return; 10 | if (events[data.type]) { 11 | events[data.type](data.content); 12 | } 13 | } 14 | return { 15 | on(event, callback) { 16 | this.tryInit(); 17 | events[event] = callback 18 | return this; 19 | }, 20 | emit(event, data) { 21 | this.tryInit(); 22 | postMessage({ type: event, content: data }) 23 | }, 24 | tryInit() { 25 | if (init) return; 26 | init = true; 27 | window.addEventListener('message', receive) 28 | }, 29 | destroy() { 30 | window.removeEventListener('message', receive) 31 | this.init = false; 32 | } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/vue/xterm/theme/auto.js: -------------------------------------------------------------------------------- 1 | export const auto = () => { 2 | const vscodeStyle = document.documentElement.style; 3 | function get(name) { 4 | return vscodeStyle.getPropertyValue(name) 5 | } 6 | return { 7 | 8 | cursor:get('--vscode-editorCursor-foreground'), 9 | 10 | foreground: get('--vscode-terminal-foreground'), 11 | background: get('--vscode-editor-background'), 12 | 13 | brightBlack: get('--vscode-terminal-ansiBrightBlack'), 14 | black: get('--vscode-terminal-ansiBlack'), 15 | 16 | brightBlue: get('--vscode-terminal-ansBrightiBlue'), 17 | blue: get('--vscode-terminal-ansiBlue'), 18 | 19 | brightGreen: get('--vscode-terminal-ansiBrightGreen'), 20 | green: get('--vscode-terminal-ansiGreen'), 21 | 22 | brightRed: get('--vscode-terminal-ansiBrightRed'), 23 | red: get('--vscode-terminal-ansiRed'), 24 | 25 | brightCyan: get('--vscode-terminal-ansiBrightCyan'), 26 | cyan: get('--vscode-terminal-ansiCyan'), 27 | 28 | brightPurple: get('--vscode-terminal-ansiBrightMagenta'), 29 | purple: get('--vscode-terminal-ansiMagenta'), 30 | 31 | brightYellow: get('--vscode-terminal-ansiBrightYellow'), 32 | yellow: get('--vscode-terminal-ansiYellow'), 33 | 34 | brightWhite: get('--vscode-terminal-ansiBrightWhite'), 35 | white: get('--vscode-terminal-ansiWhite'), 36 | } 37 | } -------------------------------------------------------------------------------- /syntaxes/es.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "//", 4 | "blockComment": [ 5 | "/*", 6 | "*/" 7 | ] 8 | }, 9 | "brackets": [ 10 | [ 11 | "{", 12 | "}" 13 | ], 14 | [ 15 | "[", 16 | "]" 17 | ] 18 | ], 19 | "autoClosingPairs": [ 20 | { 21 | "open": "{", 22 | "close": "}" 23 | }, 24 | { 25 | "open": "[", 26 | "close": "]" 27 | }, 28 | { 29 | "open": "(", 30 | "close": ")" 31 | }, 32 | { 33 | "open": "'", 34 | "close": "'", 35 | "notIn": [ 36 | "string", 37 | "comment" 38 | ] 39 | }, 40 | { 41 | "open": "\"", 42 | "close": "\"", 43 | "notIn": [ 44 | "string" 45 | ] 46 | }, 47 | { 48 | "open": "/**", 49 | "close": " */", 50 | "notIn": [ 51 | "string" 52 | ] 53 | } 54 | ] 55 | } -------------------------------------------------------------------------------- /syntaxes/language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "--", 4 | "blockComment": [ "/*", "*/" ] 5 | }, 6 | "brackets": [ 7 | ["{", "}"], 8 | ["[", "]"], 9 | ["(", ")"] 10 | ], 11 | "autoClosingPairs": [ 12 | ["{", "}"], 13 | ["[", "]"], 14 | ["(", ")"], 15 | { "open": "\"", "close": "\"", "notIn": ["string"] }, 16 | { "open": "N'", "close": "'", "notIn": ["string", "comment"] }, 17 | { "open": "'", "close": "'", "notIn": ["string", "comment"] } 18 | ], 19 | "surroundingPairs": [ 20 | ["{", "}"], 21 | ["[", "]"], 22 | ["(", ")"], 23 | ["\"", "\""], 24 | ["'", "'"], 25 | ["`", "`"] 26 | ], 27 | "folding": { 28 | "markers": { 29 | "start": "\\/\\*", 30 | "end": "\\*\\/" 31 | } 32 | } 33 | // enhancedBrackets:[ 34 | // { openTrigger: 'n', open: /begin$/i, closeComplete: 'end', matchCase: true }, 35 | // { openTrigger: 'e', open: /case$/i, closeComplete: 'end', matchCase: true }, 36 | // { openTrigger: 'n', open: /when$/i, closeComplete: 'then', matchCase: true } 37 | // ], 38 | // noindentBrackets: '()', 39 | } -------------------------------------------------------------------------------- /syntaxes/snippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "SelectTemplate": { 3 | "prefix": "sel", 4 | "body": [ 5 | "SELECT * FROM " 6 | ] 7 | }, 8 | "SelectWhereTemplate": { 9 | "prefix": "selw", 10 | "body": [ 11 | "SELECT * FROM $1 WHERE $2" 12 | ] 13 | }, 14 | "DeleteTemplate": { 15 | "prefix": "del", 16 | "body": [ 17 | "DELETE FROM " 18 | ] 19 | }, 20 | "DeleteWhereTemplate": { 21 | "prefix": "delw", 22 | "body": [ 23 | "DELETE FROM $1 WHERE $2" 24 | ] 25 | }, 26 | "InsertTemplate": { 27 | "prefix": "ins", 28 | "body": [ 29 | "INSERT INTO $1 VALUES ($2)" 30 | ] 31 | }, 32 | "UpdateTemplate": { 33 | "prefix": "upd", 34 | "body": [ 35 | "UPDATE $1 SET $2 WHERE $3" 36 | ] 37 | },"JoinTemplate": { 38 | "prefix": "joi", 39 | "body": [ 40 | "JOIN $1 ON $2" 41 | ] 42 | },"BetweenTemplate": { 43 | "prefix": "bet", 44 | "body": [ 45 | "BETWEEN $1 AND $2" 46 | ] 47 | } 48 | } -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | purge: ["./src/vue/**/*.vue", "./src/vue/**/*.js"], 3 | darkMode: false, // or 'media' or 'class' 4 | theme: { 5 | extend: {}, 6 | }, 7 | variants: {}, 8 | plugins: [], 9 | }; 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6", 8 | "es2017", 9 | "es2019" 10 | ], 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "sourceMap": true, 14 | "baseUrl": ".", 15 | "paths": { 16 | "@/*": [ 17 | "./src/*" 18 | ] 19 | } 20 | }, 21 | "exclude": [ 22 | "node_modules", 23 | ".vscode-test" 24 | ] 25 | } -------------------------------------------------------------------------------- /webpack.config.lib.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | var webpack = require('webpack'); 3 | 4 | // 1. npm i tedious node-xlsx 5 | // 2. npm run lib 6 | 7 | module.exports = [ 8 | { 9 | target: "node", 10 | node: { 11 | fs: 'empty', net: 'empty', tls: 'empty', 12 | child_process: 'empty', dns: 'empty', 13 | global: true, __dirname: true 14 | }, 15 | entry: { 16 | 'node-xlsx': './node_modules/node-xlsx/lib/index.js', 17 | tedious: './node_modules/tedious/lib/tedious.js', 18 | } , 19 | output: { 20 | path: path.resolve(__dirname, 'src/bin'), 21 | filename: '[name].js', 22 | libraryTarget: 'commonjs2' 23 | }, 24 | externals: { 25 | vscode: 'commonjs vscode' 26 | }, 27 | resolve: { 28 | extensions: ['.ts', '.js'], 29 | alias: { 30 | '@': path.resolve(__dirname, './src'), 31 | '~': path.resolve(__dirname, './src') 32 | } 33 | }, 34 | plugins: [ 35 | new webpack.IgnorePlugin(/^(pg-native|supports-color|mongodb-client-encryption)$/) 36 | ], 37 | module: { rules: [{ test: /\.ts$/, exclude: /node_modules/, use: ['ts-loader'] }] }, 38 | optimization: { minimize: true }, 39 | watch: false, 40 | mode: 'production', 41 | devtool: false, 42 | } 43 | ]; 44 | --------------------------------------------------------------------------------