Skip to content

Commit

Permalink
Merge branch 'main' into 114483/use-data-plugin-migrations-for-search…
Browse files Browse the repository at this point in the history
…-sources-in-legacy-visualizations
  • Loading branch information
kibanamachine authored Jan 24, 2022
2 parents 9ec4edc + 79ff195 commit bfe9066
Show file tree
Hide file tree
Showing 149 changed files with 1,724 additions and 1,006 deletions.
4 changes: 0 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ const RESTRICTED_IMPORTS = [
name: 'react-use',
message: 'Please use react-use/lib/{method} instead.',
},
{
name: '@kbn/io-ts-utils',
message: `Import directly from @kbn/io-ts-utils/{method} submodules`,
},
];

module.exports = {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"**/istanbul-lib-coverage": "^3.2.0",
"**/json-schema": "^0.4.0",
"**/minimist": "^1.2.5",
"**/node-forge": "^1.1.0",
"**/node-forge": "^1.2.1",
"**/pdfkit/crypto-js": "4.0.0",
"**/react-syntax-highlighter": "^15.3.1",
"**/react-syntax-highlighter/**/highlight.js": "^10.4.1",
Expand Down Expand Up @@ -302,7 +302,7 @@
"mustache": "^2.3.2",
"nock": "12.0.3",
"node-fetch": "^2.6.1",
"node-forge": "^1.1.0",
"node-forge": "^1.2.1",
"nodemailer": "^6.6.2",
"normalize-path": "^3.0.0",
"object-hash": "^1.3.1",
Expand Down Expand Up @@ -578,6 +578,7 @@
"@types/kbn__i18n": "link:bazel-bin/packages/kbn-i18n/npm_module_types",
"@types/kbn__i18n-react": "link:bazel-bin/packages/kbn-i18n-react/npm_module_types",
"@types/kbn__interpreter": "link:bazel-bin/packages/kbn-interpreter/npm_module_types",
"@types/kbn__io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils/npm_module_types",
"@types/kbn__mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl/npm_module_types",
"@types/kbn__monaco": "link:bazel-bin/packages/kbn-monaco/npm_module_types",
"@types/kbn__optimizer": "link:bazel-bin/packages/kbn-optimizer/npm_module_types",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ filegroup(
"//packages/kbn-i18n:build_types",
"//packages/kbn-i18n-react:build_types",
"//packages/kbn-interpreter:build_types",
"//packages/kbn-io-ts-utils:build_types",
"//packages/kbn-mapbox-gl:build_types",
"//packages/kbn-monaco:build_types",
"//packages/kbn-optimizer:build_types",
Expand Down
37 changes: 22 additions & 15 deletions packages/kbn-io-ts-utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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-io-ts-utils"
PKG_REQUIRE_NAME = "@kbn/io-ts-utils"
TYPES_PKG_REQUIRE_NAME = "@types/kbn__io-ts-utils"

SOURCE_FILES = glob(
[
Expand All @@ -23,17 +24,6 @@ filegroup(

NPM_MODULE_EXTRA_FILES = [
"package.json",
"deep_exact_rt/package.json",
"iso_to_epoch_rt/package.json",
"json_rt/package.json",
"merge_rt/package.json",
"non_empty_string_rt/package.json",
"parseable_types/package.json",
"props_to_schema/package.json",
"strict_keys_rt/package.json",
"to_boolean_rt/package.json",
"to_json_schema/package.json",
"to_number_rt/package.json",
]

RUNTIME_DEPS = [
Expand Down Expand Up @@ -86,7 +76,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand All @@ -105,3 +95,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"],
)
4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/deep_exact_rt/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/iso_to_epoch_rt/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/json_rt/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/merge_rt/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/non_empty_string_rt/package.json

This file was deleted.

1 change: 0 additions & 1 deletion packages/kbn-io-ts-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@kbn/io-ts-utils",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
Expand Down
4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/parseable_types/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/props_to_schema/package.json

This file was deleted.

2 changes: 2 additions & 0 deletions packages/kbn-io-ts-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Side Public License, v 1.
*/

export type { NonEmptyStringBrand } from './non_empty_string_rt';

export { deepExactRt } from './deep_exact_rt';
export { jsonRt } from './json_rt';
export { mergeRt } from './merge_rt';
Expand Down
4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/strict_keys_rt/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/to_boolean_rt/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/to_json_schema/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/kbn-io-ts-utils/to_number_rt/package.json

This file was deleted.

3 changes: 3 additions & 0 deletions packages/kbn-rule-data-utils/src/technical_field_names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const ALERT_RULE_CREATED_AT = `${ALERT_RULE_NAMESPACE}.created_at` as const;
const ALERT_RULE_CREATED_BY = `${ALERT_RULE_NAMESPACE}.created_by` as const;
const ALERT_RULE_DESCRIPTION = `${ALERT_RULE_NAMESPACE}.description` as const;
const ALERT_RULE_ENABLED = `${ALERT_RULE_NAMESPACE}.enabled` as const;
const ALERT_RULE_EXECUTION_UUID = `${ALERT_RULE_NAMESPACE}.execution.uuid` as const;
const ALERT_RULE_FROM = `${ALERT_RULE_NAMESPACE}.from` as const;
const ALERT_RULE_INTERVAL = `${ALERT_RULE_NAMESPACE}.interval` as const;
const ALERT_RULE_LICENSE = `${ALERT_RULE_NAMESPACE}.license` as const;
Expand Down Expand Up @@ -103,6 +104,7 @@ const fields = {
ALERT_RULE_CREATED_BY,
ALERT_RULE_DESCRIPTION,
ALERT_RULE_ENABLED,
ALERT_RULE_EXECUTION_UUID,
ALERT_RULE_FROM,
ALERT_RULE_INTERVAL,
ALERT_RULE_LICENSE,
Expand Down Expand Up @@ -156,6 +158,7 @@ export {
ALERT_RULE_CREATED_BY,
ALERT_RULE_DESCRIPTION,
ALERT_RULE_ENABLED,
ALERT_RULE_EXECUTION_UUID,
ALERT_RULE_FROM,
ALERT_RULE_INTERVAL,
ALERT_RULE_LICENSE,
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-server-route-repository/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RUNTIME_DEPS = [

TYPES_DEPS = [
"//packages/kbn-config-schema:npm_module_types",
"//packages/kbn-io-ts-utils",
"//packages/kbn-io-ts-utils:npm_module_types",
"@npm//@hapi/boom",
"@npm//fp-ts",
"@npm//utility-types",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
import { jsonRt } from '@kbn/io-ts-utils';
import * as t from 'io-ts';
import { decodeRequestParams } from './decode_request_params';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { omitBy, isPlainObject, isEmpty } from 'lodash';
import { isLeft } from 'fp-ts/lib/Either';
import { PathReporter } from 'io-ts/lib/PathReporter';
import Boom from '@hapi/boom';
import { strictKeysRt } from '@kbn/io-ts-utils/strict_keys_rt';
import { strictKeysRt } from '@kbn/io-ts-utils';
import { RouteParamsRT } from './typings';

interface KibanaRequestParams {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-typed-react-router-config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUNTIME_DEPS = [
]

TYPES_DEPS = [
"//packages/kbn-io-ts-utils",
"//packages/kbn-io-ts-utils:npm_module_types",
"@npm//query-string",
"@npm//utility-types",
"@npm//@types/jest",
Expand Down
53 changes: 21 additions & 32 deletions packages/kbn-typed-react-router-config/src/create_router.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@
*/
import React from 'react';
import * as t from 'io-ts';
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
import { toNumberRt } from '@kbn/io-ts-utils';
import { createRouter } from './create_router';
import { createMemoryHistory } from 'history';
import { route } from './route';

describe('createRouter', () => {
const routes = route([
{
path: '/',
const routes = {
'/': {
element: <></>,
children: [
{
path: '/',
children: {
'/': {
element: <></>,
params: t.type({
query: t.type({
Expand All @@ -32,45 +29,39 @@ describe('createRouter', () => {
rangeFrom: 'now-30m',
},
},
children: [
{
path: '/services/{serviceName}/errors',
children: {
'/services/{serviceName}/errors': {
element: <></>,
params: t.type({
path: t.type({
serviceName: t.string,
}),
}),
children: [
{
path: '/services/{serviceName}/errors/{groupId}',
children: {
'/services/{serviceName}/errors/{groupId}': {
element: <></>,
params: t.type({
path: t.type({ groupId: t.string }),
}),
},
{
path: '/services/{serviceName}/errors',
'/services/{serviceName}/errors': {
element: <></>,
},
],
},
},
{
path: '/services',
'/services': {
element: <></>,
params: t.type({
query: t.type({
transactionType: t.string,
}),
}),
},
{
path: '/services/{serviceName}',
'/services/{serviceName}': {
element: <></>,
children: [
{
children: {
'/services/{serviceName}': {
element: <></>,
path: '/services/{serviceName}',
params: t.type({
path: t.type({
serviceName: t.string,
Expand All @@ -81,10 +72,9 @@ describe('createRouter', () => {
}),
}),
},
],
},
},
{
path: '/traces',
'/traces': {
element: <></>,
params: t.type({
query: t.type({
Expand All @@ -93,20 +83,19 @@ describe('createRouter', () => {
}),
}),
},
{
path: '/service-map',
'/service-map': {
element: <></>,
params: t.type({
query: t.type({
maxNumNodes: t.string.pipe(toNumberRt as any),
}),
}),
},
],
},
},
],
},
},
] as const);
};

let history = createMemoryHistory();
const router = createRouter(routes);
Expand Down
Loading

0 comments on commit bfe9066

Please sign in to comment.