Skip to content

Commit

Permalink
Merge branch 'main' of github.com:elastic/kibana into implement/ftr-c…
Browse files Browse the repository at this point in the history
…cs-support
  • Loading branch information
spalger committed Mar 7, 2022
2 parents 845a8bb + c0a653d commit f69b556
Show file tree
Hide file tree
Showing 196 changed files with 3,040 additions and 1,767 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Client used to query the elasticsearch cluster.
<b>Signature:</b>

```typescript
export declare type ElasticsearchClient = Omit<Client, 'connectionPool' | 'serializer' | 'extend' | 'child' | 'close' | 'diagnostic'>;
export declare type ElasticsearchClient = Omit<Client, 'connectionPool' | 'serializer' | 'extend' | 'close' | 'diagnostic'>;
```
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
std_dev: `${ELASTICSEARCH_DOCS}search-aggregations-metrics-extendedstats-aggregation.html`,
sum: `${ELASTICSEARCH_DOCS}search-aggregations-metrics-sum-aggregation.html`,
top_hits: `${ELASTICSEARCH_DOCS}search-aggregations-metrics-top-hits-aggregation.html`,
top_metrics: `${ELASTICSEARCH_DOCS}search-aggregations-metrics-top-metrics.html`,
},
runtimeFields: {
overview: `${ELASTICSEARCH_DOCS}runtime.html`,
Expand Down
20 changes: 12 additions & 8 deletions packages/kbn-type-summarizer/src/lib/source_mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,25 @@ import { tryReadFile } from './helpers/fs';
import { parseJson } from './helpers/json';
import { isNodeModule } from './is_node_module';

type SourceMapConsumerEntry = [ts.SourceFile, BasicSourceMapConsumer | undefined];

export class SourceMapper {
static async forSourceFiles(
log: Logger,
dtsDir: string,
repoRelativePackageDir: string,
sourceFiles: readonly ts.SourceFile[]
) {
const consumers = new Map<ts.SourceFile, BasicSourceMapConsumer | undefined>();

await Promise.all(
sourceFiles.map(async (sourceFile) => {
const entries = await Promise.all(
sourceFiles.map(async (sourceFile): Promise<undefined | SourceMapConsumerEntry> => {
if (isNodeModule(dtsDir, sourceFile.fileName)) {
return;
}

const text = sourceFile.getText();
const match = text.match(/^\/\/#\s*sourceMappingURL=(.*)/im);
if (!match) {
consumers.set(sourceFile, undefined);
return;
return [sourceFile, undefined];
}

const relSourceFile = Path.relative(process.cwd(), sourceFile.fileName);
Expand All @@ -50,11 +49,16 @@ export class SourceMapper {
}

const json = parseJson(sourceJson, `source map at [${relSourceMapPath}]`);
consumers.set(sourceFile, await new SourceMapConsumer(json));
log.debug('loaded sourcemap for', relSourceFile);
return [sourceFile, await new SourceMapConsumer(json)];
})
);

const consumers = new Map(entries.filter((e): e is SourceMapConsumerEntry => !!e));
log.debug(
'loaded sourcemaps for',
Array.from(consumers.keys()).map((s) => Path.relative(process.cwd(), s.fileName))
);

return new SourceMapper(consumers, repoRelativePackageDir);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ it('prints basic class correctly', async () => {
}
`);
expect(output.logs).toMatchInlineSnapshot(`
"debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts
"debug loaded sourcemaps for [ 'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts' ]
debug Ignoring 1 global declarations for \\"Record\\"
debug Ignoring 5 global declarations for \\"Promise\\"
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ it('prints the function declaration, including comments', async () => {
}
`);
expect(result.logs).toMatchInlineSnapshot(`
"debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/bar.d.ts
debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts
"debug loaded sourcemaps for [
'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/bar.d.ts',
'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts'
]
"
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ it('output type links to named import from node modules', async () => {
}
`);
expect(output.logs).toMatchInlineSnapshot(`
"debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts
"debug loaded sourcemaps for [ 'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts' ]
"
`);
});
Expand Down Expand Up @@ -84,7 +84,7 @@ it('output type links to default import from node modules', async () => {
}
`);
expect(output.logs).toMatchInlineSnapshot(`
"debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts
"debug loaded sourcemaps for [ 'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts' ]
"
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ it('prints the whole interface, including comments', async () => {
}
`);
expect(result.logs).toMatchInlineSnapshot(`
"debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts
"debug loaded sourcemaps for [ 'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts' ]
debug Ignoring 5 global declarations for \\"Promise\\"
"
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ it('collects references from source files which contribute to result', async ()
}
`);
expect(result.logs).toMatchInlineSnapshot(`
"debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/files/foo.d.ts
debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/files/index.d.ts
debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts
"debug loaded sourcemaps for [
'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/files/foo.d.ts',
'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/files/index.d.ts',
'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts'
]
debug Ignoring 5 global declarations for \\"Promise\\"
debug Ignoring 4 global declarations for \\"Symbol\\"
debug Ignoring 2 global declarations for \\"Component\\"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ it('prints basic type alias', async () => {
}
`);
expect(output.logs).toMatchInlineSnapshot(`
"debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts
"debug loaded sourcemaps for [ 'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts' ]
"
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ it('prints basic variable exports with sourcemaps', async () => {
}
`);
expect(output.logs).toMatchInlineSnapshot(`
"debug loaded sourcemap for packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts
"debug loaded sourcemaps for [ 'packages/kbn-type-summarizer/tests/__tmp__/dist_dts/index.d.ts' ]
"
`);
});
2 changes: 1 addition & 1 deletion src/core/server/elasticsearch/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { Client } from '@elastic/elasticsearch';
*/
export type ElasticsearchClient = Omit<
Client,
'connectionPool' | 'serializer' | 'extend' | 'child' | 'close' | 'diagnostic'
'connectionPool' | 'serializer' | 'extend' | 'close' | 'diagnostic'
>;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ export { EcsEventOutcome }
export { EcsEventType }

// @public
export type ElasticsearchClient = Omit<Client, 'connectionPool' | 'serializer' | 'extend' | 'child' | 'close' | 'diagnostic'>;
export type ElasticsearchClient = Omit<Client, 'connectionPool' | 'serializer' | 'extend' | 'close' | 'diagnostic'>;

// @public
export type ElasticsearchClientConfig = Pick<ElasticsearchConfig, 'customHeaders' | 'compression' | 'sniffOnStart' | 'sniffOnConnectionFault' | 'requestHeadersWhitelist' | 'sniffInterval' | 'hosts' | 'username' | 'password' | 'serviceAccountToken'> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createUsageCollectionSetupMock } from '../../../plugins/usage_collectio

const { makeUsageCollector } = createUsageCollectionSetupMock();

export const myCollector = makeUsageCollector<Usage, false>({
export const myCollector = makeUsageCollector<Usage>({
type: 'importing_from_export_collector',
isReady: () => true,
fetch() {
Expand Down
2 changes: 1 addition & 1 deletion src/fixtures/telemetry_collectors/stats_collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface Usage {
* We should collect them when the schema is defined.
*/

export const myCollectorWithSchema = makeStatsCollector<Usage, false>({
export const myCollectorWithSchema = makeStatsCollector<Usage>({
type: 'my_stats_collector_with_schema',
isReady: () => true,
fetch() {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/dashboard/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
{ "path": "../navigation/tsconfig.json" },
{ "path": "../saved_objects_tagging_oss/tsconfig.json" },
{ "path": "../saved_objects/tsconfig.json" },
{ "path": "../screenshot_mode/tsconfig.json" },
{ "path": "../ui_actions/tsconfig.json" },
{ "path": "../charts/tsconfig.json" },
{ "path": "../discover/tsconfig.json" },
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/data/common/search/aggs/agg_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const getAggTypes = () => ({
{ name: METRIC_TYPES.PERCENTILES, fn: metrics.getPercentilesMetricAgg },
{ name: METRIC_TYPES.PERCENTILE_RANKS, fn: metrics.getPercentileRanksMetricAgg },
{ name: METRIC_TYPES.TOP_HITS, fn: metrics.getTopHitMetricAgg },
{ name: METRIC_TYPES.TOP_METRICS, fn: metrics.getTopMetricsMetricAgg },
{ name: METRIC_TYPES.DERIVATIVE, fn: metrics.getDerivativeMetricAgg },
{ name: METRIC_TYPES.CUMULATIVE_SUM, fn: metrics.getCumulativeSumMetricAgg },
{ name: METRIC_TYPES.MOVING_FN, fn: metrics.getMovingAvgMetricAgg },
Expand Down Expand Up @@ -109,4 +110,5 @@ export const getAggTypesFunctions = () => [
metrics.aggStdDeviation,
metrics.aggSum,
metrics.aggTopHit,
metrics.aggTopMetrics,
];
2 changes: 2 additions & 0 deletions src/plugins/data/common/search/aggs/aggs_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ describe('Aggs service', () => {
"percentiles",
"percentile_ranks",
"top_hits",
"top_metrics",
"derivative",
"cumulative_sum",
"moving_avg",
Expand Down Expand Up @@ -147,6 +148,7 @@ describe('Aggs service', () => {
"percentiles",
"percentile_ranks",
"top_hits",
"top_metrics",
"derivative",
"cumulative_sum",
"moving_avg",
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/data/common/search/aggs/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ export * from './sum_fn';
export * from './sum';
export * from './top_hit_fn';
export * from './top_hit';
export * from './top_metrics';
export * from './top_metrics_fn';
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { parentPipelineAggWriter } from './parent_pipeline_agg_writer';

const metricAggFilter = [
'!top_hits',
'!top_metrics',
'!percentiles',
'!percentile_ranks',
'!median',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { IMetricAggConfig, MetricAggParam } from '../metric_agg_type';

const metricAggFilter: string[] = [
'!top_hits',
'!top_metrics',
'!percentiles',
'!percentile_ranks',
'!median',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface MetricAggParam<TMetricAggConfig extends AggConfig>
extends AggParamType<TMetricAggConfig> {
filterFieldTypes?: FieldTypes;
onlyAggregatable?: boolean;
scriptable?: boolean;
}

const metricType = 'metrics';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export enum METRIC_TYPES {
SERIAL_DIFF = 'serial_diff',
SUM = 'sum',
TOP_HITS = 'top_hits',
TOP_METRICS = 'top_metrics',
PERCENTILES = 'percentiles',
PERCENTILE_RANKS = 'percentile_ranks',
STD_DEV = 'std_dev',
Expand Down
Loading

0 comments on commit f69b556

Please sign in to comment.