mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ML] @kbn/ml-agg-utils, @kbn/ml-is-populated-object, @kbn/ml-string-hash packages. (#132963)
Moves some ML utility code to packages. - @kbn/ml-agg-utils contains multiple utilities used in combination related to building aggregations. - @kbn/ml-is-populated-object contains the isPopulatedObject() utility function used across several plugins. - @kbn/ml-string-hash contains the stringHash() utility function used across several plugins.
This commit is contained in:
parent
0ee2ae074e
commit
adbd6a5fb8
110 changed files with 1872 additions and 398 deletions
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -202,6 +202,7 @@
|
|||
/x-pack/test/functional/apps/transform/ @elastic/ml-ui
|
||||
/x-pack/test/functional/services/transform/ @elastic/ml-ui
|
||||
/x-pack/test/functional_basic/apps/transform/ @elastic/ml-ui
|
||||
/x-pack/packages/ml/ @elastic/ml-ui
|
||||
/packages/kbn-aiops-utils @elastic/ml-ui
|
||||
/examples/response_stream/ @elastic/ml-ui
|
||||
|
||||
|
|
|
@ -197,6 +197,9 @@
|
|||
"@kbn/logging": "link:bazel-bin/packages/kbn-logging",
|
||||
"@kbn/logging-mocks": "link:bazel-bin/packages/kbn-logging-mocks",
|
||||
"@kbn/mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl",
|
||||
"@kbn/ml-agg-utils": "link:bazel-bin/x-pack/packages/ml/agg_utils",
|
||||
"@kbn/ml-is-populated-object": "link:bazel-bin/x-pack/packages/ml/is_populated_object",
|
||||
"@kbn/ml-string-hash": "link:bazel-bin/x-pack/packages/ml/string_hash",
|
||||
"@kbn/monaco": "link:bazel-bin/packages/kbn-monaco",
|
||||
"@kbn/plugin-discovery": "link:bazel-bin/packages/kbn-plugin-discovery",
|
||||
"@kbn/react-field": "link:bazel-bin/packages/kbn-react-field",
|
||||
|
@ -743,6 +746,9 @@
|
|||
"@types/kbn__logging": "link:bazel-bin/packages/kbn-logging/npm_module_types",
|
||||
"@types/kbn__logging-mocks": "link:bazel-bin/packages/kbn-logging-mocks/npm_module_types",
|
||||
"@types/kbn__mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl/npm_module_types",
|
||||
"@types/kbn__ml-agg-utils": "link:bazel-bin/x-pack/packages/ml/agg_utils/npm_module_types",
|
||||
"@types/kbn__ml-is-populated-object": "link:bazel-bin/x-pack/packages/ml/is_populated_object/npm_module_types",
|
||||
"@types/kbn__ml-string-hash": "link:bazel-bin/x-pack/packages/ml/string_hash/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",
|
||||
"@types/kbn__optimizer-webpack-helpers": "link:bazel-bin/packages/kbn-optimizer-webpack-helpers/npm_module_types",
|
||||
|
|
|
@ -159,6 +159,9 @@ filegroup(
|
|||
"//packages/shared-ux/page/analytics_no_data:build",
|
||||
"//packages/shared-ux/page/kibana_no_data:build",
|
||||
"//packages/shared-ux/prompt/no_data_views:build",
|
||||
"//x-pack/packages/ml/agg_utils:build",
|
||||
"//x-pack/packages/ml/is_populated_object:build",
|
||||
"//x-pack/packages/ml/string_hash:build",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -301,6 +304,9 @@ filegroup(
|
|||
"//packages/shared-ux/page/analytics_no_data:build_types",
|
||||
"//packages/shared-ux/page/kibana_no_data:build_types",
|
||||
"//packages/shared-ux/prompt/no_data_views:build_types",
|
||||
"//x-pack/packages/ml/agg_utils:build_types",
|
||||
"//x-pack/packages/ml/is_populated_object:build_types",
|
||||
"//x-pack/packages/ml/string_hash:build_types",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ export const BAZEL_PACKAGE_DIRS = [
|
|||
'packages/analytics/shippers',
|
||||
'packages/analytics/shippers/elastic_v3',
|
||||
'packages/core/*',
|
||||
'x-pack/packages/ml',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
125
x-pack/packages/ml/agg_utils/BUILD.bazel
Normal file
125
x-pack/packages/ml/agg_utils/BUILD.bazel
Normal file
|
@ -0,0 +1,125 @@
|
|||
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_DIRNAME = "agg_utils"
|
||||
PKG_REQUIRE_NAME = "@kbn/ml-agg-utils"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
# In this array place runtime dependencies, including other packages and NPM packages
|
||||
# which must be available for this code to run.
|
||||
#
|
||||
# To reference other packages use:
|
||||
# "//repo/relative/path/to/package"
|
||||
# eg. "//packages/kbn-utils"
|
||||
#
|
||||
# To reference a NPM package use:
|
||||
# "@npm//name-of-package"
|
||||
# eg. "@npm//lodash"
|
||||
RUNTIME_DEPS = [
|
||||
"@npm//@elastic/elasticsearch",
|
||||
"@npm//lodash",
|
||||
"//packages/kbn-field-types",
|
||||
"//x-pack/packages/ml/is_populated_object",
|
||||
"//x-pack/packages/ml/string_hash",
|
||||
]
|
||||
|
||||
# In this array place dependencies necessary to build the types, which will include the
|
||||
# :npm_module_types target of other packages and packages from NPM, including @types/*
|
||||
# packages.
|
||||
#
|
||||
# To reference the types for another package use:
|
||||
# "//repo/relative/path/to/package:npm_module_types"
|
||||
# eg. "//packages/kbn-utils:npm_module_types"
|
||||
#
|
||||
# References to NPM packages work the same as RUNTIME_DEPS
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/lodash",
|
||||
"@npm//@elastic/elasticsearch",
|
||||
"@npm//tslib",
|
||||
"//packages/kbn-field-types:npm_module_types",
|
||||
"//x-pack/packages/ml/is_populated_object:npm_module_types",
|
||||
"//x-pack/packages/ml/string_hash:npm_module_types",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
32
x-pack/packages/ml/agg_utils/README.md
Normal file
32
x-pack/packages/ml/agg_utils/README.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
# @kbn/ml-agg-utils
|
||||
|
||||
This package includes utility functions provided by the ML team to be used in Kibana plugins related to data manipulation and verification.
|
||||
|
||||
<!-- INSERT GENERATED DOCS START -->
|
||||
|
||||
### `buildSamplerAggregation` (function)
|
||||
|
||||
Wraps the supplied aggregations in a sampler aggregation.
|
||||
A supplied samplerShardSize (the shard_size parameter of the sampler aggregation)
|
||||
of less than 1 indicates no sampling, and the aggs are returned as-is.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- aggs (`any`)
|
||||
- samplerShardSize (`number`)
|
||||
|
||||
**returns:** Record<string, AggregationsAggregationContainer>
|
||||
|
||||
### `getSamplerAggregationsResponsePath` (function)
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- samplerShardSize (`number`)
|
||||
|
||||
**returns:** string[]
|
||||
|
||||
### `getAggIntervals` (function)
|
||||
|
||||
Returns aggregation intervals for the supplied document fields.
|
||||
|
||||
<!-- INSERT GENERATED DOCS END -->
|
12
x-pack/packages/ml/agg_utils/jest.config.js
Normal file
12
x-pack/packages/ml/agg_utils/jest.config.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/x-pack/packages/ml/agg_utils'],
|
||||
};
|
13
x-pack/packages/ml/agg_utils/package.json
Normal file
13
x-pack/packages/ml/agg_utils/package.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "@kbn/ml-agg-utils",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"devDependencies": {
|
||||
"ts-readme": "^1.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
"generate-docs": "ts-readme src/index.ts"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { buildSamplerAggregation } from './build_sampler_aggregation';
|
||||
|
||||
describe('buildSamplerAggregation', () => {
|
||||
const testAggs = {
|
||||
bytes_stats: {
|
||||
stats: { field: 'bytes' },
|
||||
},
|
||||
};
|
||||
|
||||
test('returns wrapped sampler aggregation for sampler shard size of 1000', () => {
|
||||
expect(buildSamplerAggregation(testAggs, 1000)).toEqual({
|
||||
sample: {
|
||||
sampler: {
|
||||
shard_size: 1000,
|
||||
},
|
||||
aggs: testAggs,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('returns un-sampled aggregation as-is for sampler shard size of 0', () => {
|
||||
expect(buildSamplerAggregation(testAggs, 0)).toEqual(testAggs);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
|
||||
/**
|
||||
* Wraps the supplied aggregations in a sampler aggregation.
|
||||
* A supplied samplerShardSize (the shard_size parameter of the sampler aggregation)
|
||||
* of less than 1 indicates no sampling, and the aggs are returned as-is.
|
||||
*/
|
||||
export function buildSamplerAggregation(
|
||||
aggs: any,
|
||||
samplerShardSize: number
|
||||
): Record<string, estypes.AggregationsAggregationContainer> {
|
||||
if (samplerShardSize < 1) {
|
||||
return aggs;
|
||||
}
|
||||
|
||||
return {
|
||||
sample: {
|
||||
sampler: {
|
||||
shard_size: samplerShardSize,
|
||||
},
|
||||
aggs,
|
||||
},
|
||||
};
|
||||
}
|
107
x-pack/packages/ml/agg_utils/src/get_agg_intervals.ts
Normal file
107
x-pack/packages/ml/agg_utils/src/get_agg_intervals.ts
Normal file
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { get } from 'lodash';
|
||||
|
||||
import type { Client } from '@elastic/elasticsearch';
|
||||
import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
|
||||
import { KBN_FIELD_TYPES } from '@kbn/field-types';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { stringHash } from '@kbn/ml-string-hash';
|
||||
|
||||
import { buildSamplerAggregation } from './build_sampler_aggregation';
|
||||
import { getSamplerAggregationsResponsePath } from './get_sampler_aggregations_response_path';
|
||||
|
||||
// TODO Temporary type definition until we can import from `@kbn/core`.
|
||||
// Copied from src/core/server/elasticsearch/client/types.ts
|
||||
// as these types aren't part of any package yet. Once they are, remove this completely
|
||||
|
||||
/**
|
||||
* Client used to query the elasticsearch cluster.
|
||||
* @deprecated At some point use the one from src/core/server/elasticsearch/client/types.ts when it is made into a package. If it never is, then keep using this one.
|
||||
* @public
|
||||
*/
|
||||
type ElasticsearchClient = Omit<
|
||||
Client,
|
||||
'connectionPool' | 'serializer' | 'extend' | 'close' | 'diagnostic'
|
||||
>;
|
||||
|
||||
const MAX_CHART_COLUMNS = 20;
|
||||
|
||||
interface HistogramField {
|
||||
fieldName: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface NumericColumnStats {
|
||||
interval: number;
|
||||
min: number;
|
||||
max: number;
|
||||
}
|
||||
type NumericColumnStatsMap = Record<string, NumericColumnStats>;
|
||||
|
||||
/**
|
||||
* Returns aggregation intervals for the supplied document fields.
|
||||
*/
|
||||
export const getAggIntervals = async (
|
||||
client: ElasticsearchClient,
|
||||
indexPattern: string,
|
||||
query: estypes.QueryDslQueryContainer,
|
||||
fields: HistogramField[],
|
||||
samplerShardSize: number,
|
||||
runtimeMappings?: estypes.MappingRuntimeFields
|
||||
): Promise<NumericColumnStatsMap> => {
|
||||
const numericColumns = fields.filter((field) => {
|
||||
return field.type === KBN_FIELD_TYPES.NUMBER || field.type === KBN_FIELD_TYPES.DATE;
|
||||
});
|
||||
|
||||
if (numericColumns.length === 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const minMaxAggs = numericColumns.reduce((aggs, c) => {
|
||||
const id = stringHash(c.fieldName);
|
||||
aggs[id] = {
|
||||
stats: {
|
||||
field: c.fieldName,
|
||||
},
|
||||
};
|
||||
return aggs;
|
||||
}, {} as Record<string, object>);
|
||||
|
||||
const body = await client.search({
|
||||
index: indexPattern,
|
||||
size: 0,
|
||||
body: {
|
||||
query,
|
||||
aggs: buildSamplerAggregation(minMaxAggs, samplerShardSize),
|
||||
size: 0,
|
||||
...(isPopulatedObject(runtimeMappings) ? { runtime_mappings: runtimeMappings } : {}),
|
||||
},
|
||||
});
|
||||
|
||||
const aggsPath = getSamplerAggregationsResponsePath(samplerShardSize);
|
||||
const aggregations = aggsPath.length > 0 ? get(body.aggregations, aggsPath) : body.aggregations;
|
||||
|
||||
return Object.keys(aggregations).reduce((p, aggName) => {
|
||||
const stats = [aggregations[aggName].min, aggregations[aggName].max];
|
||||
if (!stats.includes(null)) {
|
||||
const delta = aggregations[aggName].max - aggregations[aggName].min;
|
||||
|
||||
let aggInterval = 1;
|
||||
|
||||
if (delta > MAX_CHART_COLUMNS || delta <= 1) {
|
||||
aggInterval = delta / (MAX_CHART_COLUMNS - 1);
|
||||
}
|
||||
|
||||
p[aggName] = { interval: aggInterval, min: stats[0], max: stats[1] };
|
||||
}
|
||||
|
||||
return p;
|
||||
}, {} as NumericColumnStatsMap);
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { getSamplerAggregationsResponsePath } from './get_sampler_aggregations_response_path';
|
||||
|
||||
describe('getSamplerAggregationsResponsePath', () => {
|
||||
test('returns correct path for sampler shard size of 1000', () => {
|
||||
expect(getSamplerAggregationsResponsePath(1000)).toEqual(['sample']);
|
||||
});
|
||||
|
||||
test('returns correct path for sampler shard size of 0', () => {
|
||||
expect(getSamplerAggregationsResponsePath(0)).toEqual([]);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
// Returns the path of aggregations in the elasticsearch response, as an array,
|
||||
// depending on whether sampling is being used.
|
||||
// A supplied samplerShardSize (the shard_size parameter of the sampler aggregation)
|
||||
// of less than 1 indicates no sampling, and an empty array is returned.
|
||||
export function getSamplerAggregationsResponsePath(samplerShardSize: number): string[] {
|
||||
return samplerShardSize > 0 ? ['sample'] : [];
|
||||
}
|
10
x-pack/packages/ml/agg_utils/src/index.ts
Normal file
10
x-pack/packages/ml/agg_utils/src/index.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { buildSamplerAggregation } from './build_sampler_aggregation';
|
||||
export { getAggIntervals } from './get_agg_intervals';
|
||||
export { getSamplerAggregationsResponsePath } from './get_sampler_aggregations_response_path';
|
17
x-pack/packages/ml/agg_utils/tsconfig.json
Normal file
17
x-pack/packages/ml/agg_utils/tsconfig.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node",
|
||||
],
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
]
|
||||
}
|
300
x-pack/packages/ml/agg_utils/yarn.lock
Normal file
300
x-pack/packages/ml/agg_utils/yarn.lock
Normal file
|
@ -0,0 +1,300 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@nodelib/fs.scandir@2.1.5":
|
||||
version "2.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
|
||||
integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==
|
||||
dependencies:
|
||||
"@nodelib/fs.stat" "2.0.5"
|
||||
run-parallel "^1.1.9"
|
||||
|
||||
"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2":
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b"
|
||||
integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==
|
||||
|
||||
"@nodelib/fs.walk@^1.2.3":
|
||||
version "1.2.8"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a"
|
||||
integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==
|
||||
dependencies:
|
||||
"@nodelib/fs.scandir" "2.1.5"
|
||||
fastq "^1.6.0"
|
||||
|
||||
"@types/command-line-args@^5.0.0":
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/command-line-args/-/command-line-args-5.2.0.tgz#adbb77980a1cc376bb208e3f4142e907410430f6"
|
||||
integrity sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==
|
||||
|
||||
"@types/command-line-usage@^5.0.1":
|
||||
version "5.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/command-line-usage/-/command-line-usage-5.0.2.tgz#ba5e3f6ae5a2009d466679cc431b50635bf1a064"
|
||||
integrity sha512-n7RlEEJ+4x4TS7ZQddTmNSxP+zziEG0TNsMfiRIxcIVXt71ENJ9ojeXmGO3wPoTdn7pJcU2xc3CJYMktNT6DPg==
|
||||
|
||||
ansi-styles@^3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
|
||||
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
|
||||
dependencies:
|
||||
color-convert "^1.9.0"
|
||||
|
||||
array-back@^3.0.1, array-back@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/array-back/-/array-back-3.1.0.tgz#b8859d7a508871c9a7b2cf42f99428f65e96bfb0"
|
||||
integrity sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==
|
||||
|
||||
array-back@^4.0.1, array-back@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/array-back/-/array-back-4.0.2.tgz#8004e999a6274586beeb27342168652fdb89fa1e"
|
||||
integrity sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==
|
||||
|
||||
braces@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
|
||||
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
|
||||
dependencies:
|
||||
fill-range "^7.0.1"
|
||||
|
||||
chalk@^2.4.1, chalk@^2.4.2:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
|
||||
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
|
||||
dependencies:
|
||||
ansi-styles "^3.2.1"
|
||||
escape-string-regexp "^1.0.5"
|
||||
supports-color "^5.3.0"
|
||||
|
||||
color-convert@^1.9.0:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
|
||||
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
|
||||
dependencies:
|
||||
color-name "1.1.3"
|
||||
|
||||
color-name@1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
||||
integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
|
||||
|
||||
command-line-application@^0.9.6:
|
||||
version "0.9.6"
|
||||
resolved "https://registry.yarnpkg.com/command-line-application/-/command-line-application-0.9.6.tgz#03da3db29a0dbee1af601f03198a2f2425d67803"
|
||||
integrity sha512-7wc7YX7s/hqZWKp4r37IBlW/Bhh92HWeQW2VV++Mt9x35AKFntz9f7A94Zz+AsImHZmRGHd8iNW5m0jUd4GQpg==
|
||||
dependencies:
|
||||
"@types/command-line-args" "^5.0.0"
|
||||
"@types/command-line-usage" "^5.0.1"
|
||||
chalk "^2.4.1"
|
||||
command-line-args "^5.1.1"
|
||||
command-line-usage "^6.0.0"
|
||||
meant "^1.0.1"
|
||||
remove-markdown "^0.3.0"
|
||||
tslib "1.10.0"
|
||||
|
||||
command-line-args@^5.1.1:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/command-line-args/-/command-line-args-5.2.1.tgz#c44c32e437a57d7c51157696893c5909e9cec42e"
|
||||
integrity sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==
|
||||
dependencies:
|
||||
array-back "^3.1.0"
|
||||
find-replace "^3.0.0"
|
||||
lodash.camelcase "^4.3.0"
|
||||
typical "^4.0.0"
|
||||
|
||||
command-line-usage@^6.0.0:
|
||||
version "6.1.3"
|
||||
resolved "https://registry.yarnpkg.com/command-line-usage/-/command-line-usage-6.1.3.tgz#428fa5acde6a838779dfa30e44686f4b6761d957"
|
||||
integrity sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==
|
||||
dependencies:
|
||||
array-back "^4.0.2"
|
||||
chalk "^2.4.2"
|
||||
table-layout "^1.0.2"
|
||||
typical "^5.2.0"
|
||||
|
||||
deep-extend@~0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
|
||||
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==
|
||||
|
||||
escape-string-regexp@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==
|
||||
|
||||
fast-glob@^3.1.1:
|
||||
version "3.2.11"
|
||||
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9"
|
||||
integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==
|
||||
dependencies:
|
||||
"@nodelib/fs.stat" "^2.0.2"
|
||||
"@nodelib/fs.walk" "^1.2.3"
|
||||
glob-parent "^5.1.2"
|
||||
merge2 "^1.3.0"
|
||||
micromatch "^4.0.4"
|
||||
|
||||
fastq@^1.6.0:
|
||||
version "1.13.0"
|
||||
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c"
|
||||
integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==
|
||||
dependencies:
|
||||
reusify "^1.0.4"
|
||||
|
||||
fill-range@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
|
||||
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
|
||||
dependencies:
|
||||
to-regex-range "^5.0.1"
|
||||
|
||||
find-replace@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/find-replace/-/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38"
|
||||
integrity sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==
|
||||
dependencies:
|
||||
array-back "^3.0.1"
|
||||
|
||||
glob-parent@^5.1.2:
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
||||
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
|
||||
dependencies:
|
||||
is-glob "^4.0.1"
|
||||
|
||||
has-flag@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
|
||||
integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==
|
||||
|
||||
is-extglob@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
|
||||
integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==
|
||||
|
||||
is-glob@^4.0.1:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
|
||||
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
|
||||
dependencies:
|
||||
is-extglob "^2.1.1"
|
||||
|
||||
is-number@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
|
||||
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
|
||||
|
||||
lodash.camelcase@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
|
||||
integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==
|
||||
|
||||
meant@^1.0.1:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/meant/-/meant-1.0.3.tgz#67769af9de1d158773e928ae82c456114903554c"
|
||||
integrity sha512-88ZRGcNxAq4EH38cQ4D85PM57pikCwS8Z99EWHODxN7KBY+UuPiqzRTtZzS8KTXO/ywSWbdjjJST2Hly/EQxLw==
|
||||
|
||||
merge2@^1.3.0:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
|
||||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
||||
|
||||
micromatch@^4.0.4:
|
||||
version "4.0.5"
|
||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
|
||||
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
|
||||
dependencies:
|
||||
braces "^3.0.2"
|
||||
picomatch "^2.3.1"
|
||||
|
||||
picomatch@^2.3.1:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
|
||||
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
|
||||
|
||||
prettier@1.19.1:
|
||||
version "1.19.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
|
||||
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
|
||||
|
||||
queue-microtask@^1.2.2:
|
||||
version "1.2.3"
|
||||
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
||||
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
|
||||
|
||||
reduce-flatten@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27"
|
||||
integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==
|
||||
|
||||
remove-markdown@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/remove-markdown/-/remove-markdown-0.3.0.tgz#5e4b667493a93579728f3d52ecc1db9ca505dc98"
|
||||
integrity sha512-5392eIuy1mhjM74739VunOlsOYKjsH82rQcTBlJ1bkICVC3dQ3ksQzTHh4jGHQFnM+1xzLzcFOMH+BofqXhroQ==
|
||||
|
||||
reusify@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
|
||||
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
|
||||
|
||||
run-parallel@^1.1.9:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee"
|
||||
integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==
|
||||
dependencies:
|
||||
queue-microtask "^1.2.2"
|
||||
|
||||
supports-color@^5.3.0:
|
||||
version "5.5.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
|
||||
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
|
||||
dependencies:
|
||||
has-flag "^3.0.0"
|
||||
|
||||
table-layout@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/table-layout/-/table-layout-1.0.2.tgz#c4038a1853b0136d63365a734b6931cf4fad4a04"
|
||||
integrity sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==
|
||||
dependencies:
|
||||
array-back "^4.0.1"
|
||||
deep-extend "~0.6.0"
|
||||
typical "^5.2.0"
|
||||
wordwrapjs "^4.0.0"
|
||||
|
||||
to-regex-range@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
|
||||
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
|
||||
dependencies:
|
||||
is-number "^7.0.0"
|
||||
|
||||
ts-readme@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/ts-readme/-/ts-readme-1.1.3.tgz#18a73d21f3bb50ee8e2df819bcbbe3a76385b15a"
|
||||
integrity sha512-GvI+Vu3m/LGBlgrWwzSmvslnz8msJLNrZ7hQ3Ko2B6PMxeXidqsn6fi20IWgepFjOzhKGw/WlG8NmM7jl3DWeg==
|
||||
dependencies:
|
||||
command-line-application "^0.9.6"
|
||||
fast-glob "^3.1.1"
|
||||
prettier "1.19.1"
|
||||
|
||||
tslib@1.10.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
||||
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
|
||||
|
||||
typical@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4"
|
||||
integrity sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==
|
||||
|
||||
typical@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066"
|
||||
integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==
|
||||
|
||||
wordwrapjs@^4.0.0:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f"
|
||||
integrity sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==
|
||||
dependencies:
|
||||
reduce-flatten "^2.0.0"
|
||||
typical "^5.2.0"
|
114
x-pack/packages/ml/is_populated_object/BUILD.bazel
Normal file
114
x-pack/packages/ml/is_populated_object/BUILD.bazel
Normal file
|
@ -0,0 +1,114 @@
|
|||
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_DIRNAME = "is_populated_object"
|
||||
PKG_REQUIRE_NAME = "@kbn/ml-is-populated-object"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
# In this array place runtime dependencies, including other packages and NPM packages
|
||||
# which must be available for this code to run.
|
||||
#
|
||||
# To reference other packages use:
|
||||
# "//repo/relative/path/to/package"
|
||||
# eg. "//packages/kbn-utils"
|
||||
#
|
||||
# To reference a NPM package use:
|
||||
# "@npm//name-of-package"
|
||||
# eg. "@npm//lodash"
|
||||
RUNTIME_DEPS = [
|
||||
]
|
||||
|
||||
# In this array place dependencies necessary to build the types, which will include the
|
||||
# :npm_module_types target of other packages and packages from NPM, including @types/*
|
||||
# packages.
|
||||
#
|
||||
# To reference the types for another package use:
|
||||
# "//repo/relative/path/to/package:npm_module_types"
|
||||
# eg. "//packages/kbn-utils:npm_module_types"
|
||||
#
|
||||
# References to NPM packages work the same as RUNTIME_DEPS
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
24
x-pack/packages/ml/is_populated_object/README.md
Normal file
24
x-pack/packages/ml/is_populated_object/README.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# @kbn/ml-is-populated-object
|
||||
|
||||
<!-- INSERT GENERATED DOCS START -->
|
||||
|
||||
### `isPopulatedObject` (function)
|
||||
|
||||
A type guard to check record like object structures.
|
||||
|
||||
Examples:
|
||||
|
||||
- `isPopulatedObject({...})`
|
||||
Limits type to Record<string, unknown>
|
||||
|
||||
- `isPopulatedObject({...}, ['attribute'])`
|
||||
Limits type to Record<'attribute', unknown>
|
||||
|
||||
- `isPopulatedObject<keyof MyInterface>({...})`
|
||||
Limits type to a record with keys of the given interface.
|
||||
Note that you might want to add keys from the interface to the
|
||||
array of requiredAttributes to satisfy runtime requirements.
|
||||
Otherwise you'd just satisfy TS requirements but might still
|
||||
run into runtime issues.
|
||||
|
||||
<!-- INSERT GENERATED DOCS END -->
|
12
x-pack/packages/ml/is_populated_object/jest.config.js
Normal file
12
x-pack/packages/ml/is_populated_object/jest.config.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/x-pack/packages/ml/is_populated_object'],
|
||||
};
|
13
x-pack/packages/ml/is_populated_object/package.json
Normal file
13
x-pack/packages/ml/is_populated_object/package.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "@kbn/ml-is-populated-object",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"devDependencies": {
|
||||
"ts-readme": "^1.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
"generate-docs": "ts-readme src/index.ts"
|
||||
}
|
||||
}
|
8
x-pack/packages/ml/is_populated_object/src/index.ts
Normal file
8
x-pack/packages/ml/is_populated_object/src/index.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { isPopulatedObject } from './is_populated_object';
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { isPopulatedObject } from './is_populated_object';
|
||||
|
||||
describe('isPopulatedObject', () => {
|
||||
it('does not allow numbers', () => {
|
||||
expect(isPopulatedObject(0)).toBe(false);
|
||||
});
|
||||
it('does not allow strings', () => {
|
||||
expect(isPopulatedObject('')).toBe(false);
|
||||
});
|
||||
it('does not allow null', () => {
|
||||
expect(isPopulatedObject(null)).toBe(false);
|
||||
});
|
||||
it('does not allow an empty object', () => {
|
||||
expect(isPopulatedObject({})).toBe(false);
|
||||
});
|
||||
it('allows an object with an attribute', () => {
|
||||
expect(isPopulatedObject({ attribute: 'value' })).toBe(true);
|
||||
});
|
||||
it('does not allow an object with a non-existing required attribute', () => {
|
||||
expect(isPopulatedObject({ attribute: 'value' }, ['otherAttribute'])).toBe(false);
|
||||
});
|
||||
it('allows an object with an existing required attribute', () => {
|
||||
expect(isPopulatedObject({ attribute: 'value' }, ['attribute'])).toBe(true);
|
||||
});
|
||||
it('allows an object with two existing required attributes', () => {
|
||||
expect(
|
||||
isPopulatedObject({ attribute1: 'value1', attribute2: 'value2' }, [
|
||||
'attribute1',
|
||||
'attribute2',
|
||||
])
|
||||
).toBe(true);
|
||||
});
|
||||
it('does not allow an object with two required attributes where one does not exist', () => {
|
||||
expect(
|
||||
isPopulatedObject({ attribute1: 'value1', attribute2: 'value2' }, [
|
||||
'attribute1',
|
||||
'otherAttribute',
|
||||
])
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
/*
|
||||
/**
|
||||
* A type guard to check record like object structures.
|
||||
*
|
||||
* Examples:
|
17
x-pack/packages/ml/is_populated_object/tsconfig.json
Normal file
17
x-pack/packages/ml/is_populated_object/tsconfig.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
300
x-pack/packages/ml/is_populated_object/yarn.lock
Normal file
300
x-pack/packages/ml/is_populated_object/yarn.lock
Normal file
|
@ -0,0 +1,300 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@nodelib/fs.scandir@2.1.5":
|
||||
version "2.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
|
||||
integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==
|
||||
dependencies:
|
||||
"@nodelib/fs.stat" "2.0.5"
|
||||
run-parallel "^1.1.9"
|
||||
|
||||
"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2":
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b"
|
||||
integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==
|
||||
|
||||
"@nodelib/fs.walk@^1.2.3":
|
||||
version "1.2.8"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a"
|
||||
integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==
|
||||
dependencies:
|
||||
"@nodelib/fs.scandir" "2.1.5"
|
||||
fastq "^1.6.0"
|
||||
|
||||
"@types/command-line-args@^5.0.0":
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/command-line-args/-/command-line-args-5.2.0.tgz#adbb77980a1cc376bb208e3f4142e907410430f6"
|
||||
integrity sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==
|
||||
|
||||
"@types/command-line-usage@^5.0.1":
|
||||
version "5.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/command-line-usage/-/command-line-usage-5.0.2.tgz#ba5e3f6ae5a2009d466679cc431b50635bf1a064"
|
||||
integrity sha512-n7RlEEJ+4x4TS7ZQddTmNSxP+zziEG0TNsMfiRIxcIVXt71ENJ9ojeXmGO3wPoTdn7pJcU2xc3CJYMktNT6DPg==
|
||||
|
||||
ansi-styles@^3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
|
||||
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
|
||||
dependencies:
|
||||
color-convert "^1.9.0"
|
||||
|
||||
array-back@^3.0.1, array-back@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/array-back/-/array-back-3.1.0.tgz#b8859d7a508871c9a7b2cf42f99428f65e96bfb0"
|
||||
integrity sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==
|
||||
|
||||
array-back@^4.0.1, array-back@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/array-back/-/array-back-4.0.2.tgz#8004e999a6274586beeb27342168652fdb89fa1e"
|
||||
integrity sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==
|
||||
|
||||
braces@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
|
||||
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
|
||||
dependencies:
|
||||
fill-range "^7.0.1"
|
||||
|
||||
chalk@^2.4.1, chalk@^2.4.2:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
|
||||
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
|
||||
dependencies:
|
||||
ansi-styles "^3.2.1"
|
||||
escape-string-regexp "^1.0.5"
|
||||
supports-color "^5.3.0"
|
||||
|
||||
color-convert@^1.9.0:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
|
||||
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
|
||||
dependencies:
|
||||
color-name "1.1.3"
|
||||
|
||||
color-name@1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
||||
integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
|
||||
|
||||
command-line-application@^0.9.6:
|
||||
version "0.9.6"
|
||||
resolved "https://registry.yarnpkg.com/command-line-application/-/command-line-application-0.9.6.tgz#03da3db29a0dbee1af601f03198a2f2425d67803"
|
||||
integrity sha512-7wc7YX7s/hqZWKp4r37IBlW/Bhh92HWeQW2VV++Mt9x35AKFntz9f7A94Zz+AsImHZmRGHd8iNW5m0jUd4GQpg==
|
||||
dependencies:
|
||||
"@types/command-line-args" "^5.0.0"
|
||||
"@types/command-line-usage" "^5.0.1"
|
||||
chalk "^2.4.1"
|
||||
command-line-args "^5.1.1"
|
||||
command-line-usage "^6.0.0"
|
||||
meant "^1.0.1"
|
||||
remove-markdown "^0.3.0"
|
||||
tslib "1.10.0"
|
||||
|
||||
command-line-args@^5.1.1:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/command-line-args/-/command-line-args-5.2.1.tgz#c44c32e437a57d7c51157696893c5909e9cec42e"
|
||||
integrity sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==
|
||||
dependencies:
|
||||
array-back "^3.1.0"
|
||||
find-replace "^3.0.0"
|
||||
lodash.camelcase "^4.3.0"
|
||||
typical "^4.0.0"
|
||||
|
||||
command-line-usage@^6.0.0:
|
||||
version "6.1.3"
|
||||
resolved "https://registry.yarnpkg.com/command-line-usage/-/command-line-usage-6.1.3.tgz#428fa5acde6a838779dfa30e44686f4b6761d957"
|
||||
integrity sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==
|
||||
dependencies:
|
||||
array-back "^4.0.2"
|
||||
chalk "^2.4.2"
|
||||
table-layout "^1.0.2"
|
||||
typical "^5.2.0"
|
||||
|
||||
deep-extend@~0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
|
||||
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==
|
||||
|
||||
escape-string-regexp@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==
|
||||
|
||||
fast-glob@^3.1.1:
|
||||
version "3.2.11"
|
||||
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9"
|
||||
integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==
|
||||
dependencies:
|
||||
"@nodelib/fs.stat" "^2.0.2"
|
||||
"@nodelib/fs.walk" "^1.2.3"
|
||||
glob-parent "^5.1.2"
|
||||
merge2 "^1.3.0"
|
||||
micromatch "^4.0.4"
|
||||
|
||||
fastq@^1.6.0:
|
||||
version "1.13.0"
|
||||
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c"
|
||||
integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==
|
||||
dependencies:
|
||||
reusify "^1.0.4"
|
||||
|
||||
fill-range@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
|
||||
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
|
||||
dependencies:
|
||||
to-regex-range "^5.0.1"
|
||||
|
||||
find-replace@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/find-replace/-/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38"
|
||||
integrity sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==
|
||||
dependencies:
|
||||
array-back "^3.0.1"
|
||||
|
||||
glob-parent@^5.1.2:
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
||||
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
|
||||
dependencies:
|
||||
is-glob "^4.0.1"
|
||||
|
||||
has-flag@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
|
||||
integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==
|
||||
|
||||
is-extglob@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
|
||||
integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==
|
||||
|
||||
is-glob@^4.0.1:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
|
||||
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
|
||||
dependencies:
|
||||
is-extglob "^2.1.1"
|
||||
|
||||
is-number@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
|
||||
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
|
||||
|
||||
lodash.camelcase@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
|
||||
integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==
|
||||
|
||||
meant@^1.0.1:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/meant/-/meant-1.0.3.tgz#67769af9de1d158773e928ae82c456114903554c"
|
||||
integrity sha512-88ZRGcNxAq4EH38cQ4D85PM57pikCwS8Z99EWHODxN7KBY+UuPiqzRTtZzS8KTXO/ywSWbdjjJST2Hly/EQxLw==
|
||||
|
||||
merge2@^1.3.0:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
|
||||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
||||
|
||||
micromatch@^4.0.4:
|
||||
version "4.0.5"
|
||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
|
||||
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
|
||||
dependencies:
|
||||
braces "^3.0.2"
|
||||
picomatch "^2.3.1"
|
||||
|
||||
picomatch@^2.3.1:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
|
||||
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
|
||||
|
||||
prettier@1.19.1:
|
||||
version "1.19.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
|
||||
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
|
||||
|
||||
queue-microtask@^1.2.2:
|
||||
version "1.2.3"
|
||||
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
||||
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
|
||||
|
||||
reduce-flatten@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27"
|
||||
integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==
|
||||
|
||||
remove-markdown@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/remove-markdown/-/remove-markdown-0.3.0.tgz#5e4b667493a93579728f3d52ecc1db9ca505dc98"
|
||||
integrity sha512-5392eIuy1mhjM74739VunOlsOYKjsH82rQcTBlJ1bkICVC3dQ3ksQzTHh4jGHQFnM+1xzLzcFOMH+BofqXhroQ==
|
||||
|
||||
reusify@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
|
||||
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
|
||||
|
||||
run-parallel@^1.1.9:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee"
|
||||
integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==
|
||||
dependencies:
|
||||
queue-microtask "^1.2.2"
|
||||
|
||||
supports-color@^5.3.0:
|
||||
version "5.5.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
|
||||
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
|
||||
dependencies:
|
||||
has-flag "^3.0.0"
|
||||
|
||||
table-layout@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/table-layout/-/table-layout-1.0.2.tgz#c4038a1853b0136d63365a734b6931cf4fad4a04"
|
||||
integrity sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==
|
||||
dependencies:
|
||||
array-back "^4.0.1"
|
||||
deep-extend "~0.6.0"
|
||||
typical "^5.2.0"
|
||||
wordwrapjs "^4.0.0"
|
||||
|
||||
to-regex-range@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
|
||||
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
|
||||
dependencies:
|
||||
is-number "^7.0.0"
|
||||
|
||||
ts-readme@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/ts-readme/-/ts-readme-1.1.3.tgz#18a73d21f3bb50ee8e2df819bcbbe3a76385b15a"
|
||||
integrity sha512-GvI+Vu3m/LGBlgrWwzSmvslnz8msJLNrZ7hQ3Ko2B6PMxeXidqsn6fi20IWgepFjOzhKGw/WlG8NmM7jl3DWeg==
|
||||
dependencies:
|
||||
command-line-application "^0.9.6"
|
||||
fast-glob "^3.1.1"
|
||||
prettier "1.19.1"
|
||||
|
||||
tslib@1.10.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
||||
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
|
||||
|
||||
typical@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4"
|
||||
integrity sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==
|
||||
|
||||
typical@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066"
|
||||
integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==
|
||||
|
||||
wordwrapjs@^4.0.0:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f"
|
||||
integrity sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==
|
||||
dependencies:
|
||||
reduce-flatten "^2.0.0"
|
||||
typical "^5.2.0"
|
114
x-pack/packages/ml/string_hash/BUILD.bazel
Normal file
114
x-pack/packages/ml/string_hash/BUILD.bazel
Normal file
|
@ -0,0 +1,114 @@
|
|||
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_DIRNAME = "string_hash"
|
||||
PKG_REQUIRE_NAME = "@kbn/ml-string-hash"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
# In this array place runtime dependencies, including other packages and NPM packages
|
||||
# which must be available for this code to run.
|
||||
#
|
||||
# To reference other packages use:
|
||||
# "//repo/relative/path/to/package"
|
||||
# eg. "//packages/kbn-utils"
|
||||
#
|
||||
# To reference a NPM package use:
|
||||
# "@npm//name-of-package"
|
||||
# eg. "@npm//lodash"
|
||||
RUNTIME_DEPS = [
|
||||
]
|
||||
|
||||
# In this array place dependencies necessary to build the types, which will include the
|
||||
# :npm_module_types target of other packages and packages from NPM, including @types/*
|
||||
# packages.
|
||||
#
|
||||
# To reference the types for another package use:
|
||||
# "//repo/relative/path/to/package:npm_module_types"
|
||||
# eg. "//packages/kbn-utils:npm_module_types"
|
||||
#
|
||||
# References to NPM packages work the same as RUNTIME_DEPS
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
15
x-pack/packages/ml/string_hash/README.md
Normal file
15
x-pack/packages/ml/string_hash/README.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# @kbn/ml-string-hash
|
||||
|
||||
<!-- INSERT GENERATED DOCS START -->
|
||||
|
||||
### `stringHash` (function)
|
||||
|
||||
Creates a deterministic number based hash out of a string.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- str (`string`)
|
||||
|
||||
**returns:** number
|
||||
|
||||
<!-- INSERT GENERATED DOCS END -->
|
12
x-pack/packages/ml/string_hash/jest.config.js
Normal file
12
x-pack/packages/ml/string_hash/jest.config.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/x-pack/packages/ml/string_hash'],
|
||||
};
|
13
x-pack/packages/ml/string_hash/package.json
Normal file
13
x-pack/packages/ml/string_hash/package.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "@kbn/ml-string-hash",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"devDependencies": {
|
||||
"ts-readme": "^1.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
"generate-docs": "ts-readme src/index.ts"
|
||||
}
|
||||
}
|
8
x-pack/packages/ml/string_hash/src/index.ts
Normal file
8
x-pack/packages/ml/string_hash/src/index.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { stringHash } from './string_hash';
|
16
x-pack/packages/ml/string_hash/src/string_hash.test.ts
Normal file
16
x-pack/packages/ml/string_hash/src/string_hash.test.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { stringHash } from './string_hash';
|
||||
|
||||
describe('stringHash', () => {
|
||||
test('should return a unique number based off a string', () => {
|
||||
const hash1 = stringHash('the-string-1');
|
||||
const hash2 = stringHash('the-string-2');
|
||||
expect(hash1).not.toBe(hash2);
|
||||
});
|
||||
});
|
17
x-pack/packages/ml/string_hash/tsconfig.json
Normal file
17
x-pack/packages/ml/string_hash/tsconfig.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
300
x-pack/packages/ml/string_hash/yarn.lock
Normal file
300
x-pack/packages/ml/string_hash/yarn.lock
Normal file
|
@ -0,0 +1,300 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@nodelib/fs.scandir@2.1.5":
|
||||
version "2.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
|
||||
integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==
|
||||
dependencies:
|
||||
"@nodelib/fs.stat" "2.0.5"
|
||||
run-parallel "^1.1.9"
|
||||
|
||||
"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2":
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b"
|
||||
integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==
|
||||
|
||||
"@nodelib/fs.walk@^1.2.3":
|
||||
version "1.2.8"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a"
|
||||
integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==
|
||||
dependencies:
|
||||
"@nodelib/fs.scandir" "2.1.5"
|
||||
fastq "^1.6.0"
|
||||
|
||||
"@types/command-line-args@^5.0.0":
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/command-line-args/-/command-line-args-5.2.0.tgz#adbb77980a1cc376bb208e3f4142e907410430f6"
|
||||
integrity sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==
|
||||
|
||||
"@types/command-line-usage@^5.0.1":
|
||||
version "5.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/command-line-usage/-/command-line-usage-5.0.2.tgz#ba5e3f6ae5a2009d466679cc431b50635bf1a064"
|
||||
integrity sha512-n7RlEEJ+4x4TS7ZQddTmNSxP+zziEG0TNsMfiRIxcIVXt71ENJ9ojeXmGO3wPoTdn7pJcU2xc3CJYMktNT6DPg==
|
||||
|
||||
ansi-styles@^3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
|
||||
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
|
||||
dependencies:
|
||||
color-convert "^1.9.0"
|
||||
|
||||
array-back@^3.0.1, array-back@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/array-back/-/array-back-3.1.0.tgz#b8859d7a508871c9a7b2cf42f99428f65e96bfb0"
|
||||
integrity sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==
|
||||
|
||||
array-back@^4.0.1, array-back@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/array-back/-/array-back-4.0.2.tgz#8004e999a6274586beeb27342168652fdb89fa1e"
|
||||
integrity sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==
|
||||
|
||||
braces@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
|
||||
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
|
||||
dependencies:
|
||||
fill-range "^7.0.1"
|
||||
|
||||
chalk@^2.4.1, chalk@^2.4.2:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
|
||||
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
|
||||
dependencies:
|
||||
ansi-styles "^3.2.1"
|
||||
escape-string-regexp "^1.0.5"
|
||||
supports-color "^5.3.0"
|
||||
|
||||
color-convert@^1.9.0:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
|
||||
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
|
||||
dependencies:
|
||||
color-name "1.1.3"
|
||||
|
||||
color-name@1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
||||
integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
|
||||
|
||||
command-line-application@^0.9.6:
|
||||
version "0.9.6"
|
||||
resolved "https://registry.yarnpkg.com/command-line-application/-/command-line-application-0.9.6.tgz#03da3db29a0dbee1af601f03198a2f2425d67803"
|
||||
integrity sha512-7wc7YX7s/hqZWKp4r37IBlW/Bhh92HWeQW2VV++Mt9x35AKFntz9f7A94Zz+AsImHZmRGHd8iNW5m0jUd4GQpg==
|
||||
dependencies:
|
||||
"@types/command-line-args" "^5.0.0"
|
||||
"@types/command-line-usage" "^5.0.1"
|
||||
chalk "^2.4.1"
|
||||
command-line-args "^5.1.1"
|
||||
command-line-usage "^6.0.0"
|
||||
meant "^1.0.1"
|
||||
remove-markdown "^0.3.0"
|
||||
tslib "1.10.0"
|
||||
|
||||
command-line-args@^5.1.1:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/command-line-args/-/command-line-args-5.2.1.tgz#c44c32e437a57d7c51157696893c5909e9cec42e"
|
||||
integrity sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==
|
||||
dependencies:
|
||||
array-back "^3.1.0"
|
||||
find-replace "^3.0.0"
|
||||
lodash.camelcase "^4.3.0"
|
||||
typical "^4.0.0"
|
||||
|
||||
command-line-usage@^6.0.0:
|
||||
version "6.1.3"
|
||||
resolved "https://registry.yarnpkg.com/command-line-usage/-/command-line-usage-6.1.3.tgz#428fa5acde6a838779dfa30e44686f4b6761d957"
|
||||
integrity sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==
|
||||
dependencies:
|
||||
array-back "^4.0.2"
|
||||
chalk "^2.4.2"
|
||||
table-layout "^1.0.2"
|
||||
typical "^5.2.0"
|
||||
|
||||
deep-extend@~0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
|
||||
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==
|
||||
|
||||
escape-string-regexp@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==
|
||||
|
||||
fast-glob@^3.1.1:
|
||||
version "3.2.11"
|
||||
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9"
|
||||
integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==
|
||||
dependencies:
|
||||
"@nodelib/fs.stat" "^2.0.2"
|
||||
"@nodelib/fs.walk" "^1.2.3"
|
||||
glob-parent "^5.1.2"
|
||||
merge2 "^1.3.0"
|
||||
micromatch "^4.0.4"
|
||||
|
||||
fastq@^1.6.0:
|
||||
version "1.13.0"
|
||||
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c"
|
||||
integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==
|
||||
dependencies:
|
||||
reusify "^1.0.4"
|
||||
|
||||
fill-range@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
|
||||
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
|
||||
dependencies:
|
||||
to-regex-range "^5.0.1"
|
||||
|
||||
find-replace@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/find-replace/-/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38"
|
||||
integrity sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==
|
||||
dependencies:
|
||||
array-back "^3.0.1"
|
||||
|
||||
glob-parent@^5.1.2:
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
||||
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
|
||||
dependencies:
|
||||
is-glob "^4.0.1"
|
||||
|
||||
has-flag@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
|
||||
integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==
|
||||
|
||||
is-extglob@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
|
||||
integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==
|
||||
|
||||
is-glob@^4.0.1:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
|
||||
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
|
||||
dependencies:
|
||||
is-extglob "^2.1.1"
|
||||
|
||||
is-number@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
|
||||
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
|
||||
|
||||
lodash.camelcase@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
|
||||
integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==
|
||||
|
||||
meant@^1.0.1:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/meant/-/meant-1.0.3.tgz#67769af9de1d158773e928ae82c456114903554c"
|
||||
integrity sha512-88ZRGcNxAq4EH38cQ4D85PM57pikCwS8Z99EWHODxN7KBY+UuPiqzRTtZzS8KTXO/ywSWbdjjJST2Hly/EQxLw==
|
||||
|
||||
merge2@^1.3.0:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
|
||||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
||||
|
||||
micromatch@^4.0.4:
|
||||
version "4.0.5"
|
||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
|
||||
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
|
||||
dependencies:
|
||||
braces "^3.0.2"
|
||||
picomatch "^2.3.1"
|
||||
|
||||
picomatch@^2.3.1:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
|
||||
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
|
||||
|
||||
prettier@1.19.1:
|
||||
version "1.19.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
|
||||
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
|
||||
|
||||
queue-microtask@^1.2.2:
|
||||
version "1.2.3"
|
||||
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
||||
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
|
||||
|
||||
reduce-flatten@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27"
|
||||
integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==
|
||||
|
||||
remove-markdown@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/remove-markdown/-/remove-markdown-0.3.0.tgz#5e4b667493a93579728f3d52ecc1db9ca505dc98"
|
||||
integrity sha512-5392eIuy1mhjM74739VunOlsOYKjsH82rQcTBlJ1bkICVC3dQ3ksQzTHh4jGHQFnM+1xzLzcFOMH+BofqXhroQ==
|
||||
|
||||
reusify@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
|
||||
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
|
||||
|
||||
run-parallel@^1.1.9:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee"
|
||||
integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==
|
||||
dependencies:
|
||||
queue-microtask "^1.2.2"
|
||||
|
||||
supports-color@^5.3.0:
|
||||
version "5.5.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
|
||||
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
|
||||
dependencies:
|
||||
has-flag "^3.0.0"
|
||||
|
||||
table-layout@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/table-layout/-/table-layout-1.0.2.tgz#c4038a1853b0136d63365a734b6931cf4fad4a04"
|
||||
integrity sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==
|
||||
dependencies:
|
||||
array-back "^4.0.1"
|
||||
deep-extend "~0.6.0"
|
||||
typical "^5.2.0"
|
||||
wordwrapjs "^4.0.0"
|
||||
|
||||
to-regex-range@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
|
||||
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
|
||||
dependencies:
|
||||
is-number "^7.0.0"
|
||||
|
||||
ts-readme@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/ts-readme/-/ts-readme-1.1.3.tgz#18a73d21f3bb50ee8e2df819bcbbe3a76385b15a"
|
||||
integrity sha512-GvI+Vu3m/LGBlgrWwzSmvslnz8msJLNrZ7hQ3Ko2B6PMxeXidqsn6fi20IWgepFjOzhKGw/WlG8NmM7jl3DWeg==
|
||||
dependencies:
|
||||
command-line-application "^0.9.6"
|
||||
fast-glob "^3.1.1"
|
||||
prettier "1.19.1"
|
||||
|
||||
tslib@1.10.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
||||
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
|
||||
|
||||
typical@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4"
|
||||
integrity sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==
|
||||
|
||||
typical@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066"
|
||||
integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==
|
||||
|
||||
wordwrapjs@^4.0.0:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f"
|
||||
integrity sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==
|
||||
dependencies:
|
||||
reduce-flatten "^2.0.0"
|
||||
typical "^5.2.0"
|
|
@ -8,7 +8,7 @@
|
|||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { Query } from '@kbn/es-query';
|
||||
import { IKibanaSearchResponse } from '@kbn/data-plugin/common';
|
||||
import { isPopulatedObject } from '../utils/object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { TimeBucketsInterval } from '../services/time_buckets';
|
||||
|
||||
export interface FieldData {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type { SimpleSavedObject } from '@kbn/core/public';
|
||||
import { isPopulatedObject } from '../utils/object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
export type { JobFieldType } from './job_field_type';
|
||||
export type {
|
||||
FieldRequestConfig,
|
||||
|
|
|
@ -40,35 +40,6 @@ export function buildBaseFilterCriteria(
|
|||
return filterCriteria;
|
||||
}
|
||||
|
||||
// Wraps the supplied aggregations in a sampler aggregation.
|
||||
// A supplied samplerShardSize (the shard_size parameter of the sampler aggregation)
|
||||
// of less than 1 indicates no sampling, and the aggs are returned as-is.
|
||||
export function buildSamplerAggregation(
|
||||
aggs: any,
|
||||
samplerShardSize: number
|
||||
): Record<string, estypes.AggregationsAggregationContainer> {
|
||||
if (samplerShardSize < 1) {
|
||||
return aggs;
|
||||
}
|
||||
|
||||
return {
|
||||
sample: {
|
||||
sampler: {
|
||||
shard_size: samplerShardSize,
|
||||
},
|
||||
aggs,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the path of aggregations in the elasticsearch response, as an array,
|
||||
// depending on whether sampling is being used.
|
||||
// A supplied samplerShardSize (the shard_size parameter of the sampler aggregation)
|
||||
// of less than 1 indicates no sampling, and an empty array is returned.
|
||||
export function getSamplerAggregationsResponsePath(samplerShardSize: number): string[] {
|
||||
return samplerShardSize > 0 ? ['sample'] : [];
|
||||
}
|
||||
|
||||
// Returns a name which is safe to use in elasticsearch aggregations for the supplied
|
||||
// field name. Aggregation names must be alpha-numeric and can only contain '_' and '-' characters,
|
||||
// so if the supplied field names contains disallowed characters, the provided index
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { RUNTIME_FIELD_TYPES } from '@kbn/data-plugin/common';
|
||||
import { isPopulatedObject } from './object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
type RuntimeType = typeof RUNTIME_FIELD_TYPES[number];
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import type { ToastsStart } from '@kbn/core/public';
|
||||
import { DataView } from '@kbn/data-views-plugin/public';
|
||||
import { isPopulatedObject } from '../../../../../common/utils/object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { getTimeFieldRange } from '../../services/time_field_range';
|
||||
import type { GetTimeFieldRangeResponse } from '../../../../../common/types/time_field_request';
|
||||
import { addExcludeFrozenToQuery } from '../../utils/query_utils';
|
||||
|
|
|
@ -14,11 +14,9 @@ import type {
|
|||
ISearchOptions,
|
||||
ISearchStart,
|
||||
} from '@kbn/data-plugin/public';
|
||||
import {
|
||||
buildSamplerAggregation,
|
||||
getSamplerAggregationsResponsePath,
|
||||
} from '../../../../../common/utils/query_utils';
|
||||
import { isPopulatedObject } from '../../../../../common/utils/object_utils';
|
||||
import { buildSamplerAggregation, getSamplerAggregationsResponsePath } from '@kbn/ml-agg-utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
import type {
|
||||
Field,
|
||||
BooleanFieldStats,
|
||||
|
|
|
@ -15,11 +15,8 @@ import type {
|
|||
ISearchOptions,
|
||||
ISearchStart,
|
||||
} from '@kbn/data-plugin/public';
|
||||
import {
|
||||
buildSamplerAggregation,
|
||||
getSamplerAggregationsResponsePath,
|
||||
} from '../../../../../common/utils/query_utils';
|
||||
import { isPopulatedObject } from '../../../../../common/utils/object_utils';
|
||||
import { buildSamplerAggregation, getSamplerAggregationsResponsePath } from '@kbn/ml-agg-utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import type { FieldStatsCommonRequestParams } from '../../../../../common/types/field_stats';
|
||||
import type { Field, DateFieldStats, Aggs } from '../../../../../common/types/field_stats';
|
||||
import { FieldStatsError, isIKibanaSearchResponse } from '../../../../../common/types/field_stats';
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
import { each, get } from 'lodash';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { buildBaseFilterCriteria } from '../../../../../common/utils/query_utils';
|
||||
import { isPopulatedObject } from '../../../../../common/utils/object_utils';
|
||||
import type {
|
||||
DocumentCountStats,
|
||||
OverallStatsSearchStrategyParams,
|
||||
|
|
|
@ -14,8 +14,8 @@ import type {
|
|||
ISearchOptions,
|
||||
ISearchStart,
|
||||
} from '@kbn/data-plugin/public';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { buildBaseFilterCriteria } from '../../../../../common/utils/query_utils';
|
||||
import { isPopulatedObject } from '../../../../../common/utils/object_utils';
|
||||
import type {
|
||||
Field,
|
||||
FieldExamples,
|
||||
|
|
|
@ -16,17 +16,14 @@ import {
|
|||
ISearchOptions,
|
||||
} from '@kbn/data-plugin/common';
|
||||
import type { ISearchStart } from '@kbn/data-plugin/public';
|
||||
import { buildSamplerAggregation, getSamplerAggregationsResponsePath } from '@kbn/ml-agg-utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import {
|
||||
MAX_PERCENT,
|
||||
PERCENTILE_SPACING,
|
||||
SAMPLER_TOP_TERMS_SHARD_SIZE,
|
||||
SAMPLER_TOP_TERMS_THRESHOLD,
|
||||
} from './constants';
|
||||
import {
|
||||
buildSamplerAggregation,
|
||||
getSamplerAggregationsResponsePath,
|
||||
} from '../../../../../common/utils/query_utils';
|
||||
import { isPopulatedObject } from '../../../../../common/utils/object_utils';
|
||||
import type { Aggs, FieldStatsCommonRequestParams } from '../../../../../common/types/field_stats';
|
||||
import type {
|
||||
Field,
|
||||
|
|
|
@ -15,12 +15,9 @@ import type {
|
|||
ISearchOptions,
|
||||
ISearchStart,
|
||||
} from '@kbn/data-plugin/public';
|
||||
import { buildSamplerAggregation, getSamplerAggregationsResponsePath } from '@kbn/ml-agg-utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { SAMPLER_TOP_TERMS_SHARD_SIZE, SAMPLER_TOP_TERMS_THRESHOLD } from './constants';
|
||||
import {
|
||||
buildSamplerAggregation,
|
||||
getSamplerAggregationsResponsePath,
|
||||
} from '../../../../../common/utils/query_utils';
|
||||
import { isPopulatedObject } from '../../../../../common/utils/object_utils';
|
||||
import type {
|
||||
Aggs,
|
||||
Bucket,
|
||||
|
|
|
@ -9,14 +9,13 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
|||
import { get } from 'lodash';
|
||||
import { Query } from '@kbn/es-query';
|
||||
import { IKibanaSearchResponse } from '@kbn/data-plugin/common';
|
||||
import { buildSamplerAggregation, getSamplerAggregationsResponsePath } from '@kbn/ml-agg-utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import {
|
||||
buildBaseFilterCriteria,
|
||||
buildSamplerAggregation,
|
||||
getSafeAggregationName,
|
||||
getSamplerAggregationsResponsePath,
|
||||
} from '../../../../../common/utils/query_utils';
|
||||
import { getDatafeedAggregations } from '../../../../../common/utils/datafeed_utils';
|
||||
import { isPopulatedObject } from '../../../../../common/utils/object_utils';
|
||||
import { AggregatableField, NonAggregatableField } from '../../types/overall_stats';
|
||||
import { AggCardinality, Aggs } from '../../../../../common/types/field_stats';
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { HttpFetchError } from '@kbn/core/public';
|
||||
import Boom from '@hapi/boom';
|
||||
import { isPopulatedObject } from '../../../../common/utils/object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
export interface WrappedError {
|
||||
body: {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { isPopulatedObject } from '../../../../common/utils/object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
export const addExcludeFrozenToQuery = (originalQuery: QueryDslQueryContainer | undefined) => {
|
||||
const FROZEN_TIER_TERM = {
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export const isPopulatedObject = <U extends string = string>(
|
||||
arg: unknown,
|
||||
requiredAttributes: U[] = []
|
||||
): arg is Record<U, unknown> => {
|
||||
return (
|
||||
typeof arg === 'object' &&
|
||||
arg !== null &&
|
||||
Object.keys(arg).length > 0 &&
|
||||
(requiredAttributes.length === 0 ||
|
||||
requiredAttributes.every((d) => ({}.hasOwnProperty.call(arg, d))))
|
||||
);
|
||||
};
|
|
@ -8,6 +8,7 @@
|
|||
import { chunk, intersection } from 'lodash';
|
||||
import moment from 'moment';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { getHttp } from '../kibana_services';
|
||||
import { MB } from '../../common/constants';
|
||||
import type {
|
||||
|
@ -19,7 +20,6 @@ import type {
|
|||
IngestPipeline,
|
||||
} from '../../common/types';
|
||||
import { CreateDocsResponse, IImporter, ImportResults } from './types';
|
||||
import { isPopulatedObject } from '../../common/utils';
|
||||
|
||||
const CHUNK_SIZE = 5000;
|
||||
const REDUCED_CHUNK_SIZE = 100;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { IScopedClusterClient } from '@kbn/core/server';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { isPopulatedObject } from '../common/utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
export async function getTimeFieldRange(
|
||||
client: IScopedClusterClient,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { RUNTIME_FIELD_TYPES } from '@kbn/data-plugin/common';
|
||||
import { isPopulatedObject } from '../../common/utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
type RuntimeType = typeof RUNTIME_FIELD_TYPES[number];
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ export {
|
|||
SEVERITY_COLORS,
|
||||
} from './constants/anomalies';
|
||||
export { getSeverityColor, getSeverityType } from './util/anomaly_utils';
|
||||
export { isPopulatedObject } from './util/object_utils';
|
||||
export { composeValidators, patternValidator } from './util/validators';
|
||||
export { isRuntimeMappings, isRuntimeField } from './util/runtime_field_utils';
|
||||
export { extractErrorMessage } from './util/errors';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { isPopulatedObject } from '../util/object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
export function isMultiBucketAggregate(
|
||||
arg: unknown
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { isPopulatedObject } from '../util/object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
export type FeatureImportanceClassName = string | number | boolean;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import {
|
||||
ErrorType,
|
||||
MLErrorObject,
|
||||
|
@ -14,7 +15,6 @@ import {
|
|||
isEsErrorBody,
|
||||
isMLResponseError,
|
||||
} from './types';
|
||||
import { isPopulatedObject } from '../object_utils';
|
||||
|
||||
export const extractErrorProperties = (error: ErrorType): MLErrorObject => {
|
||||
// extract properties of the error object from within the response error
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { euiDarkVars as euiVars } from '@kbn/ui-theme';
|
||||
|
||||
import { stringHash } from './string_utils';
|
||||
import { stringHash } from '@kbn/ml-string-hash';
|
||||
|
||||
const COLORS = [
|
||||
euiVars.euiColorVis0,
|
||||
|
|
|
@ -9,9 +9,9 @@ import { each, isEmpty, isEqual, pick } from 'lodash';
|
|||
import semverGte from 'semver/functions/gte';
|
||||
import moment, { Duration } from 'moment';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
// @ts-ignore
|
||||
import numeral from '@elastic/numeral';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { ALLOWED_DATA_UNITS, JOB_ID_MAX_LENGTH } from '../constants/validation';
|
||||
import { parseInterval } from './parse_interval';
|
||||
import { maxLengthValidator } from './validators';
|
||||
|
@ -24,7 +24,7 @@ import { ES_AGGREGATION, ML_JOB_AGGREGATION } from '../constants/aggregation_typ
|
|||
import { MLCATEGORY } from '../constants/field_types';
|
||||
import { getAggregations, getDatafeedAggregations } from './datafeed_utils';
|
||||
import { findAggField } from './validation_utils';
|
||||
import { getFirstKeyInObject, isPopulatedObject } from './object_utils';
|
||||
import { getFirstKeyInObject } from './object_utils';
|
||||
import { isDefined } from '../types/guards';
|
||||
|
||||
export interface ValidationResults {
|
||||
|
|
|
@ -5,49 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { getFirstKeyInObject, isPopulatedObject } from './object_utils';
|
||||
import { getFirstKeyInObject } from './object_utils';
|
||||
|
||||
describe('object_utils', () => {
|
||||
describe('isPopulatedObject()', () => {
|
||||
it('does not allow numbers', () => {
|
||||
expect(isPopulatedObject(0)).toBe(false);
|
||||
});
|
||||
it('does not allow strings', () => {
|
||||
expect(isPopulatedObject('')).toBe(false);
|
||||
});
|
||||
it('does not allow null', () => {
|
||||
expect(isPopulatedObject(null)).toBe(false);
|
||||
});
|
||||
it('does not allow an empty object', () => {
|
||||
expect(isPopulatedObject({})).toBe(false);
|
||||
});
|
||||
it('allows an object with an attribute', () => {
|
||||
expect(isPopulatedObject({ attribute: 'value' })).toBe(true);
|
||||
});
|
||||
it('does not allow an object with a non-existing required attribute', () => {
|
||||
expect(isPopulatedObject({ attribute: 'value' }, ['otherAttribute'])).toBe(false);
|
||||
});
|
||||
it('allows an object with an existing required attribute', () => {
|
||||
expect(isPopulatedObject({ attribute: 'value' }, ['attribute'])).toBe(true);
|
||||
});
|
||||
it('allows an object with two existing required attributes', () => {
|
||||
expect(
|
||||
isPopulatedObject({ attribute1: 'value1', attribute2: 'value2' }, [
|
||||
'attribute1',
|
||||
'attribute2',
|
||||
])
|
||||
).toBe(true);
|
||||
});
|
||||
it('does not allow an object with two required attributes where one does not exist', () => {
|
||||
expect(
|
||||
isPopulatedObject({ attribute1: 'value1', attribute2: 'value2' }, [
|
||||
'attribute1',
|
||||
'otherAttribute',
|
||||
])
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getFirstKeyInObject()', () => {
|
||||
it('gets the first key in object', () => {
|
||||
expect(getFirstKeyInObject({ attribute1: 'value', attribute2: 'value2' })).toBe('attribute1');
|
||||
|
|
|
@ -5,35 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A type guard to check record like object structures.
|
||||
*
|
||||
* Examples:
|
||||
* - `isPopulatedObject({...})`
|
||||
* Limits type to Record<string, unknown>
|
||||
*
|
||||
* - `isPopulatedObject({...}, ['attribute'])`
|
||||
* Limits type to Record<'attribute', unknown>
|
||||
*
|
||||
* - `isPopulatedObject<keyof MyInterface>({...})`
|
||||
* Limits type to a record with keys of the given interface.
|
||||
* Note that you might want to add keys from the interface to the
|
||||
* array of requiredAttributes to satisfy runtime requirements.
|
||||
* Otherwise you'd just satisfy TS requirements but might still
|
||||
* run into runtime issues.
|
||||
*/
|
||||
export const isPopulatedObject = <U extends string = string>(
|
||||
arg: unknown,
|
||||
requiredAttributes: U[] = []
|
||||
): arg is Record<U, unknown> => {
|
||||
return (
|
||||
typeof arg === 'object' &&
|
||||
arg !== null &&
|
||||
Object.keys(arg).length > 0 &&
|
||||
(requiredAttributes.length === 0 ||
|
||||
requiredAttributes.every((d) => ({}.hasOwnProperty.call(arg, d))))
|
||||
);
|
||||
};
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
/**
|
||||
* Get the first key in the object
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { isPopulatedObject } from './object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
export const addExcludeFrozenToQuery = (originalQuery: QueryDslQueryContainer | undefined) => {
|
||||
const FROZEN_TIER_TERM = {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { RUNTIME_FIELD_TYPES } from '@kbn/data-plugin/common';
|
||||
import { isPopulatedObject } from './object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
type RuntimeType = typeof RUNTIME_FIELD_TYPES[number];
|
||||
|
||||
|
|
|
@ -5,12 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
renderTemplate,
|
||||
getMedianStringLength,
|
||||
stringHash,
|
||||
getGroupQueryText,
|
||||
} from './string_utils';
|
||||
import { renderTemplate, getMedianStringLength, getGroupQueryText } from './string_utils';
|
||||
|
||||
const strings: string[] = [
|
||||
'foo',
|
||||
|
@ -53,14 +48,6 @@ describe('ML - string utils', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('stringHash', () => {
|
||||
test('should return a unique number based off a string', () => {
|
||||
const hash1 = stringHash('the-string-1');
|
||||
const hash2 = stringHash('the-string-2');
|
||||
expect(hash1).not.toBe(hash2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getGroupQueryText', () => {
|
||||
const groupIdOne = 'test_group_id_1';
|
||||
const groupIdTwo = 'test_group_id_2';
|
||||
|
|
|
@ -24,23 +24,6 @@ export function getMedianStringLength(strings: string[]) {
|
|||
return sortedStringLengths[Math.floor(sortedStringLengths.length / 2)] || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a deterministic number based hash out of a string.
|
||||
*/
|
||||
export function stringHash(str: string): number {
|
||||
let hash = 0;
|
||||
let chr = 0;
|
||||
if (str.length === 0) {
|
||||
return hash;
|
||||
}
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
chr = str.charCodeAt(i);
|
||||
hash = (hash << 5) - hash + chr; // eslint-disable-line no-bitwise
|
||||
hash |= 0; // eslint-disable-line no-bitwise
|
||||
}
|
||||
return hash < 0 ? hash * -2 : hash;
|
||||
}
|
||||
|
||||
export function getGroupQueryText(groupIds: string[]): string {
|
||||
return `groups:(${groupIds.join(' or ')})`;
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { ALLOWED_DATA_UNITS } from '../constants/validation';
|
||||
import { parseInterval } from './parse_interval';
|
||||
import { isPopulatedObject } from './object_utils';
|
||||
|
||||
/**
|
||||
* Provides a validator function for maximum allowed input length.
|
||||
|
|
|
@ -11,13 +11,13 @@ import { i18n } from '@kbn/i18n';
|
|||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import useDebounce from 'react-use/lib/useDebounce';
|
||||
import { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { MlAnomalyDetectionJobsHealthRuleParams } from '../../../common/types/alerts';
|
||||
import { JobSelectorControl } from '../job_selector';
|
||||
import { jobsApiProvider } from '../../application/services/ml_api_service/jobs';
|
||||
import { HttpService } from '../../application/services/http_service';
|
||||
import { useMlKibana } from '../../application/contexts/kibana';
|
||||
import { TestsSelectionControl } from './tests_selection_control';
|
||||
import { isPopulatedObject } from '../../../common';
|
||||
import { ALL_JOBS_SELECTION } from '../../../common/constants/alerts';
|
||||
import { BetaBadge } from '../beta_badge';
|
||||
import { isDefined } from '../../../common/types/guards';
|
||||
|
|
|
@ -27,6 +27,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
|
||||
import { CoreSetup } from '@kbn/core/public';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { DEFAULT_SAMPLER_SHARD_SIZE } from '../../../../common/constants/field_histograms';
|
||||
|
||||
import { ANALYSIS_CONFIG_TYPE, INDEX_STATUS } from '../../data_frame_analytics/common';
|
||||
|
@ -44,7 +45,6 @@ import {
|
|||
FeatureImportance,
|
||||
TopClasses,
|
||||
} from '../../../../common/types/feature_importance';
|
||||
import { isPopulatedObject } from '../../../../common/util/object_utils';
|
||||
import { DEFAULT_RESULTS_FIELD } from '../../../../common/constants/data_frame_analytics';
|
||||
import { DataFrameAnalysisConfigType } from '../../../../common/types/data_frame_analytics';
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ import { i18n } from '@kbn/i18n';
|
|||
import dateMath from '@kbn/datemath';
|
||||
import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { DataView } from '@kbn/data-views-plugin/public';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { getTimefilter, getToastNotifications } from '../../util/dependency_cache';
|
||||
import { ml, GetTimeFieldRangeResponse } from '../../services/ml_api_service';
|
||||
import { isPopulatedObject } from '../../../../common/util/object_utils';
|
||||
import type { RuntimeMappings } from '../../../../common/types/fields';
|
||||
import { addExcludeFrozenToQuery } from '../../../../common/util/query_utils';
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ import {
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { DataView } from '@kbn/data-views-plugin/public';
|
||||
import { stringHash } from '@kbn/ml-string-hash';
|
||||
import { extractErrorMessage } from '../../../../common';
|
||||
import { isRuntimeMappings } from '../../../../common/util/runtime_field_utils';
|
||||
import { stringHash } from '../../../../common/util/string_utils';
|
||||
import { RuntimeMappings } from '../../../../common/types/fields';
|
||||
import type { ResultsSearchQuery } from '../../data_frame_analytics/common/analytics';
|
||||
import { getCombinedRuntimeMappings } from '../data_grid';
|
||||
|
|
|
@ -21,10 +21,10 @@ import { i18n } from '@kbn/i18n';
|
|||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { XJsonMode } from '@kbn/ace';
|
||||
import { XJson } from '@kbn/es-ui-shared-plugin/public';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { useMlContext } from '../../../../../contexts/ml';
|
||||
import { CreateAnalyticsFormProps } from '../../../analytics_management/hooks/use_create_analytics_form';
|
||||
import { getCombinedRuntimeMappings } from '../../../../../components/data_grid/common';
|
||||
import { isPopulatedObject } from '../../../../../../../common/util/object_utils';
|
||||
import { RuntimeMappingsEditor } from './runtime_mappings_editor';
|
||||
import { isRuntimeMappings } from '../../../../../../../common';
|
||||
import { SwitchModal } from './switch_modal';
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { usePageUrlState } from '../../../../util/url_state';
|
||||
import { ML_PAGES } from '../../../../../../common/constants/locator';
|
||||
import { ExplorationPageUrlState } from '../../../../../../common/types/locator';
|
||||
import { SEARCH_QUERY_LANGUAGE } from '../../../../../../common/constants/search';
|
||||
import { isPopulatedObject } from '../../../../../../common/util/object_utils';
|
||||
|
||||
export function getDefaultExplorationPageUrlState(
|
||||
overrides?: Partial<ExplorationPageUrlState>
|
||||
|
|
|
@ -21,7 +21,7 @@ import { JOB_STATE, DATAFEED_STATE } from '../../../../../common/constants/state
|
|||
import { JOB_ACTION } from '../../../../../common/constants/job_actions';
|
||||
import { parseInterval } from '../../../../../common/util/parse_interval';
|
||||
import { mlCalendarService } from '../../../services/calendar_service';
|
||||
import { isPopulatedObject } from '../../../../../common/util/object_utils';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
export function loadFullJob(jobId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { MlJob } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { isPopulatedObject } from '../../../common';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { MlSummaryJob } from '../../../common/types/anomaly_detection_jobs';
|
||||
|
||||
export const isManagedJob = (job: MlSummaryJob | MlJob) => {
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import type { RuntimeMappings } from '../../../../../../../common/types/fields';
|
||||
import type { Datafeed, Job } from '../../../../../../../common/types/anomaly_detection_jobs';
|
||||
import { isPopulatedObject } from '../../../../../../../common/util/object_utils';
|
||||
|
||||
interface Response {
|
||||
runtime_mappings: RuntimeMappings;
|
||||
|
|
|
@ -19,6 +19,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { merge } from 'lodash';
|
||||
import moment from 'moment';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { useMlKibana, useMlLocator } from '../../../contexts/kibana';
|
||||
import { ml } from '../../../services/ml_api_service';
|
||||
import { useMlContext } from '../../../contexts/ml';
|
||||
|
@ -40,7 +41,6 @@ import { JobId } from '../../../../../common/types/anomaly_detection_jobs';
|
|||
import { ML_PAGES } from '../../../../../common/constants/locator';
|
||||
import { TIME_FORMAT } from '../../../../../common/constants/time_format';
|
||||
import { JobsAwaitingNodeWarning } from '../../../components/jobs_awaiting_node_warning';
|
||||
import { isPopulatedObject } from '../../../../../common/util/object_utils';
|
||||
import { RuntimeMappings } from '../../../../../common/types/fields';
|
||||
import { addExcludeFrozenToQuery } from '../../../../../common/util/query_utils';
|
||||
import { MlPageHeader } from '../../../components/page_header';
|
||||
|
|
|
@ -9,12 +9,12 @@ import { Observable, of } from 'rxjs';
|
|||
import { map as mapObservable } from 'rxjs/operators';
|
||||
import type { TimeRange } from '@kbn/es-query';
|
||||
import type { TimefilterContract } from '@kbn/data-plugin/public';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import type { RecordForInfluencer } from './results_service/results_service';
|
||||
import type { EntityField } from '../../../common/util/anomaly_utils';
|
||||
import type { CombinedJob } from '../../../common/types/anomaly_detection_jobs';
|
||||
import type { MlApiServices } from './ml_api_service';
|
||||
import type { MlResultsService } from './results_service';
|
||||
import { isPopulatedObject } from '../../../common/util/object_utils';
|
||||
import { ExplorerChartsData } from '../explorer/explorer_charts/explorer_charts_container_service';
|
||||
import type { TimeRangeBounds } from '../util/time_buckets';
|
||||
import { isDefined } from '../../../common/types/guards';
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import { IUiSettingsClient } from '@kbn/core/public';
|
||||
import type { TimeRange } from '@kbn/es-query';
|
||||
import { TimefilterContract, UI_SETTINGS } from '@kbn/data-plugin/public';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import {
|
||||
getBoundsRoundedToInterval,
|
||||
TimeBuckets,
|
||||
|
@ -24,7 +25,6 @@ import { OVERALL_LABEL, VIEW_BY_JOB_LABEL } from '../explorer/explorer_constants
|
|||
import { MlResultsService } from './results_service';
|
||||
import { EntityField } from '../../../common/util/anomaly_utils';
|
||||
import { InfluencersFilterQuery } from '../../../common/types/es_client';
|
||||
import { isPopulatedObject } from '../../../common';
|
||||
|
||||
/**
|
||||
* Service for retrieving anomaly swim lanes data.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { each, get } from 'lodash';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { Dictionary } from '../../../../common/types/common';
|
||||
import { ML_MEDIAN_PERCENTS } from '../../../../common/util/job_utils';
|
||||
import { Datafeed, JobId } from '../../../../common/types/anomaly_detection_jobs';
|
||||
|
@ -24,7 +25,6 @@ import { findAggField } from '../../../../common/util/validation_utils';
|
|||
import { getDatafeedAggregations } from '../../../../common/util/datafeed_utils';
|
||||
import { aggregationTypeTransform, EntityField } from '../../../../common/util/anomaly_utils';
|
||||
import { ES_AGGREGATION } from '../../../../common/constants/aggregation_types';
|
||||
import { isPopulatedObject } from '../../../../common/util/object_utils';
|
||||
import { InfluencersFilterQuery } from '../../../../common/types/es_client';
|
||||
import { RecordForInfluencer } from './results_service';
|
||||
import { isRuntimeMappings } from '../../../../common';
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
import { each, get } from 'lodash';
|
||||
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
import { ML_MEDIAN_PERCENTS } from '../../../../common/util/job_utils';
|
||||
import { escapeForElasticsearchQuery } from '../../util/string_utils';
|
||||
import {
|
||||
|
@ -14,7 +16,6 @@ import {
|
|||
SWIM_LANE_DEFAULT_PAGE_SIZE,
|
||||
} from '../../explorer/explorer_constants';
|
||||
import { aggregationTypeTransform } from '../../../../common/util/anomaly_utils';
|
||||
import { isPopulatedObject } from '../../../../common/util/object_utils';
|
||||
|
||||
/**
|
||||
* Service for carrying out Elasticsearch queries to obtain data for the Ml Results dashboards.
|
||||
|
|
|
@ -23,9 +23,9 @@ import {
|
|||
import type { EuiDescriptionListProps } from '@elastic/eui/src/components/description_list/description_list';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { FIELD_FORMAT_IDS } from '@kbn/field-formats-plugin/common';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import type { ModelItemFull } from './models_list';
|
||||
import { isDefined } from '../../../../common/types/guards';
|
||||
import { isPopulatedObject } from '../../../../common';
|
||||
import { ModelPipelines } from './pipelines';
|
||||
import { AllocatedModels } from '../nodes_overview/allocated_models';
|
||||
import type { AllocatedModel } from '../../../../common/types/trained_models';
|
||||
|
|
|
@ -26,6 +26,7 @@ import { EuiBasicTableColumn } from '@elastic/eui/src/components/basic_table/bas
|
|||
import { EuiTableSelectionType } from '@elastic/eui/src/components/basic_table/table_types';
|
||||
import { Action } from '@elastic/eui/src/components/basic_table/action_types';
|
||||
import { FIELD_FORMAT_IDS } from '@kbn/field-formats-plugin/common';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { getAnalysisType } from '../../data_frame_analytics/common';
|
||||
import { ModelsTableToConfigMapping } from '.';
|
||||
import { ModelsBarStats, StatsBar } from '../../components/stats_bar';
|
||||
|
@ -44,7 +45,6 @@ import { ML_PAGES } from '../../../../common/constants/locator';
|
|||
import { ListingPageUrlState } from '../../../../common/types/common';
|
||||
import { usePageUrlState } from '../../util/url_state';
|
||||
import { ExpandedRow } from './expanded_row';
|
||||
import { isPopulatedObject } from '../../../../common';
|
||||
import { useTableSettings } from '../../data_frame_analytics/pages/analytics_management/components/analytics_list/use_table_settings';
|
||||
import { useToastNotificationService } from '../../services/toast_notification_service';
|
||||
import { useFieldFormatter } from '../../contexts/kibana/use_field_formatter';
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import {
|
||||
TRAINED_MODEL_TYPE,
|
||||
DEPLOYMENT_STATE,
|
||||
|
@ -13,8 +14,6 @@ import {
|
|||
import type { SupportedPytorchTasksType } from '../../../../../common/constants/trained_models';
|
||||
import type { ModelItem } from '../models_list';
|
||||
|
||||
import { isPopulatedObject } from '../../../../../common';
|
||||
|
||||
const PYTORCH_TYPES = Object.values(SUPPORTED_PYTORCH_TASKS);
|
||||
|
||||
export function isTestable(modelItem: ModelItem) {
|
||||
|
|
|
@ -21,11 +21,11 @@ import { useHistory, useLocation } from 'react-router-dom';
|
|||
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { distinctUntilChanged } from 'rxjs/operators';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { Dictionary } from '../../../common/types/common';
|
||||
|
||||
import { getNestedProperty } from './object_utils';
|
||||
import { MlPages } from '../../../common/constants/locator';
|
||||
import { isPopulatedObject } from '../../../common';
|
||||
|
||||
type Accessor = '_a' | '_g';
|
||||
export type SetUrlState = (
|
||||
|
|
|
@ -10,6 +10,7 @@ import type { Filter, Query, TimeRange } from '@kbn/es-query';
|
|||
import type { RefreshInterval } from '@kbn/data-plugin/common';
|
||||
import type { EmbeddableInput, EmbeddableOutput, IEmbeddable } from '@kbn/embeddable-plugin/public';
|
||||
import type { DataView } from '@kbn/data-views-plugin/common';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import type { JobId } from '../../common/types/anomaly_detection_jobs';
|
||||
import type { SwimlaneType } from '../application/explorer/explorer_constants';
|
||||
import type { AnomalyDetectorService } from '../application/services/anomaly_detector_service';
|
||||
|
@ -18,7 +19,6 @@ import type { MlDependencies } from '../application/app';
|
|||
import type { AppStateSelectedCells } from '../application/explorer/explorer_utils';
|
||||
import { AnomalyExplorerChartsService } from '../application/services/anomaly_explorer_charts_service';
|
||||
import { EntityField } from '../../common/util/anomaly_utils';
|
||||
import { isPopulatedObject } from '../../common/util/object_utils';
|
||||
import {
|
||||
ANOMALY_EXPLORER_CHARTS_EMBEDDABLE_TYPE,
|
||||
ANOMALY_SWIMLANE_EMBEDDABLE_TYPE,
|
||||
|
|
|
@ -5,11 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
buildBaseFilterCriteria,
|
||||
buildSamplerAggregation,
|
||||
getSamplerAggregationsResponsePath,
|
||||
} from './query_utils';
|
||||
import { buildBaseFilterCriteria } from './query_utils';
|
||||
|
||||
describe('ML - query utils', () => {
|
||||
describe('buildBaseFilterCriteria', () => {
|
||||
|
@ -52,37 +48,4 @@ describe('ML - query utils', () => {
|
|||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildSamplerAggregation', () => {
|
||||
const testAggs = {
|
||||
bytes_stats: {
|
||||
stats: { field: 'bytes' },
|
||||
},
|
||||
};
|
||||
|
||||
test('returns wrapped sampler aggregation for sampler shard size of 1000', () => {
|
||||
expect(buildSamplerAggregation(testAggs, 1000)).toEqual({
|
||||
sample: {
|
||||
sampler: {
|
||||
shard_size: 1000,
|
||||
},
|
||||
aggs: testAggs,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('returns un-sampled aggregation as-is for sampler shard size of 0', () => {
|
||||
expect(buildSamplerAggregation(testAggs, 0)).toEqual(testAggs);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getSamplerAggregationsResponsePath', () => {
|
||||
test('returns correct path for sampler shard size of 1000', () => {
|
||||
expect(getSamplerAggregationsResponsePath(1000)).toEqual(['sample']);
|
||||
});
|
||||
|
||||
test('returns correct path for sampler shard size of 0', () => {
|
||||
expect(getSamplerAggregationsResponsePath(0)).toEqual([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
/*
|
||||
* Contains utility functions for building and processing queries.
|
||||
*/
|
||||
|
@ -37,32 +36,3 @@ export function buildBaseFilterCriteria(
|
|||
|
||||
return filterCriteria;
|
||||
}
|
||||
|
||||
// Wraps the supplied aggregations in a sampler aggregation.
|
||||
// A supplied samplerShardSize (the shard_size parameter of the sampler aggregation)
|
||||
// of less than 1 indicates no sampling, and the aggs are returned as-is.
|
||||
export function buildSamplerAggregation(
|
||||
aggs: any,
|
||||
samplerShardSize: number
|
||||
): Record<string, estypes.AggregationsAggregationContainer> {
|
||||
if (samplerShardSize < 1) {
|
||||
return aggs;
|
||||
}
|
||||
|
||||
return {
|
||||
sample: {
|
||||
sampler: {
|
||||
shard_size: samplerShardSize,
|
||||
},
|
||||
aggs,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the path of aggregations in the elasticsearch response, as an array,
|
||||
// depending on whether sampling is being used.
|
||||
// A supplied samplerShardSize (the shard_size parameter of the sampler aggregation)
|
||||
// of less than 1 indicates no sampling, and an empty array is returned.
|
||||
export function getSamplerAggregationsResponsePath(samplerShardSize: number): string[] {
|
||||
return samplerShardSize > 0 ? ['sample'] : [];
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import type {
|
|||
import moment from 'moment';
|
||||
import { merge } from 'lodash';
|
||||
import type { DataViewsService } from '@kbn/data-views-plugin/common';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import type { AnalysisLimits } from '../../../common/types/anomaly_detection_jobs';
|
||||
import { getAuthorizationHeader } from '../../lib/request_authorization';
|
||||
import type { MlClient } from '../../lib/ml_client';
|
||||
|
@ -54,7 +55,6 @@ import type { JobExistResult, JobStat } from '../../../common/types/data_recogni
|
|||
import type { Datafeed } from '../../../common/types/anomaly_detection_jobs';
|
||||
import type { MLSavedObjectService } from '../../saved_objects';
|
||||
import { isDefined } from '../../../common/types/guards';
|
||||
import { isPopulatedObject } from '../../../common/util/object_utils';
|
||||
|
||||
const ML_DIR = 'ml';
|
||||
const KIBANA_DIR = 'kibana';
|
||||
|
|
|
@ -5,21 +5,23 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IScopedClusterClient } from '@kbn/core/server';
|
||||
import { get, each, last, find } from 'lodash';
|
||||
|
||||
import { IScopedClusterClient } from '@kbn/core/server';
|
||||
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/server';
|
||||
import {
|
||||
buildSamplerAggregation,
|
||||
getAggIntervals,
|
||||
getSamplerAggregationsResponsePath,
|
||||
} from '@kbn/ml-agg-utils';
|
||||
import { stringHash } from '@kbn/ml-string-hash';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types';
|
||||
import { getSafeAggregationName } from '../../../common/util/job_utils';
|
||||
import { stringHash } from '../../../common/util/string_utils';
|
||||
import {
|
||||
buildBaseFilterCriteria,
|
||||
buildSamplerAggregation,
|
||||
getSamplerAggregationsResponsePath,
|
||||
} from '../../lib/query_utils';
|
||||
import { buildBaseFilterCriteria } from '../../lib/query_utils';
|
||||
import { AggCardinality, RuntimeMappings } from '../../../common/types/fields';
|
||||
import { getDatafeedAggregations } from '../../../common/util/datafeed_utils';
|
||||
import { Datafeed } from '../../../common/types/anomaly_detection_jobs';
|
||||
import { isPopulatedObject } from '../../../common/util/object_utils';
|
||||
|
||||
const SAMPLER_TOP_TERMS_THRESHOLD = 100000;
|
||||
const SAMPLER_TOP_TERMS_SHARD_SIZE = 5000;
|
||||
|
@ -112,13 +114,6 @@ interface FieldExamples {
|
|||
examples: any[];
|
||||
}
|
||||
|
||||
interface NumericColumnStats {
|
||||
interval: number;
|
||||
min: number;
|
||||
max: number;
|
||||
}
|
||||
type NumericColumnStatsMap = Record<string, NumericColumnStats>;
|
||||
|
||||
interface AggHistogram {
|
||||
histogram: {
|
||||
field: string;
|
||||
|
@ -178,67 +173,6 @@ type BatchStats =
|
|||
| DocumentCountStats
|
||||
| FieldExamples;
|
||||
|
||||
const getAggIntervals = async (
|
||||
{ asCurrentUser }: IScopedClusterClient,
|
||||
indexPattern: string,
|
||||
query: any,
|
||||
fields: HistogramField[],
|
||||
samplerShardSize: number,
|
||||
runtimeMappings?: RuntimeMappings
|
||||
): Promise<NumericColumnStatsMap> => {
|
||||
const numericColumns = fields.filter((field) => {
|
||||
return field.type === KBN_FIELD_TYPES.NUMBER || field.type === KBN_FIELD_TYPES.DATE;
|
||||
});
|
||||
|
||||
if (numericColumns.length === 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const minMaxAggs = numericColumns.reduce((aggs, c) => {
|
||||
const id = stringHash(c.fieldName);
|
||||
aggs[id] = {
|
||||
stats: {
|
||||
field: c.fieldName,
|
||||
},
|
||||
};
|
||||
return aggs;
|
||||
}, {} as Record<string, object>);
|
||||
|
||||
const body = await asCurrentUser.search(
|
||||
{
|
||||
index: indexPattern,
|
||||
size: 0,
|
||||
body: {
|
||||
query,
|
||||
aggs: buildSamplerAggregation(minMaxAggs, samplerShardSize),
|
||||
size: 0,
|
||||
...(isPopulatedObject(runtimeMappings) ? { runtime_mappings: runtimeMappings } : {}),
|
||||
},
|
||||
},
|
||||
{ maxRetries: 0 }
|
||||
);
|
||||
|
||||
const aggsPath = getSamplerAggregationsResponsePath(samplerShardSize);
|
||||
const aggregations = aggsPath.length > 0 ? get(body.aggregations, aggsPath) : body.aggregations;
|
||||
|
||||
return Object.keys(aggregations).reduce((p, aggName) => {
|
||||
const stats = [aggregations[aggName].min, aggregations[aggName].max];
|
||||
if (!stats.includes(null)) {
|
||||
const delta = aggregations[aggName].max - aggregations[aggName].min;
|
||||
|
||||
let aggInterval = 1;
|
||||
|
||||
if (delta > MAX_CHART_COLUMNS || delta <= 1) {
|
||||
aggInterval = delta / (MAX_CHART_COLUMNS - 1);
|
||||
}
|
||||
|
||||
p[aggName] = { interval: aggInterval, min: stats[0], max: stats[1] };
|
||||
}
|
||||
|
||||
return p;
|
||||
}, {} as NumericColumnStatsMap);
|
||||
};
|
||||
|
||||
// export for re-use by transforms plugin
|
||||
export const getHistogramsForFields = async (
|
||||
client: IScopedClusterClient,
|
||||
|
@ -250,7 +184,7 @@ export const getHistogramsForFields = async (
|
|||
) => {
|
||||
const { asCurrentUser } = client;
|
||||
const aggIntervals = await getAggIntervals(
|
||||
client,
|
||||
client.asCurrentUser,
|
||||
indexPattern,
|
||||
query,
|
||||
fields,
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import Boom from '@hapi/boom';
|
||||
import { IScopedClusterClient } from '@kbn/core/server';
|
||||
import { duration } from 'moment';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { parseInterval } from '../../../common/util/parse_interval';
|
||||
import { initCardinalityFieldsCache } from './fields_aggs_cache';
|
||||
import { AggCardinality } from '../../../common/types/fields';
|
||||
|
@ -15,7 +16,6 @@ import { isValidAggregationField } from '../../../common/util/validation_utils';
|
|||
import { getDatafeedAggregations } from '../../../common/util/datafeed_utils';
|
||||
import { Datafeed, IndicesOptions } from '../../../common/types/anomaly_detection_jobs';
|
||||
import { RuntimeMappings } from '../../../common/types/fields';
|
||||
import { isPopulatedObject } from '../../../common/util/object_utils';
|
||||
|
||||
/**
|
||||
* Service for carrying out queries to obtain data
|
||||
|
|
|
@ -9,6 +9,7 @@ import { uniq } from 'lodash';
|
|||
import Boom from '@hapi/boom';
|
||||
import { IScopedClusterClient } from '@kbn/core/server';
|
||||
import type { RulesClient } from '@kbn/alerting-plugin/server';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import {
|
||||
getSingleMetricViewerJobErrorMessage,
|
||||
parseTimeIntervalForJob,
|
||||
|
@ -47,7 +48,6 @@ import {
|
|||
} from '../../../common/util/job_utils';
|
||||
import { groupsProvider } from './groups';
|
||||
import type { MlClient } from '../../lib/ml_client';
|
||||
import { isPopulatedObject } from '../../../common/util/object_utils';
|
||||
import { ML_ALERT_TYPES } from '../../../common/constants/alerts';
|
||||
import { MlAnomalyDetectionAlertParams } from '../../routes/schemas/alerting_schema';
|
||||
import type { AuthorizationHeader } from '../../lib/request_authorization';
|
||||
|
|
|
@ -10,8 +10,9 @@ import { i18n } from '@kbn/i18n';
|
|||
import { each, find, get, keyBy, map, reduce, sortBy } from 'lodash';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
|
||||
import { extent, max, min } from 'd3';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import type { MlClient } from '../../lib/ml_client';
|
||||
import { isPopulatedObject, isRuntimeMappings } from '../../../common';
|
||||
import { isRuntimeMappings } from '../../../common';
|
||||
import type {
|
||||
MetricData,
|
||||
ModelPlotOutput,
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
import type { EsIndex } from '../types/es_index';
|
||||
import type { EsIngestPipeline } from '../types/es_ingest_pipeline';
|
||||
import { isPopulatedObject } from '../shared_imports';
|
||||
|
||||
// To be able to use the type guards on the client side, we need to make sure we don't import
|
||||
// the code of '@kbn/config-schema' but just its types, otherwise the client side code will
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
export type { ChartData } from '@kbn/ml-plugin/common';
|
||||
export {
|
||||
composeValidators,
|
||||
isPopulatedObject,
|
||||
isRuntimeMappings,
|
||||
patternValidator,
|
||||
isRuntimeField,
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
*/
|
||||
|
||||
import type { DataView } from '@kbn/data-views-plugin/common';
|
||||
|
||||
import { isPopulatedObject } from '../shared_imports';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
// Custom minimal type guard for DataView to check against the attributes used in transforms code.
|
||||
export function isDataView(arg: any): arg is DataView {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
import type { EuiComboBoxOptionOption } from '@elastic/eui/src/components/combo_box/types';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import type { LatestFunctionConfig, PutTransformsRequestSchema } from '../api_schemas/transforms';
|
||||
import { isPopulatedObject } from '../shared_imports';
|
||||
import type { PivotGroupByDict } from './pivot_group_by';
|
||||
import type { PivotAggDict } from './pivot_aggs';
|
||||
import type { TransformHealthAlertRule } from './alerting';
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
import { TransformState, TRANSFORM_STATE } from '../constants';
|
||||
import { isPopulatedObject } from '../shared_imports';
|
||||
import { TransformId } from './transform';
|
||||
|
||||
export interface TransformStats {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { isPopulatedObject } from '../shared_imports';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
export interface ErrorResponse {
|
||||
body: {
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
import { FC } from 'react';
|
||||
|
||||
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
import type { AggName } from '../../../common/types/aggregations';
|
||||
import type { Dictionary } from '../../../common/types/common';
|
||||
import type { EsFieldName } from '../../../common/types/fields';
|
||||
import type { PivotAgg, PivotSupportedAggs } from '../../../common/types/pivot_aggs';
|
||||
import { PIVOT_SUPPORTED_AGGS } from '../../../common/types/pivot_aggs';
|
||||
import { isPopulatedObject } from '../../../common/shared_imports';
|
||||
|
||||
import { getAggFormConfig } from '../sections/create_transform/components/step_define/common/get_agg_form_config';
|
||||
import { PivotAggsConfigFilter } from '../sections/create_transform/components/step_define/common/filter_agg/types';
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
|
||||
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { AggName } from '../../../common/types/aggregations';
|
||||
import { Dictionary } from '../../../common/types/common';
|
||||
import { EsFieldName } from '../../../common/types/fields';
|
||||
import { GenericAgg } from '../../../common/types/pivot_group_by';
|
||||
import { isPopulatedObject } from '../../../common/shared_imports';
|
||||
import { PivotAggsConfigWithUiSupport } from './pivot_aggs';
|
||||
|
||||
export enum PIVOT_SUPPORTED_GROUP_BY_AGGS {
|
||||
|
|
|
@ -9,6 +9,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
|||
|
||||
import { HttpFetchError } from '@kbn/core/public';
|
||||
import type { DataView } from '@kbn/data-views-plugin/public';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
import {
|
||||
DEFAULT_CONTINUOUS_MODE_DELAY,
|
||||
|
@ -23,7 +24,6 @@ import type {
|
|||
PutTransformsPivotRequestSchema,
|
||||
PutTransformsRequestSchema,
|
||||
} from '../../../common/api_schemas/transforms';
|
||||
import { isPopulatedObject } from '../../../common/shared_imports';
|
||||
import { DateHistogramAgg, HistogramAgg, TermsAgg } from '../../../common/types/pivot_group_by';
|
||||
import { isDataView } from '../../../common/types/data_view';
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue