Skip to content

Commit 735948d

Browse files
chore(NA): splits types from code on @kbn/io-ts-utils (elastic#123431)
* chore(NA): splits types from code on @kbn/io-ts-utils * chore(NA): missing import keys Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent 7255901 commit 735948d

File tree

40 files changed

+52
-92
lines changed

40 files changed

+52
-92
lines changed

.eslintrc.js

-4
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,6 @@ const RESTRICTED_IMPORTS = [
226226
name: 'react-use',
227227
message: 'Please use react-use/lib/{method} instead.',
228228
},
229-
{
230-
name: '@kbn/io-ts-utils',
231-
message: `Import directly from @kbn/io-ts-utils/{method} submodules`,
232-
},
233229
];
234230

235231
module.exports = {

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@
578578
"@types/kbn__i18n": "link:bazel-bin/packages/kbn-i18n/npm_module_types",
579579
"@types/kbn__i18n-react": "link:bazel-bin/packages/kbn-i18n-react/npm_module_types",
580580
"@types/kbn__interpreter": "link:bazel-bin/packages/kbn-interpreter/npm_module_types",
581+
"@types/kbn__io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils/npm_module_types",
581582
"@types/kbn__mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl/npm_module_types",
582583
"@types/kbn__monaco": "link:bazel-bin/packages/kbn-monaco/npm_module_types",
583584
"@types/kbn__optimizer": "link:bazel-bin/packages/kbn-optimizer/npm_module_types",

packages/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ filegroup(
9797
"//packages/kbn-i18n:build_types",
9898
"//packages/kbn-i18n-react:build_types",
9999
"//packages/kbn-interpreter:build_types",
100+
"//packages/kbn-io-ts-utils:build_types",
100101
"//packages/kbn-mapbox-gl:build_types",
101102
"//packages/kbn-monaco:build_types",
102103
"//packages/kbn-optimizer:build_types",

packages/kbn-io-ts-utils/BUILD.bazel

+22-15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
2-
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
3-
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
1+
load("@npm//@bazel/typescript:index.bzl", "ts_config")
2+
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
3+
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
44

55
PKG_BASE_NAME = "kbn-io-ts-utils"
66
PKG_REQUIRE_NAME = "@kbn/io-ts-utils"
7+
TYPES_PKG_REQUIRE_NAME = "@types/kbn__io-ts-utils"
78

89
SOURCE_FILES = glob(
910
[
@@ -23,17 +24,6 @@ filegroup(
2324

2425
NPM_MODULE_EXTRA_FILES = [
2526
"package.json",
26-
"deep_exact_rt/package.json",
27-
"iso_to_epoch_rt/package.json",
28-
"json_rt/package.json",
29-
"merge_rt/package.json",
30-
"non_empty_string_rt/package.json",
31-
"parseable_types/package.json",
32-
"props_to_schema/package.json",
33-
"strict_keys_rt/package.json",
34-
"to_boolean_rt/package.json",
35-
"to_json_schema/package.json",
36-
"to_number_rt/package.json",
3727
]
3828

3929
RUNTIME_DEPS = [
@@ -86,7 +76,7 @@ ts_project(
8676
js_library(
8777
name = PKG_BASE_NAME,
8878
srcs = NPM_MODULE_EXTRA_FILES,
89-
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
79+
deps = RUNTIME_DEPS + [":target_node"],
9080
package_name = PKG_REQUIRE_NAME,
9181
visibility = ["//visibility:public"],
9282
)
@@ -105,3 +95,20 @@ filegroup(
10595
],
10696
visibility = ["//visibility:public"],
10797
)
98+
99+
pkg_npm_types(
100+
name = "npm_module_types",
101+
srcs = SRCS,
102+
deps = [":tsc_types"],
103+
package_name = TYPES_PKG_REQUIRE_NAME,
104+
tsconfig = ":tsconfig",
105+
visibility = ["//visibility:public"],
106+
)
107+
108+
filegroup(
109+
name = "build_types",
110+
srcs = [
111+
":npm_module_types",
112+
],
113+
visibility = ["//visibility:public"],
114+
)

packages/kbn-io-ts-utils/deep_exact_rt/package.json

-4
This file was deleted.

packages/kbn-io-ts-utils/iso_to_epoch_rt/package.json

-4
This file was deleted.

packages/kbn-io-ts-utils/json_rt/package.json

-4
This file was deleted.

packages/kbn-io-ts-utils/merge_rt/package.json

-4
This file was deleted.

packages/kbn-io-ts-utils/non_empty_string_rt/package.json

-4
This file was deleted.

packages/kbn-io-ts-utils/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "@kbn/io-ts-utils",
33
"main": "./target_node/index.js",
4-
"types": "./target_types/index.d.ts",
54
"version": "1.0.0",
65
"license": "SSPL-1.0 OR Elastic License 2.0",
76
"private": true

packages/kbn-io-ts-utils/parseable_types/package.json

-4
This file was deleted.

packages/kbn-io-ts-utils/props_to_schema/package.json

-4
This file was deleted.

packages/kbn-io-ts-utils/src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* Side Public License, v 1.
77
*/
88

9+
export type { NonEmptyStringBrand } from './non_empty_string_rt';
10+
911
export { deepExactRt } from './deep_exact_rt';
1012
export { jsonRt } from './json_rt';
1113
export { mergeRt } from './merge_rt';

packages/kbn-io-ts-utils/strict_keys_rt/package.json

-4
This file was deleted.

packages/kbn-io-ts-utils/to_boolean_rt/package.json

-4
This file was deleted.

packages/kbn-io-ts-utils/to_json_schema/package.json

-4
This file was deleted.

packages/kbn-io-ts-utils/to_number_rt/package.json

-4
This file was deleted.

packages/kbn-server-route-repository/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RUNTIME_DEPS = [
3838

3939
TYPES_DEPS = [
4040
"//packages/kbn-config-schema:npm_module_types",
41-
"//packages/kbn-io-ts-utils",
41+
"//packages/kbn-io-ts-utils:npm_module_types",
4242
"@npm//@hapi/boom",
4343
"@npm//fp-ts",
4444
"@npm//utility-types",

packages/kbn-server-route-repository/src/decode_request_params.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* in compliance with, at your election, the Elastic License 2.0 or the Server
66
* Side Public License, v 1.
77
*/
8-
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
8+
import { jsonRt } from '@kbn/io-ts-utils';
99
import * as t from 'io-ts';
1010
import { decodeRequestParams } from './decode_request_params';
1111

packages/kbn-server-route-repository/src/decode_request_params.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { omitBy, isPlainObject, isEmpty } from 'lodash';
1010
import { isLeft } from 'fp-ts/lib/Either';
1111
import { PathReporter } from 'io-ts/lib/PathReporter';
1212
import Boom from '@hapi/boom';
13-
import { strictKeysRt } from '@kbn/io-ts-utils/strict_keys_rt';
13+
import { strictKeysRt } from '@kbn/io-ts-utils';
1414
import { RouteParamsRT } from './typings';
1515

1616
interface KibanaRequestParams {

packages/kbn-typed-react-router-config/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ RUNTIME_DEPS = [
3737
]
3838

3939
TYPES_DEPS = [
40-
"//packages/kbn-io-ts-utils",
40+
"//packages/kbn-io-ts-utils:npm_module_types",
4141
"@npm//query-string",
4242
"@npm//utility-types",
4343
"@npm//@types/jest",

packages/kbn-typed-react-router-config/src/create_router.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
import React from 'react';
99
import * as t from 'io-ts';
10-
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
10+
import { toNumberRt } from '@kbn/io-ts-utils';
1111
import { createRouter } from './create_router';
1212
import { createMemoryHistory } from 'history';
1313
import { route } from './route';

packages/kbn-typed-react-router-config/src/create_router.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import {
1515
} from 'react-router-config';
1616
import qs from 'query-string';
1717
import { findLastIndex, merge, compact } from 'lodash';
18-
import { mergeRt } from '@kbn/io-ts-utils/merge_rt';
19-
import { deepExactRt } from '@kbn/io-ts-utils/deep_exact_rt';
18+
import { deepExactRt, mergeRt } from '@kbn/io-ts-utils';
2019
import { FlattenRoutesOf, Route, Router } from './types';
2120

2221
function toReactRouterPath(path: string) {

x-pack/plugins/apm/common/environment_rt.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77
import * as t from 'io-ts';
8-
import { nonEmptyStringRt } from '@kbn/io-ts-utils/non_empty_string_rt';
8+
import { nonEmptyStringRt } from '@kbn/io-ts-utils';
99
import {
1010
ENVIRONMENT_ALL,
1111
ENVIRONMENT_NOT_DEFINED,

x-pack/plugins/apm/public/components/routing/home/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n';
88
import { Outlet } from '@kbn/typed-react-router-config';
99
import * as t from 'io-ts';
1010
import React from 'react';
11-
import { toBooleanRt } from '@kbn/io-ts-utils/to_boolean_rt';
11+
import { toBooleanRt } from '@kbn/io-ts-utils';
1212
import { RedirectTo } from '../redirect_to';
1313
import { comparisonTypeRt } from '../../../../common/runtime_types/comparison_type_rt';
1414
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';

x-pack/plugins/apm/public/components/routing/service_detail/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as t from 'io-ts';
88
import { i18n } from '@kbn/i18n';
99
import React from 'react';
1010
import { Outlet } from '@kbn/typed-react-router-config';
11-
import { toBooleanRt } from '@kbn/io-ts-utils/to_boolean_rt';
11+
import { toBooleanRt } from '@kbn/io-ts-utils';
1212
import { comparisonTypeRt } from '../../../../common/runtime_types/comparison_type_rt';
1313
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
1414
import { environmentRt } from '../../../../common/environment_rt';

x-pack/plugins/apm/server/routes/apm_routes/register_apm_server_routes.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77

8-
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
8+
import { jsonRt } from '@kbn/io-ts-utils';
99
import { createServerRouteRepository } from '@kbn/server-route-repository';
1010
import { ServerRoute } from '@kbn/server-route-repository';
1111
import * as t from 'io-ts';

x-pack/plugins/apm/server/routes/apm_routes/register_apm_server_routes.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import {
1717
parseEndpoint,
1818
routeValidationObject,
1919
} from '@kbn/server-route-repository';
20-
import { mergeRt } from '@kbn/io-ts-utils/merge_rt';
21-
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
20+
import { jsonRt, mergeRt } from '@kbn/io-ts-utils';
2221
import { pickKeys } from '../../../common/utils/pick_keys';
2322
import { APMRouteHandlerResources, TelemetryUsageCounter } from '../typings';
2423
import type { ApmPluginRequestHandlerContext } from '../typings';

x-pack/plugins/apm/server/routes/backends/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import * as t from 'io-ts';
9-
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
9+
import { toNumberRt } from '@kbn/io-ts-utils';
1010
import { setupRequest } from '../../lib/helpers/setup_request';
1111
import {
1212
environmentRt,

x-pack/plugins/apm/server/routes/correlations/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as t from 'io-ts';
99
import Boom from '@hapi/boom';
1010

1111
import { i18n } from '@kbn/i18n';
12-
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
12+
import { toNumberRt } from '@kbn/io-ts-utils';
1313

1414
import { isActivePlatinumLicense } from '../../../common/license_check';
1515

x-pack/plugins/apm/server/routes/default_api_types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import * as t from 'io-ts';
9-
import { isoToEpochRt } from '@kbn/io-ts-utils/iso_to_epoch_rt';
9+
import { isoToEpochRt } from '@kbn/io-ts-utils';
1010

1111
export { environmentRt } from '../../common/environment_rt';
1212

x-pack/plugins/apm/server/routes/errors/route.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
* 2.0.
66
*/
77

8-
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
9-
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
8+
import { jsonRt, toNumberRt } from '@kbn/io-ts-utils';
109
import * as t from 'io-ts';
1110
import { createApmServerRoute } from '../apm_routes/create_apm_server_route';
1211
import { getErrorDistribution } from './distribution/get_distribution';

x-pack/plugins/apm/server/routes/latency_distribution/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import * as t from 'io-ts';
9-
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
9+
import { toNumberRt } from '@kbn/io-ts-utils';
1010
import { getOverallLatencyDistribution } from './get_overall_latency_distribution';
1111
import { setupRequest } from '../../lib/helpers/setup_request';
1212
import { createApmServerRoute } from '../apm_routes/create_apm_server_route';

x-pack/plugins/apm/server/routes/observability_overview/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import * as t from 'io-ts';
9-
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
9+
import { toNumberRt } from '@kbn/io-ts-utils';
1010
import { setupRequest } from '../../lib/helpers/setup_request';
1111
import { getServiceCount } from './get_service_count';
1212
import { getTransactionsPerMinute } from './get_transactions_per_minute';

x-pack/plugins/apm/server/routes/rum_client/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
import * as t from 'io-ts';
88
import { Logger } from 'kibana/server';
9-
import { isoToEpochRt } from '@kbn/io-ts-utils/iso_to_epoch_rt';
9+
import { isoToEpochRt } from '@kbn/io-ts-utils';
1010
import { setupRequest, Setup } from '../../lib/helpers/setup_request';
1111
import { getClientMetrics } from './get_client_metrics';
1212
import { getJSErrors } from './get_js_errors';

x-pack/plugins/apm/server/routes/services/route.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
*/
77

88
import Boom from '@hapi/boom';
9-
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
10-
import { isoToEpochRt } from '@kbn/io-ts-utils/iso_to_epoch_rt';
11-
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
9+
import { isoToEpochRt, jsonRt, toNumberRt } from '@kbn/io-ts-utils';
1210
import * as t from 'io-ts';
1311
import { uniq } from 'lodash';
1412
import { latencyAggregationTypeRt } from '../../../common/latency_aggregation_types';

x-pack/plugins/apm/server/routes/settings/agent_configuration/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import * as t from 'io-ts';
99
import Boom from '@hapi/boom';
10-
import { toBooleanRt } from '@kbn/io-ts-utils/to_boolean_rt';
10+
import { toBooleanRt } from '@kbn/io-ts-utils';
1111
import { maxSuggestions } from '../../../../../observability/common';
1212
import { setupRequest } from '../../../lib/helpers/setup_request';
1313
import { getServiceNames } from './get_service_names';

x-pack/plugins/apm/server/routes/source_maps/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import Boom from '@hapi/boom';
88
import * as t from 'io-ts';
99
import { SavedObjectsClientContract } from 'kibana/server';
10-
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
10+
import { jsonRt } from '@kbn/io-ts-utils';
1111
import {
1212
createApmArtifact,
1313
deleteApmArtifact,

x-pack/plugins/apm/server/routes/transactions/route.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
* 2.0.
66
*/
77

8-
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
9-
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
8+
import { jsonRt, toNumberRt } from '@kbn/io-ts-utils';
109
import * as t from 'io-ts';
1110
import {
1211
LatencyAggregationType,

yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -5864,6 +5864,10 @@
58645864
version "0.0.0"
58655865
uid ""
58665866

5867+
"@types/kbn__io-ts-utils@link:bazel-bin/packages/kbn-io-ts-utils/npm_module_types":
5868+
version "0.0.0"
5869+
uid ""
5870+
58675871
"@types/kbn__mapbox-gl@link:bazel-bin/packages/kbn-mapbox-gl/npm_module_types":
58685872
version "0.0.0"
58695873
uid ""

0 commit comments

Comments
 (0)