Skip to content

Commit

Permalink
Merge branch 'master' into feature-ingest-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
John Schulz authored Feb 18, 2020
2 parents 64fc710 + f6dc674 commit ac021fa
Show file tree
Hide file tree
Showing 1,003 changed files with 8,494 additions and 2,454 deletions.
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ Granted that you share your thoughts, we might even be able to come up with crea

First of all, **sorry about that!** We want you to have a great time with Kibana.

Hosting meaningful discussions on GitHub can be challenging. For that reason, we'll sometimes ask that you join us on IRC _([#kibana](https://kiwiirc.com/client/irc.freenode.net/?#kibana) on freenode)_ to chat about your issues. You may also experience **faster response times** when engaging us via IRC.

There's hundreds of open issues and prioritizing what to work on is an important aspect of our daily jobs. We prioritize issues according to impact and difficulty, so some issues can be neglected while we work on more pressing issues.

Feel free to bump your issues if you think they've been neglected for a prolonged period, or just jump on IRC and let us have it!
Feel free to bump your issues if you think they've been neglected for a prolonged period.

### "I want to help!"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"@kbn/ui-framework": "1.0.0",
"@kbn/ui-shared-deps": "1.0.0",
"JSONStream": "1.3.5",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "^1.4.0",
"angular": "^1.7.9",
"angular-aria": "^1.7.9",
"angular-elastic": "^2.5.1",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"node-sass": "^4.13.0",
"postcss-loader": "^3.0.0",
"raw-loader": "^3.1.0",
"resolve-url-loader": "^3.1.1",
"rxjs": "^6.5.3",
"sass-loader": "^8.0.2",
"style-loader": "^1.1.3",
Expand Down
21 changes: 21 additions & 0 deletions packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,27 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {
},
},
},
{
loader: 'resolve-url-loader',
options: {
join: (_: string, __: any) => (uri: string, base?: string) => {
if (!base) {
return null;
}

// manually force ui/* urls in legacy styles to resolve to ui/legacy/public
if (uri.startsWith('ui/') && base.split(Path.sep).includes('legacy')) {
return Path.resolve(
worker.repoRoot,
'src/legacy/ui/public',
uri.replace('ui/', '')
);
}

return null;
},
},
},
{
loader: 'sass-loader',
options: {
Expand Down
31 changes: 19 additions & 12 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43046,21 +43046,28 @@ module.exports = require("tty");
const os = __webpack_require__(11);
const hasFlag = __webpack_require__(12);

const env = process.env;
const {env} = process;

let forceColor;
if (hasFlag('no-color') ||
hasFlag('no-colors') ||
hasFlag('color=false')) {
forceColor = false;
hasFlag('color=false') ||
hasFlag('color=never')) {
forceColor = 0;
} else if (hasFlag('color') ||
hasFlag('colors') ||
hasFlag('color=true') ||
hasFlag('color=always')) {
forceColor = true;
forceColor = 1;
}
if ('FORCE_COLOR' in env) {
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
if (env.FORCE_COLOR === true || env.FORCE_COLOR === 'true') {
forceColor = 1;
} else if (env.FORCE_COLOR === false || env.FORCE_COLOR === 'false') {
forceColor = 0;
} else {
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
}
}

function translateLevel(level) {
Expand All @@ -43077,7 +43084,7 @@ function translateLevel(level) {
}

function supportsColor(stream) {
if (forceColor === false) {
if (forceColor === 0) {
return 0;
}

Expand All @@ -43091,11 +43098,15 @@ function supportsColor(stream) {
return 2;
}

if (stream && !stream.isTTY && forceColor !== true) {
if (stream && !stream.isTTY && forceColor === undefined) {
return 0;
}

const min = forceColor ? 1 : 0;
const min = forceColor || 0;

if (env.TERM === 'dumb') {
return min;
}

if (process.platform === 'win32') {
// Node.js 7.5.0 is the first version of Node.js to include a patch to
Expand Down Expand Up @@ -43156,10 +43167,6 @@ function supportsColor(stream) {
return 1;
}

if (env.TERM === 'dumb') {
return min;
}

return min;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"devDependencies": {
"@elastic/charts": "^17.0.2",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "^1.4.0",
"@elastic/eui": "19.0.0",
"@kbn/dev-utils": "1.0.0",
"@kbn/i18n": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ require('core-js/stable');
require('regenerator-runtime/runtime');
require('custom-event-polyfill');
require('whatwg-fetch');
require('abort-controller/polyfill');
require('abortcontroller-polyfill/dist/polyfill-patch-fetch');
require('./vendor/childnode_remove_polyfill');
require('symbol-observable');
4 changes: 4 additions & 0 deletions packages/kbn-utility-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ type B = UnwrapPromise<A>; // string

- `Ensure<T, X>` &mdash; Makes sure `T` is of type `X`.
- `ObservableLike<T>` &mdash; Minimal interface for an object resembling an `Observable`.
- `PublicContract<T>` &mdash; Returns an object with public keys only.
- `PublicKeys<T>` &mdash; Returns public keys of an object.
- `RecursiveReadonly<T>` &mdash; Like `Readonly<T>`, but freezes object recursively.
- `ShallowPromise<T>` &mdash; Same as `Promise` type, but it flat maps the wrapped type.
- `UnionToIntersection<T>` &mdash; Converts a union of types into an intersection.
- `UnwrapObservable<T>` &mdash; Returns wrapped type of an observable.
- `UnwrapPromise<T>` &mdash; Returns wrapped type of a promise.
- `UnwrapPromiseOrReturn<T>` &mdash; Returns wrapped type of a promise or the type itself, if it isn't a promise.
- `Values<T>` &mdash; Returns object or array value types.
28 changes: 28 additions & 0 deletions packages/kbn-utility-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,31 @@ export type RecursiveReadonly<T> = T extends (...args: any) => any
: T extends object
? Readonly<{ [K in keyof T]: RecursiveReadonly<T[K]> }>
: T;

/**
* Returns types or array or object values.
*/
export type Values<T> = T extends any[] ? T[number] : T extends object ? T[keyof T] : never;

/**
* Utility type for converting a union of types into an intersection.
*
* This is a bit of "black magic" that will interpret a Union type as an Intersection
* type. This is necessary in the case of distinguishing one collection from
* another.
*/
export type UnionToIntersection<U> = (U extends any
? (k: U) => void
: never) extends (k: infer I) => void
? I
: never;

/**
* Returns public keys of an object.
*/
export type PublicKeys<T> = keyof T;

/**
* Returns an object with public keys only.
*/
export type PublicContract<T> = Pick<T, PublicKeys<T>>;
33 changes: 33 additions & 0 deletions packages/kbn-utility-types/test-d/public_contract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { expectType } from 'tsd';
import { PublicContract } from '../index';

class Test {
public str: string = '';
// @ts-ignore
private num: number = 0;
}

type CONTRACT = PublicContract<Test>;

expectType<CONTRACT>({
str: 'foo',
});
31 changes: 31 additions & 0 deletions packages/kbn-utility-types/test-d/public_keys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { expectType } from 'tsd';
import { PublicKeys } from '../index';

class Test {
public str: string = '';
// @ts-ignore
private num: number = 0;
}

type KEYS = PublicKeys<Test>;

expectType<KEYS>('str');
28 changes: 28 additions & 0 deletions packages/kbn-utility-types/test-d/union_to_intersection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { expectType } from 'tsd';
import { UnionToIntersection } from '../index';

type INTERSECTED = UnionToIntersection<{ foo: 'bar' } | { baz: 'qux' }>;

expectType<INTERSECTED>({
foo: 'bar',
baz: 'qux',
});
38 changes: 38 additions & 0 deletions packages/kbn-utility-types/test-d/values.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { expectType } from 'tsd';
import { Values } from '../index';

// Arrays
type STRING = Values<string[]>;
type ASDF_FOO = Values<Array<'asdf' | 'foo'>>;

expectType<STRING>('adf');
expectType<ASDF_FOO>('asdf');
expectType<ASDF_FOO>('foo');

// Objects
type STRING2 = Values<Record<number, string>>;
type FOO = Values<Record<number, 'foo'>>;
type BAR = Values<{ foo: 'bar' }>;

expectType<STRING2>('adf');
expectType<FOO>('foo');
expectType<BAR>('bar');
9 changes: 7 additions & 2 deletions src/dev/typescript/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ export class Project {
public directory: string;
public name: string;
public config: any;
public disableTypeCheck: boolean;

private readonly include: IMinimatch[];
private readonly exclude: IMinimatch[];

constructor(public tsConfigPath: string, name?: string) {
constructor(
public tsConfigPath: string,
options: { name?: string; disableTypeCheck?: boolean } = {}
) {
this.config = parseTsConfig(tsConfigPath);

const { files, include, exclude = [] } = this.config as {
Expand All @@ -72,7 +76,8 @@ export class Project {
}

this.directory = dirname(this.tsConfigPath);
this.name = name || relative(REPO_ROOT, this.directory) || basename(this.directory);
this.disableTypeCheck = options.disableTypeCheck || false;
this.name = options.name || relative(REPO_ROOT, this.directory) || basename(this.directory);
this.include = makeMatchers(this.directory, include);
this.exclude = makeMatchers(this.directory, exclude);
}
Expand Down
16 changes: 9 additions & 7 deletions src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ import { Project } from './project';

export const PROJECTS = [
new Project(resolve(REPO_ROOT, 'tsconfig.json')),
new Project(resolve(REPO_ROOT, 'test/tsconfig.json'), 'kibana/test'),
new Project(resolve(REPO_ROOT, 'test/tsconfig.json'), { name: 'kibana/test' }),
new Project(resolve(REPO_ROOT, 'x-pack/tsconfig.json')),
new Project(resolve(REPO_ROOT, 'x-pack/test/tsconfig.json'), 'x-pack/test'),
new Project(
resolve(REPO_ROOT, 'x-pack/legacy/plugins/siem/cypress/tsconfig.json'),
'siem/cypress'
),
new Project(resolve(REPO_ROOT, 'x-pack/legacy/plugins/apm/cypress/tsconfig.json'), 'apm/cypress'),
new Project(resolve(REPO_ROOT, 'x-pack/test/tsconfig.json'), { name: 'x-pack/test' }),
new Project(resolve(REPO_ROOT, 'x-pack/legacy/plugins/siem/cypress/tsconfig.json'), {
name: 'siem/cypress',
}),
new Project(resolve(REPO_ROOT, 'x-pack/legacy/plugins/apm/cypress/tsconfig.json'), {
name: 'apm/cypress',
disableTypeCheck: true,
}),

// NOTE: using glob.sync rather than glob-all or globby
// because it takes less than 10 ms, while the other modules
Expand Down
2 changes: 1 addition & 1 deletion src/dev/typescript/run_type_check_cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function runTypeCheckCli() {
}

const tscArgs = ['--noEmit', '--pretty', ...(opts['skip-lib-check'] ? ['--skipLibCheck'] : [])];
const projects = filterProjectsByFlag(opts.project);
const projects = filterProjectsByFlag(opts.project).filter(p => !p.disableTypeCheck);

if (!projects.length) {
log.error(`Unable to find project at ${opts.project}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { AbortController } from 'abort-controller';
import { AbortController } from 'abortcontroller-polyfill/dist/cjs-ponyfill';

/*
* A simple utility for generating a handler that provides a signal to the handler that signals when
Expand Down
Loading

0 comments on commit ac021fa

Please sign in to comment.