[Security Solutions][Lists] (Phase 1) Pulls constants from lists and security solutions plugin into its own kbn package (#99149) (#99298)
## Summary Pulls constants from lists plugin into its own kbn package. Phase 1: Lift and shift small shared constants into kbn package called `kbn-securitysolution-constants` Phase 2: Deprecate existing code now in packages Phase 3+: Strangle/remove existing code and use the code from the kbn package Co-authored-by: Frank Hassanabad <frank.hassanabad@elastic.co>
This commit is contained in:
parent
2c08ac4bda
commit
5040c61428
|
@ -77,6 +77,7 @@ yarn kbn watch-bazel
|
|||
- @kbn/expect
|
||||
- @kbn/legacy-logging
|
||||
- @kbn/logging
|
||||
- @kbn/securitysolution-constants
|
||||
- @kbn/securitysolution-utils
|
||||
- @kbn/securitysolution-io-ts-utils
|
||||
- @kbn/std
|
||||
|
|
|
@ -132,6 +132,7 @@
|
|||
"@kbn/legacy-logging": "link:bazel-bin/packages/kbn-legacy-logging/npm_module",
|
||||
"@kbn/logging": "link:bazel-bin/packages/kbn-logging/npm_module",
|
||||
"@kbn/monaco": "link:packages/kbn-monaco",
|
||||
"@kbn/securitysolution-constants": "link:bazel-bin/packages/kbn-securitysolution-constants/npm_module",
|
||||
"@kbn/securitysolution-utils": "link:bazel-bin/packages/kbn-securitysolution-utils/npm_module",
|
||||
"@kbn/securitysolution-io-ts-utils": "link:bazel-bin/packages/kbn-securitysolution-io-ts-utils/npm_module",
|
||||
"@kbn/server-http-tools": "link:packages/kbn-server-http-tools",
|
||||
|
|
|
@ -19,6 +19,7 @@ filegroup(
|
|||
"//packages/kbn-expect:build",
|
||||
"//packages/kbn-legacy-logging:build",
|
||||
"//packages/kbn-logging:build",
|
||||
"//packages/kbn-securitysolution-constants:build",
|
||||
"//packages/kbn-securitysolution-io-ts-utils:build",
|
||||
"//packages/kbn-securitysolution-utils:build",
|
||||
"//packages/kbn-std:build",
|
||||
|
|
84
packages/kbn-securitysolution-constants/BUILD.bazel
Normal file
84
packages/kbn-securitysolution-constants/BUILD.bazel
Normal file
|
@ -0,0 +1,84 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
||||
|
||||
PKG_BASE_NAME = "kbn-securitysolution-constants"
|
||||
|
||||
PKG_REQUIRE_NAME = "@kbn/securitysolution-constants"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.mock.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
"README.md",
|
||||
]
|
||||
|
||||
SRC_DEPS = [
|
||||
"@npm//tslib",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/node",
|
||||
]
|
||||
|
||||
DEPS = SRC_DEPS + TYPES_DEPS
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc",
|
||||
srcs = SRCS,
|
||||
args = ["--pretty"],
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
incremental = True,
|
||||
out_dir = "target",
|
||||
root_dir = "src",
|
||||
source_map = True,
|
||||
tsconfig = ":tsconfig",
|
||||
deps = DEPS,
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_BASE_NAME,
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":tsc"] + DEPS,
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [
|
||||
":%s" % PKG_BASE_NAME,
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [
|
||||
":npm_module",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
6
packages/kbn-securitysolution-constants/README.md
Normal file
6
packages/kbn-securitysolution-constants/README.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
# kbn-securitysolution-constants
|
||||
|
||||
This is where shared constants for security solution should go that are going to be shared among plugins.
|
||||
This was originally created to remove the dependencies between security_solution and other projects such as lists.
|
||||
|
||||
|
13
packages/kbn-securitysolution-constants/jest.config.js
Normal file
13
packages/kbn-securitysolution-constants/jest.config.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test',
|
||||
rootDir: '../..',
|
||||
roots: ['<rootDir>/packages/kbn-securitysolution-constants'],
|
||||
};
|
9
packages/kbn-securitysolution-constants/package.json
Normal file
9
packages/kbn-securitysolution-constants/package.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "@kbn/securitysolution-constants",
|
||||
"version": "1.0.0",
|
||||
"description": "security solution constants to use across plugins such lists, security_solution, cases, etc...",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"main": "./target/index.js",
|
||||
"types": "./target/index.d.ts",
|
||||
"private": true
|
||||
}
|
75
packages/kbn-securitysolution-constants/src/index.ts
Normal file
75
packages/kbn-securitysolution-constants/src/index.ts
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Value list routes
|
||||
*/
|
||||
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';
|
||||
|
||||
/**
|
||||
* This ID is used for _both_ the Saved Object ID and for the list_id
|
||||
* for the single global space agnostic endpoint list
|
||||
*/
|
||||
export const ENDPOINT_LIST_ID = 'endpoint_list';
|
||||
|
||||
/** The name of the single global space agnostic endpoint list */
|
||||
export const ENDPOINT_LIST_NAME = 'Endpoint Security Exception List';
|
||||
|
||||
/** The description of the single global space agnostic endpoint list */
|
||||
export const ENDPOINT_LIST_DESCRIPTION = 'Endpoint Security Exception List';
|
||||
|
||||
export const MAX_EXCEPTION_LIST_SIZE = 10000;
|
||||
|
||||
/** ID of trusted apps agnostic list */
|
||||
export const ENDPOINT_TRUSTED_APPS_LIST_ID = 'endpoint_trusted_apps';
|
||||
|
||||
/** Name of trusted apps agnostic list */
|
||||
export const ENDPOINT_TRUSTED_APPS_LIST_NAME = 'Endpoint Security Trusted Apps List';
|
||||
|
||||
/** Description of trusted apps agnostic list */
|
||||
export const ENDPOINT_TRUSTED_APPS_LIST_DESCRIPTION = 'Endpoint Security Trusted Apps List';
|
||||
|
||||
/** ID of event filters agnostic list */
|
||||
export const ENDPOINT_EVENT_FILTERS_LIST_ID = 'endpoint_event_filters';
|
||||
|
||||
/** Name of event filters agnostic list */
|
||||
export const ENDPOINT_EVENT_FILTERS_LIST_NAME = 'Endpoint Security Event Filters List';
|
||||
|
||||
/** Description of event filters agnostic list */
|
||||
export const ENDPOINT_EVENT_FILTERS_LIST_DESCRIPTION = 'Endpoint Security Event Filters List';
|
||||
|
||||
/** The default max signals without any additional configuration */
|
||||
export const DEFAULT_MAX_SIGNALS = 100;
|
19
packages/kbn-securitysolution-constants/tsconfig.json
Normal file
19
packages/kbn-securitysolution-constants/tsconfig.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"incremental": true,
|
||||
"outDir": "target",
|
||||
"rootDir": "src",
|
||||
"sourceMap": true,
|
||||
"sourceRoot": "../../../../packages/kbn-securitysolution-constants/src",
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -2691,6 +2691,7 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/securitysolution-constants@link:bazel-bin/packages/kbn-securitysolution-constants/npm_module":
|
||||
"@kbn/securitysolution-utils@link:bazel-bin/packages/kbn-securitysolution-utils/npm_module":
|
||||
"@kbn/securitysolution-io-ts-utils@link:bazel-bin/packages/kbn-securitysolution-io-ts-utils/npm_module":
|
||||
version "0.0.0"
|
||||
|
|
Loading…
Reference in a new issue