chore(NA): splits types from code on @kbn/io-ts-utils (#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>
This commit is contained in:
Tiago Costa 2022-01-21 00:17:38 +00:00 committed by GitHub
parent 72559010f7
commit 735948de4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 52 additions and 92 deletions

View file

@ -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 = {

View file

@ -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",

View file

@ -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",

View file

@ -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(
[
@ -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 = [
@ -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"],
)
@ -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"],
)

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/deep_exact_rt",
"types": "../target_types/deep_exact_rt"
}

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/iso_to_epoch_rt",
"types": "../target_types/iso_to_epoch_rt"
}

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/json_rt",
"types": "../target_types/json_rt"
}

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/merge_rt",
"types": "../target_types/merge_rt"
}

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/non_empty_string_rt",
"types": "../target_types/non_empty_string_rt"
}

View file

@ -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

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/parseable_types",
"types": "../target_types/parseable_types"
}

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/props_to_schema",
"types": "../target_types/props_to_schema"
}

View file

@ -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';

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/strict_keys_rt",
"types": "../target_types/strict_keys_rt"
}

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/to_boolean_rt",
"types": "../target_types/to_boolean_rt"
}

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/to_json_schema",
"types": "../target_types/to_json_schema"
}

View file

@ -1,4 +0,0 @@
{
"main": "../target_node/to_number_rt",
"types": "../target_types/to_number_rt"
}

View file

@ -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",

View file

@ -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';

View file

@ -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 {

View file

@ -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",

View file

@ -7,7 +7,7 @@
*/
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';

View file

@ -15,8 +15,7 @@ import {
} from 'react-router-config';
import qs from 'query-string';
import { findLastIndex, merge, compact } from 'lodash';
import { mergeRt } from '@kbn/io-ts-utils/merge_rt';
import { deepExactRt } from '@kbn/io-ts-utils/deep_exact_rt';
import { deepExactRt, mergeRt } from '@kbn/io-ts-utils';
import { FlattenRoutesOf, Route, Router } from './types';
function toReactRouterPath(path: string) {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import * as t from 'io-ts';
import { nonEmptyStringRt } from '@kbn/io-ts-utils/non_empty_string_rt';
import { nonEmptyStringRt } from '@kbn/io-ts-utils';
import {
ENVIRONMENT_ALL,
ENVIRONMENT_NOT_DEFINED,

View file

@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n';
import { Outlet } from '@kbn/typed-react-router-config';
import * as t from 'io-ts';
import React from 'react';
import { toBooleanRt } from '@kbn/io-ts-utils/to_boolean_rt';
import { toBooleanRt } from '@kbn/io-ts-utils';
import { RedirectTo } from '../redirect_to';
import { comparisonTypeRt } from '../../../../common/runtime_types/comparison_type_rt';
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';

View file

@ -8,7 +8,7 @@ import * as t from 'io-ts';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { Outlet } from '@kbn/typed-react-router-config';
import { toBooleanRt } from '@kbn/io-ts-utils/to_boolean_rt';
import { toBooleanRt } from '@kbn/io-ts-utils';
import { comparisonTypeRt } from '../../../../common/runtime_types/comparison_type_rt';
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
import { environmentRt } from '../../../../common/environment_rt';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
import { jsonRt } from '@kbn/io-ts-utils';
import { createServerRouteRepository } from '@kbn/server-route-repository';
import { ServerRoute } from '@kbn/server-route-repository';
import * as t from 'io-ts';

View file

@ -17,8 +17,7 @@ import {
parseEndpoint,
routeValidationObject,
} from '@kbn/server-route-repository';
import { mergeRt } from '@kbn/io-ts-utils/merge_rt';
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
import { jsonRt, mergeRt } from '@kbn/io-ts-utils';
import { pickKeys } from '../../../common/utils/pick_keys';
import { APMRouteHandlerResources, TelemetryUsageCounter } from '../typings';
import type { ApmPluginRequestHandlerContext } from '../typings';

View file

@ -6,7 +6,7 @@
*/
import * as t from 'io-ts';
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
import { toNumberRt } from '@kbn/io-ts-utils';
import { setupRequest } from '../../lib/helpers/setup_request';
import {
environmentRt,

View file

@ -9,7 +9,7 @@ import * as t from 'io-ts';
import Boom from '@hapi/boom';
import { i18n } from '@kbn/i18n';
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
import { toNumberRt } from '@kbn/io-ts-utils';
import { isActivePlatinumLicense } from '../../../common/license_check';

View file

@ -6,7 +6,7 @@
*/
import * as t from 'io-ts';
import { isoToEpochRt } from '@kbn/io-ts-utils/iso_to_epoch_rt';
import { isoToEpochRt } from '@kbn/io-ts-utils';
export { environmentRt } from '../../common/environment_rt';

View file

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

View file

@ -6,7 +6,7 @@
*/
import * as t from 'io-ts';
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
import { toNumberRt } from '@kbn/io-ts-utils';
import { getOverallLatencyDistribution } from './get_overall_latency_distribution';
import { setupRequest } from '../../lib/helpers/setup_request';
import { createApmServerRoute } from '../apm_routes/create_apm_server_route';

View file

@ -6,7 +6,7 @@
*/
import * as t from 'io-ts';
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
import { toNumberRt } from '@kbn/io-ts-utils';
import { setupRequest } from '../../lib/helpers/setup_request';
import { getServiceCount } from './get_service_count';
import { getTransactionsPerMinute } from './get_transactions_per_minute';

View file

@ -6,7 +6,7 @@
*/
import * as t from 'io-ts';
import { Logger } from 'kibana/server';
import { isoToEpochRt } from '@kbn/io-ts-utils/iso_to_epoch_rt';
import { isoToEpochRt } from '@kbn/io-ts-utils';
import { setupRequest, Setup } from '../../lib/helpers/setup_request';
import { getClientMetrics } from './get_client_metrics';
import { getJSErrors } from './get_js_errors';

View file

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

View file

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

View file

@ -7,7 +7,7 @@
import Boom from '@hapi/boom';
import * as t from 'io-ts';
import { SavedObjectsClientContract } from 'kibana/server';
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
import { jsonRt } from '@kbn/io-ts-utils';
import {
createApmArtifact,
deleteApmArtifact,

View file

@ -5,8 +5,7 @@
* 2.0.
*/
import { jsonRt } from '@kbn/io-ts-utils/json_rt';
import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt';
import { jsonRt, toNumberRt } from '@kbn/io-ts-utils';
import * as t from 'io-ts';
import {
LatencyAggregationType,

View file

@ -5864,6 +5864,10 @@
version "0.0.0"
uid ""
"@types/kbn__io-ts-utils@link:bazel-bin/packages/kbn-io-ts-utils/npm_module_types":
version "0.0.0"
uid ""
"@types/kbn__mapbox-gl@link:bazel-bin/packages/kbn-mapbox-gl/npm_module_types":
version "0.0.0"
uid ""