Skip to content

Commit 2b2d37a

Browse files
Merge branch 'master' into bump-chromedriver-up-to-80
2 parents a130858 + 918c0de commit 2b2d37a

184 files changed

Lines changed: 3362 additions & 2683 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/developer/plugin/development-plugin-resources.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,8 @@ To enable TypeScript support, create a `tsconfig.json` file at the root of your
6666
TypeScript code is automatically converted into JavaScript during development,
6767
but not in the distributable version of Kibana. If you use the
6868
{repo}blob/{branch}/packages/kbn-plugin-helpers[@kbn/plugin-helpers] to build your plugin, then your `.ts` and `.tsx` files will be permanently transpiled before your plugin is archived. If you have your own build process, make sure to run the TypeScript compiler on your source files and ship the compilation output so that your plugin will work with the distributable version of Kibana.
69+
70+
==== {kib} platform migration guide
71+
72+
{repo}blob/{branch}/src/core/MIGRATION.md#migrating-legacy-plugins-to-the-new-platform[This guide]
73+
provides an action plan for moving a legacy plugin to the new platform.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"@elastic/charts": "^17.0.2",
121121
"@elastic/datemath": "5.0.2",
122122
"@elastic/ems-client": "7.6.0",
123-
"@elastic/eui": "18.3.0",
123+
"@elastic/eui": "19.0.0",
124124
"@elastic/filesaver": "1.1.2",
125125
"@elastic/good": "8.1.1-kibana2",
126126
"@elastic/numeral": "2.3.5",

packages/kbn-config-schema/src/types/duration_type.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe('#defaultValue', () => {
101101
source: duration({ defaultValue: 600 }),
102102
target: duration({ defaultValue: siblingRef('source') }),
103103
fromContext: duration({ defaultValue: contextRef('val') }),
104-
}).validate(undefined, { val: momentDuration(700, 'ms') })
104+
}).validate({}, { val: momentDuration(700, 'ms') })
105105
).toMatchInlineSnapshot(`
106106
Object {
107107
"fromContext": "PT0.7S",
@@ -115,7 +115,7 @@ Object {
115115
source: duration({ defaultValue: '1h' }),
116116
target: duration({ defaultValue: siblingRef('source') }),
117117
fromContext: duration({ defaultValue: contextRef('val') }),
118-
}).validate(undefined, { val: momentDuration(2, 'hour') })
118+
}).validate({}, { val: momentDuration(2, 'hour') })
119119
).toMatchInlineSnapshot(`
120120
Object {
121121
"fromContext": "PT2H",
@@ -129,7 +129,7 @@ Object {
129129
source: duration({ defaultValue: momentDuration(1, 'hour') }),
130130
target: duration({ defaultValue: siblingRef('source') }),
131131
fromContext: duration({ defaultValue: contextRef('val') }),
132-
}).validate(undefined, { val: momentDuration(2, 'hour') })
132+
}).validate({}, { val: momentDuration(2, 'hour') })
133133
).toMatchInlineSnapshot(`
134134
Object {
135135
"fromContext": "PT2H",

packages/kbn-config-schema/src/types/maybe_type.test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,41 @@ test('includes namespace in failure', () => {
6060
const type = schema.maybe(schema.string());
6161
expect(() => type.validate(null, {}, 'foo-namespace')).toThrowErrorMatchingSnapshot();
6262
});
63+
64+
describe('maybe + object', () => {
65+
test('returns undefined if undefined object', () => {
66+
const type = schema.maybe(schema.object({}));
67+
expect(type.validate(undefined)).toEqual(undefined);
68+
});
69+
70+
test('returns undefined if undefined object with no defaults', () => {
71+
const type = schema.maybe(
72+
schema.object({
73+
type: schema.string(),
74+
id: schema.string(),
75+
})
76+
);
77+
78+
expect(type.validate(undefined)).toEqual(undefined);
79+
});
80+
81+
test('returns empty object if maybe keys', () => {
82+
const type = schema.object({
83+
name: schema.maybe(schema.string()),
84+
});
85+
expect(type.validate({})).toEqual({});
86+
});
87+
88+
test('returns empty object if maybe nested object', () => {
89+
const type = schema.object({
90+
name: schema.maybe(
91+
schema.object({
92+
type: schema.string(),
93+
id: schema.string(),
94+
})
95+
),
96+
});
97+
98+
expect(type.validate({})).toEqual({});
99+
});
100+
});

packages/kbn-config-schema/src/types/maybe_type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class MaybeType<V> extends Type<V | undefined> {
2525
type
2626
.getSchema()
2727
.optional()
28-
.default()
28+
.default(() => undefined, 'undefined')
2929
);
3030
}
3131
}

packages/kbn-config-schema/src/types/object_type.test.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ test('returns value by default', () => {
3030
expect(type.validate(value)).toEqual({ name: 'test' });
3131
});
3232

33+
test('returns empty object if undefined', () => {
34+
const type = schema.object({});
35+
expect(type.validate(undefined)).toEqual({});
36+
});
37+
3338
test('properly parse the value if input is a string', () => {
3439
const type = schema.object({
3540
name: schema.string(),
@@ -112,21 +117,36 @@ test('undefined object within object', () => {
112117
}),
113118
});
114119

120+
expect(type.validate(undefined)).toEqual({
121+
foo: {
122+
bar: 'hello world',
123+
},
124+
});
125+
115126
expect(type.validate({})).toEqual({
116127
foo: {
117128
bar: 'hello world',
118129
},
119130
});
131+
132+
expect(type.validate({ foo: {} })).toEqual({
133+
foo: {
134+
bar: 'hello world',
135+
},
136+
});
120137
});
121138

122-
test('object within object with required', () => {
139+
test('object within object with key without defaultValue', () => {
123140
const type = schema.object({
124141
foo: schema.object({
125142
bar: schema.string(),
126143
}),
127144
});
128145
const value = { foo: {} };
129146

147+
expect(() => type.validate(undefined)).toThrowErrorMatchingInlineSnapshot(
148+
`"[foo.bar]: expected value of type [string] but got [undefined]"`
149+
);
130150
expect(() => type.validate(value)).toThrowErrorMatchingInlineSnapshot(
131151
`"[foo.bar]: expected value of type [string] but got [undefined]"`
132152
);

packages/kbn-config-schema/src/types/object_type.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ export type ObjectResultType<P extends Props> = Readonly<{ [K in keyof P]: TypeO
3333
export type ObjectTypeOptions<P extends Props = any> = TypeOptions<
3434
{ [K in keyof P]: TypeOf<P[K]> }
3535
> & {
36+
/** Should uknown keys not be defined in the schema be allowed. Defaults to `false` */
3637
allowUnknowns?: boolean;
3738
};
3839

3940
export class ObjectType<P extends Props = any> extends Type<ObjectResultType<P>> {
4041
private props: Record<string, AnySchema>;
4142

42-
constructor(props: P, options: ObjectTypeOptions<P> = {}) {
43+
constructor(props: P, { allowUnknowns = false, ...typeOptions }: ObjectTypeOptions<P> = {}) {
4344
const schemaKeys = {} as Record<string, AnySchema>;
4445
for (const [key, value] of Object.entries(props)) {
4546
schemaKeys[key] = value.getSchema();
4647
}
47-
const { allowUnknowns, ...typeOptions } = options;
4848
const schema = internals
4949
.object()
5050
.keys(schemaKeys)
51-
.optional()
5251
.default()
52+
.optional()
5353
.unknown(Boolean(allowUnknowns));
5454

5555
super(schema, typeOptions);

packages/kbn-ui-shared-deps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"devDependencies": {
1212
"@elastic/charts": "^17.0.2",
1313
"abort-controller": "^3.0.0",
14-
"@elastic/eui": "18.3.0",
14+
"@elastic/eui": "19.0.0",
1515
"@kbn/dev-utils": "1.0.0",
1616
"@kbn/i18n": "1.0.0",
1717
"@yarnpkg/lockfile": "^1.1.0",

src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/__snapshots__/no_results.test.js.snap

Lines changed: 16 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/histogram.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {
4141
} from '@elastic/charts';
4242

4343
import { i18n } from '@kbn/i18n';
44-
import { EuiChartThemeType } from '@elastic/eui/src/themes/charts/themes';
44+
import { EuiChartThemeType } from '@elastic/eui/dist/eui_charts_theme';
4545
import { Subscription } from 'rxjs';
4646
import { getServices, timezoneProvider } from '../../../kibana_services';
4747

0 commit comments

Comments
 (0)