Skip to content

Commit 8d367ed

Browse files
committed
Merge branch 'master' of github.com:yctercero/kibana into update-rule-lists-param
2 parents 7724235 + b5762eb commit 8d367ed

File tree

1,407 files changed

+6846
-48364
lines changed

Some content is hidden

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

1,407 files changed

+6846
-48364
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ module.exports = {
567567
},
568568
{
569569
// typescript only for front and back end
570-
files: ['x-pack/legacy/plugins/siem/**/*.{ts,tsx}'],
570+
files: ['x-pack/{,legacy/}plugins/siem/**/*.{ts,tsx}'],
571571
rules: {
572572
// This will be turned on after bug fixes are complete
573573
// '@typescript-eslint/explicit-member-accessibility': 'warn',
@@ -613,7 +613,7 @@ module.exports = {
613613
// },
614614
{
615615
// typescript and javascript for front and back end
616-
files: ['x-pack/legacy/plugins/siem/**/*.{js,ts,tsx}'],
616+
files: ['x-pack/{,legacy/}plugins/siem/**/*.{js,ts,tsx}'],
617617
plugins: ['eslint-plugin-node', 'react'],
618618
env: {
619619
mocha: true,

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ kibanaPipeline(timeoutMinutes: 135, checkPrChanges: true) {
4141
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
4242
'xpack-accessibility': kibanaPipeline.functionalTestProcess('xpack-accessibility', './test/scripts/jenkins_xpack_accessibility.sh'),
4343
'xpack-siemCypress': { processNumber ->
44-
whenChanged(['x-pack/legacy/plugins/siem/', 'x-pack/test/siem_cypress/']) {
44+
whenChanged(['x-pack/plugins/siem/', 'x-pack/legacy/plugins/siem/', 'x-pack/test/siem_cypress/']) {
4545
kibanaPipeline.functionalTestProcess('xpack-siemCypress', './test/scripts/jenkins_siem_cypress.sh')(processNumber)
4646
}
4747
},

docs/api/saved-objects/create.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ any data that you send to the API is properly formed.
5757

5858
[source,sh]
5959
--------------------------------------------------
60-
$ curl -X POST "localhost:5601/api/saved_objects/index-pattern/my-pattern"
60+
$ curl -X POST "localhost:5601/api/saved_objects/index-pattern/my-pattern" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d '
6161
{
6262
"attributes": {
6363
"title": "my-pattern-*"
6464
}
65-
}
65+
}'
6666
--------------------------------------------------
6767
// KIBANA
6868

docs/api/saved-objects/export.asciidoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,46 +68,46 @@ Export all index pattern saved objects:
6868

6969
[source,sh]
7070
--------------------------------------------------
71-
$ curl -X POST "localhost:5601/api/saved_objects/_export"
71+
$ curl -X POST "localhost:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d '
7272
{
7373
"type": "index-pattern"
74-
}
74+
}'
7575
--------------------------------------------------
7676
// KIBANA
7777

7878
Export all index pattern saved objects and exclude the export summary from the stream:
7979

8080
[source,sh]
8181
--------------------------------------------------
82-
$ curl -X POST "localhost:5601/api/saved_objects/_export"
82+
$ curl -X POST "localhost:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d '
8383
{
8484
"type": "index-pattern",
8585
"excludeExportDetails": true
86-
}
86+
}'
8787
--------------------------------------------------
8888
// KIBANA
8989

9090
Export a specific saved object:
9191

9292
[source,sh]
9393
--------------------------------------------------
94-
$ curl -X POST "localhost:5601/api/saved_objects/_export"
94+
$ curl -X POST "localhost:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d '
9595
{
9696
"objects": [
9797
{
9898
"type": "dashboard",
9999
"id": "be3733a0-9efe-11e7-acb3-3dab96693fab"
100100
}
101101
]
102-
}
102+
}'
103103
--------------------------------------------------
104104
// KIBANA
105105

106106
Export a specific saved object and it's related objects :
107107

108108
[source,sh]
109109
--------------------------------------------------
110-
$ curl -X POST "localhost:5601/api/saved_objects/_export"
110+
$ curl -X POST "localhost:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d '
111111
{
112112
"objects": [
113113
{
@@ -116,6 +116,6 @@ $ curl -X POST "localhost:5601/api/saved_objects/_export"
116116
}
117117
],
118118
"includeReferencesDeep": true
119-
}
119+
}'
120120
--------------------------------------------------
121121
// KIBANA

packages/kbn-config-schema/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import {
6060
export { ObjectType, TypeOf, Type };
6161
export { ByteSizeValue } from './byte_size_value';
6262
export { SchemaTypeError, ValidationError } from './errors';
63+
export { isConfigSchema } from './typeguards';
6364

6465
function any(options?: TypeOptions<any>) {
6566
return new AnyType(options);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
export { isConfigSchema } from './is_config_schema';
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { schema } from '..';
21+
import { isConfigSchema } from './is_config_schema';
22+
23+
describe('isConfigSchema', () => {
24+
it('returns true for every sub classes of `Type`', () => {
25+
expect(isConfigSchema(schema.any())).toBe(true);
26+
expect(isConfigSchema(schema.arrayOf(schema.string()))).toBe(true);
27+
expect(isConfigSchema(schema.boolean())).toBe(true);
28+
expect(isConfigSchema(schema.buffer())).toBe(true);
29+
expect(isConfigSchema(schema.byteSize())).toBe(true);
30+
expect(isConfigSchema(schema.duration())).toBe(true);
31+
expect(isConfigSchema(schema.literal(''))).toBe(true);
32+
expect(isConfigSchema(schema.mapOf(schema.string(), schema.number()))).toBe(true);
33+
expect(isConfigSchema(schema.nullable(schema.string()))).toBe(true);
34+
expect(isConfigSchema(schema.number())).toBe(true);
35+
expect(isConfigSchema(schema.object({}))).toBe(true);
36+
expect(isConfigSchema(schema.oneOf([schema.string()]))).toBe(true);
37+
expect(isConfigSchema(schema.recordOf(schema.string(), schema.object({})))).toBe(true);
38+
expect(isConfigSchema(schema.string())).toBe(true);
39+
expect(isConfigSchema(schema.stream())).toBe(true);
40+
});
41+
42+
it('returns false for every javascript data type', () => {
43+
expect(isConfigSchema('foo')).toBe(false);
44+
expect(isConfigSchema(42)).toBe(false);
45+
expect(isConfigSchema(new Date())).toBe(false);
46+
expect(isConfigSchema(null)).toBe(false);
47+
expect(isConfigSchema(undefined)).toBe(false);
48+
expect(isConfigSchema([1, 2, 3])).toBe(false);
49+
expect(isConfigSchema({ foo: 'bar' })).toBe(false);
50+
expect(isConfigSchema(function() {})).toBe(false);
51+
});
52+
53+
it('returns true as long as `__isKbnConfigSchemaType` is true', () => {
54+
expect(isConfigSchema({ __isKbnConfigSchemaType: true })).toBe(true);
55+
});
56+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Type } from '../types';
21+
22+
export function isConfigSchema(obj: any): obj is Type<any> {
23+
return obj ? obj.__isKbnConfigSchemaType === true : false;
24+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export abstract class Type<V> {
3232
// sets the value to `null` while still keeping the type.
3333
public readonly type: V = null! as V;
3434

35+
// used for the `isConfigSchema` typeguard
36+
public readonly __isKbnConfigSchemaType = true;
37+
3538
/**
3639
* Internal "schema" backed by Joi.
3740
* @type {Schema}

packages/kbn-optimizer/src/optimizer/optimizer_config.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ describe('OptimizerConfig::parseOptions()', () => {
146146
<absolute path>/x-pack/plugins,
147147
<absolute path>/plugins,
148148
<absolute path>/examples,
149+
<absolute path>/x-pack/examples,
149150
<absolute path>-extra,
150151
],
151152
"profileWebpack": false,

0 commit comments

Comments
 (0)