Showing preview only (1,355K chars total). Download the full file or copy to clipboard to get everything.
Repository: hsen-dev/vscode-elastic
Branch: master
Commit: 0baefb194bc6
Files: 395
Total size: 1.2 MB
Directory structure:
gitextract_b_w37aut/
├── .github/
│ └── workflows/
│ ├── publish.yaml
│ └── runTests.yaml
├── .gitignore
├── .husky/
│ └── pre-commit
├── .prettierrc.json
├── .vscodeignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── build/
│ └── restSpecIndex.js
├── grammar/
│ ├── es.configuration.json
│ └── es.tmLanguage
├── media/
│ ├── jquery.contextMenu.css
│ ├── jquery.contextMenu.js
│ ├── json-formatter.js
│ ├── result.tmpl
│ └── results.css
├── package.json
├── src/
│ ├── ElasticCodeLensProvider.ts
│ ├── ElasticCompletionItemProvider.ts
│ ├── ElasticContentProvider.ts
│ ├── ElasticDecoration.ts
│ ├── ElasticMatch.ts
│ ├── ElasticMatches.ts
│ ├── axiosInstance.ts
│ ├── extension.ts
│ ├── helpers.ts
│ ├── jsonPanel.ts
│ └── rest-spec/
│ ├── index.ts
│ ├── json.d.ts
│ ├── v2_4_6/
│ │ ├── 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.thread_pool.json
│ │ ├── clear_scroll.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
│ │ ├── count_percolate.json
│ │ ├── delete.json
│ │ ├── delete_script.json
│ │ ├── delete_template.json
│ │ ├── exists.json
│ │ ├── explain.json
│ │ ├── field_stats.json
│ │ ├── get.json
│ │ ├── get_script.json
│ │ ├── get_source.json
│ │ ├── get_template.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.delete_warmer.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_aliases.json
│ │ ├── indices.get_field_mapping.json
│ │ ├── indices.get_mapping.json
│ │ ├── indices.get_settings.json
│ │ ├── indices.get_template.json
│ │ ├── indices.get_upgrade.json
│ │ ├── indices.get_warmer.json
│ │ ├── indices.open.json
│ │ ├── indices.optimize.json
│ │ ├── indices.put_alias.json
│ │ ├── indices.put_mapping.json
│ │ ├── indices.put_settings.json
│ │ ├── indices.put_template.json
│ │ ├── indices.put_warmer.json
│ │ ├── indices.recovery.json
│ │ ├── indices.refresh.json
│ │ ├── indices.segments.json
│ │ ├── indices.shard_stores.json
│ │ ├── indices.stats.json
│ │ ├── indices.update_aliases.json
│ │ ├── indices.upgrade.json
│ │ ├── indices.validate_query.json
│ │ ├── info.json
│ │ ├── mget.json
│ │ ├── mpercolate.json
│ │ ├── msearch.json
│ │ ├── mtermvectors.json
│ │ ├── nodes.hot_threads.json
│ │ ├── nodes.info.json
│ │ ├── nodes.stats.json
│ │ ├── percolate.json
│ │ ├── ping.json
│ │ ├── put_script.json
│ │ ├── put_template.json
│ │ ├── reindex.json
│ │ ├── reindex_rethrottle.json
│ │ ├── render_search_template.json
│ │ ├── scroll.json
│ │ ├── search.json
│ │ ├── search_exists.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
│ │ ├── suggest.json
│ │ ├── tasks.cancel.json
│ │ ├── tasks.list.json
│ │ ├── termvectors.json
│ │ ├── update.json
│ │ └── update_by_query.json
│ ├── v5_6_4/
│ │ ├── _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
│ │ ├── count_percolate.json
│ │ ├── create.json
│ │ ├── delete.json
│ │ ├── delete_by_query.json
│ │ ├── delete_script.json
│ │ ├── delete_template.json
│ │ ├── exists.json
│ │ ├── exists_source.json
│ │ ├── explain.json
│ │ ├── field_caps.json
│ │ ├── field_stats.json
│ │ ├── get.json
│ │ ├── get_script.json
│ │ ├── get_source.json
│ │ ├── get_template.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
│ │ ├── mpercolate.json
│ │ ├── msearch.json
│ │ ├── msearch_template.json
│ │ ├── mtermvectors.json
│ │ ├── nodes.hot_threads.json
│ │ ├── nodes.info.json
│ │ ├── nodes.stats.json
│ │ ├── percolate.json
│ │ ├── ping.json
│ │ ├── put_script.json
│ │ ├── put_template.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
│ │ ├── suggest.json
│ │ ├── tasks.cancel.json
│ │ ├── tasks.get.json
│ │ ├── tasks.list.json
│ │ ├── termvectors.json
│ │ ├── update.json
│ │ └── update_by_query.json
│ └── 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
├── tsconfig.json
├── tslint-imports.json
└── webpack.config.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/publish.yaml
================================================
name: Publish To Vscode
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x
- run: npm i
- name: Publish
run: npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
REPO_URL: "${{ github.server_url }}/${{ github.repository }}"
BRANCH: "${GITHUB_REF##*/}"
================================================
FILE: .github/workflows/runTests.yaml
================================================
name: Run Tests
on:
push:
branches:
- master
pull_request:
branches: [ master ]
jobs:
prepare:
runs-on: ubuntu-latest
name: Run Tests
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install Dependencies
run: npm i
- name: Run Tests
run: npm run test
================================================
FILE: .gitignore
================================================
out
node_modules
.vscode
.DS_Store
package-lock.json
================================================
FILE: .husky/pre-commit
================================================
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npm version patch --commit-hooks false --git-tag-version false --force
git add .
================================================
FILE: .prettierrc.json
================================================
{
"bracketSpacing": true,
"jsxSingleQuote": true,
"tabWidth": 4,
"arrowParens": "avoid",
"endOfLine": "auto",
"htmlWhitespaceSensitivity": "css",
"jsxBracketSameLine": false,
"proseWrap": "preserve",
"semi": true,
"singleQuote": true,
"printWidth": 160,
"useTabs": false,
"trailingComma": "all"
}
================================================
FILE: .vscodeignore
================================================
.vscode/**
.vscode-test/**
out/test/**
test/**
src/**
**/*.map
.gitignore
tsconfig.json
vsc-extension-quickstart.md
================================================
FILE: CHANGELOG.md
================================================
## [0.13]
- show simple documention of urls endpoints and its external links to [elastic.co](https://elastic.co) on hover.
## [0.12]
- [@KenDobbins](https://github.com/KenDobbins): Allow ctrl+enter to run command
- better request body selection (blank line allowed)
- simple protocol (https) support
## [0.11]
- [@jgowdyelastic](https://github.com/jgowdyelastic): Using tabSize setting for json indentation
- minor bugfix
## [0.10]
- adding requested feature: [keybindings](https://github.com/hsen-dev/vscode-elastic/issues/5)
- fix some decorations issues
## [0.9]
- [@tsouza](https://github.com/tsouza): add IntelliSense/autocomplete for es6
- bug fixes
## [0.8]
- [@tsouza](https://github.com/tsouza): add simple IntelliSense/autocomplete for methods path
- [@heatwave](https://github.com/heatwave): bug fixes
## [0.7]
- Get Payload from File ([requested feature](https://github.com/hsen-dev/vscode-elastic/issues/4))
## [0.6]
- fixed issue [#1](https://github.com/hsen-dev/vscode-elastic/issues/1): elasticsearch logo style guides
- adding [requested feature](https://github.com/hsen-dev/vscode-elastic/issues/3): `elastic.showResultAsDocument`: Show result in a new json file, or show in default view.
- some bug fixes
- better syntax highlight
## [0.5]
- big changes: migrate execution of query to CodeLens.
- add Json validator and `Auto indent` command.
## [0.4]
- bug fixes
- add context menu for `copy JSON path` and `copy JSON content`
## [0.3]
- bug fixes
- better output ui
- add `_cat` toolbar
- work with `Elasticsearch` file type without `.es` extention
## [0.2]
- bug fixes
- better output ui
## [0.1]
- initial release
================================================
FILE: LICENSE
================================================
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org>
================================================
FILE: README.md
================================================
## Elasticsearch for VSCode
[](/../../actions/workflows/runTests.yaml)
[](/../../actions/workflows/publish.yaml)
Welcome to Elasticsearch for VSCode! An extension for developing elasticsearch queries.

## Using
- Open an existing file with a `.es` file extenion or open a new text file (`ctrl+n`) and change the language mode to `Elasticsearch (es)` by pressing `ctrl+k,m` and select `es`. Elasticsearch queries and funtionalities are enabled in the es language mode in Visual Studio Code editor.
- For https endpoints, just add protocol type in url : `https://host`
- For auth protected clusters, you can use `http://user:pass@host:9200` as the endpoint url to have it auth.
### Submit requests
Simple way:
```text
GET /my-index/_search
{
"size":7,
"query": {
"match" : {
"message" : {
"query" : "this is a test"
}
}
}
}
```
Get payload from file [[#4](https://github.com/hsen-dev/vscode-elastic/issues/4)]:
```text
PUT /my-index
!./opt/elasticsearch/mapping.json
```
## Commands
- **Elasticsearch: Set Host** to create connection profile and connect.
## Keymaps
- **Alt + Enter** / **Ctrl + Enter** to execute selected query.
## Roadmap
- Work with multi host
- User Authentication
- IntelliSense like kibana autocomplete
================================================
FILE: build/restSpecIndex.js
================================================
/*jslint esversion: 6*/
const del = require('del');
const fs = require('fs');
const jsesc = require('jsesc');
(function () {
'use strict';
const restSpecPath = '../src/rest-spec';
const SRC_ROOT = `${__dirname}/${restSpecPath}`;
del.sync(`${SRC_ROOT}/**/*.ts`);
fs.writeFileSync(`${SRC_ROOT}/json.d.ts`, 'declare module "*.json" { const value: any; export default value; }');
const requireDir = require('require-dir');
const restSpec = requireDir(restSpecPath, { recurse: true });
let rootIndex = '';
let versions = Object.keys(restSpec);
versions.forEach(version => {
rootIndex += `import * as ${version} from './${version}';\n`;
let endpointNames = Object.keys(restSpec[version]);
let versionIndex = endpointNames
.map(endpointName => `const def_${endpointName.replace(/\./g, '_')} = JSON.parse('${jsesc(JSON.stringify(restSpec[version][endpointName]))}')`)
.join(';\n');
versionIndex += `\n\nexport default {\n`;
versionIndex += endpointNames
.map(endpointName => ` '${endpointName}': def_${endpointName.replace(/\./g, '_')}` + (endpointName != '_common' ? `['${endpointName}']` : ''))
.join(',\n');
versionIndex += '\n}';
fs.writeFileSync(`${SRC_ROOT}/${version}/index.ts`, versionIndex, 'utf-8');
});
rootIndex += `\nexport default {\n`;
rootIndex += versions.map(version => ` '${version.substring(1).replace(/_/g, '.')}': ${version}`).join(',\n');
rootIndex += '\n}';
fs.writeFileSync(`${SRC_ROOT}/index.ts`, rootIndex, 'utf-8');
})();
================================================
FILE: grammar/es.configuration.json
================================================
{
"comments": {
"lineComment": "//",
"blockComment": [
"/*",
"*/"
]
},
"brackets": [
[
"{",
"}"
],
[
"[",
"]"
]
],
"autoClosingPairs": [
{
"open": "{",
"close": "}"
},
{
"open": "[",
"close": "]"
},
{
"open": "(",
"close": ")"
},
{
"open": "'",
"close": "'",
"notIn": [
"string",
"comment"
]
},
{
"open": "\"",
"close": "\"",
"notIn": [
"string"
]
},
{
"open": "/**",
"close": " */",
"notIn": [
"string"
]
}
]
}
================================================
FILE: grammar/es.tmLanguage
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>es</string>
<string>json</string>
<string>sublime-settings</string>
<string>sublime-menu</string>
<string>sublime-keymap</string>
<string>sublime-mousemap</string>
<string>sublime-theme</string>
<string>sublime-build</string>
<string>sublime-project</string>
<string>sublime-completions</string>
</array>
<key>foldingStartMarker</key>
<string>(?x) # turn on extended mode
^ # a line beginning with
\s* # some optional space
[{\[] # the start of an object or array
(?! # but not followed by
.* # whatever
[}\]] # and the close of an object or array
,? # an optional comma
\s* # some optional space
$ # at the end of the line
)
| # ...or...
[{\[] # the start of an object or array
\s* # some optional space
$ # at the end of the line</string>
<key>foldingStopMarker</key>
<string>(?x) # turn on extended mode
^ # a line beginning with
\s* # some optional space
[}\]] # and the close of an object or array</string>
<key>keyEquivalent</key>
<string>^~J</string>
<key>name</key>
<string>JSON (Javascript Next)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#value</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>array</key>
<dict>
<key>begin</key>
<string>\[</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.array.begin.json</string>
</dict>
</dict>
<key>end</key>
<string>\]</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.array.end.json</string>
</dict>
</dict>
<key>name</key>
<string>meta.structure.array.json</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#value</string>
</dict>
<dict>
<key>match</key>
<string>,</string>
<key>name</key>
<string>punctuation.separator.array.json</string>
</dict>
<dict>
<key>match</key>
<string>[^\s\]]</string>
<key>name</key>
<string>invalid.illegal.expected-array-separator.json</string>
</dict>
</array>
</dict>
<key>comments</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>/\*\*(?!/)</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.json</string>
</dict>
</dict>
<key>end</key>
<string>\*/</string>
<key>name</key>
<string>comment.block.documentation.json</string>
</dict>
<dict>
<key>begin</key>
<string>/\*</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.json</string>
</dict>
</dict>
<key>end</key>
<string>\*/</string>
<key>name</key>
<string>comment.block.json</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.json</string>
</dict>
</dict>
<key>match</key>
<string>(//).*$\n?</string>
<key>name</key>
<string>comment.line.double-slash.js</string>
</dict>
</array>
</dict>
<key>constant</key>
<dict>
<key>match</key>
<string>\b(?:true|false|null)\b</string>
<key>name</key>
<string>constant.language.json</string>
</dict>
<key>number</key>
<dict>
<key>match</key>
<string>(?x) # turn on extended mode
-? # an optional minus
(?:
0 # a zero
| # ...or...
[1-9] # a 1-9 character
\d* # followed by zero or more digits
)
(?:
(?:
\. # a period
\d+ # followed by one or more digits
)?
(?:
[eE] # an e character
[+-]? # followed by an option +/-
\d+ # followed by one or more digits
)? # make exponent optional
)? # make decimal portion optional</string>
<key>name</key>
<string>constant.numeric.json</string>
</dict>
<key>object</key>
<dict>
<key>begin</key>
<string>\{</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.dictionary.begin.json</string>
</dict>
</dict>
<key>end</key>
<string>\}</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.dictionary.end.json</string>
</dict>
</dict>
<key>name</key>
<string>meta.structure.dictionary.json</string>
<key>patterns</key>
<array>
<dict>
<key>comment</key>
<string>the JSON object key</string>
<key>include</key>
<string>#objectkey</string>
</dict>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
<dict>
<key>begin</key>
<string>:</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.separator.dictionary.key-value.json</string>
</dict>
</dict>
<key>end</key>
<string>(,)|(?=\})</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.separator.dictionary.pair.json</string>
</dict>
</dict>
<key>name</key>
<string>meta.structure.dictionary.value.json</string>
<key>patterns</key>
<array>
<dict>
<key>comment</key>
<string>the JSON object value</string>
<key>include</key>
<string>#value</string>
</dict>
<dict>
<key>match</key>
<string>[^\s,]</string>
<key>name</key>
<string>invalid.illegal.expected-dictionary-separator.json</string>
</dict>
</array>
</dict>
<dict>
<key>match</key>
<string>[^\s\}]</string>
<key>name</key>
<string>invalid.illegal.expected-dictionary-separator.json</string>
</dict>
</array>
</dict>
<key>string</key>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.json</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.json</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.json</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#stringcontent</string>
</dict>
</array>
</dict>
<key>objectkey</key>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.support.type.property-name.begin.json</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.support.type.property-name.end.json</string>
</dict>
</dict>
<key>name</key>
<string>string.json support.type.property-name.json</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#stringcontent</string>
</dict>
</array>
</dict>
<key>stringcontent</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(?x) # turn on extended mode
\\ # a literal backslash
(?: # ...followed by...
["\\/bfnrt] # one of these characters
| # ...or...
u # a u
[0-9a-fA-F]{4}) # and four hex digits</string>
<key>name</key>
<string>constant.character.escape.json</string>
</dict>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>invalid.illegal.unrecognized-string-escape.json</string>
</dict>
</array>
</dict>
<key>value</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#constant</string>
</dict>
<dict>
<key>include</key>
<string>#number</string>
</dict>
<dict>
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#array</string>
</dict>
<dict>
<key>include</key>
<string>#object</string>
</dict>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>source.es</string>
<key>uuid</key>
<string>8f97457b-516e-48ce-83c7-08ae12fb327a</string>
</dict>
</plist>
================================================
FILE: media/jquery.contextMenu.css
================================================
@charset "UTF-8";
/*!
* jQuery contextMenu - Plugin for simple contextMenu handling
*
* Version: v2.4.2
*
* Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF)
* Web: http://swisnl.github.io/jQuery-contextMenu/
*
* Copyright (c) 2011-2017 SWIS BV and contributors
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
* Date: 2017-01-02T09:03:00.383Z
*/
@-webkit-keyframes cm-spin {
0% {
-webkit-transform: translateY(-50%) rotate(0deg);
transform: translateY(-50%) rotate(0deg);
}
100% {
-webkit-transform: translateY(-50%) rotate(359deg);
transform: translateY(-50%) rotate(359deg);
}
}
@-o-keyframes cm-spin {
0% {
-webkit-transform: translateY(-50%) rotate(0deg);
-o-transform: translateY(-50%) rotate(0deg);
transform: translateY(-50%) rotate(0deg);
}
100% {
-webkit-transform: translateY(-50%) rotate(359deg);
-o-transform: translateY(-50%) rotate(359deg);
transform: translateY(-50%) rotate(359deg);
}
}
@keyframes cm-spin {
0% {
-webkit-transform: translateY(-50%) rotate(0deg);
-o-transform: translateY(-50%) rotate(0deg);
transform: translateY(-50%) rotate(0deg);
}
100% {
-webkit-transform: translateY(-50%) rotate(359deg);
-o-transform: translateY(-50%) rotate(359deg);
transform: translateY(-50%) rotate(359deg);
}
}
@font-face {
font-family: "context-menu-icons";
font-style: normal;
font-weight: normal;
src: url("font/context-menu-icons.eot?3lfph");
src: url("font/context-menu-icons.eot?3lfph#iefix") format("embedded-opentype"), url("font/context-menu-icons.woff2?3lfph") format("woff2"), url("font/context-menu-icons.woff?3lfph") format("woff"), url("font/context-menu-icons.ttf?3lfph") format("truetype");
}
.context-menu-icon-add:before {
content: "\EA01";
}
.context-menu-icon-copy:before {
content: "\EA02";
}
.context-menu-icon-cut:before {
content: "\EA03";
}
.context-menu-icon-delete:before {
content: "\EA04";
}
.context-menu-icon-edit:before {
content: "\EA05";
}
.context-menu-icon-loading:before {
content: "\EA06";
}
.context-menu-icon-paste:before {
content: "\EA07";
}
.context-menu-icon-quit:before {
content: "\EA08";
}
.context-menu-icon::before {
position: absolute;
top: 50%;
left: 0;
width: 2em;
font-family: "context-menu-icons";
font-size: 1em;
font-style: normal;
font-weight: normal;
line-height: 1;
color: #2980b9;
text-align: center;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.context-menu-icon.context-menu-hover:before {
color: #fff;
}
.context-menu-icon.context-menu-disabled::before {
color: #bbb;
}
.context-menu-icon.context-menu-icon-loading:before {
-webkit-animation: cm-spin 2s infinite;
-o-animation: cm-spin 2s infinite;
animation: cm-spin 2s infinite;
}
.context-menu-icon.context-menu-icon--fa {
display: list-item;
font-family: inherit;
}
.context-menu-icon.context-menu-icon--fa::before {
position: absolute;
top: 50%;
left: 0;
width: 2em;
font-family: FontAwesome;
font-size: 1em;
font-style: normal;
font-weight: normal;
line-height: 1;
color: #2980b9;
text-align: center;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.context-menu-icon.context-menu-icon--fa.context-menu-hover:before {
color: #fff;
}
.context-menu-icon.context-menu-icon--fa.context-menu-disabled::before {
color: #bbb;
}
.context-menu-list {
position: absolute;
display: inline-block;
min-width: 13em;
max-width: 26em;
padding: .25em 0;
margin: .3em;
font-family: inherit;
font-size: inherit;
list-style-type: none;
background: #fff;
border: 1px solid #bebebe;
border-radius: .2em;
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, .5);
box-shadow: 0 2px 5px rgba(0, 0, 0, .5);
}
.context-menu-item {
position: relative;
padding: .2em 2em;
color: #2f2f2f;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #fff;
}
.context-menu-separator {
padding: 0;
margin: .35em 0;
border-bottom: 1px solid #e6e6e6;
}
.context-menu-item > label > input,
.context-menu-item > label > textarea {
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
.context-menu-item.context-menu-hover {
color: #fff;
cursor: pointer;
background-color: #2980b9;
}
.context-menu-item.context-menu-disabled {
color: #bbb;
cursor: default;
background-color: #fff;
}
.context-menu-input.context-menu-hover {
color: #2f2f2f;
cursor: default;
}
.context-menu-submenu:after {
position: absolute;
top: 50%;
right: .5em;
z-index: 1;
width: 0;
height: 0;
content: '';
border-color: transparent transparent transparent #2f2f2f;
border-style: solid;
border-width: .25em 0 .25em .25em;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
/**
* Inputs
*/
.context-menu-item.context-menu-input {
padding: .3em .6em;
}
/* vertically align inside labels */
.context-menu-input > label > * {
vertical-align: top;
}
/* position checkboxes and radios as icons */
.context-menu-input > label > input[type="checkbox"],
.context-menu-input > label > input[type="radio"] {
position: relative;
top: .12em;
margin-right: .4em;
}
.context-menu-input > label {
margin: 0;
}
.context-menu-input > label,
.context-menu-input > label > input[type="text"],
.context-menu-input > label > textarea,
.context-menu-input > label > select {
display: block;
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.context-menu-input > label > textarea {
height: 7em;
}
.context-menu-item > .context-menu-list {
top: .3em;
/* re-positioned by js */
right: -.3em;
display: none;
}
.context-menu-item.context-menu-visible > .context-menu-list {
display: block;
}
.context-menu-accesskey {
text-decoration: underline;
}
================================================
FILE: media/jquery.contextMenu.js
================================================
/*!
* jQuery contextMenu v2.4.2 - Plugin for simple contextMenu handling
*
* Version: v2.4.2
*
* Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF)
* Web: http://swisnl.github.io/jQuery-contextMenu/
*
* Copyright (c) 2011-2017 SWIS BV and contributors
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
* GPL v3 http://opensource.org/licenses/GPL-3.0
*
* Date: 2017-01-02T09:03:00.678Z
*/
// jscs:disable
/* jshint ignore:start */
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node / CommonJS
factory(require('jquery'));
} else {
// Browser globals.
factory(jQuery);
}
})(function ($) {
'use strict';
// TODO: -
// ARIA stuff: menuitem, menuitemcheckbox und menuitemradio
// create <menu> structure if $.support[htmlCommand || htmlMenuitem] and !opt.disableNative
// determine html5 compatibility
$.support.htmlMenuitem = ('HTMLMenuItemElement' in window);
$.support.htmlCommand = ('HTMLCommandElement' in window);
$.support.eventSelectstart = ('onselectstart' in document.documentElement);
/* // should the need arise, test for css user-select
$.support.cssUserSelect = (function(){
var t = false,
e = document.createElement('div');
$.each('Moz|Webkit|Khtml|O|ms|Icab|'.split('|'), function(i, prefix) {
var propCC = prefix + (prefix ? 'U' : 'u') + 'serSelect',
prop = (prefix ? ('-' + prefix.toLowerCase() + '-') : '') + 'user-select';
e.style.cssText = prop + ': text;';
if (e.style[propCC] == 'text') {
t = true;
return false;
}
return true;
});
return t;
})();
*/
if (!$.ui || !$.widget) {
// duck punch $.cleanData like jQueryUI does to get that remove event
$.cleanData = (function (orig) {
return function (elems) {
var events, elem, i;
for (i = 0; elems[i] != null; i++) {
elem = elems[i];
try {
// Only trigger remove when necessary to save time
events = $._data(elem, 'events');
if (events && events.remove) {
$(elem).triggerHandler('remove');
}
// Http://bugs.jquery.com/ticket/8235
} catch (e) {}
}
orig(elems);
};
})($.cleanData);
}
/* jshint ignore:end */
// jscs:enable
var // currently active contextMenu trigger
$currentTrigger = null,
// is contextMenu initialized with at least one menu?
initialized = false,
// window handle
$win = $(window),
// number of registered menus
counter = 0,
// mapping selector to namespace
namespaces = {},
// mapping namespace to options
menus = {},
// custom command type handlers
types = {},
// default values
defaults = {
// selector of contextMenu trigger
selector: null,
// where to append the menu to
appendTo: null,
// method to trigger context menu ["right", "left", "hover"]
trigger: 'right',
// hide menu when mouse leaves trigger / menu elements
autoHide: false,
// ms to wait before showing a hover-triggered context menu
delay: 200,
// flag denoting if a second trigger should simply move (true) or rebuild (false) an open menu
// as long as the trigger happened on one of the trigger-element's child nodes
reposition: true,
//ability to select submenu
selectableSubMenu: false,
// Default classname configuration to be able avoid conflicts in frameworks
classNames : {
hover: 'context-menu-hover', // Item hover
disabled: 'context-menu-disabled', // Item disabled
visible: 'context-menu-visible', // Item visible
notSelectable: 'context-menu-not-selectable', // Item not selectable
icon: 'context-menu-icon',
iconEdit: 'context-menu-icon-edit',
iconCut: 'context-menu-icon-cut',
iconCopy: 'context-menu-icon-copy',
iconPaste: 'context-menu-icon-paste',
iconDelete: 'context-menu-icon-delete',
iconAdd: 'context-menu-icon-add',
iconQuit: 'context-menu-icon-quit',
iconLoadingClass: 'context-menu-icon-loading'
},
// determine position to show menu at
determinePosition: function ($menu) {
// position to the lower middle of the trigger element
if ($.ui && $.ui.position) {
// .position() is provided as a jQuery UI utility
// (...and it won't work on hidden elements)
$menu.css('display', 'block').position({
my: 'center top',
at: 'center bottom',
of: this,
offset: '0 5',
collision: 'fit'
}).css('display', 'none');
} else {
// determine contextMenu position
var offset = this.offset();
offset.top += this.outerHeight();
offset.left += this.outerWidth() / 2 - $menu.outerWidth() / 2;
$menu.css(offset);
}
},
// position menu
position: function (opt, x, y) {
var offset;
// determine contextMenu position
if (!x && !y) {
opt.determinePosition.call(this, opt.$menu);
return;
} else if (x === 'maintain' && y === 'maintain') {
// x and y must not be changed (after re-show on command click)
offset = opt.$menu.position();
} else {
// x and y are given (by mouse event)
offset = {top: y, left: x};
}
// correct offset if viewport demands it
var bottom = $win.scrollTop() + $win.height(),
right = $win.scrollLeft() + $win.width(),
height = opt.$menu.outerHeight(),
width = opt.$menu.outerWidth();
if (offset.top + height > bottom) {
offset.top -= height;
}
if (offset.top < 0) {
offset.top = 0;
}
if (offset.left + width > right) {
offset.left -= width;
}
if (offset.left < 0) {
offset.left = 0;
}
opt.$menu.css(offset);
},
// position the sub-menu
positionSubmenu: function ($menu) {
if ($menu === undefined) {
// When user hovers over item (which has sub items) handle.focusItem will call this.
// but the submenu does not exist yet if opt.items is a promise. just return, will
// call positionSubmenu after promise is completed.
return;
}
if ($.ui && $.ui.position) {
// .position() is provided as a jQuery UI utility
// (...and it won't work on hidden elements)
$menu.css('display', 'block').position({
my: 'left top-5',
at: 'right top',
of: this,
collision: 'flipfit fit'
}).css('display', '');
} else {
// determine contextMenu position
var offset = {
top: -9,
left: this.outerWidth() - 5
};
$menu.css(offset);
}
},
// offset to add to zIndex
zIndex: 1,
// show hide animation settings
animation: {
duration: 50,
show: 'slideDown',
hide: 'slideUp'
},
// events
events: {
show: $.noop,
hide: $.noop
},
// default callback
callback: null,
// list of contextMenu items
items: {}
},
// mouse position for hover activation
hoveract = {
timer: null,
pageX: null,
pageY: null
},
// determine zIndex
zindex = function ($t) {
var zin = 0,
$tt = $t;
while (true) {
zin = Math.max(zin, parseInt($tt.css('z-index'), 10) || 0);
$tt = $tt.parent();
if (!$tt || !$tt.length || 'html body'.indexOf($tt.prop('nodeName').toLowerCase()) > -1) {
break;
}
}
return zin;
},
// event handlers
handle = {
// abort anything
abortevent: function (e) {
e.preventDefault();
e.stopImmediatePropagation();
},
// contextmenu show dispatcher
contextmenu: function (e) {
var $this = $(this);
// disable actual context-menu if we are using the right mouse button as the trigger
if (e.data.trigger === 'right') {
e.preventDefault();
e.stopImmediatePropagation();
}
// abort native-triggered events unless we're triggering on right click
if ((e.data.trigger !== 'right' && e.data.trigger !== 'demand') && e.originalEvent) {
return;
}
// Let the current contextmenu decide if it should show or not based on its own trigger settings
if (e.mouseButton !== undefined && e.data) {
if (!(e.data.trigger === 'left' && e.mouseButton === 0) && !(e.data.trigger === 'right' && e.mouseButton === 2)) {
// Mouse click is not valid.
return;
}
}
// abort event if menu is visible for this trigger
if ($this.hasClass('context-menu-active')) {
return;
}
if (!$this.hasClass('context-menu-disabled')) {
// theoretically need to fire a show event at <menu>
// http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#context-menus
// var evt = jQuery.Event("show", { data: data, pageX: e.pageX, pageY: e.pageY, relatedTarget: this });
// e.data.$menu.trigger(evt);
$currentTrigger = $this;
if (e.data.build) {
var built = e.data.build($currentTrigger, e);
// abort if build() returned false
if (built === false) {
return;
}
// dynamically build menu on invocation
e.data = $.extend(true, {}, defaults, e.data, built || {});
// abort if there are no items to display
if (!e.data.items || $.isEmptyObject(e.data.items)) {
// Note: jQuery captures and ignores errors from event handlers
if (window.console) {
(console.error || console.log).call(console, 'No items specified to show in contextMenu');
}
throw new Error('No Items specified');
}
// backreference for custom command type creation
e.data.$trigger = $currentTrigger;
op.create(e.data);
}
var showMenu = false;
for (var item in e.data.items) {
if (e.data.items.hasOwnProperty(item)) {
var visible;
if ($.isFunction(e.data.items[item].visible)) {
visible = e.data.items[item].visible.call($(e.currentTarget), item, e.data);
} else if (typeof e.data.items[item] !== 'undefined' && e.data.items[item].visible) {
visible = e.data.items[item].visible === true;
} else {
visible = true;
}
if (visible) {
showMenu = true;
}
}
}
if (showMenu) {
// show menu
op.show.call($this, e.data, e.pageX, e.pageY);
}
}
},
// contextMenu left-click trigger
click: function (e) {
e.preventDefault();
e.stopImmediatePropagation();
$(this).trigger($.Event('contextmenu', {data: e.data, pageX: e.pageX, pageY: e.pageY}));
},
// contextMenu right-click trigger
mousedown: function (e) {
// register mouse down
var $this = $(this);
// hide any previous menus
if ($currentTrigger && $currentTrigger.length && !$currentTrigger.is($this)) {
$currentTrigger.data('contextMenu').$menu.trigger('contextmenu:hide');
}
// activate on right click
if (e.button === 2) {
$currentTrigger = $this.data('contextMenuActive', true);
}
},
// contextMenu right-click trigger
mouseup: function (e) {
// show menu
var $this = $(this);
if ($this.data('contextMenuActive') && $currentTrigger && $currentTrigger.length && $currentTrigger.is($this) && !$this.hasClass('context-menu-disabled')) {
e.preventDefault();
e.stopImmediatePropagation();
$currentTrigger = $this;
$this.trigger($.Event('contextmenu', {data: e.data, pageX: e.pageX, pageY: e.pageY}));
}
$this.removeData('contextMenuActive');
},
// contextMenu hover trigger
mouseenter: function (e) {
var $this = $(this),
$related = $(e.relatedTarget),
$document = $(document);
// abort if we're coming from a menu
if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) {
return;
}
// abort if a menu is shown
if ($currentTrigger && $currentTrigger.length) {
return;
}
hoveract.pageX = e.pageX;
hoveract.pageY = e.pageY;
hoveract.data = e.data;
$document.on('mousemove.contextMenuShow', handle.mousemove);
hoveract.timer = setTimeout(function () {
hoveract.timer = null;
$document.off('mousemove.contextMenuShow');
$currentTrigger = $this;
$this.trigger($.Event('contextmenu', {
data: hoveract.data,
pageX: hoveract.pageX,
pageY: hoveract.pageY
}));
}, e.data.delay);
},
// contextMenu hover trigger
mousemove: function (e) {
hoveract.pageX = e.pageX;
hoveract.pageY = e.pageY;
},
// contextMenu hover trigger
mouseleave: function (e) {
// abort if we're leaving for a menu
var $related = $(e.relatedTarget);
if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) {
return;
}
try {
clearTimeout(hoveract.timer);
} catch (e) {
}
hoveract.timer = null;
},
// click on layer to hide contextMenu
layerClick: function (e) {
var $this = $(this),
root = $this.data('contextMenuRoot'),
button = e.button,
x = e.pageX,
y = e.pageY,
target,
offset;
e.preventDefault();
e.stopImmediatePropagation();
setTimeout(function () {
var $window;
var triggerAction = ((root.trigger === 'left' && button === 0) || (root.trigger === 'right' && button === 2));
// find the element that would've been clicked, wasn't the layer in the way
if (document.elementFromPoint && root.$layer) {
root.$layer.hide();
target = document.elementFromPoint(x - $win.scrollLeft(), y - $win.scrollTop());
// also need to try and focus this element if we're in a contenteditable area,
// as the layer will prevent the browser mouse action we want
if (target.isContentEditable) {
var range = document.createRange(),
sel = window.getSelection();
range.selectNode(target);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
}
root.$layer.show();
}
if (root.reposition && triggerAction) {
if (document.elementFromPoint) {
if (root.$trigger.is(target) || root.$trigger.has(target).length) {
root.position.call(root.$trigger, root, x, y);
return;
}
} else {
offset = root.$trigger.offset();
$window = $(window);
// while this looks kinda awful, it's the best way to avoid
// unnecessarily calculating any positions
offset.top += $window.scrollTop();
if (offset.top <= e.pageY) {
offset.left += $window.scrollLeft();
if (offset.left <= e.pageX) {
offset.bottom = offset.top + root.$trigger.outerHeight();
if (offset.bottom >= e.pageY) {
offset.right = offset.left + root.$trigger.outerWidth();
if (offset.right >= e.pageX) {
// reposition
root.position.call(root.$trigger, root, x, y);
return;
}
}
}
}
}
}
if (target && triggerAction) {
root.$trigger.one('contextmenu:hidden', function () {
$(target).contextMenu({ x: x, y: y, button: button });
});
}
if (root != null && root.$menu != null) {
root.$menu.trigger('contextmenu:hide');
}
}, 50);
},
// key handled :hover
keyStop: function (e, opt) {
if (!opt.isInput) {
e.preventDefault();
}
e.stopPropagation();
},
key: function (e) {
var opt = {};
// Only get the data from $currentTrigger if it exists
if ($currentTrigger) {
opt = $currentTrigger.data('contextMenu') || {};
}
// If the trigger happen on a element that are above the contextmenu do this
if (opt.zIndex === undefined) {
opt.zIndex = 0;
}
var targetZIndex = 0;
var getZIndexOfTriggerTarget = function (target) {
if (target.style.zIndex !== '') {
targetZIndex = target.style.zIndex;
} else {
if (target.offsetParent !== null && target.offsetParent !== undefined) {
getZIndexOfTriggerTarget(target.offsetParent);
}
else if (target.parentElement !== null && target.parentElement !== undefined) {
getZIndexOfTriggerTarget(target.parentElement);
}
}
};
getZIndexOfTriggerTarget(e.target);
// If targetZIndex is heigher then opt.zIndex dont progress any futher.
// This is used to make sure that if you are using a dialog with a input / textarea / contenteditable div
// and its above the contextmenu it wont steal keys events
if (targetZIndex > opt.zIndex) {
return;
}
switch (e.keyCode) {
case 9:
case 38: // up
handle.keyStop(e, opt);
// if keyCode is [38 (up)] or [9 (tab) with shift]
if (opt.isInput) {
if (e.keyCode === 9 && e.shiftKey) {
e.preventDefault();
if(opt.$selected) {
opt.$selected.find('input, textarea, select').blur();
}
if (opt.$menu != null) opt.$menu.trigger('prevcommand');
return;
} else if (e.keyCode === 38 && opt.$selected.find('input, textarea, select').prop('type') === 'checkbox') {
// checkboxes don't capture this key
e.preventDefault();
return;
}
} else if (e.keyCode !== 9 || e.shiftKey) {
if (opt.$menu != null) opt.$menu.trigger('prevcommand');
return;
}
break;
// omitting break;
// case 9: // tab - reached through omitted break;
case 40: // down
handle.keyStop(e, opt);
if (opt.isInput) {
if (e.keyCode === 9) {
e.preventDefault();
if(opt.$selected) {
opt.$selected.find('input, textarea, select').blur();
}
if (opt.$menu != null) opt.$menu.trigger('nextcommand');
return;
} else if (e.keyCode === 40 && opt.$selected.find('input, textarea, select').prop('type') === 'checkbox') {
// checkboxes don't capture this key
e.preventDefault();
return;
}
} else {
if (opt.$menu != null) opt.$menu.trigger('nextcommand');
return;
}
break;
case 37: // left
handle.keyStop(e, opt);
if (opt.isInput || !opt.$selected || !opt.$selected.length) {
break;
}
if (!opt.$selected.parent().hasClass('context-menu-root')) {
var $parent = opt.$selected.parent().parent();
opt.$selected.trigger('contextmenu:blur');
opt.$selected = $parent;
return;
}
break;
case 39: // right
handle.keyStop(e, opt);
if (opt.isInput || !opt.$selected || !opt.$selected.length) {
break;
}
var itemdata = opt.$selected.data('contextMenu') || {};
if (itemdata.$menu && opt.$selected.hasClass('context-menu-submenu')) {
opt.$selected = null;
itemdata.$selected = null;
itemdata.$menu.trigger('nextcommand');
return;
}
break;
case 35: // end
case 36: // home
if (opt.$selected && opt.$selected.find('input, textarea, select').length) {
return;
} else {
(opt.$selected && opt.$selected.parent() || opt.$menu)
.children(':not(.' + opt.classNames.disabled + ', .' + opt.classNames.notSelectable + ')')[e.keyCode === 36 ? 'first' : 'last']()
.trigger('contextmenu:focus');
e.preventDefault();
return;
}
break;
case 13: // enter
handle.keyStop(e, opt);
if (opt.isInput) {
if (opt.$selected && !opt.$selected.is('textarea, select')) {
e.preventDefault();
return;
}
break;
}
if (typeof opt.$selected !== 'undefined' && opt.$selected !== null) {
opt.$selected.trigger('mouseup');
}
return;
case 32: // space
case 33: // page up
case 34: // page down
// prevent browser from scrolling down while menu is visible
handle.keyStop(e, opt);
return;
case 27: // esc
handle.keyStop(e, opt);
if (opt.$menu != null) opt.$menu.trigger('contextmenu:hide');
return;
default: // 0-9, a-z
var k = (String.fromCharCode(e.keyCode)).toUpperCase();
if (opt.accesskeys && opt.accesskeys[k]) {
// according to the specs accesskeys must be invoked immediately
opt.accesskeys[k].$node.trigger(opt.accesskeys[k].$menu ? 'contextmenu:focus' : 'mouseup');
return;
}
break;
}
// pass event to selected item,
// stop propagation to avoid endless recursion
e.stopPropagation();
if (typeof opt.$selected !== 'undefined' && opt.$selected !== null) {
opt.$selected.trigger(e);
}
},
// select previous possible command in menu
prevItem: function (e) {
e.stopPropagation();
var opt = $(this).data('contextMenu') || {};
var root = $(this).data('contextMenuRoot') || {};
// obtain currently selected menu
if (opt.$selected) {
var $s = opt.$selected;
opt = opt.$selected.parent().data('contextMenu') || {};
opt.$selected = $s;
}
var $children = opt.$menu.children(),
$prev = !opt.$selected || !opt.$selected.prev().length ? $children.last() : opt.$selected.prev(),
$round = $prev;
// skip disabled or hidden elements
while ($prev.hasClass(root.classNames.disabled) || $prev.hasClass(root.classNames.notSelectable) || $prev.is(':hidden')) {
if ($prev.prev().length) {
$prev = $prev.prev();
} else {
$prev = $children.last();
}
if ($prev.is($round)) {
// break endless loop
return;
}
}
// leave current
if (opt.$selected) {
handle.itemMouseleave.call(opt.$selected.get(0), e);
}
// activate next
handle.itemMouseenter.call($prev.get(0), e);
// focus input
var $input = $prev.find('input, textarea, select');
if ($input.length) {
$input.focus();
}
},
// select next possible command in menu
nextItem: function (e) {
e.stopPropagation();
var opt = $(this).data('contextMenu') || {};
var root = $(this).data('contextMenuRoot') || {};
// obtain currently selected menu
if (opt.$selected) {
var $s = opt.$selected;
opt = opt.$selected.parent().data('contextMenu') || {};
opt.$selected = $s;
}
var $children = opt.$menu.children(),
$next = !opt.$selected || !opt.$selected.next().length ? $children.first() : opt.$selected.next(),
$round = $next;
// skip disabled
while ($next.hasClass(root.classNames.disabled) || $next.hasClass(root.classNames.notSelectable) || $next.is(':hidden')) {
if ($next.next().length) {
$next = $next.next();
} else {
$next = $children.first();
}
if ($next.is($round)) {
// break endless loop
return;
}
}
// leave current
if (opt.$selected) {
handle.itemMouseleave.call(opt.$selected.get(0), e);
}
// activate next
handle.itemMouseenter.call($next.get(0), e);
// focus input
var $input = $next.find('input, textarea, select');
if ($input.length) {
$input.focus();
}
},
// flag that we're inside an input so the key handler can act accordingly
focusInput: function () {
var $this = $(this).closest('.context-menu-item'),
data = $this.data(),
opt = data.contextMenu,
root = data.contextMenuRoot;
root.$selected = opt.$selected = $this;
root.isInput = opt.isInput = true;
},
// flag that we're inside an input so the key handler can act accordingly
blurInput: function () {
var $this = $(this).closest('.context-menu-item'),
data = $this.data(),
opt = data.contextMenu,
root = data.contextMenuRoot;
root.isInput = opt.isInput = false;
},
// :hover on menu
menuMouseenter: function () {
var root = $(this).data().contextMenuRoot;
root.hovering = true;
},
// :hover on menu
menuMouseleave: function (e) {
var root = $(this).data().contextMenuRoot;
if (root.$layer && root.$layer.is(e.relatedTarget)) {
root.hovering = false;
}
},
// :hover done manually so key handling is possible
itemMouseenter: function (e) {
var $this = $(this),
data = $this.data(),
opt = data.contextMenu,
root = data.contextMenuRoot;
root.hovering = true;
// abort if we're re-entering
if (e && root.$layer && root.$layer.is(e.relatedTarget)) {
e.preventDefault();
e.stopImmediatePropagation();
}
// make sure only one item is selected
(opt.$menu ? opt : root).$menu
.children('.' + root.classNames.hover).trigger('contextmenu:blur')
.children('.hover').trigger('contextmenu:blur');
if ($this.hasClass(root.classNames.disabled) || $this.hasClass(root.classNames.notSelectable)) {
opt.$selected = null;
return;
}
$this.trigger('contextmenu:focus');
},
// :hover done manually so key handling is possible
itemMouseleave: function (e) {
var $this = $(this),
data = $this.data(),
opt = data.contextMenu,
root = data.contextMenuRoot;
if (root !== opt && root.$layer && root.$layer.is(e.relatedTarget)) {
if (typeof root.$selected !== 'undefined' && root.$selected !== null) {
root.$selected.trigger('contextmenu:blur');
}
e.preventDefault();
e.stopImmediatePropagation();
root.$selected = opt.$selected = opt.$node;
return;
}
$this.trigger('contextmenu:blur');
},
// contextMenu item click
itemClick: function (e) {
var $this = $(this),
data = $this.data(),
opt = data.contextMenu,
root = data.contextMenuRoot,
key = data.contextMenuKey,
callback;
// abort if the key is unknown or disabled or is a menu
if (!opt.items[key] || $this.is('.' + root.classNames.disabled + ', .context-menu-separator, .' + root.classNames.notSelectable) || ($this.is('.context-menu-submenu') && root.selectableSubMenu === false )) {
return;
}
e.preventDefault();
e.stopImmediatePropagation();
if ($.isFunction(opt.callbacks[key]) && Object.prototype.hasOwnProperty.call(opt.callbacks, key)) {
// item-specific callback
callback = opt.callbacks[key];
} else if ($.isFunction(root.callback)) {
// default callback
callback = root.callback;
} else {
// no callback, no action
return;
}
// hide menu if callback doesn't stop that
if (callback.call(root.$trigger, key, root) !== false) {
root.$menu.trigger('contextmenu:hide');
} else if (root.$menu.parent().length) {
op.update.call(root.$trigger, root);
}
},
// ignore click events on input elements
inputClick: function (e) {
e.stopImmediatePropagation();
},
// hide <menu>
hideMenu: function (e, data) {
var root = $(this).data('contextMenuRoot');
op.hide.call(root.$trigger, root, data && data.force);
},
// focus <command>
focusItem: function (e) {
e.stopPropagation();
var $this = $(this),
data = $this.data(),
opt = data.contextMenu,
root = data.contextMenuRoot;
if ($this.hasClass(root.classNames.disabled) || $this.hasClass(root.classNames.notSelectable)) {
return;
}
$this
.addClass([root.classNames.hover, root.classNames.visible].join(' '))
// select other items and included items
.parent().find('.context-menu-item').not($this)
.removeClass(root.classNames.visible)
.filter('.' + root.classNames.hover)
.trigger('contextmenu:blur');
// remember selected
opt.$selected = root.$selected = $this;
// position sub-menu - do after show so dumb $.ui.position can keep up
if (opt.$node) {
root.positionSubmenu.call(opt.$node, opt.$menu);
}
},
// blur <command>
blurItem: function (e) {
e.stopPropagation();
var $this = $(this),
data = $this.data(),
opt = data.contextMenu,
root = data.contextMenuRoot;
if (opt.autoHide) { // for tablets and touch screens this needs to remain
$this.removeClass(root.classNames.visible);
}
$this.removeClass(root.classNames.hover);
opt.$selected = null;
}
},
// operations
op = {
show: function (opt, x, y) {
var $trigger = $(this),
css = {};
// hide any open menus
$('#context-menu-layer').trigger('mousedown');
// backreference for callbacks
opt.$trigger = $trigger;
// show event
if (opt.events.show.call($trigger, opt) === false) {
$currentTrigger = null;
return;
}
// create or update context menu
op.update.call($trigger, opt);
// position menu
opt.position.call($trigger, opt, x, y);
// make sure we're in front
if (opt.zIndex) {
var additionalZValue = opt.zIndex;
// If opt.zIndex is a function, call the function to get the right zIndex.
if (typeof opt.zIndex === 'function') {
additionalZValue = opt.zIndex.call($trigger, opt);
}
css.zIndex = zindex($trigger) + additionalZValue;
}
// add layer
op.layer.call(opt.$menu, opt, css.zIndex);
// adjust sub-menu zIndexes
opt.$menu.find('ul').css('zIndex', css.zIndex + 1);
// position and show context menu
opt.$menu.css(css)[opt.animation.show](opt.animation.duration, function () {
$trigger.trigger('contextmenu:visible');
});
// make options available and set state
$trigger
.data('contextMenu', opt)
.addClass('context-menu-active');
// register key handler
$(document).off('keydown.contextMenu').on('keydown.contextMenu', handle.key);
// register autoHide handler
if (opt.autoHide) {
// mouse position handler
$(document).on('mousemove.contextMenuAutoHide', function (e) {
// need to capture the offset on mousemove,
// since the page might've been scrolled since activation
var pos = $trigger.offset();
pos.right = pos.left + $trigger.outerWidth();
pos.bottom = pos.top + $trigger.outerHeight();
if (opt.$layer && !opt.hovering && (!(e.pageX >= pos.left && e.pageX <= pos.right) || !(e.pageY >= pos.top && e.pageY <= pos.bottom))) {
/* Additional hover check after short time, you might just miss the edge of the menu */
setTimeout(function () {
if (!opt.hovering && opt.$menu != null) { opt.$menu.trigger('contextmenu:hide'); }
}, 50);
}
});
}
},
hide: function (opt, force) {
var $trigger = $(this);
if (!opt) {
opt = $trigger.data('contextMenu') || {};
}
// hide event
if (!force && opt.events && opt.events.hide.call($trigger, opt) === false) {
return;
}
// remove options and revert state
$trigger
.removeData('contextMenu')
.removeClass('context-menu-active');
if (opt.$layer) {
// keep layer for a bit so the contextmenu event can be aborted properly by opera
setTimeout((function ($layer) {
return function () {
$layer.remove();
};
})(opt.$layer), 10);
try {
delete opt.$layer;
} catch (e) {
opt.$layer = null;
}
}
// remove handle
$currentTrigger = null;
// remove selected
opt.$menu.find('.' + opt.classNames.hover).trigger('contextmenu:blur');
opt.$selected = null;
// collapse all submenus
opt.$menu.find('.' + opt.classNames.visible).removeClass(opt.classNames.visible);
// unregister key and mouse handlers
// $(document).off('.contextMenuAutoHide keydown.contextMenu'); // http://bugs.jquery.com/ticket/10705
$(document).off('.contextMenuAutoHide').off('keydown.contextMenu');
// hide menu
if(opt.$menu){
opt.$menu[opt.animation.hide](opt.animation.duration, function () {
// tear down dynamically built menu after animation is completed.
if (opt.build) {
opt.$menu.remove();
$.each(opt, function (key) {
switch (key) {
case 'ns':
case 'selector':
case 'build':
case 'trigger':
return true;
default:
opt[key] = undefined;
try {
delete opt[key];
} catch (e) {
}
return true;
}
});
}
setTimeout(function () {
$trigger.trigger('contextmenu:hidden');
}, 10);
});
}
},
create: function (opt, root) {
if (root === undefined) {
root = opt;
}
// create contextMenu
opt.$menu = $('<ul class="context-menu-list"></ul>').addClass(opt.className || '').data({
'contextMenu': opt,
'contextMenuRoot': root
});
$.each(['callbacks', 'commands', 'inputs'], function (i, k) {
opt[k] = {};
if (!root[k]) {
root[k] = {};
}
});
if(!root.accesskeys){
root.accesskeys = {};
}
function createNameNode(item) {
var $name = $('<span></span>');
if (item._accesskey) {
if (item._beforeAccesskey) {
$name.append(document.createTextNode(item._beforeAccesskey));
}
$('<span></span>')
.addClass('context-menu-accesskey')
.text(item._accesskey)
.appendTo($name);
if (item._afterAccesskey) {
$name.append(document.createTextNode(item._afterAccesskey));
}
} else {
if (item.isHtmlName) {
// restrict use with access keys
if (typeof item.accesskey !== 'undefined') {
throw new Error('accesskeys are not compatible with HTML names and cannot be used together in the same item');
}
$name.html(item.name);
} else {
$name.text(item.name);
}
}
return $name;
}
// create contextMenu items
$.each(opt.items, function (key, item) {
var $t = $('<li class="context-menu-item"></li>').addClass(item.className || ''),
$label = null,
$input = null;
// iOS needs to see a click-event bound to an element to actually
// have the TouchEvents infrastructure trigger the click event
$t.on('click', $.noop);
// Make old school string seperator a real item so checks wont be
// akward later.
// And normalize 'cm_separator' into 'cm_seperator'.
if (typeof item === 'string' || item.type === 'cm_separator') {
item = { type : 'cm_seperator' };
}
item.$node = $t.data({
'contextMenu': opt,
'contextMenuRoot': root,
'contextMenuKey': key
});
// register accesskey
// NOTE: the accesskey attribute should be applicable to any element, but Safari5 and Chrome13 still can't do that
if (typeof item.accesskey !== 'undefined') {
var aks = splitAccesskey(item.accesskey);
for (var i = 0, ak; ak = aks[i]; i++) {
if (!root.accesskeys[ak]) {
root.accesskeys[ak] = item;
var matched = item.name.match(new RegExp('^(.*?)(' + ak + ')(.*)$', 'i'));
if (matched) {
item._beforeAccesskey = matched[1];
item._accesskey = matched[2];
item._afterAccesskey = matched[3];
}
break;
}
}
}
if (item.type && types[item.type]) {
// run custom type handler
types[item.type].call($t, item, opt, root);
// register commands
$.each([opt, root], function (i, k) {
k.commands[key] = item;
// Overwrite only if undefined or the item is appended to the root. This so it
// doesn't overwrite callbacks of root elements if the name is the same.
if ($.isFunction(item.callback) && (k.callbacks[key] === undefined || opt.type === undefined)) {
k.callbacks[key] = item.callback;
}
});
} else {
// add label for input
if (item.type === 'cm_seperator') {
$t.addClass('context-menu-separator ' + root.classNames.notSelectable);
} else if (item.type === 'html') {
$t.addClass('context-menu-html ' + root.classNames.notSelectable);
} else if (item.type === 'sub') {
// We don't want to execute the next else-if if it is a sub.
} else if (item.type) {
$label = $('<label></label>').appendTo($t);
createNameNode(item).appendTo($label);
$t.addClass('context-menu-input');
opt.hasTypes = true;
$.each([opt, root], function (i, k) {
k.commands[key] = item;
k.inputs[key] = item;
});
} else if (item.items) {
item.type = 'sub';
}
switch (item.type) {
case 'cm_seperator':
break;
case 'text':
$input = $('<input type="text" value="1" name="" />')
.attr('name', 'context-menu-input-' + key)
.val(item.value || '')
.appendTo($label);
break;
case 'textarea':
$input = $('<textarea name=""></textarea>')
.attr('name', 'context-menu-input-' + key)
.val(item.value || '')
.appendTo($label);
if (item.height) {
$input.height(item.height);
}
break;
case 'checkbox':
$input = $('<input type="checkbox" value="1" name="" />')
.attr('name', 'context-menu-input-' + key)
.val(item.value || '')
.prop('checked', !!item.selected)
.prependTo($label);
break;
case 'radio':
$input = $('<input type="radio" value="1" name="" />')
.attr('name', 'context-menu-input-' + item.radio)
.val(item.value || '')
.prop('checked', !!item.selected)
.prependTo($label);
break;
case 'select':
$input = $('<select name=""></select>')
.attr('name', 'context-menu-input-' + key)
.appendTo($label);
if (item.options) {
$.each(item.options, function (value, text) {
$('<option></option>').val(value).text(text).appendTo($input);
});
$input.val(item.selected);
}
break;
case 'sub':
createNameNode(item).appendTo($t);
item.appendTo = item.$node;
$t.data('contextMenu', item).addClass('context-menu-submenu');
item.callback = null;
// If item contains items, and this is a promise, we should create it later
// check if subitems is of type promise. If it is a promise we need to create
// it later, after promise has been resolved.
if ('function' === typeof item.items.then) {
// probably a promise, process it, when completed it will create the sub menu's.
op.processPromises(item, root, item.items);
} else {
// normal submenu.
op.create(item, root);
}
break;
case 'html':
$(item.html).appendTo($t);
break;
default:
$.each([opt, root], function (i, k) {
k.commands[key] = item;
// Overwrite only if undefined or the item is appended to the root. This so it
// doesn't overwrite callbacks of root elements if the name is the same.
if ($.isFunction(item.callback) && (k.callbacks[key] === undefined || opt.type === undefined)) {
k.callbacks[key] = item.callback;
}
});
createNameNode(item).appendTo($t);
break;
}
// disable key listener in <input>
if (item.type && item.type !== 'sub' && item.type !== 'html' && item.type !== 'cm_seperator') {
$input
.on('focus', handle.focusInput)
.on('blur', handle.blurInput);
if (item.events) {
$input.on(item.events, opt);
}
}
// add icons
if (item.icon) {
if ($.isFunction(item.icon)) {
item._icon = item.icon.call(this, this, $t, key, item);
} else {
if ( typeof(item.icon) === 'string' && item.icon.substring(0,3) === 'fa-' ) {
// to enable font awesome
item._icon = root.classNames.icon + ' ' + root.classNames.icon + '--fa fa ' + item.icon;
} else {
item._icon = root.classNames.icon + ' ' + root.classNames.icon + '-' + item.icon;
}
}
$t.addClass(item._icon);
}
}
// cache contained elements
item.$input = $input;
item.$label = $label;
// attach item to menu
$t.appendTo(opt.$menu);
// Disable text selection
if (!opt.hasTypes && $.support.eventSelectstart) {
// browsers support user-select: none,
// IE has a special event for text-selection
// browsers supporting neither will not be preventing text-selection
$t.on('selectstart.disableTextSelect', handle.abortevent);
}
});
// attach contextMenu to <body> (to bypass any possible overflow:hidden issues on parents of the trigger element)
if (!opt.$node) {
opt.$menu.css('display', 'none').addClass('context-menu-root');
}
opt.$menu.appendTo(opt.appendTo || document.body);
},
resize: function ($menu, nested) {
var domMenu;
// determine widths of submenus, as CSS won't grow them automatically
// position:absolute within position:absolute; min-width:100; max-width:200; results in width: 100;
// kinda sucks hard...
// determine width of absolutely positioned element
$menu.css({position: 'absolute', display: 'block'});
// don't apply yet, because that would break nested elements' widths
$menu.data('width',
(domMenu = $menu.get(0)).getBoundingClientRect ?
Math.ceil(domMenu.getBoundingClientRect().width) :
$menu.outerWidth() + 1); // outerWidth() returns rounded pixels
// reset styles so they allow nested elements to grow/shrink naturally
$menu.css({
position: 'static',
minWidth: '0px',
maxWidth: '100000px'
});
// identify width of nested menus
$menu.find('> li > ul').each(function () {
op.resize($(this), true);
});
// reset and apply changes in the end because nested
// elements' widths wouldn't be calculatable otherwise
if (!nested) {
$menu.find('ul').addBack().css({
position: '',
display: '',
minWidth: '',
maxWidth: ''
}).outerWidth(function () {
return $(this).data('width');
});
}
},
update: function (opt, root) {
var $trigger = this;
if (root === undefined) {
root = opt;
op.resize(opt.$menu);
}
// re-check disabled for each item
opt.$menu.children().each(function () {
var $item = $(this),
key = $item.data('contextMenuKey'),
item = opt.items[key],
disabled = ($.isFunction(item.disabled) && item.disabled.call($trigger, key, root)) || item.disabled === true,
visible;
if ($.isFunction(item.visible)) {
visible = item.visible.call($trigger, key, root);
} else if (typeof item.visible !== 'undefined') {
visible = item.visible === true;
} else {
visible = true;
}
$item[visible ? 'show' : 'hide']();
// dis- / enable item
$item[disabled ? 'addClass' : 'removeClass'](root.classNames.disabled);
if ($.isFunction(item.icon)) {
$item.removeClass(item._icon);
item._icon = item.icon.call(this, $trigger, $item, key, item);
$item.addClass(item._icon);
}
if (item.type) {
// dis- / enable input elements
$item.find('input, select, textarea').prop('disabled', disabled);
// update input states
switch (item.type) {
case 'text':
case 'textarea':
item.$input.val(item.value || '');
break;
case 'checkbox':
case 'radio':
item.$input.val(item.value || '').prop('checked', !!item.selected);
break;
case 'select':
item.$input.val(item.selected || '');
break;
}
}
if (item.$menu) {
// update sub-menu
op.update.call($trigger, item, root);
}
});
},
layer: function (opt, zIndex) {
// add transparent layer for click area
// filter and background for Internet Explorer, Issue #23
var $layer = opt.$layer = $('<div id="context-menu-layer" style="position:fixed; z-index:' + zIndex + '; top:0; left:0; opacity: 0; filter: alpha(opacity=0); background-color: #000;"></div>')
.css({height: $win.height(), width: $win.width(), display: 'block'})
.data('contextMenuRoot', opt)
.insertBefore(this)
.on('contextmenu', handle.abortevent)
.on('mousedown', handle.layerClick);
// IE6 doesn't know position:fixed;
if (document.body.style.maxWidth === undefined) { // IE6 doesn't support maxWidth
$layer.css({
'position': 'absolute',
'height': $(document).height()
});
}
return $layer;
},
processPromises: function (opt, root, promise) {
// Start
opt.$node.addClass(root.classNames.iconLoadingClass);
function completedPromise(opt,root,items) {
// Completed promise (dev called promise.resolve). We now have a list of items which can
// be used to create the rest of the context menu.
if (items === undefined) {
// Null result, dev should have checked
errorPromise(undefined);//own error object
}
finishPromiseProcess(opt,root, items);
}
function errorPromise(opt,root,errorItem) {
// User called promise.reject() with an error item, if not, provide own error item.
if (errorItem === undefined) {
errorItem = { "error": { name: "No items and no error item", icon: "context-menu-icon context-menu-icon-quit" } };
if (window.console) {
(console.error || console.log).call(console, 'When you reject a promise, provide an "items" object, equal to normal sub-menu items');
}
} else if(typeof errorItem === 'string'){
errorItem = { "error": { name: errorItem } };
}
finishPromiseProcess(opt,root,errorItem);
}
function finishPromiseProcess(opt,root,items) {
if(root.$menu === undefined || !root.$menu.is(':visible')){
return;
}
opt.$node.removeClass(root.classNames.iconLoadingClass);
opt.items = items;
op.create(opt, root, true); // Create submenu
op.update(opt, root); // Correctly update position if user is already hovered over menu item
root.positionSubmenu.call(opt.$node, opt.$menu); // positionSubmenu, will only do anything if user already hovered over menu item that just got new subitems.
}
// Wait for promise completion. .then(success, error, notify) (we don't track notify). Bind the opt
// and root to avoid scope problems
promise.then(completedPromise.bind(this, opt, root), errorPromise.bind(this, opt, root));
}
};
// split accesskey according to http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#assigned-access-key
function splitAccesskey(val) {
var t = val.split(/\s+/),
keys = [];
for (var i = 0, k; k = t[i]; i++) {
k = k.charAt(0).toUpperCase(); // first character only
// theoretically non-accessible characters should be ignored, but different systems, different keyboard layouts, ... screw it.
// a map to look up already used access keys would be nice
keys.push(k);
}
return keys;
}
// handle contextMenu triggers
$.fn.contextMenu = function (operation) {
var $t = this, $o = operation;
if (this.length > 0) { // this is not a build on demand menu
if (operation === undefined) {
this.first().trigger('contextmenu');
} else if (operation.x !== undefined && operation.y !== undefined) {
this.first().trigger($.Event('contextmenu', { pageX: operation.x, pageY: operation.y, mouseButton: operation.button }));
} else if (operation === 'hide') {
var $menu = this.first().data('contextMenu') ? this.first().data('contextMenu').$menu : null;
if($menu){
$menu.trigger('contextmenu:hide');
}
} else if (operation === 'destroy') {
$.contextMenu('destroy', {context: this});
} else if ($.isPlainObject(operation)) {
operation.context = this;
$.contextMenu('create', operation);
} else if (operation) {
this.removeClass('context-menu-disabled');
} else if (!operation) {
this.addClass('context-menu-disabled');
}
} else {
$.each(menus, function () {
if (this.selector === $t.selector) {
$o.data = this;
$.extend($o.data, {trigger: 'demand'});
}
});
handle.contextmenu.call($o.target, $o);
}
return this;
};
// manage contextMenu instances
$.contextMenu = function (operation, options) {
if (typeof operation !== 'string') {
options = operation;
operation = 'create';
}
if (typeof options === 'string') {
options = {selector: options};
} else if (options === undefined) {
options = {};
}
// merge with default options
var o = $.extend(true, {}, defaults, options || {});
var $document = $(document);
var $context = $document;
var _hasContext = false;
if (!o.context || !o.context.length) {
o.context = document;
} else {
// you never know what they throw at you...
$context = $(o.context).first();
o.context = $context.get(0);
_hasContext = !$(o.context).is(document);
}
switch (operation) {
case 'create':
// no selector no joy
if (!o.selector) {
throw new Error('No selector specified');
}
// make sure internal classes are not bound to
if (o.selector.match(/.context-menu-(list|item|input)($|\s)/)) {
throw new Error('Cannot bind to selector "' + o.selector + '" as it contains a reserved className');
}
if (!o.build && (!o.items || $.isEmptyObject(o.items))) {
throw new Error('No Items specified');
}
counter++;
o.ns = '.contextMenu' + counter;
if (!_hasContext) {
namespaces[o.selector] = o.ns;
}
menus[o.ns] = o;
// default to right click
if (!o.trigger) {
o.trigger = 'right';
}
if (!initialized) {
var itemClick = o.itemClickEvent === 'click' ? 'click.contextMenu' : 'mouseup.contextMenu';
var contextMenuItemObj = {
// 'mouseup.contextMenu': handle.itemClick,
// 'click.contextMenu': handle.itemClick,
'contextmenu:focus.contextMenu': handle.focusItem,
'contextmenu:blur.contextMenu': handle.blurItem,
'contextmenu.contextMenu': handle.abortevent,
'mouseenter.contextMenu': handle.itemMouseenter,
'mouseleave.contextMenu': handle.itemMouseleave
};
contextMenuItemObj[itemClick] = handle.itemClick;
// make sure item click is registered first
$document
.on({
'contextmenu:hide.contextMenu': handle.hideMenu,
'prevcommand.contextMenu': handle.prevItem,
'nextcommand.contextMenu': handle.nextItem,
'contextmenu.contextMenu': handle.abortevent,
'mouseenter.contextMenu': handle.menuMouseenter,
'mouseleave.contextMenu': handle.menuMouseleave
}, '.context-menu-list')
.on('mouseup.contextMenu', '.context-menu-input', handle.inputClick)
.on(contextMenuItemObj, '.context-menu-item');
initialized = true;
}
// engage native contextmenu event
$context
.on('contextmenu' + o.ns, o.selector, o, handle.contextmenu);
if (_hasContext) {
// add remove hook, just in case
$context.on('remove' + o.ns, function () {
$(this).contextMenu('destroy');
});
}
switch (o.trigger) {
case 'hover':
$context
.on('mouseenter' + o.ns, o.selector, o, handle.mouseenter)
.on('mouseleave' + o.ns, o.selector, o, handle.mouseleave);
break;
case 'left':
$context.on('click' + o.ns, o.selector, o, handle.click);
break;
/*
default:
// http://www.quirksmode.org/dom/events/contextmenu.html
$document
.on('mousedown' + o.ns, o.selector, o, handle.mousedown)
.on('mouseup' + o.ns, o.selector, o, handle.mouseup);
break;
*/
}
// create menu
if (!o.build) {
op.create(o);
}
break;
case 'destroy':
var $visibleMenu;
if (_hasContext) {
// get proper options
var context = o.context;
$.each(menus, function (ns, o) {
if (!o) {
return true;
}
// Is this menu equest to the context called from
if (!$(context).is(o.selector)) {
return true;
}
$visibleMenu = $('.context-menu-list').filter(':visible');
if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is($(o.context).find(o.selector))) {
$visibleMenu.trigger('contextmenu:hide', {force: true});
}
try {
if (menus[o.ns].$menu) {
menus[o.ns].$menu.remove();
}
delete menus[o.ns];
} catch (e) {
menus[o.ns] = null;
}
$(o.context).off(o.ns);
return true;
});
} else if (!o.selector) {
$document.off('.contextMenu .contextMenuAutoHide');
$.each(menus, function (ns, o) {
$(o.context).off(o.ns);
});
namespaces = {};
menus = {};
counter = 0;
initialized = false;
$('#context-menu-layer, .context-menu-list').remove();
} else if (namespaces[o.selector]) {
$visibleMenu = $('.context-menu-list').filter(':visible');
if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is(o.selector)) {
$visibleMenu.trigger('contextmenu:hide', {force: true});
}
try {
if (menus[namespaces[o.selector]].$menu) {
menus[namespaces[o.selector]].$menu.remove();
}
delete menus[namespaces[o.selector]];
} catch (e) {
menus[namespaces[o.selector]] = null;
}
$document.off(namespaces[o.selector]);
}
break;
case 'html5':
// if <command> or <menuitem> are not handled by the browser,
// or options was a bool true,
// initialize $.contextMenu for them
if ((!$.support.htmlCommand && !$.support.htmlMenuitem) || (typeof options === 'boolean' && options)) {
$('menu[type="context"]').each(function () {
if (this.id) {
$.contextMenu({
selector: '[contextmenu=' + this.id + ']',
items: $.contextMenu.fromMenu(this)
});
}
}).css('display', 'none');
}
break;
default:
throw new Error('Unknown operation "' + operation + '"');
}
return this;
};
// import values into <input> commands
$.contextMenu.setInputValues = function (opt, data) {
if (data === undefined) {
data = {};
}
$.each(opt.inputs, function (key, item) {
switch (item.type) {
case 'text':
case 'textarea':
item.value = data[key] || '';
break;
case 'checkbox':
item.selected = data[key] ? true : false;
break;
case 'radio':
item.selected = (data[item.radio] || '') === item.value;
break;
case 'select':
item.selected = data[key] || '';
break;
}
});
};
// export values from <input> commands
$.contextMenu.getInputValues = function (opt, data) {
if (data === undefined) {
data = {};
}
$.each(opt.inputs, function (key, item) {
switch (item.type) {
case 'text':
case 'textarea':
case 'select':
data[key] = item.$input.val();
break;
case 'checkbox':
data[key] = item.$input.prop('checked');
break;
case 'radio':
if (item.$input.prop('checked')) {
data[item.radio] = item.value;
}
break;
}
});
return data;
};
// find <label for="xyz">
function inputLabel(node) {
return (node.id && $('label[for="' + node.id + '"]').val()) || node.name;
}
// convert <menu> to items object
function menuChildren(items, $children, counter) {
if (!counter) {
counter = 0;
}
$children.each(function () {
var $node = $(this),
node = this,
nodeName = this.nodeName.toLowerCase(),
label,
item;
// extract <label><input>
if (nodeName === 'label' && $node.find('input, textarea, select').length) {
label = $node.text();
$node = $node.children().first();
node = $node.get(0);
nodeName = node.nodeName.toLowerCase();
}
/*
* <menu> accepts flow-content as children. that means <embed>, <canvas> and such are valid menu items.
* Not being the sadistic kind, $.contextMenu only accepts:
* <command>, <menuitem>, <hr>, <span>, <p> <input [text, radio, checkbox]>, <textarea>, <select> and of course <menu>.
* Everything else will be imported as an html node, which is not interfaced with contextMenu.
*/
// http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#concept-command
switch (nodeName) {
// http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#the-menu-element
case 'menu':
item = {name: $node.attr('label'), items: {}};
counter = menuChildren(item.items, $node.children(), counter);
break;
// http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-a-element-to-define-a-command
case 'a':
// http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-button-element-to-define-a-command
case 'button':
item = {
name: $node.text(),
disabled: !!$node.attr('disabled'),
callback: (function () {
return function () {
$node.click();
};
})()
};
break;
// http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-command-element-to-define-a-command
case 'menuitem':
case 'command':
switch ($node.attr('type')) {
case undefined:
case 'command':
case 'menuitem':
item = {
name: $node.attr('label'),
disabled: !!$node.attr('disabled'),
icon: $node.attr('icon'),
callback: (function () {
return function () {
$node.click();
};
})()
};
break;
case 'checkbox':
item = {
type: 'checkbox',
disabled: !!$node.attr('disabled'),
name: $node.attr('label'),
selected: !!$node.attr('checked')
};
break;
case 'radio':
item = {
type: 'radio',
disabled: !!$node.attr('disabled'),
name: $node.attr('label'),
radio: $node.attr('radiogroup'),
value: $node.attr('id'),
selected: !!$node.attr('checked')
};
break;
default:
item = undefined;
}
break;
case 'hr':
item = '-------';
break;
case 'input':
switch ($node.attr('type')) {
case 'text':
item = {
type: 'text',
name: label || inputLabel(node),
disabled: !!$node.attr('disabled'),
value: $node.val()
};
break;
case 'checkbox':
item = {
type: 'checkbox',
name: label || inputLabel(node),
disabled: !!$node.attr('disabled'),
selected: !!$node.attr('checked')
};
break;
case 'radio':
item = {
type: 'radio',
name: label || inputLabel(node),
disabled: !!$node.attr('disabled'),
radio: !!$node.attr('name'),
value: $node.val(),
selected: !!$node.attr('checked')
};
break;
default:
item = undefined;
break;
}
break;
case 'select':
item = {
type: 'select',
name: label || inputLabel(node),
disabled: !!$node.attr('disabled'),
selected: $node.val(),
options: {}
};
$node.children().each(function () {
item.options[this.value] = $(this).text();
});
break;
case 'textarea':
item = {
type: 'textarea',
name: label || inputLabel(node),
disabled: !!$node.attr('disabled'),
value: $node.val()
};
break;
case 'label':
break;
default:
item = {type: 'html', html: $node.clone(true)};
break;
}
if (item) {
counter++;
items['key' + counter] = item;
}
});
return counter;
}
// convert html5 menu
$.contextMenu.fromMenu = function (element) {
var $this = $(element),
items = {};
menuChildren(items, $this.children());
return items;
};
// make defaults accessible
$.contextMenu.defaults = defaults;
$.contextMenu.types = types;
// export internal functions - undocumented, for hacking only!
$.contextMenu.handle = handle;
$.contextMenu.op = op;
$.contextMenu.menus = menus;
});
================================================
FILE: media/json-formatter.js
================================================
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("JSONFormatter", [], factory);
else if(typeof exports === 'object')
exports["JSONFormatter"] = factory();
else
root["JSONFormatter"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "dist";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(2);
var helpers_ts_1 = __webpack_require__(6);
var DATE_STRING_REGEX = /(^\d{1,4}[\.|\\/|-]\d{1,2}[\.|\\/|-]\d{1,4})(\s*(?:0?[1-9]:[0-5]|1(?=[012])\d:[0-5])\d\s*[ap]m)?$/;
var PARTIAL_DATE_REGEX = /\d{2}:\d{2}:\d{2} GMT-\d{4}/;
var JSON_DATE_REGEX = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;
// When toggleing, don't animated removal or addition of more than a few items
var MAX_ANIMATED_TOGGLE_ITEMS = 10;
var requestAnimationFrame = window.requestAnimationFrame || function (cb) { cb(); return 0; };
;
var _defaultConfig = {
hoverPreviewEnabled: false,
hoverPreviewArrayCount: 100,
hoverPreviewFieldCount: 5,
animateOpen: true,
animateClose: true,
theme: null
};
module.exports = (function () {
/**
* @param {object} json The JSON object you want to render. It has to be an
* object or array. Do NOT pass raw JSON string.
*
* @param {number} [open=1] his number indicates up to how many levels the
* rendered tree should expand. Set it to `0` to make the whole tree collapsed
* or set it to `Infinity` to expand the tree deeply
*
* @param {object} [config=defaultConfig] -
* defaultConfig = {
* hoverPreviewEnabled: false,
* hoverPreviewArrayCount: 100,
* hoverPreviewFieldCount: 5
* }
*
* Available configurations:
* #####Hover Preview
* * `hoverPreviewEnabled`: enable preview on hover
* * `hoverPreviewArrayCount`: number of array items to show in preview Any
* array larger than this number will be shown as `Array[XXX]` where `XXX`
* is length of the array.
* * `hoverPreviewFieldCount`: number of object properties to show for object
* preview. Any object with more properties that thin number will be
* truncated.
*
* @param {string} [key=undefined] The key that this object in it's parent
* context
*/
function JSONFormatter(json, open, config, key) {
if (open === void 0) { open = 1; }
if (config === void 0) { config = _defaultConfig; }
this.json = json;
this.open = open;
this.config = config;
this.key = key;
// Hold the open state after the toggler is used
this._isOpen = null;
// Setting default values for config object
if (this.config.hoverPreviewEnabled === undefined) {
this.config.hoverPreviewEnabled = _defaultConfig.hoverPreviewEnabled;
}
if (this.config.hoverPreviewArrayCount === undefined) {
this.config.hoverPreviewArrayCount = _defaultConfig.hoverPreviewArrayCount;
}
if (this.config.hoverPreviewFieldCount === undefined) {
this.config.hoverPreviewFieldCount = _defaultConfig.hoverPreviewFieldCount;
}
}
Object.defineProperty(JSONFormatter.prototype, "isOpen", {
/*
* is formatter open?
*/
get: function () {
if (this._isOpen !== null) {
return this._isOpen;
}
else {
return this.open > 0;
}
},
/*
* set open state (from toggler)
*/
set: function (value) {
this._isOpen = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(JSONFormatter.prototype, "isDate", {
/*
* is this a date string?
*/
get: function () {
return (this.type === 'string') &&
(DATE_STRING_REGEX.test(this.json) ||
JSON_DATE_REGEX.test(this.json) ||
PARTIAL_DATE_REGEX.test(this.json));
},
enumerable: true,
configurable: true
});
Object.defineProperty(JSONFormatter.prototype, "isUrl", {
/*
* is this a URL string?
*/
get: function () {
return this.type === 'string' && (this.json.indexOf('http') === 0);
},
enumerable: true,
configurable: true
});
Object.defineProperty(JSONFormatter.prototype, "isArray", {
/*
* is this an array?
*/
get: function () {
return Array.isArray(this.json);
},
enumerable: true,
configurable: true
});
Object.defineProperty(JSONFormatter.prototype, "isObject", {
/*
* is this an object?
* Note: In this context arrays are object as well
*/
get: function () {
return helpers_ts_1.isObject(this.json);
},
enumerable: true,
configurable: true
});
Object.defineProperty(JSONFormatter.prototype, "isEmptyObject", {
/*
* is this an empty object with no properties?
*/
get: function () {
return !this.keys.length && !this.isArray;
},
enumerable: true,
configurable: true
});
Object.defineProperty(JSONFormatter.prototype, "isEmpty", {
/*
* is this an empty object or array?
*/
get: function () {
return this.isEmptyObject || (this.keys && !this.keys.length && this.isArray);
},
enumerable: true,
configurable: true
});
Object.defineProperty(JSONFormatter.prototype, "hasKey", {
/*
* did we recieve a key argument?
* This means that the formatter was called as a sub formatter of a parent formatter
*/
get: function () {
return typeof this.key !== 'undefined';
},
enumerable: true,
configurable: true
});
Object.defineProperty(JSONFormatter.prototype, "constructorName", {
/*
* if this is an object, get constructor function name
*/
get: function () {
return helpers_ts_1.getObjectName(this.json);
},
enumerable: true,
configurable: true
});
Object.defineProperty(JSONFormatter.prototype, "type", {
/*
* get type of this value
* Possible values: all JavaScript primitive types plus "array" and "null"
*/
get: function () {
return helpers_ts_1.getType(this.json);
},
enumerable: true,
configurable: true
});
Object.defineProperty(JSONFormatter.prototype, "keys", {
/*
* get object keys
* If there is an empty key we pad it wit quotes to make it visible
*/
get: function () {
if (this.isObject) {
return Object.keys(this.json).map(function (key) { return key ? key : '""'; });
}
else {
return [];
}
},
enumerable: true,
configurable: true
});
/**
* Toggles `isOpen` state
*
*/
JSONFormatter.prototype.toggleOpen = function () {
this.isOpen = !this.isOpen;
if (this.element) {
if (this.isOpen) {
this.appendChildren(this.config.animateOpen);
}
else {
this.removeChildren(this.config.animateClose);
}
this.element.classList.toggle(helpers_ts_1.cssClass('open'));
}
};
/**
* Open all children up to a certain depth.
* Allows actions such as expand all/collapse all
*
*/
JSONFormatter.prototype.openAtDepth = function (depth) {
if (depth === void 0) { depth = 1; }
if (depth < 0) {
return;
}
this.open = depth;
this.isOpen = (depth !== 0);
if (this.element) {
this.removeChildren(false);
if (depth === 0) {
this.element.classList.remove(helpers_ts_1.cssClass('open'));
}
else {
this.appendChildren(this.config.animateOpen);
this.element.classList.add(helpers_ts_1.cssClass('open'));
}
}
};
/**
* Generates inline preview
*
* @returns {string}
*/
JSONFormatter.prototype.getInlinepreview = function () {
var _this = this;
if (this.isArray) {
// if array length is greater then 100 it shows "Array[101]"
if (this.json.length > this.config.hoverPreviewArrayCount) {
return "Array[" + this.json.length + "]";
}
else {
return "[" + this.json.map(helpers_ts_1.getPreview).join(', ') + "]";
}
}
else {
var keys = this.keys;
// the first five keys (like Chrome Developer Tool)
var narrowKeys = keys.slice(0, this.config.hoverPreviewFieldCount);
// json value schematic information
var kvs = narrowKeys.map(function (key) { return (key + ":" + helpers_ts_1.getPreview(_this.json[key])); });
// if keys count greater then 5 then show ellipsis
var ellipsis = keys.length >= this.config.hoverPreviewFieldCount ? '…' : '';
return "{" + kvs.join(', ') + ellipsis + "}";
}
};
/**
* Renders an HTML element and installs event listeners
*
* @returns {HTMLDivElement}
*/
JSONFormatter.prototype.render = function () {
// construct the root element and assign it to this.element
this.element = helpers_ts_1.createElement('div', 'row');
// construct the toggler link
var togglerLink = helpers_ts_1.createElement('a', 'toggler-link');
// if this is an object we need a wrapper span (toggler)
if (this.isObject) {
togglerLink.appendChild(helpers_ts_1.createElement('span', 'toggler'));
}
// if this is child of a parent formatter we need to append the key
if (this.hasKey) {
togglerLink.appendChild(helpers_ts_1.createElement('span', 'key', this.key + ":"));
}
// Value for objects and arrays
if (this.isObject) {
// construct the value holder element
var value = helpers_ts_1.createElement('span', 'value');
// we need a wrapper span for objects
var objectWrapperSpan = helpers_ts_1.createElement('span');
// get constructor name and append it to wrapper span
var constructorName = helpers_ts_1.createElement('span', 'constructor-name', this.constructorName);
objectWrapperSpan.appendChild(constructorName);
// if it's an array append the array specific elements like brackets and length
if (this.isArray) {
var arrayWrapperSpan = helpers_ts_1.createElement('span');
arrayWrapperSpan.appendChild(helpers_ts_1.createElement('span', 'bracket', '['));
arrayWrapperSpan.appendChild(helpers_ts_1.createElement('span', 'number', (this.json.length)));
arrayWrapperSpan.appendChild(helpers_ts_1.createElement('span', 'bracket', ']'));
objectWrapperSpan.appendChild(arrayWrapperSpan);
}
// append object wrapper span to toggler link
value.appendChild(objectWrapperSpan);
togglerLink.appendChild(value);
}
else {
// make a value holder element
var value = this.isUrl ? helpers_ts_1.createElement('a') : helpers_ts_1.createElement('span');
// add type and other type related CSS classes
value.classList.add(helpers_ts_1.cssClass(this.type));
if (this.isDate) {
value.classList.add(helpers_ts_1.cssClass('date'));
}
if (this.isUrl) {
value.classList.add(helpers_ts_1.cssClass('url'));
value.setAttribute('href', this.json);
}
// Append value content to value element
var valuePreview = helpers_ts_1.getValuePreview(this.json, this.json);
value.appendChild(document.createTextNode(valuePreview));
// append the value element to toggler link
togglerLink.appendChild(value);
}
// if hover preview is enabled, append the inline preview element
if (this.isObject && this.config.hoverPreviewEnabled) {
var preview = helpers_ts_1.createElement('span', 'preview-text');
preview.appendChild(document.createTextNode(this.getInlinepreview()));
togglerLink.appendChild(preview);
}
// construct a children element
var children = helpers_ts_1.createElement('div', 'children');
// set CSS classes for children
if (this.isObject) {
children.classList.add(helpers_ts_1.cssClass('object'));
}
if (this.isArray) {
children.classList.add(helpers_ts_1.cssClass('array'));
}
if (this.isEmpty) {
children.classList.add(helpers_ts_1.cssClass('empty'));
}
// set CSS classes for root element
if (this.config && this.config.theme) {
this.element.classList.add(helpers_ts_1.cssClass(this.config.theme));
}
if (this.isOpen) {
this.element.classList.add(helpers_ts_1.cssClass('open'));
}
// append toggler and children elements to root element
this.element.appendChild(togglerLink);
this.element.appendChild(children);
// if formatter is set to be open call appendChildren
if (this.isObject && this.isOpen) {
this.appendChildren();
}
// add event listener for toggling
if (this.isObject) {
togglerLink.addEventListener('click', this.toggleOpen.bind(this));
}
return this.element;
};
/**
* Appends all the children to children element
* Animated option is used when user triggers this via a click
*/
JSONFormatter.prototype.appendChildren = function (animated) {
var _this = this;
if (animated === void 0) { animated = false; }
var children = this.element.querySelector("div." + helpers_ts_1.cssClass('children'));
if (!children || this.isEmpty) {
return;
}
if (animated) {
var index_1 = 0;
var addAChild_1 = function () {
var key = _this.keys[index_1];
var formatter = new JSONFormatter(_this.json[key], _this.open - 1, _this.config, key);
children.appendChild(formatter.render());
index_1 += 1;
if (index_1 < _this.keys.length) {
if (index_1 > MAX_ANIMATED_TOGGLE_ITEMS) {
addAChild_1();
}
else {
requestAnimationFrame(addAChild_1);
}
}
};
requestAnimationFrame(addAChild_1);
}
else {
this.keys.forEach(function (key) {
var formatter = new JSONFormatter(_this.json[key], _this.open - 1, _this.config, key);
children.appendChild(formatter.render());
});
}
};
/**
* Removes all the children from children element
* Animated option is used when user triggers this via a click
*/
JSONFormatter.prototype.removeChildren = function (animated) {
if (animated === void 0) { animated = false; }
var childrenElement = this.element.querySelector("div." + helpers_ts_1.cssClass('children'));
if (animated) {
var childrenRemoved_1 = 0;
var removeAChild_1 = function () {
if (childrenElement && childrenElement.children.length) {
childrenElement.removeChild(childrenElement.children[0]);
childrenRemoved_1 += 1;
if (childrenRemoved_1 > MAX_ANIMATED_TOGGLE_ITEMS) {
removeAChild_1();
}
else {
requestAnimationFrame(removeAChild_1);
}
}
};
requestAnimationFrame(removeAChild_1);
}
else {
if (childrenElement) {
childrenElement.innerHTML = '';
}
}
};
return JSONFormatter;
}());
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(3);
if(typeof content === 'string') content = [[module.id, content, '']];
// add the styles to the DOM
var update = __webpack_require__(5)(content, {"sourceMap":true});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!./../node_modules/css-loader/index.js?sourceMap!./../node_modules/less-loader/index.js?sourceMap!./style.less", function() {
var newContent = require("!!./../node_modules/css-loader/index.js?sourceMap!./../node_modules/less-loader/index.js?sourceMap!./style.less");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(4)();
// imports
// module
exports.push([module.id, ".json-formatter-row {\n font-family: monospace;\n}\n.json-formatter-row,\n.json-formatter-row a,\n.json-formatter-row a:hover {\n color: black;\n text-decoration: none;\n}\n.json-formatter-row .json-formatter-row {\n margin-left: 1rem;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty {\n opacity: 0.5;\n margin-left: 1rem;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty:after {\n display: none;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\n content: \"No properties\";\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\n content: \"[]\";\n}\n.json-formatter-row .json-formatter-string {\n color: green;\n white-space: pre;\n word-wrap: break-word;\n}\n.json-formatter-row .json-formatter-number {\n color: blue;\n}\n.json-formatter-row .json-formatter-boolean {\n color: red;\n}\n.json-formatter-row .json-formatter-null {\n color: #855A00;\n}\n.json-formatter-row .json-formatter-undefined {\n color: #ca0b69;\n}\n.json-formatter-row .json-formatter-function {\n color: #FF20ED;\n}\n.json-formatter-row .json-formatter-date {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.json-formatter-row .json-formatter-url {\n text-decoration: underline;\n color: blue;\n cursor: pointer;\n}\n.json-formatter-row .json-formatter-bracket {\n color: blue;\n}\n.json-formatter-row .json-formatter-key {\n color: #00008B;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-row .json-formatter-constructor-name {\n cursor: pointer;\n}\n.json-formatter-row .json-formatter-toggler {\n line-height: 1.2rem;\n font-size: 0.7rem;\n vertical-align: middle;\n opacity: 0.6;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-row .json-formatter-toggler:after {\n display: inline-block;\n transition: transform 100ms ease-in;\n content: \"\\25BA\";\n}\n.json-formatter-row > a > .json-formatter-preview-text {\n opacity: 0;\n transition: opacity 0.15s ease-in;\n font-style: italic;\n}\n.json-formatter-row:hover > a > .json-formatter-preview-text {\n opacity: 0.6;\n}\n.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\n transform: rotate(90deg);\n}\n.json-formatter-row.json-formatter-open > .json-formatter-children:after {\n display: inline-block;\n}\n.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\n display: none;\n}\n.json-formatter-row.json-formatter-open.json-formatter-empty:after {\n display: block;\n}\n.json-formatter-dark.json-formatter-row {\n font-family: monospace;\n}\n.json-formatter-dark.json-formatter-row,\n.json-formatter-dark.json-formatter-row a,\n.json-formatter-dark.json-formatter-row a:hover {\n color: white;\n text-decoration: none;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-row {\n margin-left: 1rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty {\n opacity: 0.5;\n margin-left: 1rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty:after {\n display: none;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\n content: \"No properties\";\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\n content: \"[]\";\n}\n.json-formatter-dark.json-formatter-row .json-formatter-string {\n color: #31F031;\n white-space: pre;\n word-wrap: break-word;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-number {\n color: #66C2FF;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-boolean {\n color: #EC4242;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-null {\n color: #EEC97D;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-undefined {\n color: #ef8fbe;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-function {\n color: #FD48CB;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-date {\n background-color: rgba(255, 255, 255, 0.05);\n}\n.json-formatter-dark.json-formatter-row .json-formatter-url {\n text-decoration: underline;\n color: #027BFF;\n cursor: pointer;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-bracket {\n color: #9494FF;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-key {\n color: #23A0DB;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-constructor-name {\n cursor: pointer;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-toggler {\n line-height: 1.2rem;\n font-size: 0.7rem;\n vertical-align: middle;\n opacity: 0.6;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-toggler:after {\n display: inline-block;\n transition: transform 100ms ease-in;\n content: \"\\25BA\";\n}\n.json-formatter-dark.json-formatter-row > a > .json-formatter-preview-text {\n opacity: 0;\n transition: opacity 0.15s ease-in;\n font-style: italic;\n}\n.json-formatter-dark.json-formatter-row:hover > a > .json-formatter-preview-text {\n opacity: 0.6;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\n transform: rotate(90deg);\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-children:after {\n display: inline-block;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\n display: none;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open.json-formatter-empty:after {\n display: block;\n}\n", "", {"version":3,"sources":["/./src/style.less","/./src/style.less"],"names":[],"mappings":"AA0GA;EA3FE,uBAAA;CCbD;ADcC;;;EACE,aAAA;EACA,sBAAA;CCVH;ADkGD;EApFI,kBAAA;CCXH;ADeG;EACE,aAAA;EACA,kBAAA;CCbL;ADeK;EAAU,cAAA;CCZf;ADaK;EAAgC,yBAAA;CCVrC;ADWK;EAA+B,cAAA;CCRpC;ADkFD;EArEI,aAAA;EACA,iBAAA;EACA,sBAAA;CCVH;AD6ED;EAjE2B,YAAA;CCT1B;AD0ED;EAhE4B,WAAA;CCP3B;ADuED;EA/DyB,eAAA;CCLxB;ADoED;EA9D8B,eAAA;CCH7B;ADiED;EA7D6B,eAAA;CCD5B;AD8DD;EA5DyB,sCAAA;CCCxB;AD2DD;EA1DI,2BAAA;EACA,YAAA;EACA,gBAAA;CCEH;ADsDD;EArD4B,YAAA;CCE3B;ADmDD;EAnDI,eAAA;EACA,gBAAA;EACA,sBAAA;CCGH;AD8CD;EA9CI,gBAAA;CCGH;AD2CD;EA1CI,oBAAA;EACA,kBAAA;EACA,uBAAA;EACA,aAAA;EACA,gBAAA;EACA,sBAAA;CCEH;ADAG;EACE,sBAAA;EACA,oCAAA;EACA,iBAAA;CCEL;AD8BD;EA1BI,WAAA;EACA,kCAAA;EACA,mBAAA;CCDH;ADGC;EACE,aAAA;CCDH;ADKC;EAEI,yBAAA;CCJL;ADEC;EAKI,sBAAA;CCJL;ADDC;EAQI,cAAA;CCJL;ADMG;EACE,eAAA;CCJL;ADeD;EAhGE,uBAAA;CCoFD;ADnFC;;;EACE,aAAA;EACA,sBAAA;CCuFH;ADMD;EAzFI,kBAAA;CCsFH;ADlFG;EACE,aAAA;EACA,kBAAA;CCoFL;ADlFK;EAAU,cAAA;CCqFf;ADpFK;EAAgC,yBAAA;CCuFrC;ADtFK;EAA+B,cAAA;CCyFpC;ADVD;EA1EI,eAAA;EACA,iBAAA;EACA,sBAAA;CCuFH;ADfD;EAtE2B,eAAA;CCwF1B;ADlBD;EArE4B,eAAA;CC0F3B;ADrBD;EApEyB,eAAA;CC4FxB;ADxBD;EAnE8B,eAAA;CC8F7B;AD3BD;EAlE6B,eAAA;CCgG5B;AD9BD;EAjEyB,4CAAA;CCkGxB;ADjCD;EA/DI,2BAAA;EACA,eAAA;EACA,gBAAA;CCmGH;ADtCD;EA1D4B,eAAA;CCmG3B;ADzCD;EAxDI,eAAA;EACA,gBAAA;EACA,sBAAA;CCoGH;AD9CD;EAnDI,gBAAA;CCoGH;ADjDD;EA/CI,oBAAA;EACA,kBAAA;EACA,uBAAA;EACA,aAAA;EACA,gBAAA;EACA,sBAAA;CCmGH;ADjGG;EACE,sBAAA;EACA,oCAAA;EACA,iBAAA;CCmGL;AD9DD;EA/BI,WAAA;EACA,kCAAA;EACA,mBAAA;CCgGH;AD9FC;EACE,aAAA;CCgGH;AD5FC;EAEI,yBAAA;CC6FL;AD/FC;EAKI,sBAAA;CC6FL;ADlGC;EAQI,cAAA;CC6FL;AD3FG;EACE,eAAA;CC6FL","file":"style.less","sourcesContent":[".theme(\n @default-color: black,\n @string-color: green,\n @number-color: blue,\n @boolean-color: red,\n @null-color: #855A00,\n @undefined-color: rgb(202, 11, 105),\n @function-color: #FF20ED,\n @rotate-time: 100ms,\n @toggler-opacity: 0.6,\n @toggler-color: #45376F,\n @bracket-color: blue,\n @key-color: #00008B,\n @url-color: blue ){\n\n font-family: monospace;\n &, a, a:hover {\n color: @default-color;\n text-decoration: none;\n }\n\n .json-formatter-row {\n margin-left: 1rem;\n }\n\n .json-formatter-children {\n &.json-formatter-empty {\n opacity: 0.5;\n margin-left: 1rem;\n\n &:after { display: none; }\n &.json-formatter-object:after { content: \"No properties\"; }\n &.json-formatter-array:after { content: \"[]\"; }\n }\n }\n\n .json-formatter-string {\n color: @string-color;\n white-space: pre;\n word-wrap: break-word;\n }\n .json-formatter-number { color: @number-color; }\n .json-formatter-boolean { color: @boolean-color; }\n .json-formatter-null { color: @null-color; }\n .json-formatter-undefined { color: @undefined-color; }\n .json-formatter-function { color: @function-color; }\n .json-formatter-date { background-color: fade(@default-color, 5%); }\n .json-formatter-url {\n text-decoration: underline;\n color: @url-color;\n cursor: pointer;\n }\n\n .json-formatter-bracket { color: @bracket-color; }\n .json-formatter-key {\n color: @key-color;\n cursor: pointer;\n padding-right: 0.2rem;\n }\n .json-formatter-constructor-name {\n cursor: pointer;\n }\n\n .json-formatter-toggler {\n line-height: 1.2rem;\n font-size: 0.7rem;\n vertical-align: middle;\n opacity: @toggler-opacity;\n cursor: pointer;\n padding-right: 0.2rem;\n\n &:after {\n display: inline-block;\n transition: transform @rotate-time ease-in;\n content: \"►\";\n }\n }\n\n // Inline preview on hover (optional)\n > a > .json-formatter-preview-text {\n opacity: 0;\n transition: opacity .15s ease-in;\n font-style: italic;\n }\n &:hover > a > .json-formatter-preview-text {\n opacity: 0.6;\n }\n\n // Open state\n &.json-formatter-open {\n > .json-formatter-toggler-link .json-formatter-toggler:after{\n transform: rotate(90deg);\n }\n > .json-formatter-children:after {\n display: inline-block;\n }\n > a > .json-formatter-preview-text {\n display: none;\n }\n &.json-formatter-empty:after {\n display: block;\n }\n }\n}\n\n// Default theme\n.json-formatter-row {\n .theme();\n}\n\n// Dark theme\n.json-formatter-dark.json-formatter-row {\n .theme(\n @default-color: white,\n @string-color: #31F031,\n @number-color: #66C2FF,\n @boolean-color: #EC4242,\n @null-color: #EEC97D,\n @undefined-color: rgb(239, 143, 190),\n @function-color: #FD48CB,\n @rotate-time: 100ms,\n @toggler-opacity: 0.6,\n @toggler-color: #45376F,\n @bracket-color: #9494FF,\n @key-color: #23A0DB,\n @url-color: #027BFF);\n}\n",".json-formatter-row {\n font-family: monospace;\n}\n.json-formatter-row,\n.json-formatter-row a,\n.json-formatter-row a:hover {\n color: black;\n text-decoration: none;\n}\n.json-formatter-row .json-formatter-row {\n margin-left: 1rem;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty {\n opacity: 0.5;\n margin-left: 1rem;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty:after {\n display: none;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\n content: \"No properties\";\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\n content: \"[]\";\n}\n.json-formatter-row .json-formatter-string {\n color: green;\n white-space: pre;\n word-wrap: break-word;\n}\n.json-formatter-row .json-formatter-number {\n color: blue;\n}\n.json-formatter-row .json-formatter-boolean {\n color: red;\n}\n.json-formatter-row .json-formatter-null {\n color: #855A00;\n}\n.json-formatter-row .json-formatter-undefined {\n color: #ca0b69;\n}\n.json-formatter-row .json-formatter-function {\n color: #FF20ED;\n}\n.json-formatter-row .json-formatter-date {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.json-formatter-row .json-formatter-url {\n text-decoration: underline;\n color: blue;\n cursor: pointer;\n}\n.json-formatter-row .json-formatter-bracket {\n color: blue;\n}\n.json-formatter-row .json-formatter-key {\n color: #00008B;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-row .json-formatter-constructor-name {\n cursor: pointer;\n}\n.json-formatter-row .json-formatter-toggler {\n line-height: 1.2rem;\n font-size: 0.7rem;\n vertical-align: middle;\n opacity: 0.6;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-row .json-formatter-toggler:after {\n display: inline-block;\n transition: transform 100ms ease-in;\n content: \"►\";\n}\n.json-formatter-row > a > .json-formatter-preview-text {\n opacity: 0;\n transition: opacity 0.15s ease-in;\n font-style: italic;\n}\n.json-formatter-row:hover > a > .json-formatter-preview-text {\n opacity: 0.6;\n}\n.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\n transform: rotate(90deg);\n}\n.json-formatter-row.json-formatter-open > .json-formatter-children:after {\n display: inline-block;\n}\n.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\n display: none;\n}\n.json-formatter-row.json-formatter-open.json-formatter-empty:after {\n display: block;\n}\n.json-formatter-dark.json-formatter-row {\n font-family: monospace;\n}\n.json-formatter-dark.json-formatter-row,\n.json-formatter-dark.json-formatter-row a,\n.json-formatter-dark.json-formatter-row a:hover {\n color: white;\n text-decoration: none;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-row {\n margin-left: 1rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty {\n opacity: 0.5;\n margin-left: 1rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty:after {\n display: none;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\n content: \"No properties\";\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\n content: \"[]\";\n}\n.json-formatter-dark.json-formatter-row .json-formatter-string {\n color: #31F031;\n white-space: pre;\n word-wrap: break-word;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-number {\n color: #66C2FF;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-boolean {\n color: #EC4242;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-null {\n color: #EEC97D;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-undefined {\n color: #ef8fbe;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-function {\n color: #FD48CB;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-date {\n background-color: rgba(255, 255, 255, 0.05);\n}\n.json-formatter-dark.json-formatter-row .json-formatter-url {\n text-decoration: underline;\n color: #027BFF;\n cursor: pointer;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-bracket {\n color: #9494FF;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-key {\n color: #23A0DB;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-constructor-name {\n cursor: pointer;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-toggler {\n line-height: 1.2rem;\n font-size: 0.7rem;\n vertical-align: middle;\n opacity: 0.6;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-toggler:after {\n display: inline-block;\n transition: transform 100ms ease-in;\n content: \"►\";\n}\n.json-formatter-dark.json-formatter-row > a > .json-formatter-preview-text {\n opacity: 0;\n transition: opacity 0.15s ease-in;\n font-style: italic;\n}\n.json-formatter-dark.json-formatter-row:hover > a > .json-formatter-preview-text {\n opacity: 0.6;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\n transform: rotate(90deg);\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-children:after {\n display: inline-block;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\n display: none;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open.json-formatter-empty:after {\n display: block;\n}\n"],"sourceRoot":"webpack://"}]);
// exports
/***/ },
/* 4 */
/***/ function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function() {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
var result = [];
for(var i = 0; i < this.length; i++) {
var item = this[i];
if(item[2]) {
result.push("@media " + item[2] + "{" + item[1] + "}");
} else {
result.push(item[1]);
}
}
return result.join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var stylesInDom = {},
memoize = function(fn) {
var memo;
return function () {
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
return memo;
};
},
isOldIE = memoize(function() {
return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase());
}),
getHeadElement = memoize(function () {
return document.head || document.getElementsByTagName("head")[0];
}),
singletonElement = null,
singletonCounter = 0,
styleElementsInsertedAtTop = [];
module.exports = function(list, options) {
if(false) {
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
options = options || {};
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (typeof options.singleton === "undefined") options.singleton = isOldIE();
// By default, add <style> tags to the bottom of <head>.
if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
var styles = listToStyles(list);
addStylesToDom(styles, options);
return function update(newList) {
var mayRemove = [];
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
domStyle.refs--;
mayRemove.push(domStyle);
}
if(newList) {
var newStyles = listToStyles(newList);
addStylesToDom(newStyles, options);
}
for(var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if(domStyle.refs === 0) {
for(var j = 0; j < domStyle.parts.length; j++)
domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
}
function addStylesToDom(styles, options) {
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if(domStyle) {
domStyle.refs++;
for(var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for(; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for(var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
}
}
}
function listToStyles(list) {
var styles = [];
var newStyles = {};
for(var i = 0; i < list.length; i++) {
var item = list[i];
var id = item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {css: css, media: media, sourceMap: sourceMap};
if(!newStyles[id])
styles.push(newStyles[id] = {id: id, parts: [part]});
else
newStyles[id].parts.push(part);
}
return styles;
}
function insertStyleElement(options, styleElement) {
var head = getHeadElement();
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
if (options.insertAt === "top") {
if(!lastStyleElementInsertedAtTop) {
head.insertBefore(styleElement, head.firstChild);
} else if(lastStyleElementInsertedAtTop.nextSibling) {
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
} else {
head.appendChild(styleElement);
}
styleElementsInsertedAtTop.push(styleElement);
} else if (options.insertAt === "bottom") {
head.appendChild(styleElement);
} else {
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
}
}
function removeStyleElement(styleElement) {
styleElement.parentNode.removeChild(styleElement);
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
if(idx >= 0) {
styleElementsInsertedAtTop.splice(idx, 1);
}
}
function createStyleElement(options) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
insertStyleElement(options, styleElement);
return styleElement;
}
function createLinkElement(options) {
var linkElement = document.createElement("link");
linkElement.rel = "stylesheet";
insertStyleElement(options, linkElement);
return linkElement;
}
function addStyle(obj, options) {
var styleElement, update, remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
styleElement = singletonElement || (singletonElement = createStyleElement(options));
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
} else if(obj.sourceMap &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
typeof Blob === "function" &&
typeof btoa === "function") {
styleElement = createLinkElement(options);
update = updateLink.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
if(styleElement.href)
URL.revokeObjectURL(styleElement.href);
};
} else {
styleElement = createStyleElement(options);
update = applyToTag.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
};
}
update(obj);
return function updateStyle(newObj) {
if(newObj) {
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
return;
update(obj = newObj);
} else {
remove();
}
};
}
var replaceText = (function () {
var textStore = [];
return function (index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
})();
function applyToSingletonTag(styleElement, index, remove, obj) {
var css = remove ? "" : obj.css;
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = styleElement.childNodes;
if (childNodes[index]) styleElement.removeChild(childNodes[index]);
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index]);
} else {
styleElement.appendChild(cssNode);
}
}
}
function applyToTag(styleElement, obj) {
var css = obj.css;
var media = obj.media;
if(media) {
styleElement.setAttribute("media", media)
}
if(styleElement.styleSheet) {
styleElement.styleSheet.cssText = css;
} else {
while(styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild);
}
styleElement.appendChild(document.createTextNode(css));
}
}
function updateLink(linkElement, obj) {
var css = obj.css;
var sourceMap = obj.sourceMap;
if(sourceMap) {
// http://stackoverflow.com/a/26603875
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
}
var blob = new Blob([css], { type: "text/css" });
var oldSrc = linkElement.href;
linkElement.href = URL.createObjectURL(blob);
if(oldSrc)
URL.revokeObjectURL(oldSrc);
}
/***/ },
/* 6 */
/***/ function(module, exports) {
"use strict";
/*
* Escapes `"` charachters from string
*/
function escapeString(str) {
return str.replace('"', '\"');
}
/*
* Determines if a value is an object
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object');
}
exports.isObject = isObject;
/*
* Gets constructor name of an object.
* From http://stackoverflow.com/a/332429
*
*/
function getObjectName(object) {
if (object === undefined) {
return '';
}
if (object === null) {
return 'Object';
}
if (typeof object === 'object' && !object.constructor) {
return 'Object';
}
var funcNameRegex = /function ([^(]*)/;
var results = (funcNameRegex).exec((object).constructor.toString());
if (results && results.length > 1) {
return results[1];
}
else {
return '';
}
}
exports.getObjectName = getObjectName;
/*
* Gets type of an object. Returns "null" for null objects
*/
function getType(object) {
if (object === null) {
return 'null';
}
return typeof object;
}
exports.getType = getType;
/*
* Generates inline preview for a JavaScript object based on a value
*/
function getValuePreview(object, value) {
var type = getType(object);
if (type === 'null' || type === 'undefined') {
return type;
}
if (type === 'string') {
value = '"' + escapeString(value) + '"';
}
if (type === 'function') {
// Remove content of the function
return object.toString()
.replace(/[\r\n]/g, '')
.replace(/\{.*\}/, '') + '{…}';
}
return value;
}
exports.getValuePreview = getValuePreview;
/*
* Generates inline preview for a JavaScript object
*/
function getPreview(object) {
var value = '';
if (isObject(object)) {
value = getObjectName(object);
if (Array.isArray(object))
value += '[' + object.length + ']';
}
else {
value = getValuePreview(object, object);
}
return value;
}
exports.getPreview = getPreview;
/*
* Generates a prefixed CSS class name
*/
function cssClass(className) {
return "json-formatter-" + className;
}
exports.cssClass = cssClass;
/*
* Creates a new DOM element wiht given type and class
* TODO: move me to helpers
*/
function createElement(type, className, content) {
var el = document.createElement(type);
if (className) {
el.classList.add(cssClass(className));
}
if (content !== undefined) {
if (content instanceof Node) {
el.appendChild(content);
}
else {
el.appendChild(document.createTextNode(String(content)));
}
}
return el;
}
exports.createElement = createElement;
/***/ }
/******/ ])
});
;
//# sourceMappingURL=json-formatter.js.map
================================================
FILE: media/result.tmpl
================================================
<!DOCTYPE html>
<html>
<meta charset='utf-8'>
<head>
{{{header}}}
<style>
.json-formatter-dark.json-formatter-row,
.code {
font-family:{{{fontFamily}}};
font-size: {{{fontSize}}}px;
}
body {
font-family:{{{fontFamily}}};
font-size: {{{fontSize}}}px;
}
</style>
</head>
<body>
<a id="commander"></a>
<div class="info {{err}}">
<table>
<tbody>
<tr>
<th>Host</th>
<td>{{host}}</td>
</tr>
<!-- <tr><th>Time Taken</th><td>{{time}}ms</td></tr> -->
<tr>
<td class='msg {{err}}'>{{statusText}}</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="code">
{{{plain}}}
</div>
<div style="display:none">
<menu id="html5menu" style="display:none" class="showcase">
<command label="copy JSON path" onclick="copy_path(1)"></command>
<command label="copy JSON content" onclick="copy_content()"></command>
</menu>
</div>
<script>
const myJSON = {{{json}}};
const formatter = new JSONFormatter(myJSON, Infinity, { theme: 'dark' });
document.getElementsByClassName("code")[0].appendChild(formatter.render());
</script>
<script>
$(function () {
$.contextMenu({
selector: '.json-formatter-row',
items: $.contextMenu.fromMenu($('#html5menu'))
});
});
</script>
<script>
$(function () {
$.contextMenu({
selector: '.json-formatter-row',
items: $.contextMenu.fromMenu($('#html5menu'))
});
});
function copy_path(clip) {
var r = $(".context-menu-active");
var i = 20;
var last = '';
var path = '';
while (r && i > 0) {
var a = r.closest(".json-formatter-row");
var t = a.children("a").children(".json-formatter-key");
if (t[0] == undefined)
break;
var str = t[0].textContent;
var t2 = a.children("div")
.attr("class")
.replace("json-formatter-children", "")
.replace("json-formatter-object", "")
.trim();
if (last.length > 0) {
if (t2 === 'json-formatter-array') {
path = '[' + last + ']' + path;
} else {
path = '["' + last + '"]' + path;
}
}
r = a.parent();
last = str.substring(0, str.length - 1);
i -= 1;
}
path = '["' + last + '"]' + path;
if (clip == 1) {
var command = encodeURI('command:extension.setClip?' + JSON.stringify(['${uri}', path]));
$("#commander").attr("href", command);
$("#commander")[0].click();
}
return path;
}
function copy_content() {
var q = copy_path(0);
q = 'var result = myJSON' + q;
eval(q);
var command = encodeURI('command:extension.setClip?' + JSON.stringify(['${uri}', result]));
$("#commander").attr("href", command);
$("#commander")[0].click();
}
</script>
</body>
</html>
================================================
FILE: media/results.css
================================================
.info {
background-color: rgba(85, 85, 85, .85);
padding: 10px 10px;
position: fixed;
top: 0;
left: 0;
right: 0;
border-bottom: 2px solid #66BB6A;
}
.info.err {
border-bottom: 2px solid #ef5350;
}
.info.wait {
border-bottom: 2px solid #fff;
}
.msg {
color: #66BB6A;
}
.msg.err {
color: #ef5350;
}
.msg.wait {
color: #fff;
}
.sep{
height: 1px;
margin: 7px 0 2px 0;
background-color: rgba(200,200,200,0.1);
}
.tool.box{
float: right;
}
.tool.btn{
display: inline-block;
padding: 3px 7px;
/*margin: 1px;*/
/*background-color: rgba(200,200,200,0.1);*/
color: #aaa;
/*border: 1px solid rgba(200,200,200,0.1);*/
}
.tool.btn:hover{
color: #fff;
background-color: rgba(200,200,200,0.1);
/*background-color: #337ab7;*/
/*border: 1px solid #eee;*/
}
.code {
overflow-y: scroll;
height: 100%;
margin-top: 100px;
}
td,
th {
padding: 0px 10px;
text-align: left;
}
================================================
FILE: package.json
================================================
{
"name": "elastic",
"displayName": "Elasticsearch for VSCode",
"description": "Elasticsearch client like Kibana console for vscode",
"version": "1.0.38",
"publisher": "ria",
"icon": "media/elastic.png",
"main": "./out/extension.js",
"scripts": {
"vscode:prepublish": "npm run package",
"package": "webpack --mode production --devtool hidden-source-map",
"test": "npm run package",
"compile": "webpack",
"watch": "webpack --watch",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
"removeUnusedImports": "tslint --config tslint-imports.json --fix --project .",
"deploy": "cross-env-shell \"vsce publish --yarn --githubBranch $BRANCH --baseContentUrl $REPO_URL --baseImagesUrl $REPO_URL --pat $VSCE_PAT\"",
"postinstall": "husky install",
"updateDep": "npm-check-updates -u"
},
"engines": {
"vscode": "^1.66.0"
},
"galleryBanner": {
"color": "#005571",
"theme": "dark"
},
"categories": [
"Other",
"Programming Languages",
"Snippets"
],
"keywords": [
"Elasticsearch",
"Kibana",
"Elastic",
"Elastic client",
"es"
],
"tags": [
"Elasticsearch",
"Elastic",
"Kibana"
],
"bugs": {
"url": "https://github.com/hsen-dev/vscode-elastic/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/hsen-dev/vscode-elastic.git"
},
"activationEvents": [
"onLanguage:es",
"onCommand:extension.execute",
"onCommand:extension.setHost"
],
"contributes": {
"commands": [
{
"command": "extension.setHost",
"title": "Elasticsearch: Set Host",
"category": "ES"
}
],
"languages": [
{
"id": "es",
"aliases": [
"ElasticSearch",
"es",
"elasticsearch"
],
"extensions": [
"es"
],
"configuration": "./grammar/es.configuration.json"
}
],
"grammars": [
{
"language": "es",
"scopeName": "source.es",
"path": "./grammar/es.tmLanguage"
}
],
"configuration": {
"title": "Elasticsearch",
"properties": {
"elastic.showResultAsDocument": {
"type": "boolean",
"default": true,
"description": "Show result in a new json file, or show in default view"
},
"elastic.host": {
"type": "string",
"default": "http://localhost:9200",
"description": "Elasticsearch Host"
}
}
},
"keybindings": [
{
"key": "ctrl+enter",
"command": "extension.execute",
"when": "editorTextFocus && resourceLangId == 'es'"
},
{
"command": "extension.execute",
"key": "alt+Enter",
"when": "editorTextFocus && resourceLangId==es"
}
]
},
"dependencies": {
"cross-env": "^7.0.3",
"axios": "^0.26.1",
"copy-paste": "^1.3.0",
"json-markup": "^1.1.3",
"jsonc-parser": "^3.0.0",
"mustache": "^4.2.0",
"path": "^0.12.7",
"routington": "^1.0.3",
"semver-closest": "^0.1.2"
},
"devDependencies": {
"@types/copy-paste": "^1.1.30",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.25",
"@types/vscode": "^1.66.0",
"del": "^6.0.0",
"husky": "^7.0.4",
"jsesc": "^3.0.2",
"mocha": "^9.2.2",
"npm-check-updates": "^12.5.9",
"prettier": "^2.6.2",
"require-dir": "^1.2.0",
"ts-loader": "^9.2.8",
"tslib": "^2.3.1",
"tslint": "^6.1.3",
"tslint-etc": "^1.13.10",
"typescript": "^4.6.3",
"vsce": "^2.7.0",
"vscode-test": "^1.6.1",
"webpack": "^5.72.0",
"webpack-cli": "^4.9.2"
}
}
================================================
FILE: src/ElasticCodeLensProvider.ts
================================================
import * as vscode from 'vscode';
import { ElasticDecoration } from './ElasticDecoration';
import { ElasticMatches } from './ElasticMatches';
export class ElasticCodeLensProvider implements vscode.CodeLensProvider {
decoration: ElasticDecoration;
context: vscode.ExtensionContext;
public constructor(context: vscode.ExtensionContext) {
this.context = context;
this.decoration = new ElasticDecoration(context);
}
public provideCodeLenses(document: vscode.TextDocument, _token: vscode.CancellationToken) {
var esMatches = new ElasticMatches(vscode.window.activeTextEditor!);
var ret: any[] = [];
esMatches.Matches.forEach(em => {
if (em.Error.Text == null) {
ret.push(
new vscode.CodeLens(em.Method.Range, {
title: '▶ Run Query',
command: 'extension.execute',
arguments: [em],
}),
);
if (em.HasBody) {
var command = {
title: '⚡Auto indent',
command: 'extension.lint',
arguments: [em] as any,
};
if (em.File && em.File.Text) {
command = {
title: '📂Open File',
command: 'extension.open',
arguments: [em],
};
}
ret.push(new vscode.CodeLens(em.Method.Range, command));
}
} else {
if (em.File) {
command = {
title: '⚠️File NotExist',
command: '',
arguments: undefined,
};
if (em.File.Text) {
command = {
title: '⚠️Invalid JsonFile',
command: '',
arguments: undefined,
};
}
ret.push(new vscode.CodeLens(em.Method.Range, command));
} else if (em.Error.Text != null) {
ret.push(
new vscode.CodeLens(em.Method.Range, {
title: '⚠️Invalid Json',
command: '',
}),
);
}
}
});
return ret;
}
}
================================================
FILE: src/ElasticCompletionItemProvider.ts
================================================
import { ElasticMatch } from './ElasticMatch';
import { ElasticMatches } from './ElasticMatches';
import * as vscode from 'vscode';
import * as os from 'os';
import { getHost } from './extension';
import axiosInstance from './axiosInstance';
const routington = require('routington');
const closestSemver = require('semver-closest');
export class ElasticCompletionItemProvider implements vscode.CompletionItemProvider, vscode.HoverProvider {
private readonly context: vscode.ExtensionContext;
private readonly restSpec: any;
constructor(context: vscode.ExtensionContext) {
this.context = context;
this.restSpec = this.buildRestSpecRouter();
}
private buildRestSpecRouter() {
const restSpec = require('./rest-spec').default;
const versions = Object.keys(restSpec);
const result: any = {};
versions.forEach(version => {
const endpointDescriptions = restSpec[version].default;
const common = endpointDescriptions._common;
delete endpointDescriptions._common;
const endpointNames = Object.keys(endpointDescriptions);
const router = (result[version] = routington());
endpointNames.forEach(endpointName => {
const endpointDescription = endpointDescriptions[endpointName];
if (common) {
if (endpointDescription.url.params)
Object.keys(common.params).forEach(param => (endpointDescription.url.params[param] = common.params[param]));
else endpointDescription.url.params = common.params;
}
const paths = endpointDescription.url.paths.map((path: any) => path.replace(/\{/g, ':').replace(/\}/g, ''));
const methods = endpointDescription.methods;
methods.forEach((method: any) => paths.forEach((path: any) => (router.define(`${method}${path}`)[0].spec = endpointDescription)));
});
});
return result;
}
provideCompletionItems(
document: vscode.TextDocument,
position: vscode.Position,
token: vscode.CancellationToken,
): vscode.ProviderResult<vscode.CompletionItem[] | vscode.CompletionList> {
return this.asyncProvideCompletionItems(document, position, token);
}
provideHover(document: vscode.TextDocument, position: vscode.Position): Promise<vscode.Hover | undefined> {
return this.asyncProvideHover(document, position);
}
private async asyncProvideHover(document: vscode.TextDocument, position: vscode.Position): Promise<vscode.Hover | undefined> {
let esVersion = (await this.getElasticVersion()) || '6.0.0';
if (!esVersion) return;
let apiVersion = closestSemver(esVersion, Object.keys(this.restSpec));
let restSpec = this.restSpec[apiVersion];
if (!restSpec) return;
const line = document.lineAt(position);
var match = ElasticMatch.RegexMatch.exec(line.text);
var params = [];
if (match != null) {
let range = line.range;
var path = match[2].split('?')[0];
path.split('/').pop();
const m = restSpec.match(`${match[1]}${path}`);
if (!m) return;
if (m.node.spec.body) params.push(`${m.node.spec.body.description}`);
if (m.node.spec.url.params) {
params.push(os.EOL + 'url params:');
for (var i in m.node.spec.url.params) {
var p = m.node.spec.url.params[i];
var text = `* ${i} *(${p.type})*`;
params.push(text);
}
}
var htm = [`${m.node.spec.methods.join(' | ')} **${m.node.string}** ([documentation](${m.node.spec.documentation}))`, params.join(os.EOL)];
return Promise.resolve<vscode.Hover>(new vscode.Hover(htm, range));
}
return;
}
private async asyncProvideCompletionItems(
document: vscode.TextDocument,
position: vscode.Position,
token: vscode.CancellationToken,
): Promise<vscode.CompletionItem[] | vscode.CompletionList> {
let esVersion = await this.getElasticVersion();
esVersion = '6.0.0';
if (!esVersion) return [];
const editor = vscode.window.activeTextEditor!;
let esMatch = new ElasticMatches(editor).Selection;
if (!esMatch) return [];
let apiVersion = closestSemver(esVersion, Object.keys(this.restSpec));
let restSpec = this.restSpec[apiVersion];
if (!restSpec) return [];
if (this.isPathCompletion(esMatch, position)) return this.providePathCompletionItem(esMatch, restSpec);
else if (this.isPathParamCompletion(esMatch, position)) return this.providePathParamCompletionItem(esMatch, restSpec);
console.log(esMatch.Body.Text);
return [];
}
private async providePathParamCompletionItem(esMatch: any, restSpec: any): Promise<vscode.CompletionItem[] | vscode.CompletionList> {
const match = restSpec.match(`${esMatch.Method.Text}${esMatch.Path.Text.split('?')[0]}`);
if (!match) return [];
return Object.keys(match.node.spec.url.params).map(param => new vscode.CompletionItem(param));
}
private async providePathCompletionItem(esMatch: any, restSpec: any): Promise<vscode.CompletionItem[] | vscode.CompletionList> {
let parts = (esMatch.Path.Text as string).split('/').filter(part => part.length);
let parent = restSpec.child[esMatch.Method.Text];
let grandParent: any;
parts.forEach(part => {
if (!parent) return;
grandParent = parent;
parent = part in parent.child ? parent.child[part] : parent.children[0];
});
if (!parent) return [];
let result: any[] = [];
let variable = parent.children[0];
if (variable) {
if (variable.name == 'index') {
result = result.concat(
(await this.listIndices()).map(index => ({
label: index,
})),
);
result = result.concat(
(await this.listAliases()).map(index => ({
label: index,
})),
);
} else if (variable.name == 'name' && grandParent && grandParent.string === '_alias')
result = result.concat(
(await this.listAliases()).map(index => ({
label: index,
})),
);
else if (variable.name == 'repository')
result = result.concat(
(await this.listRepositories()).map(repository => ({
label: repository,
})),
);
else result.push({ label: `<${variable.name}>` });
}
result = result.concat(
Object.keys(parent.child).map(child => ({
label: child,
})),
);
return result.filter(part => part.label.length).map(part => new vscode.CompletionItem(part.label));
}
private isPathCompletion(esMatch: ElasticMatch, position: vscode.Position): boolean {
return esMatch.Method.Range.start.line === position.line && esMatch.Path.Text[esMatch.Path.Text.length - 1] === '/';
}
private isPathParamCompletion(esMatch: ElasticMatch, position: vscode.Position): boolean {
return (
esMatch.Method.Range.start.line === position.line &&
(esMatch.Path.Text[esMatch.Path.Text.length - 1] === '?' || esMatch.Path.Text[esMatch.Path.Text.length - 1] === '&')
);
}
//private lookupEndpoint(esVersion: string, )
private async listIndices(): Promise<string[]> {
const host = getHost(this.context);
return await axiosInstance
.get(`${host}/_cat/indices?format=json`)
.then(res => res.data.map((entry: any) => entry.index) as string[])
.catch(() => [] as string[]);
}
private async listAliases(): Promise<string[]> {
const host = getHost(this.context);
return await axiosInstance
.get(`${host}/_cat/aliases?format=json`)
.then(res => res.data.map((entry: any) => entry.alias) as string[])
.catch(() => [] as string[]);
}
private async listRepositories(): Promise<string[]> {
const host = getHost(this.context);
return await axiosInstance
.get(`${host}/_snapshot`)
.then(res => Object.keys(res.data) as string[])
.catch(() => [] as string[]);
}
private async getElasticVersion(): Promise<string | null> {
const host = getHost(this.context);
return await axiosInstance
.get(`${host}`)
.then(res => res.data.version.number as string)
.catch(() => null);
}
}
================================================
FILE: src/ElasticContentProvider.ts
================================================
import * as vscode from 'vscode';
import * as path from 'path';
import fs = require('fs');
const Mustache = require('mustache');
export class ElasticContentProvider implements vscode.TextDocumentContentProvider {
host!: string;
time!: number;
context!: vscode.ExtensionContext;
statusCode!: number;
statusText!: string;
results!: string;
searchQuery!: string;
public contentUri = vscode.Uri.parse('elasticsearch://results');
private changeEvent = new vscode.EventEmitter<vscode.Uri>();
public provideTextDocumentContent(uri: vscode.Uri, token: vscode.CancellationToken): string | Thenable<string> {
let json = '';
let plain = '';
const config = vscode.workspace.getConfiguration();
if (typeof this.results === 'string' && this.results.startsWith('{')) {
json = this.results;
} else if (typeof this.results === 'string' && this.results.indexOf('\n')) {
plain = this.results.replace(/\n/g, '<br/>').replace(/\r/g, '<br/>');
} else if (typeof this.results === 'object') {
json = JSON.stringify(this.results);
} else {
plain = this.results;
}
let mediaPath = this.getPath('media');
let header = `<script src="${mediaPath}/json-formatter.js"></script>
<script src="${mediaPath}/jquery.min.js"></script>
<script src="${mediaPath}/jquery.contextMenu.js"></script>
<link rel="stylesheet" type="text/css" href="${mediaPath}/results.css">
<link rel="stylesheet" type="text/css" href="${mediaPath}/jquery.contextMenu.css">`;
let err = '';
if (this.statusCode != 200) {
err = 'err';
}
if (this.statusCode == 0) {
err = 'wait';
}
var data = fs.readFileSync(this.getPath('media/result.tmpl'), 'utf-8');
var result = Mustache.render(data, {
fontSize: config.get('editor.fontSize'),
fontFamily: config.get('editor.fontFamily'),
header: header,
err: err,
statusCode: this.statusCode,
statusText: this.statusText,
plain: plain,
json: json,
host: this.host,
time: this.time,
});
return result;
}
update(context: any, host: any, results: any, time_el: any, statusCode: any, statusText: any) {
this.results = results;
this.host = host;
this.time = time_el;
this.context = context;
this.statusCode = statusCode;
this.statusText = statusText;
this.changeEvent.fire(this.contentUri);
}
getPath(p: any) {
return path.join(this.context.extensionPath, p);
}
get onDidChange() {
return this.changeEvent.event;
}
}
================================================
FILE: src/ElasticDecoration.ts
================================================
import * as vscode from 'vscode';
import { ElasticMatches } from './ElasticMatches';
import { getHost } from './extension';
export class ElasticDecoration {
pHighlight: vscode.TextEditorDecorationType;
bHighlight: vscode.TextEditorDecorationType;
bHighlightSelected: vscode.TextEditorDecorationType;
mHighlight: vscode.TextEditorDecorationType;
errHighlight: vscode.TextEditorDecorationType;
context: vscode.ExtensionContext;
public constructor(context: vscode.ExtensionContext) {
this.context = context;
getHost(context);
this.pHighlight = vscode.window.createTextEditorDecorationType({
light: {
color: 'rgb(0,191,171)',
// after: { contentText: ' • ' + host, color: 'lightgray' }
},
dark: {
color: 'rgb(0,191,171)',
// after: { contentText: ' • ' + host, color: 'gray' }
},
});
this.bHighlight = vscode.window.createTextEditorDecorationType({
isWholeLine: true,
light: {
gutterIconSize: 'contain',
backgroundColor: 'rgba(200, 200, 200, 0.2)',
gutterIconPath: this.context.asAbsolutePath('./media/gutter-dis-light.svg'),
},
dark: {
gutterIconSize: 'contain',
backgroundColor: 'rgba(50, 50, 50, 0.3)',
gutterIconPath: this.context.asAbsolutePath('./media/gutter-dis-dark.svg'), //vscode.Uri.parse('data:image/svg+xml;base64,PHN2ZyB4b+'),
},
});
this.bHighlightSelected = vscode.window.createTextEditorDecorationType({
isWholeLine: true,
gutterIconPath: this.context.asAbsolutePath('./media/gutter.svg'), //vscode.Uri.parse('data:image/svg+xml;base64,PHN2ZyB4b+'),
gutterIconSize: 'contain',
light: {
backgroundColor: 'rgba(200, 200, 200, 0.2)',
},
dark: {
backgroundColor: 'rgba(50, 50, 50, 0.3)',
},
});
this.mHighlight = vscode.window.createTextEditorDecorationType({
rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed,
light: {
color: '#EF5098',
},
dark: {
color: '#EF5098',
},
overviewRulerColor: '#0271bc',
overviewRulerLane: vscode.OverviewRulerLane.Left,
});
this.errHighlight = vscode.window.createTextEditorDecorationType({
borderWidth: '1px',
borderStyle: 'solid',
light: {
borderColor: 'rgba(255,0,0,0.5)',
backgroundColor: 'rgba(255,0,0,0.25)',
},
dark: {
borderColor: 'rgba(255,0,0,0.5)',
backgroundColor: 'rgba(255,0,0,0.25)',
},
overviewRulerColor: 'rgba(255,0,0,0.5)',
overviewRulerLane: vscode.OverviewRulerLane.Left,
});
}
public UpdateDecoration(esMatches: ElasticMatches) {
getHost(this.context);
var editor = esMatches.Editor;
var matches = esMatches.Matches;
editor.setDecorations(
this.mHighlight,
matches.map(m => m.Method.Range).filter(x => !!x),
);
editor.setDecorations(
this.pHighlight,
matches.map(p => p.Path.Range).filter(x => !!x),
);
editor.setDecorations(
this.bHighlight,
matches
.filter(x => !x.Selected)
.map(b => b.Range)
.filter(x => !!x),
);
editor.setDecorations(
this.errHighlight,
matches.map(e => e.Error.Range).filter(x => !!x),
);
editor.setDecorations(
this.bHighlightSelected,
matches.filter(x => x.Selected).map(b => b.Range),
);
}
}
================================================
FILE: src/ElasticMatch.ts
================================================
import * as vscode from 'vscode';
import * as path from 'path';
import * as fs from 'fs';
import stripJsonComments from './helpers';
export class ElasticItem {
public Range!: vscode.Range;
public Text!: string;
}
export class ElasticMatch {
static RegexMatch: RegExp = /^(GET|POST|DELETE|PUT)\s+([A-Za-z0-9\-\._~:\/#\[\]@!$&'"%\(\)\*+,;=`?]+)\s*$/gim;
Error: ElasticItem;
Path: ElasticItem;
Body: ElasticItem;
Method: ElasticItem;
File!: ElasticItem;
Range: vscode.Range;
HasBody: boolean = false;
Selected: boolean = false;
IsBulk: boolean = false;
public constructor(headLine: vscode.TextLine, match: RegExpExecArray) {
let lrange = new vscode.Range(headLine.lineNumber, match[1].length + 1, headLine.lineNumber, headLine.text.length);
let mrange = new vscode.Range(headLine.lineNumber, 0, headLine.lineNumber, match[1].length);
this.Method = { Text: match[1], Range: mrange };
this.Path = { Text: match[2], Range: lrange };
this.Body = new ElasticItem();
this.Error = new ElasticItem();
const editor = vscode.window.activeTextEditor!;
let lm = 1;
let txt = '';
let line = this.Method.Range.start.line + 1;
let ln = line;
let url = match[2].split('?')[0];
this.IsBulk = url === '_bulk' || url.endsWith('/_bulk');
while (editor.document.lineCount > ln) {
var t = editor.document.lineAt(ln).text;
var m = ElasticMatch.RegexMatch.exec(t);
if (m != null) break;
txt += t + '\n';
lm = editor.document.lineAt(ln).text.length;
ln++;
}
txt = txt.substring(0, txt.length - 1);
let sp = new vscode.Position(line, 0);
let ep = new vscode.Position(ln - 1, lm);
this.Body.Range = new vscode.Range(sp, ep);
let jsonText = txt;
if (txt.startsWith('!')) {
this.File = new ElasticItem();
this.File.Range = new vscode.Range(line, 1, line, editor.document.lineAt(line).text.trim().length);
var fPath = txt.substring(1).trim();
if (!path.isAbsolute(fPath)) {
fPath = path.join(path.dirname(editor.document.uri.fsPath), fPath);
}
if (fs.existsSync(fPath)) {
jsonText = fs.readFileSync(fPath).toString();
this.File.Text = fPath;
}
}
this.Body.Text = jsonText;
try {
if (!this.IsBulk) JSON.parse(stripJsonComments(jsonText));
this.HasBody = true;
this.Range = new vscode.Range(this.Method.Range.start, this.Body.Range.end);
} catch (error: any) {
// console.error(error.message)
this.HasBody = false;
this.Range = new vscode.Range(this.Method.Range.start, this.Path.Range.end);
this.Error = this.GetErrorFromMessage(txt, error.message);
}
}
GetErrorFromMessage(text: string, message: string): ElasticItem {
var res = new ElasticItem();
var regexp = /Position\s(\d+)/gim;
var match = regexp.exec(message);
if (match) {
var pos = +match[1];
text = text.substring(0, pos);
var lines: string[] = text.split('\n');
var char = lines[lines.length - 1].length;
var line = lines.length + this.Method.Range.start.line;
res.Range = new vscode.Range(line, char, line, char + 1);
}
if (text.trim().length > 0) res.Text = message;
return res;
}
}
================================================
FILE: src/ElasticMatches.ts
================================================
import * as vscode from 'vscode';
import { ElasticMatch } from './ElasticMatch';
export class ElasticMatches {
Editor!: vscode.TextEditor;
Matches: ElasticMatch[];
Selection!: ElasticMatch;
public constructor(editor: vscode.TextEditor) {
if (!editor) {
console.error('updateDecorations(): no active text editor.');
this.Matches = [];
return;
}
this.Editor = editor;
this.Matches = [];
var matched = false;
for (var i = 0; i < editor.document.lineCount; i++) {
var line = editor.document.lineAt(i);
var trimedLine = line.text.trim();
if (trimedLine.length == 0) continue;
if (matched && trimedLine.startsWith('{')) this.Matches[this.Matches.length - 1].HasBody = true;
matched = false;
var match = ElasticMatch.RegexMatch.exec(line.text);
if (match != null) {
matched = true;
let em = new ElasticMatch(line, match);
this.Matches.push(em);
}
}
this.UpdateSelection(editor);
}
public UpdateSelection(editor: vscode.TextEditor) {
this.Editor = editor;
this.Matches.forEach(element => {
element.Selected = element.Range.contains(editor.selection);
if (element.Selected) this.Selection = element;
});
}
}
================================================
FILE: src/axiosInstance.ts
================================================
import axios from 'axios';
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
export default axios.create({
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
});
================================================
FILE: src/extension.ts
================================================
import * as vscode from 'vscode';
import path = require('path');
import * as fs from 'fs';
import * as os from 'os';
import { ElasticCompletionItemProvider } from './ElasticCompletionItemProvider';
import { ElasticCodeLensProvider } from './ElasticCodeLensProvider';
import { ElasticContentProvider } from './ElasticContentProvider';
import { ElasticDecoration } from './ElasticDecoration';
import { ElasticMatch } from './ElasticMatch';
import { ElasticMatches } from './ElasticMatches';
import axios, { AxiosError, AxiosResponse } from 'axios';
import stripJsonComments from './helpers';
import { JsonPanel } from './jsonPanel';
const jsonPanel = new JsonPanel();
export async function activate(context: vscode.ExtensionContext) {
getHost(context);
const languages = ['es', 'elasticsearch'];
context.subscriptions.push(vscode.languages.registerCodeLensProvider(languages, new ElasticCodeLensProvider(context)));
let resultsProvider = new ElasticContentProvider();
vscode.workspace.registerTextDocumentContentProvider('elasticsearch', resultsProvider);
let esMatches: ElasticMatches;
let decoration: ElasticDecoration;
function checkEditor(document: vscode.TextDocument): Boolean {
if (document === vscode.window.activeTextEditor!.document && document.languageId == 'es') {
if (esMatches == null || d
gitextract_b_w37aut/ ├── .github/ │ └── workflows/ │ ├── publish.yaml │ └── runTests.yaml ├── .gitignore ├── .husky/ │ └── pre-commit ├── .prettierrc.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── build/ │ └── restSpecIndex.js ├── grammar/ │ ├── es.configuration.json │ └── es.tmLanguage ├── media/ │ ├── jquery.contextMenu.css │ ├── jquery.contextMenu.js │ ├── json-formatter.js │ ├── result.tmpl │ └── results.css ├── package.json ├── src/ │ ├── ElasticCodeLensProvider.ts │ ├── ElasticCompletionItemProvider.ts │ ├── ElasticContentProvider.ts │ ├── ElasticDecoration.ts │ ├── ElasticMatch.ts │ ├── ElasticMatches.ts │ ├── axiosInstance.ts │ ├── extension.ts │ ├── helpers.ts │ ├── jsonPanel.ts │ └── rest-spec/ │ ├── index.ts │ ├── json.d.ts │ ├── v2_4_6/ │ │ ├── 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.thread_pool.json │ │ ├── clear_scroll.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 │ │ ├── count_percolate.json │ │ ├── delete.json │ │ ├── delete_script.json │ │ ├── delete_template.json │ │ ├── exists.json │ │ ├── explain.json │ │ ├── field_stats.json │ │ ├── get.json │ │ ├── get_script.json │ │ ├── get_source.json │ │ ├── get_template.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.delete_warmer.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_aliases.json │ │ ├── indices.get_field_mapping.json │ │ ├── indices.get_mapping.json │ │ ├── indices.get_settings.json │ │ ├── indices.get_template.json │ │ ├── indices.get_upgrade.json │ │ ├── indices.get_warmer.json │ │ ├── indices.open.json │ │ ├── indices.optimize.json │ │ ├── indices.put_alias.json │ │ ├── indices.put_mapping.json │ │ ├── indices.put_settings.json │ │ ├── indices.put_template.json │ │ ├── indices.put_warmer.json │ │ ├── indices.recovery.json │ │ ├── indices.refresh.json │ │ ├── indices.segments.json │ │ ├── indices.shard_stores.json │ │ ├── indices.stats.json │ │ ├── indices.update_aliases.json │ │ ├── indices.upgrade.json │ │ ├── indices.validate_query.json │ │ ├── info.json │ │ ├── mget.json │ │ ├── mpercolate.json │ │ ├── msearch.json │ │ ├── mtermvectors.json │ │ ├── nodes.hot_threads.json │ │ ├── nodes.info.json │ │ ├── nodes.stats.json │ │ ├── percolate.json │ │ ├── ping.json │ │ ├── put_script.json │ │ ├── put_template.json │ │ ├── reindex.json │ │ ├── reindex_rethrottle.json │ │ ├── render_search_template.json │ │ ├── scroll.json │ │ ├── search.json │ │ ├── search_exists.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 │ │ ├── suggest.json │ │ ├── tasks.cancel.json │ │ ├── tasks.list.json │ │ ├── termvectors.json │ │ ├── update.json │ │ └── update_by_query.json │ ├── v5_6_4/ │ │ ├── _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 │ │ ├── count_percolate.json │ │ ├── create.json │ │ ├── delete.json │ │ ├── delete_by_query.json │ │ ├── delete_script.json │ │ ├── delete_template.json │ │ ├── exists.json │ │ ├── exists_source.json │ │ ├── explain.json │ │ ├── field_caps.json │ │ ├── field_stats.json │ │ ├── get.json │ │ ├── get_script.json │ │ ├── get_source.json │ │ ├── get_template.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 │ │ ├── mpercolate.json │ │ ├── msearch.json │ │ ├── msearch_template.json │ │ ├── mtermvectors.json │ │ ├── nodes.hot_threads.json │ │ ├── nodes.info.json │ │ ├── nodes.stats.json │ │ ├── percolate.json │ │ ├── ping.json │ │ ├── put_script.json │ │ ├── put_template.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 │ │ ├── suggest.json │ │ ├── tasks.cancel.json │ │ ├── tasks.get.json │ │ ├── tasks.list.json │ │ ├── termvectors.json │ │ ├── update.json │ │ └── update_by_query.json │ └── 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 ├── tsconfig.json ├── tslint-imports.json └── webpack.config.js
SYMBOL INDEX (73 symbols across 11 files)
FILE: media/jquery.contextMenu.js
function createNameNode (line 1100) | function createNameNode(item) {
function completedPromise (line 1454) | function completedPromise(opt,root,items) {
function errorPromise (line 1463) | function errorPromise(opt,root,errorItem) {
function finishPromiseProcess (line 1475) | function finishPromiseProcess(opt,root,items) {
function splitAccesskey (line 1493) | function splitAccesskey(val) {
function inputLabel (line 1811) | function inputLabel(node) {
function menuChildren (line 1816) | function menuChildren(items, $children, counter) {
FILE: media/json-formatter.js
function __webpack_require__ (line 16) | function __webpack_require__(moduleId) {
function JSONFormatter (line 111) | function JSONFormatter(json, open, config, key) {
function addStylesToDom (line 655) | function addStylesToDom(styles, options) {
function listToStyles (line 677) | function listToStyles(list) {
function insertStyleElement (line 695) | function insertStyleElement(options, styleElement) {
function removeStyleElement (line 714) | function removeStyleElement(styleElement) {
function createStyleElement (line 722) | function createStyleElement(options) {
function createLinkElement (line 729) | function createLinkElement(options) {
function addStyle (line 736) | function addStyle(obj, options) {
function applyToSingletonTag (line 787) | function applyToSingletonTag(styleElement, index, remove, obj) {
function applyToTag (line 804) | function applyToTag(styleElement, obj) {
function updateLink (line 822) | function updateLink(linkElement, obj) {
function escapeString (line 850) | function escapeString(str) {
function isObject (line 856) | function isObject(value) {
function getObjectName (line 866) | function getObjectName(object) {
function getType (line 889) | function getType(object) {
function getValuePreview (line 899) | function getValuePreview(object, value) {
function getPreview (line 919) | function getPreview(object) {
function cssClass (line 935) | function cssClass(className) {
function createElement (line 943) | function createElement(type, className, content) {
FILE: src/ElasticCodeLensProvider.ts
class ElasticCodeLensProvider (line 5) | class ElasticCodeLensProvider implements vscode.CodeLensProvider {
method constructor (line 9) | public constructor(context: vscode.ExtensionContext) {
method provideCodeLenses (line 14) | public provideCodeLenses(document: vscode.TextDocument, _token: vscode...
FILE: src/ElasticCompletionItemProvider.ts
class ElasticCompletionItemProvider (line 10) | class ElasticCompletionItemProvider implements vscode.CompletionItemProv...
method constructor (line 14) | constructor(context: vscode.ExtensionContext) {
method buildRestSpecRouter (line 19) | private buildRestSpecRouter() {
method provideCompletionItems (line 49) | provideCompletionItems(
method provideHover (line 57) | provideHover(document: vscode.TextDocument, position: vscode.Position)...
method asyncProvideHover (line 61) | private async asyncProvideHover(document: vscode.TextDocument, positio...
method asyncProvideCompletionItems (line 98) | private async asyncProvideCompletionItems(
method providePathParamCompletionItem (line 123) | private async providePathParamCompletionItem(esMatch: any, restSpec: a...
method providePathCompletionItem (line 129) | private async providePathCompletionItem(esMatch: any, restSpec: any): ...
method isPathCompletion (line 181) | private isPathCompletion(esMatch: ElasticMatch, position: vscode.Posit...
method isPathParamCompletion (line 185) | private isPathParamCompletion(esMatch: ElasticMatch, position: vscode....
method listIndices (line 193) | private async listIndices(): Promise<string[]> {
method listAliases (line 200) | private async listAliases(): Promise<string[]> {
method listRepositories (line 208) | private async listRepositories(): Promise<string[]> {
method getElasticVersion (line 216) | private async getElasticVersion(): Promise<string | null> {
FILE: src/ElasticContentProvider.ts
class ElasticContentProvider (line 6) | class ElasticContentProvider implements vscode.TextDocumentContentProvid...
method provideTextDocumentContent (line 19) | public provideTextDocumentContent(uri: vscode.Uri, token: vscode.Cance...
method update (line 68) | update(context: any, host: any, results: any, time_el: any, statusCode...
method getPath (line 77) | getPath(p: any) {
method onDidChange (line 81) | get onDidChange() {
FILE: src/ElasticDecoration.ts
class ElasticDecoration (line 5) | class ElasticDecoration {
method constructor (line 14) | public constructor(context: vscode.ExtensionContext) {
method UpdateDecoration (line 83) | public UpdateDecoration(esMatches: ElasticMatches) {
FILE: src/ElasticMatch.ts
class ElasticItem (line 6) | class ElasticItem {
class ElasticMatch (line 11) | class ElasticMatch {
method constructor (line 23) | public constructor(headLine: vscode.TextLine, match: RegExpExecArray) {
method GetErrorFromMessage (line 89) | GetErrorFromMessage(text: string, message: string): ElasticItem {
FILE: src/ElasticMatches.ts
class ElasticMatches (line 4) | class ElasticMatches {
method constructor (line 9) | public constructor(editor: vscode.TextEditor) {
method UpdateSelection (line 40) | public UpdateSelection(editor: vscode.TextEditor) {
FILE: src/extension.ts
function activate (line 16) | async function activate(context: vscode.ExtensionContext) {
function setHost (line 120) | async function setHost(context: vscode.ExtensionContext): Promise<string> {
function getHost (line 132) | function getHost(context: vscode.ExtensionContext): string {
function executeQuery (line 136) | async function executeQuery(context: vscode.ExtensionContext, resultsPro...
function showResult (line 182) | function showResult(result: string, column?: vscode.ViewColumn): Thenabl...
function deactivate (line 209) | function deactivate() {}
FILE: src/helpers.ts
function stripJsonComments (line 19) | function stripJsonComments(jsonString: string, { whitespace = true } = {...
FILE: src/jsonPanel.ts
function renderJson (line 3) | function renderJson(jsonObj: object): string {
function syntaxHighlight (line 8) | function syntaxHighlight(json: string): string {
class JsonPanel (line 26) | class JsonPanel {
method constructor (line 73) | public constructor() {}
method render (line 75) | public render(jsonObj: object, title?: string) {
method ensurePanelValid (line 81) | public ensurePanelValid(title: string): void {
Condensed preview — 395 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,441K chars).
[
{
"path": ".github/workflows/publish.yaml",
"chars": 550,
"preview": "name: Publish To Vscode\r\non:\r\n push:\r\n branches:\r\n - master\r\n\r\njobs:\r\n publish:\r\n runs-on: ubuntu-latest\r\n "
},
{
"path": ".github/workflows/runTests.yaml",
"chars": 444,
"preview": "name: Run Tests\non:\n push:\n branches:\n - master\n pull_request:\n branches: [ master ]\njobs:\n prepare:\n r"
},
{
"path": ".gitignore",
"chars": 58,
"preview": "out\r\nnode_modules\r\n.vscode\r\n.DS_Store\r\npackage-lock.json\r\n"
},
{
"path": ".husky/pre-commit",
"chars": 122,
"preview": "#!/bin/sh\n. \"$(dirname \"$0\")/_/husky.sh\"\n\nnpm version patch --commit-hooks false --git-tag-version false --force\ngit add"
},
{
"path": ".prettierrc.json",
"chars": 349,
"preview": "{\n \"bracketSpacing\": true,\n \"jsxSingleQuote\": true,\n \"tabWidth\": 4,\n \"arrowParens\": \"avoid\",\n \"endOfLine\""
},
{
"path": ".vscodeignore",
"chars": 125,
"preview": ".vscode/**\r\n.vscode-test/**\r\nout/test/**\r\ntest/**\r\nsrc/**\r\n**/*.map\r\n.gitignore\r\ntsconfig.json\r\nvsc-extension-quickstart"
},
{
"path": "CHANGELOG.md",
"chars": 1784,
"preview": "## [0.13]\r\n\r\n- show simple documention of urls endpoints and its external links to [elastic.co](https://elastic.co) on"
},
{
"path": "LICENSE",
"chars": 1234,
"preview": "This is free and unencumbered software released into the public domain.\r\n\r\nAnyone is free to copy, modify, publish, use,"
},
{
"path": "README.md",
"chars": 1567,
"preview": "## Elasticsearch for VSCode\r\n\r\n[](/."
},
{
"path": "build/restSpecIndex.js",
"chars": 1654,
"preview": "/*jslint esversion: 6*/\r\nconst del = require('del');\r\nconst fs = require('fs');\r\nconst jsesc = require('jsesc');\r\n(funct"
},
{
"path": "grammar/es.configuration.json",
"chars": 597,
"preview": "{\r\n\t\"comments\": {\r\n\t\t\"lineComment\": \"//\",\r\n\t\t\"blockComment\": [\r\n\t\t\t\"/*\",\r\n\t\t\t\"*/\"\r\n\t\t]\r\n\t},\r\n\t\"brackets\": [\r\n\t\t[\r\n\t\t\t\"{\""
},
{
"path": "grammar/es.tmLanguage",
"chars": 9485,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/"
},
{
"path": "media/jquery.contextMenu.css",
"chars": 6849,
"preview": "@charset \"UTF-8\";\r\n/*!\r\n * jQuery contextMenu - Plugin for simple contextMenu handling\r\n *\r\n * Version: v2.4.2\r\n *\r\n * A"
},
{
"path": "media/jquery.contextMenu.js",
"chars": 87976,
"preview": "/*!\r\n * jQuery contextMenu v2.4.2 - Plugin for simple contextMenu handling\r\n *\r\n * Version: v2.4.2\r\n *\r\n * Authors: Björ"
},
{
"path": "media/json-formatter.js",
"chars": 48980,
"preview": "(function webpackUniversalModuleDefinition(root, factory) {\r\n\tif(typeof exports === 'object' && typeof module === 'objec"
},
{
"path": "media/result.tmpl",
"chars": 3749,
"preview": "<!DOCTYPE html>\r\n<html>\r\n<meta charset='utf-8'>\r\n\r\n<head>\r\n{{{header}}}\r\n <style>\r\n .json-formatter-dark.json-"
},
{
"path": "media/results.css",
"chars": 1056,
"preview": ".info {\r\n background-color: rgba(85, 85, 85, .85);\r\n padding: 10px 10px;\r\n position: fixed;\r\n top: 0;\r\n l"
},
{
"path": "package.json",
"chars": 4389,
"preview": "{\n \"name\": \"elastic\",\n \"displayName\": \"Elasticsearch for VSCode\",\n \"description\": \"Elasticsearch client like Ki"
},
{
"path": "src/ElasticCodeLensProvider.ts",
"chars": 2648,
"preview": "import * as vscode from 'vscode';\r\nimport { ElasticDecoration } from './ElasticDecoration';\r\nimport { ElasticMatches } f"
},
{
"path": "src/ElasticCompletionItemProvider.ts",
"chars": 9234,
"preview": "import { ElasticMatch } from './ElasticMatch';\r\nimport { ElasticMatches } from './ElasticMatches';\r\nimport * as vscode f"
},
{
"path": "src/ElasticContentProvider.ts",
"chars": 2939,
"preview": "import * as vscode from 'vscode';\r\nimport * as path from 'path';\r\nimport fs = require('fs');\r\nconst Mustache = require('"
},
{
"path": "src/ElasticDecoration.ts",
"chars": 4081,
"preview": "import * as vscode from 'vscode';\r\nimport { ElasticMatches } from './ElasticMatches';\r\nimport { getHost } from './extens"
},
{
"path": "src/ElasticMatch.ts",
"chars": 3728,
"preview": "import * as vscode from 'vscode';\r\nimport * as path from 'path';\r\nimport * as fs from 'fs';\r\nimport stripJsonComments fr"
},
{
"path": "src/ElasticMatches.ts",
"chars": 1475,
"preview": "import * as vscode from 'vscode';\r\nimport { ElasticMatch } from './ElasticMatch';\r\n\r\nexport class ElasticMatches {\r\n "
},
{
"path": "src/axiosInstance.ts",
"chars": 226,
"preview": "import axios from 'axios';\r\n\r\n// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';\r\n\r\nexport default axios.create({\r\n h"
},
{
"path": "src/extension.ts",
"chars": 8679,
"preview": "import * as vscode from 'vscode';\r\nimport path = require('path');\r\nimport * as fs from 'fs';\r\nimport * as os from 'os';\r"
},
{
"path": "src/helpers.ts",
"chars": 2777,
"preview": "const singleComment = Symbol('singleComment');\nconst multiComment = Symbol('multiComment');\n\nconst stripWithoutWhitespac"
},
{
"path": "src/jsonPanel.ts",
"chars": 2240,
"preview": "import * as vscode from 'vscode';\n\nfunction renderJson(jsonObj: object): string {\n var str = JSON.stringify(jsonObj, "
},
{
"path": "src/rest-spec/index.ts",
"chars": 201,
"preview": "import * as v2_4_6 from './v2_4_6';\r\nimport * as v5_6_4 from './v5_6_4';\r\nimport * as v6_0_0 from './v6_0_0';\r\n\r\nexport "
},
{
"path": "src/rest-spec/json.d.ts",
"chars": 76,
"preview": "declare module '*.json' {\n const value: any;\n export default value;\n}\n"
},
{
"path": "src/rest-spec/v2_4_6/bulk.json",
"chars": 1679,
"preview": "{\r\n \"bulk\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-bulk.html\",\r\n "
},
{
"path": "src/rest-spec/v2_4_6/cat.aliases.json",
"chars": 1240,
"preview": "{\r\n \"cat.aliases\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-alias.html\""
},
{
"path": "src/rest-spec/v2_4_6/cat.allocation.json",
"chars": 1466,
"preview": "{\r\n \"cat.allocation\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-allocati"
},
{
"path": "src/rest-spec/v2_4_6/cat.count.json",
"chars": 1257,
"preview": "{\r\n \"cat.count\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-count.html\",\r"
},
{
"path": "src/rest-spec/v2_4_6/cat.fielddata.json",
"chars": 1584,
"preview": "{\r\n \"cat.fielddata\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-fielddata"
},
{
"path": "src/rest-spec/v2_4_6/cat.health.json",
"chars": 1231,
"preview": "{\r\n \"cat.health\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-health.html\""
},
{
"path": "src/rest-spec/v2_4_6/cat.help.json",
"chars": 435,
"preview": "{\r\n \"cat.help\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat.html\",\r\n \"m"
},
{
"path": "src/rest-spec/v2_4_6/cat.indices.json",
"chars": 1612,
"preview": "{\r\n \"cat.indices\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-indices.htm"
},
{
"path": "src/rest-spec/v2_4_6/cat.master.json",
"chars": 1079,
"preview": "{\r\n \"cat.master\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-master.html\""
},
{
"path": "src/rest-spec/v2_4_6/cat.nodeattrs.json",
"chars": 1091,
"preview": "{\r\n \"cat.nodeattrs\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-nodeattrs"
},
{
"path": "src/rest-spec/v2_4_6/cat.nodes.json",
"chars": 1075,
"preview": "{\r\n \"cat.nodes\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-nodes.html\",\r"
},
{
"path": "src/rest-spec/v2_4_6/cat.pending_tasks.json",
"chars": 1107,
"preview": "{\r\n \"cat.pending_tasks\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-pendi"
},
{
"path": "src/rest-spec/v2_4_6/cat.plugins.json",
"chars": 1055,
"preview": "{\r\n \"cat.plugins\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-plugins.htm"
},
{
"path": "src/rest-spec/v2_4_6/cat.recovery.json",
"chars": 1269,
"preview": "{\r\n \"cat.recovery\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-recovery.h"
},
{
"path": "src/rest-spec/v2_4_6/cat.repositories.json",
"chars": 1111,
"preview": "{\r\n \"cat.repositories\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-reposi"
},
{
"path": "src/rest-spec/v2_4_6/cat.segments.json",
"chars": 939,
"preview": "{\r\n \"cat.segments\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-segments.h"
},
{
"path": "src/rest-spec/v2_4_6/cat.shards.json",
"chars": 1262,
"preview": "{\r\n \"cat.shards\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-shards.html\""
},
{
"path": "src/rest-spec/v2_4_6/cat.snapshots.json",
"chars": 1296,
"preview": "{\r\n \"cat.snapshots\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-snapshots"
},
{
"path": "src/rest-spec/v2_4_6/cat.thread_pool.json",
"chars": 1261,
"preview": "{\r\n \"cat.thread_pool\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-thread-"
},
{
"path": "src/rest-spec/v2_4_6/clear_scroll.json",
"chars": 636,
"preview": "{\r\n \"clear_scroll\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-request"
},
{
"path": "src/rest-spec/v2_4_6/cluster.get_settings.json",
"chars": 762,
"preview": "{\r\n \"cluster.get_settings\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cluste"
},
{
"path": "src/rest-spec/v2_4_6/cluster.health.json",
"chars": 1891,
"preview": "{\r\n \"cluster.health\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cluster-heal"
},
{
"path": "src/rest-spec/v2_4_6/cluster.pending_tasks.json",
"chars": 667,
"preview": "{\r\n \"cluster.pending_tasks\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/clust"
},
{
"path": "src/rest-spec/v2_4_6/cluster.put_settings.json",
"chars": 888,
"preview": "{\r\n \"cluster.put_settings\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cluste"
},
{
"path": "src/rest-spec/v2_4_6/cluster.reroute.json",
"chars": 1305,
"preview": "{\r\n \"cluster.reroute\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cluster-rer"
},
{
"path": "src/rest-spec/v2_4_6/cluster.state.json",
"chars": 2087,
"preview": "{\r\n \"cluster.state\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cluster-state"
},
{
"path": "src/rest-spec/v2_4_6/cluster.stats.json",
"chars": 1103,
"preview": "{\r\n \"cluster.stats\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cluster-stats"
},
{
"path": "src/rest-spec/v2_4_6/count.json",
"chars": 3135,
"preview": "{\r\n \"count\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-count.html\",\r\n"
},
{
"path": "src/rest-spec/v2_4_6/count_percolate.json",
"chars": 2876,
"preview": "{\r\n \"count_percolate\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-perc"
},
{
"path": "src/rest-spec/v2_4_6/delete.json",
"chars": 1775,
"preview": "{\r\n \"delete\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-delete.html\",\r\n"
},
{
"path": "src/rest-spec/v2_4_6/delete_script.json",
"chars": 942,
"preview": "{\r\n \"delete_script\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-scrip"
},
{
"path": "src/rest-spec/v2_4_6/delete_template.json",
"chars": 809,
"preview": "{\r\n \"delete_template\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-temp"
},
{
"path": "src/rest-spec/v2_4_6/exists.json",
"chars": 1568,
"preview": "{\r\n \"exists\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-get.html\",\r\n "
},
{
"path": "src/rest-spec/v2_4_6/explain.json",
"chars": 3102,
"preview": "{\r\n \"explain\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-explain.html"
},
{
"path": "src/rest-spec/v2_4_6/field_stats.json",
"chars": 1948,
"preview": "{\r\n \"field_stats\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-field-st"
},
{
"path": "src/rest-spec/v2_4_6/get.json",
"chars": 2537,
"preview": "{\r\n \"get\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-get.html\",\r\n \"m"
},
{
"path": "src/rest-spec/v2_4_6/get_script.json",
"chars": 938,
"preview": "{\r\n \"get_script\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-scriptin"
},
{
"path": "src/rest-spec/v2_4_6/get_source.json",
"chars": 2411,
"preview": "{\r\n \"get_source\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-get.html\",\r"
},
{
"path": "src/rest-spec/v2_4_6/get_template.json",
"chars": 801,
"preview": "{\r\n \"get_template\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-templat"
},
{
"path": "src/rest-spec/v2_4_6/index.json",
"chars": 2281,
"preview": "{\r\n \"index\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-index_.html\",\r\n "
},
{
"path": "src/rest-spec/v2_4_6/index.ts",
"chars": 143932,
"preview": "const def_bulk = JSON.parse(\r\n '{\"bulk\":{\"documentation\":\"https://www.elastic.co/guide/en/elasticsearch/reference/2.4"
},
{
"path": "src/rest-spec/v2_4_6/indices.analyze.json",
"chars": 2718,
"preview": "{\r\n \"indices.analyze\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-ana"
},
{
"path": "src/rest-spec/v2_4_6/indices.clear_cache.json",
"chars": 2166,
"preview": "{\r\n \"indices.clear_cache\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices"
},
{
"path": "src/rest-spec/v2_4_6/indices.close.json",
"chars": 1496,
"preview": "{\r\n \"indices.close\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-open-"
},
{
"path": "src/rest-spec/v2_4_6/indices.create.json",
"chars": 1007,
"preview": "{\r\n \"indices.create\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-crea"
},
{
"path": "src/rest-spec/v2_4_6/indices.delete.json",
"chars": 792,
"preview": "{\r\n \"indices.delete\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-dele"
},
{
"path": "src/rest-spec/v2_4_6/indices.delete_alias.json",
"chars": 1097,
"preview": "{\r\n \"indices.delete_alias\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indice"
},
{
"path": "src/rest-spec/v2_4_6/indices.delete_template.json",
"chars": 750,
"preview": "{\r\n \"indices.delete_template\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/ind"
},
{
"path": "src/rest-spec/v2_4_6/indices.delete_warmer.json",
"chars": 1373,
"preview": "{\r\n \"indices.delete_warmer\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indic"
},
{
"path": "src/rest-spec/v2_4_6/indices.exists.json",
"chars": 1402,
"preview": "{\r\n \"indices.exists\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-exis"
},
{
"path": "src/rest-spec/v2_4_6/indices.exists_alias.json",
"chars": 1589,
"preview": "{\r\n \"indices.exists_alias\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indice"
},
{
"path": "src/rest-spec/v2_4_6/indices.exists_template.json",
"chars": 817,
"preview": "{\r\n \"indices.exists_template\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/ind"
},
{
"path": "src/rest-spec/v2_4_6/indices.exists_type.json",
"chars": 1640,
"preview": "{\r\n \"indices.exists_type\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices"
},
{
"path": "src/rest-spec/v2_4_6/indices.flush.json",
"chars": 1971,
"preview": "{\r\n \"indices.flush\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-flush"
},
{
"path": "src/rest-spec/v2_4_6/indices.flush_synced.json",
"chars": 1359,
"preview": "{\r\n \"indices.flush_synced\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indice"
},
{
"path": "src/rest-spec/v2_4_6/indices.forcemerge.json",
"chars": 2113,
"preview": "{\r\n \"indices.forcemerge\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-"
},
{
"path": "src/rest-spec/v2_4_6/indices.get.json",
"chars": 1792,
"preview": "{\r\n \"indices.get\":{\r\n \"documentation\":\"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-get-index"
},
{
"path": "src/rest-spec/v2_4_6/indices.get_alias.json",
"chars": 1587,
"preview": "{\r\n \"indices.get_alias\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-a"
},
{
"path": "src/rest-spec/v2_4_6/indices.get_aliases.json",
"chars": 968,
"preview": "{\r\n \"indices.get_aliases\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices"
},
{
"path": "src/rest-spec/v2_4_6/indices.get_field_mapping.json",
"chars": 1977,
"preview": "{\r\n \"indices.get_field_mapping\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/i"
},
{
"path": "src/rest-spec/v2_4_6/indices.get_mapping.json",
"chars": 1572,
"preview": "{\r\n \"indices.get_mapping\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices"
},
{
"path": "src/rest-spec/v2_4_6/indices.get_settings.json",
"chars": 2008,
"preview": "{\r\n \"indices.get_settings\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indice"
},
{
"path": "src/rest-spec/v2_4_6/indices.get_template.json",
"chars": 1023,
"preview": "{\r\n \"indices.get_template\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indice"
},
{
"path": "src/rest-spec/v2_4_6/indices.get_upgrade.json",
"chars": 1473,
"preview": "{\r\n \"indices.get_upgrade\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices"
},
{
"path": "src/rest-spec/v2_4_6/indices.get_warmer.json",
"chars": 1920,
"preview": "{\r\n \"indices.get_warmer\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-"
},
{
"path": "src/rest-spec/v2_4_6/indices.open.json",
"chars": 1482,
"preview": "{\r\n \"indices.open\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-open-c"
},
{
"path": "src/rest-spec/v2_4_6/indices.optimize.json",
"chars": 2103,
"preview": "{\r\n \"indices.optimize\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-op"
},
{
"path": "src/rest-spec/v2_4_6/indices.put_alias.json",
"chars": 1190,
"preview": "{\r\n \"indices.put_alias\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-a"
},
{
"path": "src/rest-spec/v2_4_6/indices.put_mapping.json",
"chars": 2128,
"preview": "{\r\n \"indices.put_mapping\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices"
},
{
"path": "src/rest-spec/v2_4_6/indices.put_settings.json",
"chars": 1653,
"preview": "{\r\n \"indices.put_settings\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indice"
},
{
"path": "src/rest-spec/v2_4_6/indices.put_template.json",
"chars": 1419,
"preview": "{\r\n \"indices.put_template\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indice"
},
{
"path": "src/rest-spec/v2_4_6/indices.put_warmer.json",
"chars": 2358,
"preview": "{\r\n \"indices.put_warmer\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-"
},
{
"path": "src/rest-spec/v2_4_6/indices.recovery.json",
"chars": 1325,
"preview": "{\r\n \"indices.recovery\" : {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/ind"
},
{
"path": "src/rest-spec/v2_4_6/indices.refresh.json",
"chars": 1534,
"preview": "{\r\n \"indices.refresh\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-ref"
},
{
"path": "src/rest-spec/v2_4_6/indices.segments.json",
"chars": 1720,
"preview": "{\r\n \"indices.segments\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-se"
},
{
"path": "src/rest-spec/v2_4_6/indices.shard_stores.json",
"chars": 1632,
"preview": "{\r\n \"indices.shard_stores\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indice"
},
{
"path": "src/rest-spec/v2_4_6/indices.stats.json",
"chars": 2291,
"preview": "{\r\n \"indices.stats\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-stats"
},
{
"path": "src/rest-spec/v2_4_6/indices.update_aliases.json",
"chars": 668,
"preview": "{\r\n \"indices.update_aliases\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indi"
},
{
"path": "src/rest-spec/v2_4_6/indices.upgrade.json",
"chars": 1663,
"preview": "{\r\n \"indices.upgrade\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-upg"
},
{
"path": "src/rest-spec/v2_4_6/indices.validate_query.json",
"chars": 3259,
"preview": "{\r\n \"indices.validate_query\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/sear"
},
{
"path": "src/rest-spec/v2_4_6/info.json",
"chars": 243,
"preview": "{\r\n \"info\": {\r\n \"documentation\": \"https://www.elastic.co/guide/\",\r\n \"methods\": [\"GET\"],\r\n \"url\": {\r\n \"pat"
},
{
"path": "src/rest-spec/v2_4_6/mget.json",
"chars": 2034,
"preview": "{\r\n \"mget\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-multi-get.html\",\r"
},
{
"path": "src/rest-spec/v2_4_6/mpercolate.json",
"chars": 1572,
"preview": "{\r\n \"mpercolate\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-percolate"
},
{
"path": "src/rest-spec/v2_4_6/msearch.json",
"chars": 1080,
"preview": "{\r\n \"msearch\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-multi-search"
},
{
"path": "src/rest-spec/v2_4_6/mtermvectors.json",
"chars": 4283,
"preview": "{\r\n \"mtermvectors\" : {\r\n \"documentation\" : \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-multi-t"
},
{
"path": "src/rest-spec/v2_4_6/nodes.hot_threads.json",
"chars": 1850,
"preview": "{\r\n \"nodes.hot_threads\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cluster-n"
},
{
"path": "src/rest-spec/v2_4_6/nodes.info.json",
"chars": 1398,
"preview": "{\r\n \"nodes.info\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cluster-nodes-in"
},
{
"path": "src/rest-spec/v2_4_6/nodes.stats.json",
"chars": 3014,
"preview": "{\r\n \"nodes.stats\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cluster-nodes-s"
},
{
"path": "src/rest-spec/v2_4_6/percolate.json",
"chars": 3377,
"preview": "{\r\n \"percolate\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-percolate."
},
{
"path": "src/rest-spec/v2_4_6/ping.json",
"chars": 244,
"preview": "{\r\n \"ping\": {\r\n \"documentation\": \"https://www.elastic.co/guide/\",\r\n \"methods\": [\"HEAD\"],\r\n \"url\": {\r\n \"pa"
},
{
"path": "src/rest-spec/v2_4_6/put_script.json",
"chars": 1201,
"preview": "{\r\n \"put_script\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-scriptin"
},
{
"path": "src/rest-spec/v2_4_6/put_template.json",
"chars": 1070,
"preview": "{\r\n \"put_template\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-templat"
},
{
"path": "src/rest-spec/v2_4_6/reindex.json",
"chars": 1378,
"preview": "{\r\n \"reindex\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-reindex.html\","
},
{
"path": "src/rest-spec/v2_4_6/reindex_rethrottle.json",
"chars": 802,
"preview": "{\r\n \"reindex_rethrottle\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-rei"
},
{
"path": "src/rest-spec/v2_4_6/render_search_template.json",
"chars": 553,
"preview": "{\r\n \"render_search_template\": {\r\n \"documentation\": \"http://www.elasticsearch.org/guide/en/elasticsearch/reference/2."
},
{
"path": "src/rest-spec/v2_4_6/scroll.json",
"chars": 867,
"preview": "{\r\n \"scroll\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-request-scrol"
},
{
"path": "src/rest-spec/v2_4_6/search.json",
"chars": 6545,
"preview": "{\r\n \"search\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-search.html\","
},
{
"path": "src/rest-spec/v2_4_6/search_exists.json",
"chars": 3176,
"preview": "{\r\n \"search_exists\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-exists"
},
{
"path": "src/rest-spec/v2_4_6/search_shards.json",
"chars": 2013,
"preview": "{\r\n \"search_shards\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-shards"
},
{
"path": "src/rest-spec/v2_4_6/search_template.json",
"chars": 2366,
"preview": "{\r\n \"search_template\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/current/search-"
},
{
"path": "src/rest-spec/v2_4_6/snapshot.create.json",
"chars": 1104,
"preview": "{\r\n \"snapshot.create\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-sna"
},
{
"path": "src/rest-spec/v2_4_6/snapshot.create_repository.json",
"chars": 1005,
"preview": "{\r\n \"snapshot.create_repository\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/"
},
{
"path": "src/rest-spec/v2_4_6/snapshot.delete.json",
"chars": 809,
"preview": "{\r\n \"snapshot.delete\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-sna"
},
{
"path": "src/rest-spec/v2_4_6/snapshot.delete_repository.json",
"chars": 801,
"preview": "{\r\n \"snapshot.delete_repository\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/"
},
{
"path": "src/rest-spec/v2_4_6/snapshot.get.json",
"chars": 826,
"preview": "{\r\n \"snapshot.get\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-snapsh"
},
{
"path": "src/rest-spec/v2_4_6/snapshot.get_repository.json",
"chars": 824,
"preview": "{\r\n \"snapshot.get_repository\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/mod"
},
{
"path": "src/rest-spec/v2_4_6/snapshot.restore.json",
"chars": 1119,
"preview": "{\r\n \"snapshot.restore\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-sn"
},
{
"path": "src/rest-spec/v2_4_6/snapshot.status.json",
"chars": 816,
"preview": "{\r\n \"snapshot.status\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-sna"
},
{
"path": "src/rest-spec/v2_4_6/snapshot.verify_repository.json",
"chars": 970,
"preview": "{\r\n \"snapshot.verify_repository\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/referenc"
},
{
"path": "src/rest-spec/v2_4_6/suggest.json",
"chars": 1678,
"preview": "{\r\n \"suggest\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-suggesters.h"
},
{
"path": "src/rest-spec/v2_4_6/tasks.cancel.json",
"chars": 1269,
"preview": "{\r\n \"tasks.cancel\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/tasks.html#_ta"
},
{
"path": "src/rest-spec/v2_4_6/tasks.list.json",
"chars": 1583,
"preview": "{\r\n \"tasks.list\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/tasks.html#_curr"
},
{
"path": "src/rest-spec/v2_4_6/termvectors.json",
"chars": 3599,
"preview": "{\r\n \"termvectors\" : {\r\n \"documentation\" : \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-termvect"
},
{
"path": "src/rest-spec/v2_4_6/update.json",
"chars": 3080,
"preview": "{\r\n \"update\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-update.html\",\r\n"
},
{
"path": "src/rest-spec/v2_4_6/update_by_query.json",
"chars": 8422,
"preview": "{\r\n \"update_by_query\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-update"
},
{
"path": "src/rest-spec/v5_6_4/_common.json",
"chars": 965,
"preview": "{\r\n \"description\": \"Parameters that are accepted by all API endpoints.\",\r\n \"documentation\": \"https://www.elastic.co/gu"
},
{
"path": "src/rest-spec/v5_6_4/bulk.json",
"chars": 2933,
"preview": "{\r\n \"bulk\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-bulk.html\",\r\n "
},
{
"path": "src/rest-spec/v5_6_4/cat.aliases.json",
"chars": 1536,
"preview": "{\r\n \"cat.aliases\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-alias.html\""
},
{
"path": "src/rest-spec/v5_6_4/cat.allocation.json",
"chars": 1802,
"preview": "{\r\n \"cat.allocation\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-allocati"
},
{
"path": "src/rest-spec/v5_6_4/cat.count.json",
"chars": 1553,
"preview": "{\r\n \"cat.count\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-count.html\",\r"
},
{
"path": "src/rest-spec/v5_6_4/cat.fielddata.json",
"chars": 1920,
"preview": "{\r\n \"cat.fielddata\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-fielddata"
},
{
"path": "src/rest-spec/v5_6_4/cat.health.json",
"chars": 1527,
"preview": "{\r\n \"cat.health\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-health.html\""
},
{
"path": "src/rest-spec/v5_6_4/cat.help.json",
"chars": 585,
"preview": "{\r\n \"cat.help\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat.html\",\r\n \"m"
},
{
"path": "src/rest-spec/v5_6_4/cat.indices.json",
"chars": 2187,
"preview": "{\r\n \"cat.indices\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-indices.htm"
},
{
"path": "src/rest-spec/v5_6_4/cat.master.json",
"chars": 1375,
"preview": "{\r\n \"cat.master\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-master.html\""
},
{
"path": "src/rest-spec/v5_6_4/cat.nodeattrs.json",
"chars": 1387,
"preview": "{\r\n \"cat.nodeattrs\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-nodeattrs"
},
{
"path": "src/rest-spec/v5_6_4/cat.nodes.json",
"chars": 1539,
"preview": "{\r\n \"cat.nodes\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-nodes.html\",\r"
},
{
"path": "src/rest-spec/v5_6_4/cat.pending_tasks.json",
"chars": 1403,
"preview": "{\r\n \"cat.pending_tasks\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-pendi"
},
{
"path": "src/rest-spec/v5_6_4/cat.plugins.json",
"chars": 1351,
"preview": "{\r\n \"cat.plugins\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-plugins.htm"
},
{
"path": "src/rest-spec/v5_6_4/cat.recovery.json",
"chars": 1605,
"preview": "{\r\n \"cat.recovery\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-recovery.h"
},
{
"path": "src/rest-spec/v5_6_4/cat.repositories.json",
"chars": 1407,
"preview": "{\r\n \"cat.repositories\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-reposi"
},
{
"path": "src/rest-spec/v5_6_4/cat.segments.json",
"chars": 1450,
"preview": "{\r\n \"cat.segments\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-segments.h"
},
{
"path": "src/rest-spec/v5_6_4/cat.shards.json",
"chars": 1773,
"preview": "{\r\n \"cat.shards\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-shards.html\""
},
{
"path": "src/rest-spec/v5_6_4/cat.snapshots.json",
"chars": 1617,
"preview": "{\r\n \"cat.snapshots\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-snapshots"
},
{
"path": "src/rest-spec/v5_6_4/cat.tasks.json",
"chars": 1939,
"preview": "{\r\n \"cat.tasks\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/tasks.html\",\r\n "
},
{
"path": "src/rest-spec/v5_6_4/cat.templates.json",
"chars": 1548,
"preview": "{\r\n \"cat.templates\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-templates"
},
{
"path": "src/rest-spec/v5_6_4/cat.thread_pool.json",
"chars": 1810,
"preview": "{\r\n \"cat.thread_pool\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-thread-"
},
{
"path": "src/rest-spec/v5_6_4/clear_scroll.json",
"chars": 636,
"preview": "{\r\n \"clear_scroll\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-request"
},
{
"path": "src/rest-spec/v5_6_4/cluster.allocation_explain.json",
"chars": 836,
"preview": "{\r\n \"cluster.allocation_explain\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/"
},
{
"path": "src/rest-spec/v5_6_4/cluster.get_settings.json",
"chars": 940,
"preview": "{\r\n \"cluster.get_settings\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluste"
},
{
"path": "src/rest-spec/v5_6_4/cluster.health.json",
"chars": 2158,
"preview": "{\r\n \"cluster.health\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-heal"
},
{
"path": "src/rest-spec/v5_6_4/cluster.pending_tasks.json",
"chars": 667,
"preview": "{\r\n \"cluster.pending_tasks\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/clust"
},
{
"path": "src/rest-spec/v5_6_4/cluster.put_settings.json",
"chars": 888,
"preview": "{\r\n \"cluster.put_settings\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluste"
},
{
"path": "src/rest-spec/v5_6_4/cluster.reroute.json",
"chars": 1497,
"preview": "{\r\n \"cluster.reroute\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-rer"
},
{
"path": "src/rest-spec/v5_6_4/cluster.state.json",
"chars": 2087,
"preview": "{\r\n \"cluster.state\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-state"
},
{
"path": "src/rest-spec/v5_6_4/cluster.stats.json",
"chars": 913,
"preview": "{\r\n \"cluster.stats\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-stats"
},
{
"path": "src/rest-spec/v5_6_4/count.json",
"chars": 3172,
"preview": "{\r\n \"count\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-count.html\",\r\n"
},
{
"path": "src/rest-spec/v5_6_4/count_percolate.json",
"chars": 2876,
"preview": "{\r\n \"count_percolate\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-perc"
},
{
"path": "src/rest-spec/v5_6_4/create.json",
"chars": 2701,
"preview": "{\r\n \"create\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-index_.html\",\r\n"
},
{
"path": "src/rest-spec/v5_6_4/delete.json",
"chars": 2216,
"preview": "{\r\n \"delete\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-delete.html\",\r\n"
},
{
"path": "src/rest-spec/v5_6_4/delete_by_query.json",
"chars": 7097,
"preview": "{\r\n \"delete_by_query\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-delete"
},
{
"path": "src/rest-spec/v5_6_4/delete_script.json",
"chars": 886,
"preview": "{\r\n \"delete_script\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-scrip"
},
{
"path": "src/rest-spec/v5_6_4/delete_template.json",
"chars": 482,
"preview": "{\r\n \"delete_template\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-temp"
},
{
"path": "src/rest-spec/v5_6_4/exists.json",
"chars": 2555,
"preview": "{\r\n \"exists\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-get.html\",\r\n "
},
{
"path": "src/rest-spec/v5_6_4/exists_source.json",
"chars": 2417,
"preview": "{\r\n \"exists_source\": {\r\n \"documentation\": \"http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.ht"
},
{
"path": "src/rest-spec/v5_6_4/explain.json",
"chars": 2956,
"preview": "{\r\n \"explain\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-explain.html"
},
{
"path": "src/rest-spec/v5_6_4/field_caps.json",
"chars": 1537,
"preview": "{\r\n \"field_caps\": {\r\n \"documentation\": \"http://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-field-caps"
},
{
"path": "src/rest-spec/v5_6_4/field_stats.json",
"chars": 1948,
"preview": "{\r\n \"field_stats\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-field-st"
},
{
"path": "src/rest-spec/v5_6_4/get.json",
"chars": 2551,
"preview": "{\r\n \"get\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-get.html\",\r\n \"m"
},
{
"path": "src/rest-spec/v5_6_4/get_script.json",
"chars": 622,
"preview": "{\r\n \"get_script\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-scriptin"
},
{
"path": "src/rest-spec/v5_6_4/get_source.json",
"chars": 2411,
"preview": "{\r\n \"get_source\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-get.html\",\r"
},
{
"path": "src/rest-spec/v5_6_4/get_template.json",
"chars": 474,
"preview": "{\r\n \"get_template\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-templat"
},
{
"path": "src/rest-spec/v5_6_4/index.json",
"chars": 2860,
"preview": "{\r\n \"index\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-index_.html\",\r\n "
},
{
"path": "src/rest-spec/v5_6_4/index.ts",
"chars": 165202,
"preview": "const def__common = JSON.parse(\r\n '{\"description\":\"Parameters that are accepted by all API endpoints.\",\"documentation"
},
{
"path": "src/rest-spec/v5_6_4/indices.analyze.json",
"chars": 2379,
"preview": "{\r\n \"indices.analyze\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-ana"
},
{
"path": "src/rest-spec/v5_6_4/indices.clear_cache.json",
"chars": 2286,
"preview": "{\r\n \"indices.clear_cache\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices"
},
{
"path": "src/rest-spec/v5_6_4/indices.close.json",
"chars": 1496,
"preview": "{\r\n \"indices.close\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-open-"
},
{
"path": "src/rest-spec/v5_6_4/indices.create.json",
"chars": 1182,
"preview": "{\r\n \"indices.create\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-crea"
},
{
"path": "src/rest-spec/v5_6_4/indices.delete.json",
"chars": 792,
"preview": "{\r\n \"indices.delete\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-dele"
},
{
"path": "src/rest-spec/v5_6_4/indices.delete_alias.json",
"chars": 1097,
"preview": "{\r\n \"indices.delete_alias\": {\r\n \"documentation\": \"https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indice"
}
]
// ... and 195 more files (download for full content)
About this extraction
This page contains the full source code of the hsen-dev/vscode-elastic GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 395 files (1.2 MB), approximately 299.3k tokens, and a symbol index with 73 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.