[SIEM][NP] Fixes bug in ML signals promotion (#64720)

* Add set-value as an explicit dependency

This is a more robust solution than lodash's set().

* Replace lodash.set() with set-value's equivalent

* Rebuild renovate config

We added set-value to our dependencies.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Ryland Herrick 2020-04-29 11:58:46 -05:00 committed by GitHub
parent 0d4cfba4b4
commit f8e01bd3a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 3 deletions

View file

@ -846,6 +846,14 @@
'@types/semver',
],
},
{
groupSlug: 'set-value',
groupName: 'set-value related packages',
packageNames: [
'set-value',
'@types/set-value',
],
},
{
groupSlug: 'sinon',
groupName: 'sinon related packages',

View file

@ -105,6 +105,7 @@
"@types/recompose": "^0.30.6",
"@types/reduce-reducers": "^1.0.0",
"@types/redux-actions": "^2.6.1",
"@types/set-value": "^2.0.0",
"@types/sinon": "^7.0.13",
"@types/styled-components": "^4.4.2",
"@types/supertest": "^2.0.5",
@ -344,6 +345,7 @@
"rison-node": "0.3.1",
"rxjs": "^6.5.3",
"semver": "5.7.0",
"set-value": "^3.0.2",
"squel": "^5.13.0",
"stats-lite": "^2.2.0",
"style-it": "^2.1.3",

View file

@ -4,7 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { flow, set, omit } from 'lodash/fp';
import { flow, omit } from 'lodash/fp';
import set from 'set-value';
import { SearchResponse } from 'elasticsearch';
import { Logger } from '../../../../../../../src/core/server';
@ -55,8 +56,11 @@ export const transformAnomalyFieldsToEcs = (anomaly: Anomaly): EcsAnomaly => {
}
const omitDottedFields = omit(errantFields.map(field => field.name));
const setNestedFields = errantFields.map(field => set(field.name, field.value));
const setTimestamp = set('@timestamp', new Date(timestamp).toISOString());
const setNestedFields = errantFields.map(field => (_anomaly: Anomaly) =>
set(_anomaly, field.name, field.value)
);
const setTimestamp = (_anomaly: Anomaly) =>
set(_anomaly, '@timestamp', new Date(timestamp).toISOString());
return flow(omitDottedFields, setNestedFields, setTimestamp)(anomaly);
};

View file

@ -4798,6 +4798,11 @@
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45"
integrity sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==
"@types/set-value@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@types/set-value/-/set-value-2.0.0.tgz#63d386b103926dcf49b50e16e0f6dd49983046be"
integrity sha512-k8dCJEC80F/mbsIOZ5Hj3YSzTVVVBwMdtP/M9Rtc2TM4F5etVd+2UG8QUiAUfbXm4fABedL2tBZnrBheY7UwpA==
"@types/shot@*":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/shot/-/shot-4.0.0.tgz#7545500c489b65c69b5bc5446ba4fef3bd26af92"
@ -26910,6 +26915,13 @@ set-value@^2.0.0, set-value@^2.0.1:
is-plain-object "^2.0.3"
split-string "^3.0.1"
set-value@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/set-value/-/set-value-3.0.2.tgz#74e8ecd023c33d0f77199d415409a40f21e61b90"
integrity sha512-npjkVoz+ank0zjlV9F47Fdbjfj/PfXyVhZvGALWsyIYU/qrMzpi6avjKW3/7KeSU2Df3I46BrN1xOI1+6vW0hA==
dependencies:
is-plain-object "^2.0.4"
setimmediate@^1.0.4, setimmediate@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"