[Security Solution] Utilizes constants package and deletes duplicate code (#100513)

## Summary

Utilizes constants package and deletes duplicate code

* Renames the `securitysolution-constants` to be `securitysolution-list-constants` to be specific
* Deletes duplicated code found during cleanup
* Moves more tests into the packages found along the way with the duplicated code
* Moves `parseScheduleDates` from `@kbn/securitysolution-io-ts-types` to `@kbn/securitysolution-io-ts-utils`

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This commit is contained in:
Frank Hassanabad 2021-05-24 18:38:14 -06:00 committed by GitHub
parent 676d40ebbe
commit aa2f5b535d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
168 changed files with 751 additions and 1356 deletions

View file

@ -29,6 +29,7 @@ NPM_MODULE_EXTRA_FILES = [
SRC_DEPS = [
"//packages/kbn-securitysolution-io-ts-utils",
"//packages/kbn-securitysolution-list-constants",
"//packages/kbn-securitysolution-io-ts-list-types",
"@npm//fp-ts",
"@npm//io-ts",

View file

@ -31,14 +31,14 @@ import {
UpdateExceptionListProps,
} from '@kbn/securitysolution-io-ts-list-types';
import { toError, toPromise } from '../fp_utils';
import {
ENDPOINT_LIST_URL,
EXCEPTION_LIST_ITEM_URL,
EXCEPTION_LIST_NAMESPACE,
EXCEPTION_LIST_NAMESPACE_AGNOSTIC,
EXCEPTION_LIST_URL,
} from '../constants';
} from '@kbn/securitysolution-list-constants';
import { toError, toPromise } from '../fp_utils';
/**
* Add new ExceptionList

View file

@ -1,39 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
// TODO: These should be all replaced with constants from a shared kbn constants package
export const LIST_URL = '/api/lists';
export const LIST_INDEX = `${LIST_URL}/index`;
export const LIST_ITEM_URL = `${LIST_URL}/items`;
export const LIST_PRIVILEGES_URL = `${LIST_URL}/privileges`;
/**
* Exception list routes
*/
export const EXCEPTION_LIST_URL = '/api/exception_lists';
export const EXCEPTION_LIST_ITEM_URL = '/api/exception_lists/items';
/**
* Exception list spaces
*/
export const EXCEPTION_LIST_NAMESPACE_AGNOSTIC = 'exception-list-agnostic';
export const EXCEPTION_LIST_NAMESPACE = 'exception-list';
/**
* Specific routes for the single global space agnostic endpoint list
*/
export const ENDPOINT_LIST_URL = '/api/endpoint_list';
/**
* Specific routes for the single global space agnostic endpoint list. These are convenience
* routes where they are going to try and create the global space agnostic endpoint list if it
* does not exist yet or if it was deleted at some point and re-create it before adding items to
* the list
*/
export const ENDPOINT_LIST_ITEM_URL = '/api/endpoint_list/items';

View file

@ -30,10 +30,14 @@ import {
listItemIndexExistSchema,
listSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import {
LIST_INDEX,
LIST_ITEM_URL,
LIST_PRIVILEGES_URL,
LIST_URL,
} from '@kbn/securitysolution-list-constants';
import { toError, toPromise } from '../fp_utils';
import { LIST_INDEX, LIST_ITEM_URL, LIST_PRIVILEGES_URL, LIST_URL } from '../constants';
import {
ApiParams,
DeleteListParams,