mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
chore(NA): splits types from code on @kbn/securitysolution-io-ts-utils (#121677)
* chore(NA): splits types from code on @kbn/securitysolution-io-ts-utils * chore(NA): fix package.json * chore(NA): merge and solve conflicts with main * chore(NA): remove any from types Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
9ca9fe7577
commit
0a75d426b9
14 changed files with 43 additions and 20 deletions
|
@ -590,6 +590,7 @@
|
|||
"@types/kbn__securitysolution-io-ts-alerting-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-alerting-types/npm_module_types",
|
||||
"@types/kbn__securitysolution-io-ts-list-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-list-types/npm_module_types",
|
||||
"@types/kbn__securitysolution-io-ts-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-types/npm_module_types",
|
||||
"@types/kbn__securitysolution-io-ts-utils": "link:bazel-bin/packages/kbn-securitysolution-io-ts-utils/npm_module_types",
|
||||
"@types/kbn__securitysolution-list-api": "link:bazel-bin/packages/kbn-securitysolution-list-api/npm_module_types",
|
||||
"@types/kbn__securitysolution-list-constants": "link:bazel-bin/packages/kbn-securitysolution-list-constants/npm_module_types",
|
||||
"@types/kbn__securitysolution-list-hooks": "link:bazel-bin/packages/kbn-securitysolution-list-hooks/npm_module_types",
|
||||
|
|
|
@ -107,6 +107,7 @@ filegroup(
|
|||
"//packages/kbn-securitysolution-io-ts-alerting-types:build_types",
|
||||
"//packages/kbn-securitysolution-io-ts-list-types:build_types",
|
||||
"//packages/kbn-securitysolution-io-ts-types:build_types",
|
||||
"//packages/kbn-securitysolution-io-ts-utils:build_types",
|
||||
"//packages/kbn-securitysolution-list-api:build_types",
|
||||
"//packages/kbn-securitysolution-list-constants:build_types",
|
||||
"//packages/kbn-securitysolution-list-hooks:build_types",
|
||||
|
|
|
@ -38,9 +38,10 @@ RUNTIME_DEPS = [
|
|||
|
||||
TYPES_DEPS = [
|
||||
"//packages/kbn-securitysolution-io-ts-types:npm_module_types",
|
||||
"//packages/kbn-securitysolution-io-ts-utils",
|
||||
"//packages/kbn-securitysolution-io-ts-utils:npm_module_types",
|
||||
"@npm//fp-ts",
|
||||
"@npm//io-ts",
|
||||
"@npm//tslib",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/uuid"
|
||||
|
|
|
@ -38,10 +38,11 @@ RUNTIME_DEPS = [
|
|||
|
||||
TYPES_DEPS = [
|
||||
"//packages/kbn-securitysolution-io-ts-types:npm_module_types",
|
||||
"//packages/kbn-securitysolution-io-ts-utils",
|
||||
"//packages/kbn-securitysolution-io-ts-utils:npm_module_types",
|
||||
"//packages/kbn-securitysolution-list-constants:npm_module_types",
|
||||
"@npm//fp-ts",
|
||||
"@npm//io-ts",
|
||||
"@npm//tslib",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/node",
|
||||
]
|
||||
|
|
|
@ -36,9 +36,10 @@ RUNTIME_DEPS = [
|
|||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"//packages/kbn-securitysolution-io-ts-utils",
|
||||
"//packages/kbn-securitysolution-io-ts-utils:npm_module_types",
|
||||
"@npm//fp-ts",
|
||||
"@npm//io-ts",
|
||||
"@npm//tslib",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/uuid"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
||||
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
|
||||
load("@npm//@bazel/typescript:index.bzl", "ts_config")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
|
||||
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
|
||||
|
||||
PKG_BASE_NAME = "kbn-securitysolution-io-ts-utils"
|
||||
PKG_REQUIRE_NAME = "@kbn/securitysolution-io-ts-utils"
|
||||
TYPES_PKG_REQUIRE_NAME = "@types/kbn__securitysolution-io-ts-utils"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
|
@ -86,7 +87,7 @@ ts_project(
|
|||
js_library(
|
||||
name = PKG_BASE_NAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
|
||||
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
@ -105,3 +106,20 @@ filegroup(
|
|||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = TYPES_PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [
|
||||
":npm_module_types",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
@ -5,6 +5,5 @@
|
|||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"browser": "./target_web/index.js",
|
||||
"main": "./target_node/index.js",
|
||||
"types": "./target_types/index.d.ts",
|
||||
"private": true
|
||||
}
|
||||
|
|
|
@ -38,10 +38,11 @@ RUNTIME_DEPS = [
|
|||
|
||||
TYPES_DEPS = [
|
||||
"//packages/kbn-securitysolution-io-ts-list-types:npm_module_types",
|
||||
"//packages/kbn-securitysolution-io-ts-utils",
|
||||
"//packages/kbn-securitysolution-io-ts-utils:npm_module_types",
|
||||
"//packages/kbn-securitysolution-list-constants:npm_module_types",
|
||||
"@npm//fp-ts",
|
||||
"@npm//io-ts",
|
||||
"@npm//tslib",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/node",
|
||||
]
|
||||
|
|
|
@ -52,8 +52,6 @@ TYPES_DEPS = [
|
|||
"@npm//@types/react",
|
||||
"@npm//@types/testing-library__react-hooks",
|
||||
"@npm//fp-ts",
|
||||
# TODO: Remove once the bug on pkg_npm_types around transitive type deps got solved
|
||||
"@npm//io-ts",
|
||||
"@npm//tslib",
|
||||
]
|
||||
|
||||
|
|
|
@ -74,11 +74,11 @@ export const transformInput = (exceptionItem: ExceptionListItemSchema): Exceptio
|
|||
export const addIdToExceptionItemEntries = (
|
||||
exceptionItem: ExceptionListItemSchema
|
||||
): ExceptionListItemSchema => {
|
||||
const entries = exceptionItem.entries.map((entry: any) => {
|
||||
const entries = exceptionItem.entries.map((entry) => {
|
||||
if (entry.type === 'nested') {
|
||||
return addIdToItem({
|
||||
...entry,
|
||||
entries: entry.entries.map((nestedEntry: any) => addIdToItem(nestedEntry)),
|
||||
entries: entry.entries.map((nestedEntry) => addIdToItem(nestedEntry)),
|
||||
});
|
||||
} else {
|
||||
return addIdToItem(entry);
|
||||
|
@ -100,11 +100,11 @@ export const removeIdFromExceptionItemsEntries = <T extends { entries: EntriesAr
|
|||
exceptionItem: T
|
||||
): T => {
|
||||
const { entries } = exceptionItem;
|
||||
const entriesNoId = entries.map((entry: any) => {
|
||||
const entriesNoId = entries.map((entry) => {
|
||||
if (entry.type === 'nested') {
|
||||
return removeIdFromItem({
|
||||
...entry,
|
||||
entries: entry.entries.map((nestedEntry: any) => removeIdFromItem(nestedEntry)),
|
||||
entries: entry.entries.map((nestedEntry) => removeIdFromItem(nestedEntry)),
|
||||
});
|
||||
} else {
|
||||
return removeIdFromItem<Entry>(entry);
|
||||
|
|
|
@ -203,7 +203,7 @@ export const useApi = (http: HttpStart): ExceptionsApi => {
|
|||
// This data transform is UI specific and useful for UI concerns
|
||||
// to compensate for the differences and preferences of how ReactJS might prefer
|
||||
// data vs. how we want to model data. View `transformInput` for more details
|
||||
exceptions: data.map((item: any) => transformInput(item)),
|
||||
exceptions: data.map((item) => transformInput(item)),
|
||||
pagination: {
|
||||
page,
|
||||
perPage,
|
||||
|
|
|
@ -120,7 +120,7 @@ export const useExceptionListItems = ({
|
|||
|
||||
// Please see `x-pack/plugins/lists/public/exceptions/transforms.ts` doc notes
|
||||
// for context around the temporary `id`
|
||||
const transformedData = data.map((item: any) => transformInput(item));
|
||||
const transformedData = data.map((item) => transformInput(item));
|
||||
|
||||
if (isSubscribed) {
|
||||
setPagination({
|
||||
|
|
|
@ -43,7 +43,7 @@ TYPES_DEPS = [
|
|||
"//packages/kbn-es-query:npm_module_types",
|
||||
"//packages/kbn-i18n:npm_module_types",
|
||||
"//packages/kbn-securitysolution-io-ts-list-types:npm_module_types",
|
||||
"//packages/kbn-securitysolution-io-ts-utils",
|
||||
"//packages/kbn-securitysolution-io-ts-utils:npm_module_types",
|
||||
"//packages/kbn-securitysolution-list-constants:npm_module_types",
|
||||
"//packages/kbn-securitysolution-utils:npm_module_types",
|
||||
"@npm//@elastic/elasticsearch",
|
||||
|
@ -51,8 +51,6 @@ TYPES_DEPS = [
|
|||
"@npm//@types/lodash",
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/uuid",
|
||||
# TODO: Remove once the bug on pkg_npm_types around transitive type deps got solved
|
||||
"@npm//io-ts",
|
||||
"@npm//tslib",
|
||||
]
|
||||
|
||||
|
|
|
@ -5957,6 +5957,10 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__securitysolution-io-ts-utils@link:bazel-bin/packages/kbn-securitysolution-io-ts-utils/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__securitysolution-list-api@link:bazel-bin/packages/kbn-securitysolution-list-api/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue