kibana/packages
Marshall Main 482f819a05
[Security Solution][Alerts] Replace schemas derived from FieldMaps with versioned alert schema (#127218)
* Replace schemas derived from FieldMaps with versioned alert schema

* Import fixes and comment

* Another import fix

* Separate read and write schemas

* Separate read and write schemas for common alert fields

* fix import

* Update ALERT_RULE_PARAMETERS type

* Fix getField type

* Fix more types

* Remove unneeded index signature from PersistenceAlertServiceResult

* Fix types and tests

* Update comment describing new schema process

* Update Ancestor800 type

* Add modified PR description as initial README

* Remove duplication in CommonAlertFields definition

* Add explicit undefined value for rule in mock

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-29 20:11:55 -07:00
..
elastic-apm-synthtrace [APM] fix cypress (#128411) 2022-03-29 12:16:32 -07:00
elastic-datemath [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
elastic-eslint-config-kibana chore(NA): upgrade typescript-eslint packages to v5.14.0 (#127275) 2022-03-10 22:44:06 +00:00
elastic-safer-lodash-set chore(NA): splits types from code on @elastic/safer-lodash-set (#122697) 2022-01-12 19:10:36 +00:00
kbn-ace [type-summarizer] summarize types with source-maps for @kbn/ace (#127680) 2022-03-18 16:44:16 +01:00
kbn-alerts [type-summarizer] summarize @kbn/alerts types with source-maps (#128191) 2022-03-21 12:17:36 -07:00
kbn-analytics [type-summarizer] enable @kbn/analytics, @kbn/apm-config-loader and @kbn/apm-utils (#128206) 2022-03-22 16:28:49 -06:00
kbn-apm-config-loader [type-summarizer] enable @kbn/analytics, @kbn/apm-config-loader and @kbn/apm-utils (#128206) 2022-03-22 16:28:49 -06:00
kbn-apm-utils [type-summarizer] enable @kbn/analytics, @kbn/apm-config-loader and @kbn/apm-utils (#128206) 2022-03-22 16:28:49 -06:00
kbn-axe-config [axe-config] extract module to it's own package (#128815) 2022-03-29 15:12:14 -07:00
kbn-babel-code-parser [eslint] automatically determine dev packages (#127089) 2022-03-08 07:42:06 -06:00
kbn-babel-preset [emotion] Output meaningful classnames in dev mode (#127531) 2022-03-11 11:58:24 -06:00
kbn-bazel-packages [bazel/packages] make package discovery dirs easier to extend (#127836) 2022-03-16 08:57:29 -06:00
kbn-cli-dev-mode [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-config [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-config-schema [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-crypto [ts] enable sourcemaps in summarized types of @kbn/crypto (#126410) 2022-03-04 08:02:02 -06:00
kbn-dev-utils [ci-stats-reporter] prevent Request body larger than maxBodyLength limit error (#128840) 2022-03-29 17:53:38 -06:00
kbn-doc-links add link to ilm docs (#128656) 2022-03-29 17:27:55 +01:00
kbn-docs-utils [plugin-discovery] move logic to a package (#128684) 2022-03-29 13:19:58 -06:00
kbn-es Extend yarn es: plugin support + adding secure files to es keystore (#126938) 2022-03-09 11:11:34 +01:00
kbn-es-archiver [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-es-query Fix unhandled alias search errors (#128289) 2022-03-24 11:52:21 -07:00
kbn-eslint-import-resolver-kibana chore(NA): use internal pkg_npm on @kbn/eslint-import-resolver-kibana (#120786) 2021-12-08 10:48:49 -07:00
kbn-eslint-plugin-eslint chore(NA): use internal pkg_npm on @kbn/eslint-plugin-eslint (#120940) 2021-12-10 02:45:33 +00:00
kbn-expect chore(NA): use internal pkg_npm on @kbn/expect (#120941) 2021-12-10 02:45:49 +00:00
kbn-field-types [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-flot-charts Tweak Canvas plot renderer (#126862) 2022-03-04 10:00:03 -05:00
kbn-generate fix(NA): do not declare @types packages as prod dependencies when generating the pkg.json (#128805) 2022-03-29 14:12:19 -07:00
kbn-i18n [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-i18n-react [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-interpreter [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-io-ts-utils [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-logging [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-logging-mocks [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-mapbox-gl [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-monaco [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-optimizer [plugin-discovery] move logic to a package (#128684) 2022-03-29 13:19:58 -06:00
kbn-plugin-discovery [plugin-discovery] move logic to a package (#128684) 2022-03-29 13:19:58 -06:00
kbn-plugin-generator [eslint] automatically determine dev packages (#127089) 2022-03-08 07:42:06 -06:00
kbn-plugin-helpers [plugin-discovery] move logic to a package (#128684) 2022-03-29 13:19:58 -06:00
kbn-pm [ci-stats-reporter] prevent Request body larger than maxBodyLength limit error (#128840) 2022-03-29 17:53:38 -06:00
kbn-react-field [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-rule-data-utils [Security Solution][Alerts] Replace schemas derived from FieldMaps with versioned alert schema (#127218) 2022-03-29 20:11:55 -07:00
kbn-securitysolution-autocomplete [Security Solution][Endpoint] Update warning text for event filter matches operator (#127958) 2022-03-17 13:10:28 -07:00
kbn-securitysolution-es-utils [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-hook-utils [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-io-ts-alerting-types [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-io-ts-list-types Create generic get filter method to be used with an array of list id's (#127983) 2022-03-24 08:23:21 +01:00
kbn-securitysolution-io-ts-types [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-io-ts-utils [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-list-api Set filter to undefined when it's empty on findExceptionLists method (#128455) 2022-03-29 12:44:31 +02:00
kbn-securitysolution-list-constants [Security Solution] add blocklist list (#126390) 2022-03-01 09:46:13 -06:00
kbn-securitysolution-list-hooks [Security Solution] Consider exceptions when loading threshold alert timelines (#128495) 2022-03-29 15:09:55 -04:00
kbn-securitysolution-list-utils [Security Solution] Consider exceptions when loading threshold alert timelines (#128495) 2022-03-29 15:09:55 -04:00
kbn-securitysolution-rules [Security Solution][Detections] Adds rule execution log table (#126215) 2022-03-28 16:42:46 -06:00
kbn-securitysolution-t-grid [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-utils [Security Solution] update blocklist fields to use file prefix (#128291) 2022-03-23 21:04:29 -07:00
kbn-server-http-tools [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-server-route-repository [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-shared-ux-components [SharedUX] Add url-loader to BAZEL.build (#128650) 2022-03-29 22:41:00 +02:00
kbn-shared-ux-services [Telemetry] Move privacy statement URL to doc links (#126597) 2022-03-18 10:56:38 +01:00
kbn-shared-ux-storybook [sharedUX] Move to Package-based Architecture (#127546) 2022-03-16 17:13:58 -04:00
kbn-shared-ux-utility [sharedUX] Move to Package-based Architecture (#127546) 2022-03-16 17:13:58 -04:00
kbn-spec-to-console chore(NA): use internal pkg_npm on @kbn/spec-to-console (#121812) 2021-12-22 03:21:00 +00:00
kbn-std [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-storybook Fix Storybook background/grid selection (#125961) 2022-03-19 09:29:49 -05:00
kbn-telemetry-tools chore(NA): upgrade typescript-eslint packages to v5.14.0 (#127275) 2022-03-10 22:44:06 +00:00
kbn-test [axe-config] extract module to it's own package (#128815) 2022-03-29 15:12:14 -07:00
kbn-test-jest-helpers [axe-config] extract module to it's own package (#128815) 2022-03-29 15:12:14 -07:00
kbn-test-subj-selector chore(NA): use internal pkg_npm on @kbn/test-subj-selector (#121839) 2021-12-22 14:00:50 -07:00
kbn-timelion-grammar chore(NA): use internal pkg_npm on @kbn/timelion-grammar (#121840) 2021-12-22 09:36:21 -07:00
kbn-tinymath chore(NA): use internal pkg_npm on @kbn/tinymath (#121920) 2021-12-23 02:53:20 +00:00
kbn-type-summarizer [plugin-discovery] move logic to a package (#128684) 2022-03-29 13:19:58 -06:00
kbn-typed-react-router-config [APM] Improve error message for route matching (#126455) 2022-03-01 14:49:27 +01:00
kbn-ui-framework chore(NA): use internal pkg_npm on @kbn/ui-framework (#121922) 2021-12-23 02:53:36 +00:00
kbn-ui-shared-deps-npm [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-ui-shared-deps-src [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-ui-theme [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-utility-types [eslint] automatically determine dev packages (#127089) 2022-03-08 07:42:06 -06:00
kbn-utils [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
BUILD.bazel [axe-config] extract module to it's own package (#128815) 2022-03-29 15:12:14 -07:00
README.md Remove grunt (#111882) 2021-09-16 15:24:42 -04:00

Kibana-related packages

This folder contains packages that are intended for use in Kibana and Kibana plugins.

tl;dr:

  • Don't publish to npm registry
  • Always use the @kbn namespace
  • Always set "private": true in package.json

Using these packages

We no longer publish these packages to the npm registry. Now, instead of specifying a version when including these packages, we rely on yarn workspaces, which sets up a symlink to the package.

For example if you want to use the @kbn/i18n package in Kibana itself, you can specify the dependency like this:

"@kbn/i18n": "1.0.0"

However, if you want to use this from a Kibana plugin, you need to use a link: dependency and account for the relative location of the Kibana repo, so it would instead be:

"@kbn/i18n": "link:../../kibana/packages/kbn-i18n"

How all of this works is described in more detail in the @kbn/pm docs.

Creating a new package

Create a new sub-folder. The name of the folder should mirror the name in the package's package.json. E.g. if the name is @kbn/i18n the folder name should be kbn-i18n.

All new packages should use the @kbn namespace, and should be marked with "private": true.

Unit tests for a package

Currently there is only one tool being used in order to test packages which is Jest. Below we will explain how it should be done.

Jest

A package should follow the pattern of having .test.js files as siblings of the source code files, and these run by Jest.

A package using the .test.js naming convention will have those tests automatically picked up by Jest and run by the unit test runner, currently mapped to the Kibana test script in the root package.json.

  • yarn test runs all unit tests.
  • yarn jest runs all Jest tests in Kibana.

In order for the plugin or package to use Jest, a jest.config.js file must be present in it's root. However, there are safeguards for this in CI should a test file be added without a corresponding config file.


Each package can also specify its own test script in the package's package.json, for cases where you'd prefer to run the tests from the local package directory.