Skip to content

Commit 4e8a628

Browse files
authored
Merge branch 'main' into artifacts/docker-cloud-context
2 parents 4e5eec4 + 327df57 commit 4e8a628

165 files changed

Lines changed: 3685 additions & 582 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/api/alerting/create_rule.asciidoc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,24 @@
66

77
Create {kib} rules.
88

9-
WARNING: This API supports <<token-api-authentication>> only.
10-
119
[[create-rule-api-request]]
1210
==== Request
1311

1412
`POST <kibana host>:<port>/api/alerting/rule/<id>`
1513

1614
`POST <kibana host>:<port>/s/<space_id>/api/alerting/rule/<id>`
1715

16+
==== {api-description-title}
17+
18+
[WARNING]
19+
====
20+
* This API supports only
21+
<<token-api-authentication,token-based authentication>>.
22+
* When you create a rule, it identifies which roles you have at that point in time.
23+
Thereafter, when the rule performs queries, it uses those security privileges.
24+
If a user with different privileges updates the rule, its behavior might change.
25+
====
26+
1827
[[create-rule-api-path-params]]
1928
==== Path parameters
2029

docs/api/alerting/update_rule.asciidoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,25 @@
66

77
Update the attributes for an existing rule.
88

9-
WARNING: This API supports <<token-api-authentication>> only.
10-
119
[[update-rule-api-request]]
1210
==== Request
1311

1412
`PUT <kibana host>:<port>/api/alerting/rule/<id>`
1513

1614
`PUT <kibana host>:<port>/s/<space_id>/api/alerting/rule/<id>`
1715

16+
==== {api-description-title}
17+
18+
[WARNING]
19+
====
20+
* This API supports only
21+
<<token-api-authentication,token-based authentication>>.
22+
* When you update a rule, it identifies which roles you have at that point in time.
23+
Thereafter, when the rule performs queries, it uses those security privileges.
24+
If you have different privileges than the user that created or most recently
25+
updated the rule, you might change its behavior.
26+
====
27+
1828
[[update-rule-api-path-params]]
1929
==== Path parameters
2030

docs/setup/upgrade/resolving-migration-failures.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Upgrade migrations fail because routing allocation is disabled or restricted (`c
171171

172172
[source,sh]
173173
--------------------------------------------
174-
Unable to complete saved object migrations for the [.kibana] index: [unsupported_cluster_routing_allocation] The elasticsearch cluster has cluster routing allocation incorrectly set for migrations to continue. To proceed, please remove the cluster routing allocation settings with PUT /_cluster/settings {"transient": {"cluster.routing.allocation.enable": null}, "persistent": {"cluster.routing.allocation.enable": null}}
174+
Unable to complete saved object migrations for the [.kibana] index: [incompatible_cluster_routing_allocation] The elasticsearch cluster has cluster routing allocation incorrectly set for migrations to continue. To proceed, please remove the cluster routing allocation settings with PUT /_cluster/settings {"transient": {"cluster.routing.allocation.enable": null}, "persistent": {"cluster.routing.allocation.enable": null}}
175175
--------------------------------------------
176176

177177
To get around the issue, remove the transient and persisted routing allocation settings:

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"yarn": "^1.21.1"
7474
},
7575
"resolutions": {
76-
"**/@babel/runtime": "^7.17.8",
76+
"**/@babel/runtime": "^7.17.9",
7777
"**/@types/node": "16.11.7",
7878
"**/chokidar": "^3.4.3",
7979
"**/deepmerge": "^4.2.2",
@@ -97,7 +97,7 @@
9797
"puppeteer/node-fetch": "^2.6.7"
9898
},
9999
"dependencies": {
100-
"@babel/runtime": "^7.17.8",
100+
"@babel/runtime": "^7.17.9",
101101
"@dnd-kit/core": "^3.1.1",
102102
"@dnd-kit/sortable": "^4.0.0",
103103
"@dnd-kit/utilities": "^2.0.0",
@@ -446,12 +446,12 @@
446446
"devDependencies": {
447447
"@apidevtools/swagger-parser": "^10.0.3",
448448
"@babel/cli": "^7.17.6",
449-
"@babel/core": "^7.17.8",
449+
"@babel/core": "^7.17.9",
450450
"@babel/eslint-parser": "^7.17.0",
451451
"@babel/eslint-plugin": "^7.17.7",
452-
"@babel/generator": "^7.17.7",
452+
"@babel/generator": "^7.17.9",
453453
"@babel/helper-plugin-utils": "^7.16.7",
454-
"@babel/parser": "^7.17.8",
454+
"@babel/parser": "^7.17.9",
455455
"@babel/plugin-proposal-class-properties": "^7.16.7",
456456
"@babel/plugin-proposal-export-namespace-from": "^7.16.7",
457457
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
@@ -463,7 +463,7 @@
463463
"@babel/preset-react": "^7.16.7",
464464
"@babel/preset-typescript": "^7.16.7",
465465
"@babel/register": "^7.17.7",
466-
"@babel/traverse": "^7.17.3",
466+
"@babel/traverse": "^7.17.9",
467467
"@babel/types": "^7.17.0",
468468
"@bazel/ibazel": "^0.16.2",
469469
"@bazel/typescript": "4.6.2",
@@ -796,7 +796,7 @@
796796
"babel-plugin-add-module-exports": "^1.0.4",
797797
"babel-plugin-istanbul": "^6.1.1",
798798
"babel-plugin-require-context-hook": "^1.0.0",
799-
"babel-plugin-styled-components": "^2.0.6",
799+
"babel-plugin-styled-components": "^2.0.7",
800800
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
801801
"backport": "^7.3.1",
802802
"callsites": "^3.1.0",

packages/analytics/client/src/schema/types.test.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,66 @@ describe('schema types', () => {
182182
});
183183
});
184184

185+
describe('Date value', () => {
186+
test('it should allow the correct type and enforce the _meta.description', () => {
187+
let valueType: SchemaValue<Date> = {
188+
type: 'date',
189+
_meta: {
190+
description: 'Some description',
191+
},
192+
};
193+
194+
valueType = {
195+
type: 'keyword',
196+
_meta: {
197+
description: 'Some description',
198+
optional: false,
199+
},
200+
};
201+
202+
valueType = {
203+
// @ts-expect-error because the type does not match
204+
type: 'long',
205+
_meta: {
206+
description: 'Some description',
207+
optional: false,
208+
},
209+
};
210+
211+
valueType = {
212+
type: 'keyword',
213+
_meta: {
214+
description: 'Some description',
215+
// @ts-expect-error optional can't be true when the types don't set the value as optional
216+
optional: true,
217+
},
218+
};
219+
220+
// @ts-expect-error because it's missing the _meta.description
221+
valueType = { type: 'date' };
222+
expect(valueType).not.toBeUndefined(); // <-- Only to stop the var-not-used complain
223+
});
224+
test('it should enforce `_meta.optional: true`', () => {
225+
let valueType: SchemaValue<Date | undefined> = {
226+
type: 'date',
227+
_meta: {
228+
description: 'Some description',
229+
optional: true,
230+
},
231+
};
232+
233+
valueType = {
234+
type: 'date',
235+
_meta: {
236+
description: 'Some description',
237+
// @ts-expect-error because optional can't be false when the value can be undefined
238+
optional: false,
239+
},
240+
};
241+
expect(valueType).not.toBeUndefined(); // <-- Only to stop the var-not-used complain
242+
});
243+
});
244+
185245
describe('Object value', () => {
186246
test('it should allow "pass_through" and enforce the _meta.description', () => {
187247
let valueType: SchemaValue<{ a_value: string }> = {

packages/analytics/client/src/schema/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export type AllowedSchemaTypes =
3131
/**
3232
* Helper to ensure the declared types match the schema types
3333
*/
34-
export type PossibleSchemaTypes<Value> = Value extends string
34+
export type PossibleSchemaTypes<Value> = Value extends string | Date
3535
? AllowedSchemaStringTypes
3636
: Value extends number
3737
? AllowedSchemaNumberTypes
@@ -66,6 +66,8 @@ export type SchemaValue<Value> =
6666
: // Otherwise, try to infer the type and enforce the schema
6767
NonNullable<Value> extends Array<infer U> | ReadonlyArray<infer U>
6868
? SchemaArray<U, Value>
69+
: NonNullable<Value> extends Date
70+
? SchemaChildValue<Value>
6971
: NonNullable<Value> extends object
7072
? SchemaObject<Value>
7173
: SchemaChildValue<Value>);

packages/elastic-eslint-config-kibana/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,6 @@ module.exports = {
196196
'@kbn/eslint/no_this_in_property_initializers': 'error',
197197
'@kbn/imports/no_unresolvable_imports': 'error',
198198
'@kbn/imports/uniform_imports': 'error',
199+
'@kbn/imports/no_unused_imports': 'error',
199200
},
200201
};

packages/kbn-eslint-plugin-imports/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@ Config example:
5353

5454
This config will find any import of `@kbn/kitchen-sink` which specifically references the `Spatula` or `isSpatula` exports, remove the old exports from the import (potentially removing the entire import), and add a new import after the previous following it's style pointing to the new package.
5555

56-
The auto-fixer here covers the vast majority of import styles in the repository but might not cover everything, including `import * as Namespace from '@kbn/kitchen-sink'`. Imports like this will need to be found and updated manually, though TypeScript should be able to find the vast majority of those.
56+
The auto-fixer here covers the vast majority of import styles in the repository but might not cover everything, including `import * as Namespace from '@kbn/kitchen-sink'`. Imports like this will need to be found and updated manually, though TypeScript should be able to find the vast majority of those.
57+
58+
## `@kbn/imports/no_unused_imports`
59+
60+
This rule finds imports that are unused and provides an auto-fix to remove them. When ESLint appears to be running in an editor, as defined by [`helpers/running_in_editor.ts`](src/helpers/running_in_editor.ts), this rule provided suggestions instead of fixes so that the removals are not applied automatically in case you are debugging, returning early, or something else which makes ESLint think that the import is unused when it isn't. On CI and in the pre-commit hook though, this fix will be applied automatically.

packages/kbn-eslint-plugin-imports/src/helpers/running_in_editor.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
*/
88

99
export const RUNNING_IN_EDITOR =
10+
!process.env.IS_KIBANA_PRECOMIT_HOOK &&
1011
// vscode sets this in the env for all workers
11-
!!process.env.VSCODE_CWD ||
12-
// MacOS sets this for intellij processes, not sure if it works in webstorm but we could expand this check later
13-
!!process.env.__CFBundleIdentifier?.startsWith('com.jetbrains.intellij');
12+
(!!process.env.VSCODE_CWD ||
13+
// MacOS sets this for intellij processes, not sure if it works in webstorm but we could expand this check later
14+
!!process.env.__CFBundleIdentifier?.startsWith('com.jetbrains.intellij'));

packages/kbn-eslint-plugin-imports/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export * from './get_import_resolver';
1010
import { NoUnresolvableImportsRule } from './rules/no_unresolvable_imports';
1111
import { UniformImportsRule } from './rules/uniform_imports';
1212
import { ExportsMovedPackagesRule } from './rules/exports_moved_packages';
13+
import { NoUnusedImportsRule } from './rules/no_unused_imports';
1314

1415
/**
1516
* Custom ESLint rules, add `'@kbn/eslint-plugin-imports'` to your eslint config to use them
@@ -19,4 +20,5 @@ export const rules = {
1920
no_unresolvable_imports: NoUnresolvableImportsRule,
2021
uniform_imports: UniformImportsRule,
2122
exports_moved_packages: ExportsMovedPackagesRule,
23+
no_unused_imports: NoUnusedImportsRule,
2224
};

0 commit comments

Comments
 (0)