Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Snyk] Fix for 2 vulnerable dependencies #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
Analyze text with Aalyzer
![Sample image](docs/sample_image.jpg)

This branch is for Kibana 7.x.

## How to use?

See [Getting Started](docs/GETTING_STARTED.md)

## Installation
The latest version is for kibana 6.5.0.
The latest stable version is for kibana 6.5.0.
The latest alpha version is for kibana 7.0.0-alpha1

| Kibana version | Command |
| ---------- | ------- |
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "analyze-api-ui-plugin",
"version": "6.5.0",
"version": "7.0.0-alpha1",
"description": "UI for elasticsearch analyze API",
"main": "index.js",
"kibana": {
"version": "6.5.0",
"version": "7.0.0-alpha1",
"templateVersion": "1.0.0"
},
"scripts": {
Expand All @@ -19,21 +19,21 @@
"dependencies": {
"boom": "2.8.0",
"joi": "6.10.1",
"lodash": "4.17.5"
"lodash": "4.17.11"
},
"devDependencies": {
"@elastic/eslint-config-kibana": "link:../../kibana/packages/eslint-config-kibana",
"@elastic/eslint-import-resolver-kibana": "link:../../kibana/packages/kbn-eslint-import-resolver-kibana",
"@kbn/plugin-helpers": "link:../../kibana/packages/kbn-plugin-helpers",
"babel-eslint": "^8.0.2",
"eslint": "^4.11.0",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-jest": "^21.3.2",
"eslint-plugin-mocha": "^4.9.0",
"babel-eslint": "^9.0.0",
"eslint": "^5.6.0",
"eslint-plugin-babel": "^5.2.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^21.22.1",
"eslint-plugin-mocha": "^5.2.0",
"eslint-plugin-no-unsanitized": "^3.0.2",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-react": "^7.0.1",
"eslint-plugin-react": "^7.11.1",
"expect.js": "^0.3.1"
}
}
34 changes: 16 additions & 18 deletions server/routes/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function (server) {
server.route({
path: '/api/analyze-api-ui-plugin/analyze',
method: 'POST',
config: {
options: {
validate: {
payload: Joi.object().keys({
text: Joi.string().required(),
Expand All @@ -21,7 +21,7 @@ export default function (server) {
}).required()
}
},
handler(req, reply) {
handler: async (req) => {

// get params from req
// call _analyze api
Expand All @@ -37,24 +37,22 @@ export default function (server) {
if (req.payload.charfilters) param.body.char_filter = req.payload.charfilters;
if (req.payload.field) param.body.field = req.payload.field;
if (req.payload.filters) param.body.filter = req.payload.filters;
call(req, 'indices.analyze', param)
.then(function (response) {
let res = {
detail: response.detail,
request: param.body
}
reply(res);
})
.catch(error => {
reply(convertEsError(param.index, error));
});
try {
const response = await call(req, 'indices.analyze', param);
return {
detail: response.detail,
request: param.body
};
} catch (error) {
return convertEsError(param.index, error);
}
}
});

server.route({
path: '/api/analyze-api-ui-plugin/multi_analyze',
method: 'POST',
config: {
options: {
validate: {
payload: Joi.object().keys({
text: Joi.string().required(),
Expand All @@ -66,7 +64,7 @@ export default function (server) {
}).required()
}
},
handler(req, reply) {
handler: async (req, h) => {

// get params from req
// call _analyze api
Expand Down Expand Up @@ -106,13 +104,13 @@ export default function (server) {
return 0;
}
);
reply(res);
return h.response(res);
})
.catch(error => {
reply(convertEsError(param.index, error));
return h.response(convertEsError(param.index, error));
});
} else {
reply(res);
return h.response(res);
}
}
});
Expand Down