Skip to content

Commit 5e5df07

Browse files
Merge branch 'master' into slim-vis_type_markdown
2 parents 39859a5 + ad89b1e commit 5e5df07

File tree

818 files changed

+33003
-23345
lines changed

Some content is hidden

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

818 files changed

+33003
-23345
lines changed

.eslintignore

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,48 @@
1-
node_modules
2-
bower_components
3-
/data
4-
/optimize
5-
/build
6-
/target
1+
**/*.js.snap
2+
**/graphql/types.ts
73
/.es
8-
/plugins
4+
/build
95
/built_assets
6+
/data
107
/html_docs
11-
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
12-
/src/plugins/vis_type_timelion/public/_generated_/**
13-
src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data
14-
/src/legacy/ui/public/flot-charts
8+
/optimize
9+
/plugins
1510
/test/fixtures/scenarios
16-
/src/legacy/core_plugins/console/public/webpackShims
11+
/x-pack/build
12+
node_modules
13+
target
14+
15+
!/.eslintrc.js
16+
17+
# plugin overrides
18+
/src/core/lib/kbn_internal_native_observable
1719
/src/legacy/core_plugins/console/public/tests/webpackShims
20+
/src/legacy/core_plugins/console/public/webpackShims
21+
/src/legacy/plugin_discovery/plugin_pack/__tests__/fixtures/plugins/broken
22+
/src/legacy/ui/public/flot-charts
1823
/src/legacy/ui/public/utils/decode_geo_hash.js
24+
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
25+
/src/plugins/vis_type_timelion/public/_generated_/**
1926
/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.*
20-
/src/core/lib/kbn_internal_native_observable
21-
/packages/*/target
22-
/packages/eslint-config-kibana
23-
/packages/kbn-pm/dist
24-
/packages/kbn-plugin-generator/sao_template/template
25-
/packages/kbn-ui-framework/dist
26-
/packages/kbn-ui-framework/doc_site/build
27-
/packages/kbn-ui-framework/generator-kui/*/templates/
28-
/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/
29-
/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/
30-
/x-pack/legacy/plugins/maps/public/vendor/**
31-
/x-pack/coverage
32-
/x-pack/build
3327
/x-pack/legacy/plugins/**/__tests__/fixtures/**
34-
/packages/kbn-interpreter/src/common/lib/grammar.js
28+
/x-pack/legacy/plugins/apm/e2e/cypress/**/snapshots.js
3529
/x-pack/legacy/plugins/canvas/canvas_plugin
30+
/x-pack/legacy/plugins/canvas/canvas_plugin_src/lib/flot-charts
3631
/x-pack/legacy/plugins/canvas/shareable_runtime/build
3732
/x-pack/legacy/plugins/canvas/storybook
38-
/x-pack/legacy/plugins/canvas/canvas_plugin_src/lib/flot-charts
3933
/x-pack/legacy/plugins/infra/common/graphql/types.ts
4034
/x-pack/legacy/plugins/infra/public/graphql/types.ts
4135
/x-pack/legacy/plugins/infra/server/graphql/types.ts
42-
/x-pack/legacy/plugins/apm/e2e/cypress/**/snapshots.js
43-
/src/legacy/plugin_discovery/plugin_pack/__tests__/fixtures/plugins/broken
44-
**/graphql/types.ts
45-
**/*.js.snap
46-
!/.eslintrc.js
36+
/x-pack/legacy/plugins/maps/public/vendor/**
37+
38+
# package overrides
39+
/packages/eslint-config-kibana
40+
/packages/kbn-interpreter/src/common/lib/grammar.js
41+
/packages/kbn-plugin-generator/sao_template/template
42+
/packages/kbn-pm/dist
43+
/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/
44+
/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/
45+
/packages/kbn-ui-framework/dist
46+
/packages/kbn-ui-framework/doc_site/build
47+
/packages/kbn-ui-framework/generator-kui/*/templates/
48+

.eslintrc.js

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ module.exports = {
217217
'examples/**/*',
218218
'!(src|x-pack)/**/*.test.*',
219219
'!(x-pack/)?test/**/*',
220+
// next folder contains legacy browser tests which can't be migrated to jest
221+
// which import np files
222+
'!src/legacy/core_plugins/kibana/public/__tests__/**/*',
220223
],
221224
from: [
222225
'(src|x-pack)/plugins/**/(public|server)/**/*',
@@ -739,6 +742,101 @@ module.exports = {
739742
},
740743
},
741744

745+
/**
746+
* Lists overrides
747+
*/
748+
{
749+
// typescript and javascript for front and back end
750+
files: ['x-pack/plugins/lists/**/*.{js,ts,tsx}'],
751+
plugins: ['eslint-plugin-node'],
752+
env: {
753+
mocha: true,
754+
jest: true,
755+
},
756+
rules: {
757+
'accessor-pairs': 'error',
758+
'array-callback-return': 'error',
759+
'no-array-constructor': 'error',
760+
complexity: 'error',
761+
'consistent-return': 'error',
762+
'func-style': ['error', 'expression'],
763+
'import/order': [
764+
'error',
765+
{
766+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
767+
'newlines-between': 'always',
768+
},
769+
],
770+
'sort-imports': [
771+
'error',
772+
{
773+
ignoreDeclarationSort: true,
774+
},
775+
],
776+
'node/no-deprecated-api': 'error',
777+
'no-bitwise': 'error',
778+
'no-continue': 'error',
779+
'no-dupe-keys': 'error',
780+
'no-duplicate-case': 'error',
781+
'no-duplicate-imports': 'error',
782+
'no-empty-character-class': 'error',
783+
'no-empty-pattern': 'error',
784+
'no-ex-assign': 'error',
785+
'no-extend-native': 'error',
786+
'no-extra-bind': 'error',
787+
'no-extra-boolean-cast': 'error',
788+
'no-extra-label': 'error',
789+
'no-func-assign': 'error',
790+
'no-implicit-globals': 'error',
791+
'no-implied-eval': 'error',
792+
'no-invalid-regexp': 'error',
793+
'no-inner-declarations': 'error',
794+
'no-lone-blocks': 'error',
795+
'no-multi-assign': 'error',
796+
'no-misleading-character-class': 'error',
797+
'no-new-symbol': 'error',
798+
'no-obj-calls': 'error',
799+
'no-param-reassign': ['error', { props: true }],
800+
'no-process-exit': 'error',
801+
'no-prototype-builtins': 'error',
802+
'no-return-await': 'error',
803+
'no-self-compare': 'error',
804+
'no-shadow-restricted-names': 'error',
805+
'no-sparse-arrays': 'error',
806+
'no-this-before-super': 'error',
807+
'no-undef': 'error',
808+
'no-unreachable': 'error',
809+
'no-unsafe-finally': 'error',
810+
'no-useless-call': 'error',
811+
'no-useless-catch': 'error',
812+
'no-useless-concat': 'error',
813+
'no-useless-computed-key': 'error',
814+
'no-useless-escape': 'error',
815+
'no-useless-rename': 'error',
816+
'no-useless-return': 'error',
817+
'no-void': 'error',
818+
'one-var-declaration-per-line': 'error',
819+
'prefer-object-spread': 'error',
820+
'prefer-promise-reject-errors': 'error',
821+
'prefer-rest-params': 'error',
822+
'prefer-spread': 'error',
823+
'prefer-template': 'error',
824+
'require-atomic-updates': 'error',
825+
'symbol-description': 'error',
826+
'vars-on-top': 'error',
827+
'@typescript-eslint/explicit-member-accessibility': 'error',
828+
'@typescript-eslint/no-this-alias': 'error',
829+
'@typescript-eslint/no-explicit-any': 'error',
830+
'@typescript-eslint/no-useless-constructor': 'error',
831+
'@typescript-eslint/unified-signatures': 'error',
832+
'@typescript-eslint/explicit-function-return-type': 'error',
833+
'@typescript-eslint/no-non-null-assertion': 'error',
834+
'@typescript-eslint/no-unused-vars': 'error',
835+
'no-template-curly-in-string': 'error',
836+
'sort-keys': 'error',
837+
'prefer-destructuring': 'error',
838+
},
839+
},
742840
/**
743841
* Alerting Services overrides
744842
*/

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/src/legacy/core_plugins/kibana/public/discover/ @elastic/kibana-app
1212
/src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
1313
/src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app
14-
/src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
14+
/src/plugins/vis_type_vislib/ @elastic/kibana-app
1515
/src/plugins/vis_type_xy/ @elastic/kibana-app
1616
/src/plugins/vis_type_table/ @elastic/kibana-app
1717
/src/plugins/kibana_legacy/ @elastic/kibana-app
@@ -224,7 +224,7 @@
224224
/x-pack/test/detection_engine_api_integration @elastic/siem
225225
/x-pack/test/api_integration/apis/siem @elastic/siem
226226
/x-pack/plugins/case @elastic/siem
227+
/x-pack/plugins/lists @elastic/siem
227228

228229
# Security Intelligence And Analytics
229-
/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics
230230
/x-pack/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics

.i18nrc.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
"visTypeMetric": "src/plugins/vis_type_metric",
5151
"visTypeTable": "src/plugins/vis_type_table",
5252
"visTypeTagCloud": "src/plugins/vis_type_tagcloud",
53-
"visTypeTimeseries": ["src/legacy/core_plugins/vis_type_timeseries", "src/plugins/vis_type_timeseries"],
53+
"visTypeTimeseries": "src/plugins/vis_type_timeseries",
5454
"visTypeVega": "src/plugins/vis_type_vega",
55-
"visTypeVislib": "src/legacy/core_plugins/vis_type_vislib",
56-
"visTypeXy": "src/legacy/core_plugins/vis_type_xy",
55+
"visTypeVislib": "src/plugins/vis_type_vislib",
56+
"visTypeXy": "src/plugins/vis_type_xy",
5757
"visualizations": "src/plugins/visualizations",
5858
"visualize": "src/plugins/visualize"
5959
},

.sass-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ files:
22
include:
33
- 'src/legacy/core_plugins/metrics/**/*.s+(a|c)ss'
44
- 'src/legacy/core_plugins/timelion/**/*.s+(a|c)ss'
5-
- 'src/legacy/core_plugins/vis_type_vislib/**/*.s+(a|c)ss'
6-
- 'src/legacy/core_plugins/vis_type_xy/**/*.s+(a|c)ss'
5+
- 'src/plugins/vis_type_vislib/**/*.s+(a|c)ss'
6+
- 'src/plugins/vis_type_xy/**/*.s+(a|c)ss'
77
- 'x-pack/legacy/plugins/security/**/*.s+(a|c)ss'
88
- 'x-pack/legacy/plugins/canvas/**/*.s+(a|c)ss'
99
- 'x-pack/plugins/triggers_actions_ui/**/*.s+(a|c)ss'

docs/development/core/server/kibana-plugin-core-server.savedobjectscorefieldmapping.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ export interface SavedObjectsCoreFieldMapping
1919
| [enabled](./kibana-plugin-core-server.savedobjectscorefieldmapping.enabled.md) | <code>boolean</code> | |
2020
| [fields](./kibana-plugin-core-server.savedobjectscorefieldmapping.fields.md) | <code>{</code><br/><code> [subfield: string]: {</code><br/><code> type: string;</code><br/><code> };</code><br/><code> }</code> | |
2121
| [index](./kibana-plugin-core-server.savedobjectscorefieldmapping.index.md) | <code>boolean</code> | |
22+
| [null\_value](./kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md) | <code>number &#124; boolean &#124; string</code> | |
2223
| [type](./kibana-plugin-core-server.savedobjectscorefieldmapping.type.md) | <code>string</code> | |
2324

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) &gt; [null\_value](./kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md)
4+
5+
## SavedObjectsCoreFieldMapping.null\_value property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
null_value?: number | boolean | string;
11+
```

src/core/public/plugins/plugin.test.mocks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export const mockPlugin = {
2424
};
2525
export const mockInitializer = jest.fn(() => mockPlugin);
2626

27-
export const mockPluginLoader = jest.fn().mockResolvedValue(mockInitializer);
27+
export const mockPluginReader = jest.fn(() => mockInitializer);
2828

29-
jest.mock('./plugin_loader', () => ({
30-
loadPluginBundle: mockPluginLoader,
29+
jest.mock('./plugin_reader', () => ({
30+
read: mockPluginReader,
3131
}));

src/core/public/plugins/plugin.test.ts

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { mockInitializer, mockPlugin, mockPluginLoader } from './plugin.test.mocks';
19+
import { mockInitializer, mockPlugin, mockPluginReader } from './plugin.test.mocks';
2020

2121
import { DiscoveredPlugin } from '../../server';
2222
import { coreMock } from '../mocks';
@@ -38,67 +38,49 @@ function createManifest(
3838
let plugin: PluginWrapper<unknown, Record<string, unknown>>;
3939
const opaqueId = Symbol();
4040
const initializerContext = coreMock.createPluginInitializerContext();
41-
const addBasePath = (path: string) => path;
4241

4342
beforeEach(() => {
44-
mockPluginLoader.mockClear();
43+
mockPluginReader.mockClear();
4544
mockPlugin.setup.mockClear();
4645
mockPlugin.start.mockClear();
4746
mockPlugin.stop.mockClear();
4847
plugin = new PluginWrapper(createManifest('plugin-a'), opaqueId, initializerContext);
4948
});
5049

5150
describe('PluginWrapper', () => {
52-
test('`load` calls loadPluginBundle', () => {
53-
plugin.load(addBasePath);
54-
expect(mockPluginLoader).toHaveBeenCalledWith(addBasePath, 'plugin-a');
55-
});
56-
57-
test('`setup` fails if load is not called first', async () => {
58-
await expect(plugin.setup({} as any, {} as any)).rejects.toThrowErrorMatchingInlineSnapshot(
59-
`"Plugin \\"plugin-a\\" can't be setup since its bundle isn't loaded."`
60-
);
61-
});
62-
6351
test('`setup` fails if plugin.setup is not a function', async () => {
6452
mockInitializer.mockReturnValueOnce({ start: jest.fn() } as any);
65-
await plugin.load(addBasePath);
6653
await expect(plugin.setup({} as any, {} as any)).rejects.toThrowErrorMatchingInlineSnapshot(
6754
`"Instance of plugin \\"plugin-a\\" does not define \\"setup\\" function."`
6855
);
6956
});
7057

7158
test('`setup` fails if plugin.start is not a function', async () => {
7259
mockInitializer.mockReturnValueOnce({ setup: jest.fn() } as any);
73-
await plugin.load(addBasePath);
7460
await expect(plugin.setup({} as any, {} as any)).rejects.toThrowErrorMatchingInlineSnapshot(
7561
`"Instance of plugin \\"plugin-a\\" does not define \\"start\\" function."`
7662
);
7763
});
7864

7965
test('`setup` calls initializer with initializer context', async () => {
80-
await plugin.load(addBasePath);
8166
await plugin.setup({} as any, {} as any);
8267
expect(mockInitializer).toHaveBeenCalledWith(initializerContext);
8368
});
8469

8570
test('`setup` calls plugin.setup with context and dependencies', async () => {
86-
await plugin.load(addBasePath);
8771
const context = { any: 'thing' } as any;
8872
const deps = { otherDep: 'value' };
8973
await plugin.setup(context, deps);
9074
expect(mockPlugin.setup).toHaveBeenCalledWith(context, deps);
9175
});
9276

9377
test('`start` fails if setup is not called first', async () => {
94-
await plugin.load(addBasePath);
9578
await expect(plugin.start({} as any, {} as any)).rejects.toThrowErrorMatchingInlineSnapshot(
9679
`"Plugin \\"plugin-a\\" can't be started since it isn't set up."`
9780
);
9881
});
9982

10083
test('`start` calls plugin.start with context and dependencies', async () => {
101-
await plugin.load(addBasePath);
10284
await plugin.setup({} as any, {} as any);
10385
const context = { any: 'thing' } as any;
10486
const deps = { otherDep: 'value' };
@@ -114,20 +96,21 @@ describe('PluginWrapper', () => {
11496
};
11597

11698
let startDependenciesResolved = false;
117-
mockPluginLoader.mockResolvedValueOnce(() => ({
118-
setup: jest.fn(),
119-
start: async () => {
120-
// Add small delay to ensure startDependencies is not resolved until after the plugin instance's start resolves.
121-
await new Promise(resolve => setTimeout(resolve, 10));
122-
expect(startDependenciesResolved).toBe(false);
123-
return pluginStartContract;
124-
},
125-
}));
126-
await plugin.load(addBasePath);
99+
mockPluginReader.mockReturnValueOnce(
100+
jest.fn(() => ({
101+
setup: jest.fn(),
102+
start: jest.fn(async () => {
103+
// Add small delay to ensure startDependencies is not resolved until after the plugin instance's start resolves.
104+
await new Promise(resolve => setTimeout(resolve, 10));
105+
expect(startDependenciesResolved).toBe(false);
106+
return pluginStartContract;
107+
}),
108+
stop: jest.fn(),
109+
}))
110+
);
127111
await plugin.setup({} as any, {} as any);
128112
const context = { any: 'thing' } as any;
129113
const deps = { otherDep: 'value' };
130-
131114
// Add promise callback prior to calling `start` to ensure calls in `setup` will not resolve before `start` is
132115
// called.
133116
const startDependenciesCheck = plugin.startDependencies.then(res => {
@@ -145,15 +128,13 @@ describe('PluginWrapper', () => {
145128
});
146129

147130
test('`stop` calls plugin.stop', async () => {
148-
await plugin.load(addBasePath);
149131
await plugin.setup({} as any, {} as any);
150132
await plugin.stop();
151133
expect(mockPlugin.stop).toHaveBeenCalled();
152134
});
153135

154136
test('`stop` does not fail if plugin.stop does not exist', async () => {
155137
mockInitializer.mockReturnValueOnce({ setup: jest.fn(), start: jest.fn() } as any);
156-
await plugin.load(addBasePath);
157138
await plugin.setup({} as any, {} as any);
158139
expect(() => plugin.stop()).not.toThrow();
159140
});

0 commit comments

Comments
 (0)