From 18eb11a958bebc983d4879b20e6007cf7223a2ad Mon Sep 17 00:00:00 2001 From: Tre Date: Mon, 25 Nov 2024 09:11:21 +0000 Subject: [PATCH 01/71] [Ownership] Assign test files to security-defend-workflows team (#201000) ## Summary Assign test files to security-defend-workflows team Contributes to: #192979 Co-authored-by: Elastic Machine --- .github/CODEOWNERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1633269c82c28..350282c9af60e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2352,7 +2352,8 @@ x-pack/plugins/security_solution/common/api/entity_analytics @elastic/security-e x-pack/test/security_solution_api_integration/test_suites/genai @elastic/security-generative-ai # Security Defend Workflows - OSQuery Ownership -x-pack/plugins/osquery @elastic/security-defend-workflows +/x-pack/test/osquery_cypress @elastic/security-defend-workflows +/x-pack/plugins/osquery @elastic/security-defend-workflows /x-pack/plugins/security_solution/common/api/detection_engine/model/rule_response_actions @elastic/security-defend-workflows /x-pack/plugins/security_solution/public/detection_engine/rule_response_actions @elastic/security-defend-workflows /x-pack/plugins/security_solution/server/lib/detection_engine/rule_response_actions @elastic/security-defend-workflows From a41017e74e4f495c6892fbe023cff0045839bd9b Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 25 Nov 2024 20:14:41 +1100 Subject: [PATCH 02/71] [ES|QL] Update grammars (#201514) Part of https://github.com/elastic/kibana/issues/200858 This PR updates the ES|QL grammars (lexer and parser) to match the latest version in Elasticsearch. --------- Co-authored-by: Stratoula Kalafateli --- packages/kbn-esql-ast/src/antlr/esql_lexer.g4 | 38 +- .../kbn-esql-ast/src/antlr/esql_lexer.interp | 43 +- .../kbn-esql-ast/src/antlr/esql_lexer.tokens | 296 +-- packages/kbn-esql-ast/src/antlr/esql_lexer.ts | 1437 +++++++------- .../kbn-esql-ast/src/antlr/esql_parser.g4 | 19 +- .../kbn-esql-ast/src/antlr/esql_parser.interp | 28 +- .../kbn-esql-ast/src/antlr/esql_parser.tokens | 296 +-- .../kbn-esql-ast/src/antlr/esql_parser.ts | 1720 ++++++++++------- .../src/antlr/esql_parser_listener.ts | 44 + .../esql_validation_meta_tests.json | 2 +- .../src/validation/validation.test.ts | 2 +- .../src/esql/lib/esql_theme.test.ts | 1 + .../kbn-monaco/src/esql/lib/esql_theme.ts | 8 + 13 files changed, 2281 insertions(+), 1653 deletions(-) diff --git a/packages/kbn-esql-ast/src/antlr/esql_lexer.g4 b/packages/kbn-esql-ast/src/antlr/esql_lexer.g4 index ad17de2984ad7..28ba50ef3efef 100644 --- a/packages/kbn-esql-ast/src/antlr/esql_lexer.g4 +++ b/packages/kbn-esql-ast/src/antlr/esql_lexer.g4 @@ -87,8 +87,15 @@ WHERE : 'where' -> pushMode(EXPRESSION_MODE); // main section while preserving alphabetical order: // MYCOMMAND : 'mycommand' -> ... DEV_INLINESTATS : {this.isDevVersion()}? 'inlinestats' -> pushMode(EXPRESSION_MODE); -DEV_LOOKUP : {this.isDevVersion()}? 'lookup' -> pushMode(LOOKUP_MODE); +DEV_LOOKUP : {this.isDevVersion()}? 'lookup_🐔' -> pushMode(LOOKUP_MODE); DEV_METRICS : {this.isDevVersion()}? 'metrics' -> pushMode(METRICS_MODE); +// list of all JOIN commands +DEV_JOIN : {this.isDevVersion()}? 'join' -> pushMode(JOIN_MODE); +DEV_JOIN_FULL : {this.isDevVersion()}? 'full' -> pushMode(JOIN_MODE); +DEV_JOIN_LEFT : {this.isDevVersion()}? 'left' -> pushMode(JOIN_MODE); +DEV_JOIN_RIGHT : {this.isDevVersion()}? 'right' -> pushMode(JOIN_MODE); +DEV_JOIN_LOOKUP : {this.isDevVersion()}? 'lookup' -> pushMode(JOIN_MODE); + // // Catch-all for unrecognized commands - don't define any beyond this line @@ -107,8 +114,6 @@ WS : [ \r\n\t]+ -> channel(HIDDEN) ; -COLON : ':'; - // // Expression - used by most command // @@ -179,6 +184,7 @@ AND : 'and'; ASC : 'asc'; ASSIGN : '='; CAST_OP : '::'; +COLON : ':'; COMMA : ','; DESC : 'desc'; DOT : '.'; @@ -211,7 +217,6 @@ MINUS : '-'; ASTERISK : '*'; SLASH : '/'; PERCENT : '%'; -EXPRESSION_COLON : {this.isDevVersion()}? COLON -> type(COLON); NESTED_WHERE : WHERE -> type(WHERE); @@ -545,6 +550,31 @@ LOOKUP_FIELD_WS : WS -> channel(HIDDEN) ; +// +// JOIN-related commands +// +mode JOIN_MODE; +JOIN_PIPE : PIPE -> type(PIPE), popMode; +JOIN_JOIN : DEV_JOIN -> type(DEV_JOIN); +JOIN_AS : AS -> type(AS); +JOIN_ON : ON -> type(ON), popMode, pushMode(EXPRESSION_MODE); +USING : 'USING' -> popMode, pushMode(EXPRESSION_MODE); + +JOIN_UNQUOTED_IDENTIFER: UNQUOTED_IDENTIFIER -> type(UNQUOTED_IDENTIFIER); +JOIN_QUOTED_IDENTIFIER : QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER); + +JOIN_LINE_COMMENT + : LINE_COMMENT -> channel(HIDDEN) + ; + +JOIN_MULTILINE_COMMENT + : MULTILINE_COMMENT -> channel(HIDDEN) + ; + +JOIN_WS + : WS -> channel(HIDDEN) + ; + // // METRICS command // diff --git a/packages/kbn-esql-ast/src/antlr/esql_lexer.interp b/packages/kbn-esql-ast/src/antlr/esql_lexer.interp index 8f9c5956dddd5..c83fdbe8847a9 100644 --- a/packages/kbn-esql-ast/src/antlr/esql_lexer.interp +++ b/packages/kbn-esql-ast/src/antlr/esql_lexer.interp @@ -23,7 +23,11 @@ null null null null -':' +null +null +null +null +null '|' null null @@ -33,6 +37,7 @@ null 'asc' '=' '::' +':' ',' 'desc' '.' @@ -113,6 +118,10 @@ null null null null +'USING' +null +null +null null null null @@ -141,11 +150,15 @@ WHERE DEV_INLINESTATS DEV_LOOKUP DEV_METRICS +DEV_JOIN +DEV_JOIN_FULL +DEV_JOIN_LEFT +DEV_JOIN_RIGHT +DEV_JOIN_LOOKUP UNKNOWN_CMD LINE_COMMENT MULTILINE_COMMENT WS -COLON PIPE QUOTED_STRING INTEGER_LITERAL @@ -155,6 +168,7 @@ AND ASC ASSIGN CAST_OP +COLON COMMA DESC DOT @@ -235,6 +249,10 @@ LOOKUP_WS LOOKUP_FIELD_LINE_COMMENT LOOKUP_FIELD_MULTILINE_COMMENT LOOKUP_FIELD_WS +USING +JOIN_LINE_COMMENT +JOIN_MULTILINE_COMMENT +JOIN_WS METRICS_LINE_COMMENT METRICS_MULTILINE_COMMENT METRICS_WS @@ -262,11 +280,15 @@ WHERE DEV_INLINESTATS DEV_LOOKUP DEV_METRICS +DEV_JOIN +DEV_JOIN_FULL +DEV_JOIN_LEFT +DEV_JOIN_RIGHT +DEV_JOIN_LOOKUP UNKNOWN_CMD LINE_COMMENT MULTILINE_COMMENT WS -COLON PIPE DIGIT LETTER @@ -286,6 +308,7 @@ AND ASC ASSIGN CAST_OP +COLON COMMA DESC DOT @@ -316,7 +339,6 @@ MINUS ASTERISK SLASH PERCENT -EXPRESSION_COLON NESTED_WHERE NAMED_OR_POSITIONAL_PARAM OPENING_BRACKET @@ -427,6 +449,16 @@ LOOKUP_FIELD_ID_PATTERN LOOKUP_FIELD_LINE_COMMENT LOOKUP_FIELD_MULTILINE_COMMENT LOOKUP_FIELD_WS +JOIN_PIPE +JOIN_JOIN +JOIN_AS +JOIN_ON +USING +JOIN_UNQUOTED_IDENTIFER +JOIN_QUOTED_IDENTIFIER +JOIN_LINE_COMMENT +JOIN_MULTILINE_COMMENT +JOIN_WS METRICS_PIPE METRICS_UNQUOTED_SOURCE METRICS_QUOTED_SOURCE @@ -461,8 +493,9 @@ SHOW_MODE SETTING_MODE LOOKUP_MODE LOOKUP_FIELD_MODE +JOIN_MODE METRICS_MODE CLOSING_METRICS_MODE atn: -[4, 0, 119, 1484, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, 7, 198, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 4, 19, 580, 8, 19, 11, 19, 12, 19, 581, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 5, 20, 590, 8, 20, 10, 20, 12, 20, 593, 9, 20, 1, 20, 3, 20, 596, 8, 20, 1, 20, 3, 20, 599, 8, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 5, 21, 608, 8, 21, 10, 21, 12, 21, 611, 9, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 4, 22, 619, 8, 22, 11, 22, 12, 22, 620, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 3, 29, 642, 8, 29, 1, 29, 4, 29, 645, 8, 29, 11, 29, 12, 29, 646, 1, 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 3, 32, 656, 8, 32, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 3, 34, 663, 8, 34, 1, 35, 1, 35, 1, 35, 5, 35, 668, 8, 35, 10, 35, 12, 35, 671, 9, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 5, 35, 679, 8, 35, 10, 35, 12, 35, 682, 9, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 689, 8, 35, 1, 35, 3, 35, 692, 8, 35, 3, 35, 694, 8, 35, 1, 36, 4, 36, 697, 8, 36, 11, 36, 12, 36, 698, 1, 37, 4, 37, 702, 8, 37, 11, 37, 12, 37, 703, 1, 37, 1, 37, 5, 37, 708, 8, 37, 10, 37, 12, 37, 711, 9, 37, 1, 37, 1, 37, 4, 37, 715, 8, 37, 11, 37, 12, 37, 716, 1, 37, 4, 37, 720, 8, 37, 11, 37, 12, 37, 721, 1, 37, 1, 37, 5, 37, 726, 8, 37, 10, 37, 12, 37, 729, 9, 37, 3, 37, 731, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 4, 37, 737, 8, 37, 11, 37, 12, 37, 738, 1, 37, 1, 37, 3, 37, 743, 8, 37, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 69, 1, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 3, 75, 874, 8, 75, 1, 75, 5, 75, 877, 8, 75, 10, 75, 12, 75, 880, 9, 75, 1, 75, 1, 75, 4, 75, 884, 8, 75, 11, 75, 12, 75, 885, 3, 75, 888, 8, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 78, 1, 78, 5, 78, 902, 8, 78, 10, 78, 12, 78, 905, 9, 78, 1, 78, 1, 78, 3, 78, 909, 8, 78, 1, 78, 4, 78, 912, 8, 78, 11, 78, 12, 78, 913, 3, 78, 916, 8, 78, 1, 79, 1, 79, 4, 79, 920, 8, 79, 11, 79, 12, 79, 921, 1, 79, 1, 79, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, 3, 96, 999, 8, 96, 1, 97, 4, 97, 1002, 8, 97, 11, 97, 12, 97, 1003, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 108, 3, 108, 1053, 8, 108, 1, 109, 1, 109, 3, 109, 1057, 8, 109, 1, 109, 5, 109, 1060, 8, 109, 10, 109, 12, 109, 1063, 9, 109, 1, 109, 1, 109, 3, 109, 1067, 8, 109, 1, 109, 4, 109, 1070, 8, 109, 11, 109, 12, 109, 1071, 3, 109, 1074, 8, 109, 1, 110, 1, 110, 4, 110, 1078, 8, 110, 11, 110, 12, 110, 1079, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 115, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 130, 4, 130, 1165, 8, 130, 11, 130, 12, 130, 1166, 1, 130, 1, 130, 3, 130, 1171, 8, 130, 1, 130, 4, 130, 1174, 8, 130, 11, 130, 12, 130, 1175, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 4, 163, 1321, 8, 163, 11, 163, 12, 163, 1322, 1, 164, 1, 164, 1, 164, 1, 164, 1, 165, 1, 165, 1, 165, 1, 165, 1, 166, 1, 166, 1, 166, 1, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 168, 1, 168, 1, 168, 1, 168, 1, 169, 1, 169, 1, 169, 1, 169, 1, 170, 1, 170, 1, 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 187, 1, 187, 1, 187, 1, 187, 1, 188, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, 1, 189, 1, 189, 1, 190, 1, 190, 1, 190, 1, 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 1, 194, 1, 194, 1, 194, 1, 194, 1, 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 196, 1, 196, 1, 196, 1, 196, 1, 196, 1, 196, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 2, 609, 680, 0, 199, 15, 1, 17, 2, 19, 3, 21, 4, 23, 5, 25, 6, 27, 7, 29, 8, 31, 9, 33, 10, 35, 11, 37, 12, 39, 13, 41, 14, 43, 15, 45, 16, 47, 17, 49, 18, 51, 19, 53, 20, 55, 21, 57, 22, 59, 23, 61, 24, 63, 25, 65, 0, 67, 0, 69, 0, 71, 0, 73, 0, 75, 0, 77, 0, 79, 0, 81, 0, 83, 0, 85, 26, 87, 27, 89, 28, 91, 29, 93, 30, 95, 31, 97, 32, 99, 33, 101, 34, 103, 35, 105, 36, 107, 37, 109, 38, 111, 39, 113, 40, 115, 41, 117, 42, 119, 43, 121, 44, 123, 45, 125, 46, 127, 47, 129, 48, 131, 49, 133, 50, 135, 51, 137, 52, 139, 53, 141, 54, 143, 55, 145, 56, 147, 57, 149, 58, 151, 59, 153, 60, 155, 61, 157, 62, 159, 63, 161, 0, 163, 0, 165, 64, 167, 65, 169, 66, 171, 67, 173, 0, 175, 68, 177, 69, 179, 70, 181, 71, 183, 0, 185, 0, 187, 72, 189, 73, 191, 74, 193, 0, 195, 0, 197, 0, 199, 0, 201, 0, 203, 0, 205, 75, 207, 0, 209, 76, 211, 0, 213, 0, 215, 77, 217, 78, 219, 79, 221, 0, 223, 0, 225, 0, 227, 0, 229, 0, 231, 0, 233, 0, 235, 80, 237, 81, 239, 82, 241, 83, 243, 0, 245, 0, 247, 0, 249, 0, 251, 0, 253, 0, 255, 84, 257, 0, 259, 85, 261, 86, 263, 87, 265, 0, 267, 0, 269, 88, 271, 89, 273, 0, 275, 90, 277, 0, 279, 91, 281, 92, 283, 93, 285, 0, 287, 0, 289, 0, 291, 0, 293, 0, 295, 0, 297, 0, 299, 0, 301, 0, 303, 94, 305, 95, 307, 96, 309, 0, 311, 0, 313, 0, 315, 0, 317, 0, 319, 0, 321, 97, 323, 98, 325, 99, 327, 0, 329, 100, 331, 101, 333, 102, 335, 103, 337, 0, 339, 0, 341, 104, 343, 105, 345, 106, 347, 107, 349, 0, 351, 0, 353, 0, 355, 0, 357, 0, 359, 0, 361, 0, 363, 108, 365, 109, 367, 110, 369, 0, 371, 0, 373, 0, 375, 0, 377, 111, 379, 112, 381, 113, 383, 0, 385, 0, 387, 0, 389, 114, 391, 115, 393, 116, 395, 0, 397, 0, 399, 117, 401, 118, 403, 119, 405, 0, 407, 0, 409, 0, 411, 0, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 35, 2, 0, 68, 68, 100, 100, 2, 0, 73, 73, 105, 105, 2, 0, 83, 83, 115, 115, 2, 0, 69, 69, 101, 101, 2, 0, 67, 67, 99, 99, 2, 0, 84, 84, 116, 116, 2, 0, 82, 82, 114, 114, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 78, 78, 110, 110, 2, 0, 72, 72, 104, 104, 2, 0, 86, 86, 118, 118, 2, 0, 65, 65, 97, 97, 2, 0, 76, 76, 108, 108, 2, 0, 88, 88, 120, 120, 2, 0, 70, 70, 102, 102, 2, 0, 77, 77, 109, 109, 2, 0, 71, 71, 103, 103, 2, 0, 75, 75, 107, 107, 2, 0, 87, 87, 119, 119, 2, 0, 85, 85, 117, 117, 6, 0, 9, 10, 13, 13, 32, 32, 47, 47, 91, 91, 93, 93, 2, 0, 10, 10, 13, 13, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 48, 57, 2, 0, 65, 90, 97, 122, 8, 0, 34, 34, 78, 78, 82, 82, 84, 84, 92, 92, 110, 110, 114, 114, 116, 116, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 2, 0, 43, 43, 45, 45, 1, 0, 96, 96, 2, 0, 66, 66, 98, 98, 2, 0, 89, 89, 121, 121, 11, 0, 9, 10, 13, 13, 32, 32, 34, 34, 44, 44, 47, 47, 58, 58, 61, 61, 91, 91, 93, 93, 124, 124, 2, 0, 42, 42, 47, 47, 11, 0, 9, 10, 13, 13, 32, 32, 34, 35, 44, 44, 47, 47, 58, 58, 60, 60, 62, 63, 92, 92, 124, 124, 1512, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 1, 63, 1, 0, 0, 0, 1, 85, 1, 0, 0, 0, 1, 87, 1, 0, 0, 0, 1, 89, 1, 0, 0, 0, 1, 91, 1, 0, 0, 0, 1, 93, 1, 0, 0, 0, 1, 95, 1, 0, 0, 0, 1, 97, 1, 0, 0, 0, 1, 99, 1, 0, 0, 0, 1, 101, 1, 0, 0, 0, 1, 103, 1, 0, 0, 0, 1, 105, 1, 0, 0, 0, 1, 107, 1, 0, 0, 0, 1, 109, 1, 0, 0, 0, 1, 111, 1, 0, 0, 0, 1, 113, 1, 0, 0, 0, 1, 115, 1, 0, 0, 0, 1, 117, 1, 0, 0, 0, 1, 119, 1, 0, 0, 0, 1, 121, 1, 0, 0, 0, 1, 123, 1, 0, 0, 0, 1, 125, 1, 0, 0, 0, 1, 127, 1, 0, 0, 0, 1, 129, 1, 0, 0, 0, 1, 131, 1, 0, 0, 0, 1, 133, 1, 0, 0, 0, 1, 135, 1, 0, 0, 0, 1, 137, 1, 0, 0, 0, 1, 139, 1, 0, 0, 0, 1, 141, 1, 0, 0, 0, 1, 143, 1, 0, 0, 0, 1, 145, 1, 0, 0, 0, 1, 147, 1, 0, 0, 0, 1, 149, 1, 0, 0, 0, 1, 151, 1, 0, 0, 0, 1, 153, 1, 0, 0, 0, 1, 155, 1, 0, 0, 0, 1, 157, 1, 0, 0, 0, 1, 159, 1, 0, 0, 0, 1, 161, 1, 0, 0, 0, 1, 163, 1, 0, 0, 0, 1, 165, 1, 0, 0, 0, 1, 167, 1, 0, 0, 0, 1, 169, 1, 0, 0, 0, 1, 171, 1, 0, 0, 0, 1, 175, 1, 0, 0, 0, 1, 177, 1, 0, 0, 0, 1, 179, 1, 0, 0, 0, 1, 181, 1, 0, 0, 0, 2, 183, 1, 0, 0, 0, 2, 185, 1, 0, 0, 0, 2, 187, 1, 0, 0, 0, 2, 189, 1, 0, 0, 0, 2, 191, 1, 0, 0, 0, 3, 193, 1, 0, 0, 0, 3, 195, 1, 0, 0, 0, 3, 197, 1, 0, 0, 0, 3, 199, 1, 0, 0, 0, 3, 201, 1, 0, 0, 0, 3, 203, 1, 0, 0, 0, 3, 205, 1, 0, 0, 0, 3, 209, 1, 0, 0, 0, 3, 211, 1, 0, 0, 0, 3, 213, 1, 0, 0, 0, 3, 215, 1, 0, 0, 0, 3, 217, 1, 0, 0, 0, 3, 219, 1, 0, 0, 0, 4, 221, 1, 0, 0, 0, 4, 223, 1, 0, 0, 0, 4, 225, 1, 0, 0, 0, 4, 227, 1, 0, 0, 0, 4, 229, 1, 0, 0, 0, 4, 235, 1, 0, 0, 0, 4, 237, 1, 0, 0, 0, 4, 239, 1, 0, 0, 0, 4, 241, 1, 0, 0, 0, 5, 243, 1, 0, 0, 0, 5, 245, 1, 0, 0, 0, 5, 247, 1, 0, 0, 0, 5, 249, 1, 0, 0, 0, 5, 251, 1, 0, 0, 0, 5, 253, 1, 0, 0, 0, 5, 255, 1, 0, 0, 0, 5, 257, 1, 0, 0, 0, 5, 259, 1, 0, 0, 0, 5, 261, 1, 0, 0, 0, 5, 263, 1, 0, 0, 0, 6, 265, 1, 0, 0, 0, 6, 267, 1, 0, 0, 0, 6, 269, 1, 0, 0, 0, 6, 271, 1, 0, 0, 0, 6, 275, 1, 0, 0, 0, 6, 277, 1, 0, 0, 0, 6, 279, 1, 0, 0, 0, 6, 281, 1, 0, 0, 0, 6, 283, 1, 0, 0, 0, 7, 285, 1, 0, 0, 0, 7, 287, 1, 0, 0, 0, 7, 289, 1, 0, 0, 0, 7, 291, 1, 0, 0, 0, 7, 293, 1, 0, 0, 0, 7, 295, 1, 0, 0, 0, 7, 297, 1, 0, 0, 0, 7, 299, 1, 0, 0, 0, 7, 301, 1, 0, 0, 0, 7, 303, 1, 0, 0, 0, 7, 305, 1, 0, 0, 0, 7, 307, 1, 0, 0, 0, 8, 309, 1, 0, 0, 0, 8, 311, 1, 0, 0, 0, 8, 313, 1, 0, 0, 0, 8, 315, 1, 0, 0, 0, 8, 317, 1, 0, 0, 0, 8, 319, 1, 0, 0, 0, 8, 321, 1, 0, 0, 0, 8, 323, 1, 0, 0, 0, 8, 325, 1, 0, 0, 0, 9, 327, 1, 0, 0, 0, 9, 329, 1, 0, 0, 0, 9, 331, 1, 0, 0, 0, 9, 333, 1, 0, 0, 0, 9, 335, 1, 0, 0, 0, 10, 337, 1, 0, 0, 0, 10, 339, 1, 0, 0, 0, 10, 341, 1, 0, 0, 0, 10, 343, 1, 0, 0, 0, 10, 345, 1, 0, 0, 0, 10, 347, 1, 0, 0, 0, 11, 349, 1, 0, 0, 0, 11, 351, 1, 0, 0, 0, 11, 353, 1, 0, 0, 0, 11, 355, 1, 0, 0, 0, 11, 357, 1, 0, 0, 0, 11, 359, 1, 0, 0, 0, 11, 361, 1, 0, 0, 0, 11, 363, 1, 0, 0, 0, 11, 365, 1, 0, 0, 0, 11, 367, 1, 0, 0, 0, 12, 369, 1, 0, 0, 0, 12, 371, 1, 0, 0, 0, 12, 373, 1, 0, 0, 0, 12, 375, 1, 0, 0, 0, 12, 377, 1, 0, 0, 0, 12, 379, 1, 0, 0, 0, 12, 381, 1, 0, 0, 0, 13, 383, 1, 0, 0, 0, 13, 385, 1, 0, 0, 0, 13, 387, 1, 0, 0, 0, 13, 389, 1, 0, 0, 0, 13, 391, 1, 0, 0, 0, 13, 393, 1, 0, 0, 0, 14, 395, 1, 0, 0, 0, 14, 397, 1, 0, 0, 0, 14, 399, 1, 0, 0, 0, 14, 401, 1, 0, 0, 0, 14, 403, 1, 0, 0, 0, 14, 405, 1, 0, 0, 0, 14, 407, 1, 0, 0, 0, 14, 409, 1, 0, 0, 0, 14, 411, 1, 0, 0, 0, 15, 413, 1, 0, 0, 0, 17, 423, 1, 0, 0, 0, 19, 430, 1, 0, 0, 0, 21, 439, 1, 0, 0, 0, 23, 446, 1, 0, 0, 0, 25, 456, 1, 0, 0, 0, 27, 463, 1, 0, 0, 0, 29, 470, 1, 0, 0, 0, 31, 477, 1, 0, 0, 0, 33, 485, 1, 0, 0, 0, 35, 497, 1, 0, 0, 0, 37, 506, 1, 0, 0, 0, 39, 512, 1, 0, 0, 0, 41, 519, 1, 0, 0, 0, 43, 526, 1, 0, 0, 0, 45, 534, 1, 0, 0, 0, 47, 542, 1, 0, 0, 0, 49, 557, 1, 0, 0, 0, 51, 567, 1, 0, 0, 0, 53, 579, 1, 0, 0, 0, 55, 585, 1, 0, 0, 0, 57, 602, 1, 0, 0, 0, 59, 618, 1, 0, 0, 0, 61, 624, 1, 0, 0, 0, 63, 626, 1, 0, 0, 0, 65, 630, 1, 0, 0, 0, 67, 632, 1, 0, 0, 0, 69, 634, 1, 0, 0, 0, 71, 637, 1, 0, 0, 0, 73, 639, 1, 0, 0, 0, 75, 648, 1, 0, 0, 0, 77, 650, 1, 0, 0, 0, 79, 655, 1, 0, 0, 0, 81, 657, 1, 0, 0, 0, 83, 662, 1, 0, 0, 0, 85, 693, 1, 0, 0, 0, 87, 696, 1, 0, 0, 0, 89, 742, 1, 0, 0, 0, 91, 744, 1, 0, 0, 0, 93, 747, 1, 0, 0, 0, 95, 751, 1, 0, 0, 0, 97, 755, 1, 0, 0, 0, 99, 757, 1, 0, 0, 0, 101, 760, 1, 0, 0, 0, 103, 762, 1, 0, 0, 0, 105, 767, 1, 0, 0, 0, 107, 769, 1, 0, 0, 0, 109, 775, 1, 0, 0, 0, 111, 781, 1, 0, 0, 0, 113, 784, 1, 0, 0, 0, 115, 787, 1, 0, 0, 0, 117, 792, 1, 0, 0, 0, 119, 797, 1, 0, 0, 0, 121, 799, 1, 0, 0, 0, 123, 803, 1, 0, 0, 0, 125, 808, 1, 0, 0, 0, 127, 814, 1, 0, 0, 0, 129, 817, 1, 0, 0, 0, 131, 819, 1, 0, 0, 0, 133, 825, 1, 0, 0, 0, 135, 827, 1, 0, 0, 0, 137, 832, 1, 0, 0, 0, 139, 835, 1, 0, 0, 0, 141, 838, 1, 0, 0, 0, 143, 841, 1, 0, 0, 0, 145, 843, 1, 0, 0, 0, 147, 846, 1, 0, 0, 0, 149, 848, 1, 0, 0, 0, 151, 851, 1, 0, 0, 0, 153, 853, 1, 0, 0, 0, 155, 855, 1, 0, 0, 0, 157, 857, 1, 0, 0, 0, 159, 859, 1, 0, 0, 0, 161, 861, 1, 0, 0, 0, 163, 866, 1, 0, 0, 0, 165, 887, 1, 0, 0, 0, 167, 889, 1, 0, 0, 0, 169, 894, 1, 0, 0, 0, 171, 915, 1, 0, 0, 0, 173, 917, 1, 0, 0, 0, 175, 925, 1, 0, 0, 0, 177, 927, 1, 0, 0, 0, 179, 931, 1, 0, 0, 0, 181, 935, 1, 0, 0, 0, 183, 939, 1, 0, 0, 0, 185, 944, 1, 0, 0, 0, 187, 949, 1, 0, 0, 0, 189, 953, 1, 0, 0, 0, 191, 957, 1, 0, 0, 0, 193, 961, 1, 0, 0, 0, 195, 966, 1, 0, 0, 0, 197, 970, 1, 0, 0, 0, 199, 974, 1, 0, 0, 0, 201, 978, 1, 0, 0, 0, 203, 982, 1, 0, 0, 0, 205, 986, 1, 0, 0, 0, 207, 998, 1, 0, 0, 0, 209, 1001, 1, 0, 0, 0, 211, 1005, 1, 0, 0, 0, 213, 1009, 1, 0, 0, 0, 215, 1013, 1, 0, 0, 0, 217, 1017, 1, 0, 0, 0, 219, 1021, 1, 0, 0, 0, 221, 1025, 1, 0, 0, 0, 223, 1030, 1, 0, 0, 0, 225, 1034, 1, 0, 0, 0, 227, 1038, 1, 0, 0, 0, 229, 1043, 1, 0, 0, 0, 231, 1052, 1, 0, 0, 0, 233, 1073, 1, 0, 0, 0, 235, 1077, 1, 0, 0, 0, 237, 1081, 1, 0, 0, 0, 239, 1085, 1, 0, 0, 0, 241, 1089, 1, 0, 0, 0, 243, 1093, 1, 0, 0, 0, 245, 1098, 1, 0, 0, 0, 247, 1102, 1, 0, 0, 0, 249, 1106, 1, 0, 0, 0, 251, 1110, 1, 0, 0, 0, 253, 1115, 1, 0, 0, 0, 255, 1120, 1, 0, 0, 0, 257, 1123, 1, 0, 0, 0, 259, 1127, 1, 0, 0, 0, 261, 1131, 1, 0, 0, 0, 263, 1135, 1, 0, 0, 0, 265, 1139, 1, 0, 0, 0, 267, 1144, 1, 0, 0, 0, 269, 1149, 1, 0, 0, 0, 271, 1154, 1, 0, 0, 0, 273, 1161, 1, 0, 0, 0, 275, 1170, 1, 0, 0, 0, 277, 1177, 1, 0, 0, 0, 279, 1181, 1, 0, 0, 0, 281, 1185, 1, 0, 0, 0, 283, 1189, 1, 0, 0, 0, 285, 1193, 1, 0, 0, 0, 287, 1199, 1, 0, 0, 0, 289, 1203, 1, 0, 0, 0, 291, 1207, 1, 0, 0, 0, 293, 1211, 1, 0, 0, 0, 295, 1215, 1, 0, 0, 0, 297, 1219, 1, 0, 0, 0, 299, 1223, 1, 0, 0, 0, 301, 1228, 1, 0, 0, 0, 303, 1233, 1, 0, 0, 0, 305, 1237, 1, 0, 0, 0, 307, 1241, 1, 0, 0, 0, 309, 1245, 1, 0, 0, 0, 311, 1250, 1, 0, 0, 0, 313, 1254, 1, 0, 0, 0, 315, 1259, 1, 0, 0, 0, 317, 1264, 1, 0, 0, 0, 319, 1268, 1, 0, 0, 0, 321, 1272, 1, 0, 0, 0, 323, 1276, 1, 0, 0, 0, 325, 1280, 1, 0, 0, 0, 327, 1284, 1, 0, 0, 0, 329, 1289, 1, 0, 0, 0, 331, 1294, 1, 0, 0, 0, 333, 1298, 1, 0, 0, 0, 335, 1302, 1, 0, 0, 0, 337, 1306, 1, 0, 0, 0, 339, 1311, 1, 0, 0, 0, 341, 1320, 1, 0, 0, 0, 343, 1324, 1, 0, 0, 0, 345, 1328, 1, 0, 0, 0, 347, 1332, 1, 0, 0, 0, 349, 1336, 1, 0, 0, 0, 351, 1341, 1, 0, 0, 0, 353, 1345, 1, 0, 0, 0, 355, 1349, 1, 0, 0, 0, 357, 1353, 1, 0, 0, 0, 359, 1358, 1, 0, 0, 0, 361, 1362, 1, 0, 0, 0, 363, 1366, 1, 0, 0, 0, 365, 1370, 1, 0, 0, 0, 367, 1374, 1, 0, 0, 0, 369, 1378, 1, 0, 0, 0, 371, 1384, 1, 0, 0, 0, 373, 1388, 1, 0, 0, 0, 375, 1392, 1, 0, 0, 0, 377, 1396, 1, 0, 0, 0, 379, 1400, 1, 0, 0, 0, 381, 1404, 1, 0, 0, 0, 383, 1408, 1, 0, 0, 0, 385, 1413, 1, 0, 0, 0, 387, 1419, 1, 0, 0, 0, 389, 1425, 1, 0, 0, 0, 391, 1429, 1, 0, 0, 0, 393, 1433, 1, 0, 0, 0, 395, 1437, 1, 0, 0, 0, 397, 1443, 1, 0, 0, 0, 399, 1449, 1, 0, 0, 0, 401, 1453, 1, 0, 0, 0, 403, 1457, 1, 0, 0, 0, 405, 1461, 1, 0, 0, 0, 407, 1467, 1, 0, 0, 0, 409, 1473, 1, 0, 0, 0, 411, 1479, 1, 0, 0, 0, 413, 414, 7, 0, 0, 0, 414, 415, 7, 1, 0, 0, 415, 416, 7, 2, 0, 0, 416, 417, 7, 2, 0, 0, 417, 418, 7, 3, 0, 0, 418, 419, 7, 4, 0, 0, 419, 420, 7, 5, 0, 0, 420, 421, 1, 0, 0, 0, 421, 422, 6, 0, 0, 0, 422, 16, 1, 0, 0, 0, 423, 424, 7, 0, 0, 0, 424, 425, 7, 6, 0, 0, 425, 426, 7, 7, 0, 0, 426, 427, 7, 8, 0, 0, 427, 428, 1, 0, 0, 0, 428, 429, 6, 1, 1, 0, 429, 18, 1, 0, 0, 0, 430, 431, 7, 3, 0, 0, 431, 432, 7, 9, 0, 0, 432, 433, 7, 6, 0, 0, 433, 434, 7, 1, 0, 0, 434, 435, 7, 4, 0, 0, 435, 436, 7, 10, 0, 0, 436, 437, 1, 0, 0, 0, 437, 438, 6, 2, 2, 0, 438, 20, 1, 0, 0, 0, 439, 440, 7, 3, 0, 0, 440, 441, 7, 11, 0, 0, 441, 442, 7, 12, 0, 0, 442, 443, 7, 13, 0, 0, 443, 444, 1, 0, 0, 0, 444, 445, 6, 3, 0, 0, 445, 22, 1, 0, 0, 0, 446, 447, 7, 3, 0, 0, 447, 448, 7, 14, 0, 0, 448, 449, 7, 8, 0, 0, 449, 450, 7, 13, 0, 0, 450, 451, 7, 12, 0, 0, 451, 452, 7, 1, 0, 0, 452, 453, 7, 9, 0, 0, 453, 454, 1, 0, 0, 0, 454, 455, 6, 4, 3, 0, 455, 24, 1, 0, 0, 0, 456, 457, 7, 15, 0, 0, 457, 458, 7, 6, 0, 0, 458, 459, 7, 7, 0, 0, 459, 460, 7, 16, 0, 0, 460, 461, 1, 0, 0, 0, 461, 462, 6, 5, 4, 0, 462, 26, 1, 0, 0, 0, 463, 464, 7, 17, 0, 0, 464, 465, 7, 6, 0, 0, 465, 466, 7, 7, 0, 0, 466, 467, 7, 18, 0, 0, 467, 468, 1, 0, 0, 0, 468, 469, 6, 6, 0, 0, 469, 28, 1, 0, 0, 0, 470, 471, 7, 18, 0, 0, 471, 472, 7, 3, 0, 0, 472, 473, 7, 3, 0, 0, 473, 474, 7, 8, 0, 0, 474, 475, 1, 0, 0, 0, 475, 476, 6, 7, 1, 0, 476, 30, 1, 0, 0, 0, 477, 478, 7, 13, 0, 0, 478, 479, 7, 1, 0, 0, 479, 480, 7, 16, 0, 0, 480, 481, 7, 1, 0, 0, 481, 482, 7, 5, 0, 0, 482, 483, 1, 0, 0, 0, 483, 484, 6, 8, 0, 0, 484, 32, 1, 0, 0, 0, 485, 486, 7, 16, 0, 0, 486, 487, 7, 11, 0, 0, 487, 488, 5, 95, 0, 0, 488, 489, 7, 3, 0, 0, 489, 490, 7, 14, 0, 0, 490, 491, 7, 8, 0, 0, 491, 492, 7, 12, 0, 0, 492, 493, 7, 9, 0, 0, 493, 494, 7, 0, 0, 0, 494, 495, 1, 0, 0, 0, 495, 496, 6, 9, 5, 0, 496, 34, 1, 0, 0, 0, 497, 498, 7, 6, 0, 0, 498, 499, 7, 3, 0, 0, 499, 500, 7, 9, 0, 0, 500, 501, 7, 12, 0, 0, 501, 502, 7, 16, 0, 0, 502, 503, 7, 3, 0, 0, 503, 504, 1, 0, 0, 0, 504, 505, 6, 10, 6, 0, 505, 36, 1, 0, 0, 0, 506, 507, 7, 6, 0, 0, 507, 508, 7, 7, 0, 0, 508, 509, 7, 19, 0, 0, 509, 510, 1, 0, 0, 0, 510, 511, 6, 11, 0, 0, 511, 38, 1, 0, 0, 0, 512, 513, 7, 2, 0, 0, 513, 514, 7, 10, 0, 0, 514, 515, 7, 7, 0, 0, 515, 516, 7, 19, 0, 0, 516, 517, 1, 0, 0, 0, 517, 518, 6, 12, 7, 0, 518, 40, 1, 0, 0, 0, 519, 520, 7, 2, 0, 0, 520, 521, 7, 7, 0, 0, 521, 522, 7, 6, 0, 0, 522, 523, 7, 5, 0, 0, 523, 524, 1, 0, 0, 0, 524, 525, 6, 13, 0, 0, 525, 42, 1, 0, 0, 0, 526, 527, 7, 2, 0, 0, 527, 528, 7, 5, 0, 0, 528, 529, 7, 12, 0, 0, 529, 530, 7, 5, 0, 0, 530, 531, 7, 2, 0, 0, 531, 532, 1, 0, 0, 0, 532, 533, 6, 14, 0, 0, 533, 44, 1, 0, 0, 0, 534, 535, 7, 19, 0, 0, 535, 536, 7, 10, 0, 0, 536, 537, 7, 3, 0, 0, 537, 538, 7, 6, 0, 0, 538, 539, 7, 3, 0, 0, 539, 540, 1, 0, 0, 0, 540, 541, 6, 15, 0, 0, 541, 46, 1, 0, 0, 0, 542, 543, 4, 16, 0, 0, 543, 544, 7, 1, 0, 0, 544, 545, 7, 9, 0, 0, 545, 546, 7, 13, 0, 0, 546, 547, 7, 1, 0, 0, 547, 548, 7, 9, 0, 0, 548, 549, 7, 3, 0, 0, 549, 550, 7, 2, 0, 0, 550, 551, 7, 5, 0, 0, 551, 552, 7, 12, 0, 0, 552, 553, 7, 5, 0, 0, 553, 554, 7, 2, 0, 0, 554, 555, 1, 0, 0, 0, 555, 556, 6, 16, 0, 0, 556, 48, 1, 0, 0, 0, 557, 558, 4, 17, 1, 0, 558, 559, 7, 13, 0, 0, 559, 560, 7, 7, 0, 0, 560, 561, 7, 7, 0, 0, 561, 562, 7, 18, 0, 0, 562, 563, 7, 20, 0, 0, 563, 564, 7, 8, 0, 0, 564, 565, 1, 0, 0, 0, 565, 566, 6, 17, 8, 0, 566, 50, 1, 0, 0, 0, 567, 568, 4, 18, 2, 0, 568, 569, 7, 16, 0, 0, 569, 570, 7, 3, 0, 0, 570, 571, 7, 5, 0, 0, 571, 572, 7, 6, 0, 0, 572, 573, 7, 1, 0, 0, 573, 574, 7, 4, 0, 0, 574, 575, 7, 2, 0, 0, 575, 576, 1, 0, 0, 0, 576, 577, 6, 18, 9, 0, 577, 52, 1, 0, 0, 0, 578, 580, 8, 21, 0, 0, 579, 578, 1, 0, 0, 0, 580, 581, 1, 0, 0, 0, 581, 579, 1, 0, 0, 0, 581, 582, 1, 0, 0, 0, 582, 583, 1, 0, 0, 0, 583, 584, 6, 19, 0, 0, 584, 54, 1, 0, 0, 0, 585, 586, 5, 47, 0, 0, 586, 587, 5, 47, 0, 0, 587, 591, 1, 0, 0, 0, 588, 590, 8, 22, 0, 0, 589, 588, 1, 0, 0, 0, 590, 593, 1, 0, 0, 0, 591, 589, 1, 0, 0, 0, 591, 592, 1, 0, 0, 0, 592, 595, 1, 0, 0, 0, 593, 591, 1, 0, 0, 0, 594, 596, 5, 13, 0, 0, 595, 594, 1, 0, 0, 0, 595, 596, 1, 0, 0, 0, 596, 598, 1, 0, 0, 0, 597, 599, 5, 10, 0, 0, 598, 597, 1, 0, 0, 0, 598, 599, 1, 0, 0, 0, 599, 600, 1, 0, 0, 0, 600, 601, 6, 20, 10, 0, 601, 56, 1, 0, 0, 0, 602, 603, 5, 47, 0, 0, 603, 604, 5, 42, 0, 0, 604, 609, 1, 0, 0, 0, 605, 608, 3, 57, 21, 0, 606, 608, 9, 0, 0, 0, 607, 605, 1, 0, 0, 0, 607, 606, 1, 0, 0, 0, 608, 611, 1, 0, 0, 0, 609, 610, 1, 0, 0, 0, 609, 607, 1, 0, 0, 0, 610, 612, 1, 0, 0, 0, 611, 609, 1, 0, 0, 0, 612, 613, 5, 42, 0, 0, 613, 614, 5, 47, 0, 0, 614, 615, 1, 0, 0, 0, 615, 616, 6, 21, 10, 0, 616, 58, 1, 0, 0, 0, 617, 619, 7, 23, 0, 0, 618, 617, 1, 0, 0, 0, 619, 620, 1, 0, 0, 0, 620, 618, 1, 0, 0, 0, 620, 621, 1, 0, 0, 0, 621, 622, 1, 0, 0, 0, 622, 623, 6, 22, 10, 0, 623, 60, 1, 0, 0, 0, 624, 625, 5, 58, 0, 0, 625, 62, 1, 0, 0, 0, 626, 627, 5, 124, 0, 0, 627, 628, 1, 0, 0, 0, 628, 629, 6, 24, 11, 0, 629, 64, 1, 0, 0, 0, 630, 631, 7, 24, 0, 0, 631, 66, 1, 0, 0, 0, 632, 633, 7, 25, 0, 0, 633, 68, 1, 0, 0, 0, 634, 635, 5, 92, 0, 0, 635, 636, 7, 26, 0, 0, 636, 70, 1, 0, 0, 0, 637, 638, 8, 27, 0, 0, 638, 72, 1, 0, 0, 0, 639, 641, 7, 3, 0, 0, 640, 642, 7, 28, 0, 0, 641, 640, 1, 0, 0, 0, 641, 642, 1, 0, 0, 0, 642, 644, 1, 0, 0, 0, 643, 645, 3, 65, 25, 0, 644, 643, 1, 0, 0, 0, 645, 646, 1, 0, 0, 0, 646, 644, 1, 0, 0, 0, 646, 647, 1, 0, 0, 0, 647, 74, 1, 0, 0, 0, 648, 649, 5, 64, 0, 0, 649, 76, 1, 0, 0, 0, 650, 651, 5, 96, 0, 0, 651, 78, 1, 0, 0, 0, 652, 656, 8, 29, 0, 0, 653, 654, 5, 96, 0, 0, 654, 656, 5, 96, 0, 0, 655, 652, 1, 0, 0, 0, 655, 653, 1, 0, 0, 0, 656, 80, 1, 0, 0, 0, 657, 658, 5, 95, 0, 0, 658, 82, 1, 0, 0, 0, 659, 663, 3, 67, 26, 0, 660, 663, 3, 65, 25, 0, 661, 663, 3, 81, 33, 0, 662, 659, 1, 0, 0, 0, 662, 660, 1, 0, 0, 0, 662, 661, 1, 0, 0, 0, 663, 84, 1, 0, 0, 0, 664, 669, 5, 34, 0, 0, 665, 668, 3, 69, 27, 0, 666, 668, 3, 71, 28, 0, 667, 665, 1, 0, 0, 0, 667, 666, 1, 0, 0, 0, 668, 671, 1, 0, 0, 0, 669, 667, 1, 0, 0, 0, 669, 670, 1, 0, 0, 0, 670, 672, 1, 0, 0, 0, 671, 669, 1, 0, 0, 0, 672, 694, 5, 34, 0, 0, 673, 674, 5, 34, 0, 0, 674, 675, 5, 34, 0, 0, 675, 676, 5, 34, 0, 0, 676, 680, 1, 0, 0, 0, 677, 679, 8, 22, 0, 0, 678, 677, 1, 0, 0, 0, 679, 682, 1, 0, 0, 0, 680, 681, 1, 0, 0, 0, 680, 678, 1, 0, 0, 0, 681, 683, 1, 0, 0, 0, 682, 680, 1, 0, 0, 0, 683, 684, 5, 34, 0, 0, 684, 685, 5, 34, 0, 0, 685, 686, 5, 34, 0, 0, 686, 688, 1, 0, 0, 0, 687, 689, 5, 34, 0, 0, 688, 687, 1, 0, 0, 0, 688, 689, 1, 0, 0, 0, 689, 691, 1, 0, 0, 0, 690, 692, 5, 34, 0, 0, 691, 690, 1, 0, 0, 0, 691, 692, 1, 0, 0, 0, 692, 694, 1, 0, 0, 0, 693, 664, 1, 0, 0, 0, 693, 673, 1, 0, 0, 0, 694, 86, 1, 0, 0, 0, 695, 697, 3, 65, 25, 0, 696, 695, 1, 0, 0, 0, 697, 698, 1, 0, 0, 0, 698, 696, 1, 0, 0, 0, 698, 699, 1, 0, 0, 0, 699, 88, 1, 0, 0, 0, 700, 702, 3, 65, 25, 0, 701, 700, 1, 0, 0, 0, 702, 703, 1, 0, 0, 0, 703, 701, 1, 0, 0, 0, 703, 704, 1, 0, 0, 0, 704, 705, 1, 0, 0, 0, 705, 709, 3, 105, 45, 0, 706, 708, 3, 65, 25, 0, 707, 706, 1, 0, 0, 0, 708, 711, 1, 0, 0, 0, 709, 707, 1, 0, 0, 0, 709, 710, 1, 0, 0, 0, 710, 743, 1, 0, 0, 0, 711, 709, 1, 0, 0, 0, 712, 714, 3, 105, 45, 0, 713, 715, 3, 65, 25, 0, 714, 713, 1, 0, 0, 0, 715, 716, 1, 0, 0, 0, 716, 714, 1, 0, 0, 0, 716, 717, 1, 0, 0, 0, 717, 743, 1, 0, 0, 0, 718, 720, 3, 65, 25, 0, 719, 718, 1, 0, 0, 0, 720, 721, 1, 0, 0, 0, 721, 719, 1, 0, 0, 0, 721, 722, 1, 0, 0, 0, 722, 730, 1, 0, 0, 0, 723, 727, 3, 105, 45, 0, 724, 726, 3, 65, 25, 0, 725, 724, 1, 0, 0, 0, 726, 729, 1, 0, 0, 0, 727, 725, 1, 0, 0, 0, 727, 728, 1, 0, 0, 0, 728, 731, 1, 0, 0, 0, 729, 727, 1, 0, 0, 0, 730, 723, 1, 0, 0, 0, 730, 731, 1, 0, 0, 0, 731, 732, 1, 0, 0, 0, 732, 733, 3, 73, 29, 0, 733, 743, 1, 0, 0, 0, 734, 736, 3, 105, 45, 0, 735, 737, 3, 65, 25, 0, 736, 735, 1, 0, 0, 0, 737, 738, 1, 0, 0, 0, 738, 736, 1, 0, 0, 0, 738, 739, 1, 0, 0, 0, 739, 740, 1, 0, 0, 0, 740, 741, 3, 73, 29, 0, 741, 743, 1, 0, 0, 0, 742, 701, 1, 0, 0, 0, 742, 712, 1, 0, 0, 0, 742, 719, 1, 0, 0, 0, 742, 734, 1, 0, 0, 0, 743, 90, 1, 0, 0, 0, 744, 745, 7, 30, 0, 0, 745, 746, 7, 31, 0, 0, 746, 92, 1, 0, 0, 0, 747, 748, 7, 12, 0, 0, 748, 749, 7, 9, 0, 0, 749, 750, 7, 0, 0, 0, 750, 94, 1, 0, 0, 0, 751, 752, 7, 12, 0, 0, 752, 753, 7, 2, 0, 0, 753, 754, 7, 4, 0, 0, 754, 96, 1, 0, 0, 0, 755, 756, 5, 61, 0, 0, 756, 98, 1, 0, 0, 0, 757, 758, 5, 58, 0, 0, 758, 759, 5, 58, 0, 0, 759, 100, 1, 0, 0, 0, 760, 761, 5, 44, 0, 0, 761, 102, 1, 0, 0, 0, 762, 763, 7, 0, 0, 0, 763, 764, 7, 3, 0, 0, 764, 765, 7, 2, 0, 0, 765, 766, 7, 4, 0, 0, 766, 104, 1, 0, 0, 0, 767, 768, 5, 46, 0, 0, 768, 106, 1, 0, 0, 0, 769, 770, 7, 15, 0, 0, 770, 771, 7, 12, 0, 0, 771, 772, 7, 13, 0, 0, 772, 773, 7, 2, 0, 0, 773, 774, 7, 3, 0, 0, 774, 108, 1, 0, 0, 0, 775, 776, 7, 15, 0, 0, 776, 777, 7, 1, 0, 0, 777, 778, 7, 6, 0, 0, 778, 779, 7, 2, 0, 0, 779, 780, 7, 5, 0, 0, 780, 110, 1, 0, 0, 0, 781, 782, 7, 1, 0, 0, 782, 783, 7, 9, 0, 0, 783, 112, 1, 0, 0, 0, 784, 785, 7, 1, 0, 0, 785, 786, 7, 2, 0, 0, 786, 114, 1, 0, 0, 0, 787, 788, 7, 13, 0, 0, 788, 789, 7, 12, 0, 0, 789, 790, 7, 2, 0, 0, 790, 791, 7, 5, 0, 0, 791, 116, 1, 0, 0, 0, 792, 793, 7, 13, 0, 0, 793, 794, 7, 1, 0, 0, 794, 795, 7, 18, 0, 0, 795, 796, 7, 3, 0, 0, 796, 118, 1, 0, 0, 0, 797, 798, 5, 40, 0, 0, 798, 120, 1, 0, 0, 0, 799, 800, 7, 9, 0, 0, 800, 801, 7, 7, 0, 0, 801, 802, 7, 5, 0, 0, 802, 122, 1, 0, 0, 0, 803, 804, 7, 9, 0, 0, 804, 805, 7, 20, 0, 0, 805, 806, 7, 13, 0, 0, 806, 807, 7, 13, 0, 0, 807, 124, 1, 0, 0, 0, 808, 809, 7, 9, 0, 0, 809, 810, 7, 20, 0, 0, 810, 811, 7, 13, 0, 0, 811, 812, 7, 13, 0, 0, 812, 813, 7, 2, 0, 0, 813, 126, 1, 0, 0, 0, 814, 815, 7, 7, 0, 0, 815, 816, 7, 6, 0, 0, 816, 128, 1, 0, 0, 0, 817, 818, 5, 63, 0, 0, 818, 130, 1, 0, 0, 0, 819, 820, 7, 6, 0, 0, 820, 821, 7, 13, 0, 0, 821, 822, 7, 1, 0, 0, 822, 823, 7, 18, 0, 0, 823, 824, 7, 3, 0, 0, 824, 132, 1, 0, 0, 0, 825, 826, 5, 41, 0, 0, 826, 134, 1, 0, 0, 0, 827, 828, 7, 5, 0, 0, 828, 829, 7, 6, 0, 0, 829, 830, 7, 20, 0, 0, 830, 831, 7, 3, 0, 0, 831, 136, 1, 0, 0, 0, 832, 833, 5, 61, 0, 0, 833, 834, 5, 61, 0, 0, 834, 138, 1, 0, 0, 0, 835, 836, 5, 61, 0, 0, 836, 837, 5, 126, 0, 0, 837, 140, 1, 0, 0, 0, 838, 839, 5, 33, 0, 0, 839, 840, 5, 61, 0, 0, 840, 142, 1, 0, 0, 0, 841, 842, 5, 60, 0, 0, 842, 144, 1, 0, 0, 0, 843, 844, 5, 60, 0, 0, 844, 845, 5, 61, 0, 0, 845, 146, 1, 0, 0, 0, 846, 847, 5, 62, 0, 0, 847, 148, 1, 0, 0, 0, 848, 849, 5, 62, 0, 0, 849, 850, 5, 61, 0, 0, 850, 150, 1, 0, 0, 0, 851, 852, 5, 43, 0, 0, 852, 152, 1, 0, 0, 0, 853, 854, 5, 45, 0, 0, 854, 154, 1, 0, 0, 0, 855, 856, 5, 42, 0, 0, 856, 156, 1, 0, 0, 0, 857, 858, 5, 47, 0, 0, 858, 158, 1, 0, 0, 0, 859, 860, 5, 37, 0, 0, 860, 160, 1, 0, 0, 0, 861, 862, 4, 73, 3, 0, 862, 863, 3, 61, 23, 0, 863, 864, 1, 0, 0, 0, 864, 865, 6, 73, 12, 0, 865, 162, 1, 0, 0, 0, 866, 867, 3, 45, 15, 0, 867, 868, 1, 0, 0, 0, 868, 869, 6, 74, 13, 0, 869, 164, 1, 0, 0, 0, 870, 873, 3, 129, 57, 0, 871, 874, 3, 67, 26, 0, 872, 874, 3, 81, 33, 0, 873, 871, 1, 0, 0, 0, 873, 872, 1, 0, 0, 0, 874, 878, 1, 0, 0, 0, 875, 877, 3, 83, 34, 0, 876, 875, 1, 0, 0, 0, 877, 880, 1, 0, 0, 0, 878, 876, 1, 0, 0, 0, 878, 879, 1, 0, 0, 0, 879, 888, 1, 0, 0, 0, 880, 878, 1, 0, 0, 0, 881, 883, 3, 129, 57, 0, 882, 884, 3, 65, 25, 0, 883, 882, 1, 0, 0, 0, 884, 885, 1, 0, 0, 0, 885, 883, 1, 0, 0, 0, 885, 886, 1, 0, 0, 0, 886, 888, 1, 0, 0, 0, 887, 870, 1, 0, 0, 0, 887, 881, 1, 0, 0, 0, 888, 166, 1, 0, 0, 0, 889, 890, 5, 91, 0, 0, 890, 891, 1, 0, 0, 0, 891, 892, 6, 76, 0, 0, 892, 893, 6, 76, 0, 0, 893, 168, 1, 0, 0, 0, 894, 895, 5, 93, 0, 0, 895, 896, 1, 0, 0, 0, 896, 897, 6, 77, 11, 0, 897, 898, 6, 77, 11, 0, 898, 170, 1, 0, 0, 0, 899, 903, 3, 67, 26, 0, 900, 902, 3, 83, 34, 0, 901, 900, 1, 0, 0, 0, 902, 905, 1, 0, 0, 0, 903, 901, 1, 0, 0, 0, 903, 904, 1, 0, 0, 0, 904, 916, 1, 0, 0, 0, 905, 903, 1, 0, 0, 0, 906, 909, 3, 81, 33, 0, 907, 909, 3, 75, 30, 0, 908, 906, 1, 0, 0, 0, 908, 907, 1, 0, 0, 0, 909, 911, 1, 0, 0, 0, 910, 912, 3, 83, 34, 0, 911, 910, 1, 0, 0, 0, 912, 913, 1, 0, 0, 0, 913, 911, 1, 0, 0, 0, 913, 914, 1, 0, 0, 0, 914, 916, 1, 0, 0, 0, 915, 899, 1, 0, 0, 0, 915, 908, 1, 0, 0, 0, 916, 172, 1, 0, 0, 0, 917, 919, 3, 77, 31, 0, 918, 920, 3, 79, 32, 0, 919, 918, 1, 0, 0, 0, 920, 921, 1, 0, 0, 0, 921, 919, 1, 0, 0, 0, 921, 922, 1, 0, 0, 0, 922, 923, 1, 0, 0, 0, 923, 924, 3, 77, 31, 0, 924, 174, 1, 0, 0, 0, 925, 926, 3, 173, 79, 0, 926, 176, 1, 0, 0, 0, 927, 928, 3, 55, 20, 0, 928, 929, 1, 0, 0, 0, 929, 930, 6, 81, 10, 0, 930, 178, 1, 0, 0, 0, 931, 932, 3, 57, 21, 0, 932, 933, 1, 0, 0, 0, 933, 934, 6, 82, 10, 0, 934, 180, 1, 0, 0, 0, 935, 936, 3, 59, 22, 0, 936, 937, 1, 0, 0, 0, 937, 938, 6, 83, 10, 0, 938, 182, 1, 0, 0, 0, 939, 940, 3, 167, 76, 0, 940, 941, 1, 0, 0, 0, 941, 942, 6, 84, 14, 0, 942, 943, 6, 84, 15, 0, 943, 184, 1, 0, 0, 0, 944, 945, 3, 63, 24, 0, 945, 946, 1, 0, 0, 0, 946, 947, 6, 85, 16, 0, 947, 948, 6, 85, 11, 0, 948, 186, 1, 0, 0, 0, 949, 950, 3, 59, 22, 0, 950, 951, 1, 0, 0, 0, 951, 952, 6, 86, 10, 0, 952, 188, 1, 0, 0, 0, 953, 954, 3, 55, 20, 0, 954, 955, 1, 0, 0, 0, 955, 956, 6, 87, 10, 0, 956, 190, 1, 0, 0, 0, 957, 958, 3, 57, 21, 0, 958, 959, 1, 0, 0, 0, 959, 960, 6, 88, 10, 0, 960, 192, 1, 0, 0, 0, 961, 962, 3, 63, 24, 0, 962, 963, 1, 0, 0, 0, 963, 964, 6, 89, 16, 0, 964, 965, 6, 89, 11, 0, 965, 194, 1, 0, 0, 0, 966, 967, 3, 167, 76, 0, 967, 968, 1, 0, 0, 0, 968, 969, 6, 90, 14, 0, 969, 196, 1, 0, 0, 0, 970, 971, 3, 169, 77, 0, 971, 972, 1, 0, 0, 0, 972, 973, 6, 91, 17, 0, 973, 198, 1, 0, 0, 0, 974, 975, 3, 61, 23, 0, 975, 976, 1, 0, 0, 0, 976, 977, 6, 92, 12, 0, 977, 200, 1, 0, 0, 0, 978, 979, 3, 101, 43, 0, 979, 980, 1, 0, 0, 0, 980, 981, 6, 93, 18, 0, 981, 202, 1, 0, 0, 0, 982, 983, 3, 97, 41, 0, 983, 984, 1, 0, 0, 0, 984, 985, 6, 94, 19, 0, 985, 204, 1, 0, 0, 0, 986, 987, 7, 16, 0, 0, 987, 988, 7, 3, 0, 0, 988, 989, 7, 5, 0, 0, 989, 990, 7, 12, 0, 0, 990, 991, 7, 0, 0, 0, 991, 992, 7, 12, 0, 0, 992, 993, 7, 5, 0, 0, 993, 994, 7, 12, 0, 0, 994, 206, 1, 0, 0, 0, 995, 999, 8, 32, 0, 0, 996, 997, 5, 47, 0, 0, 997, 999, 8, 33, 0, 0, 998, 995, 1, 0, 0, 0, 998, 996, 1, 0, 0, 0, 999, 208, 1, 0, 0, 0, 1000, 1002, 3, 207, 96, 0, 1001, 1000, 1, 0, 0, 0, 1002, 1003, 1, 0, 0, 0, 1003, 1001, 1, 0, 0, 0, 1003, 1004, 1, 0, 0, 0, 1004, 210, 1, 0, 0, 0, 1005, 1006, 3, 209, 97, 0, 1006, 1007, 1, 0, 0, 0, 1007, 1008, 6, 98, 20, 0, 1008, 212, 1, 0, 0, 0, 1009, 1010, 3, 85, 35, 0, 1010, 1011, 1, 0, 0, 0, 1011, 1012, 6, 99, 21, 0, 1012, 214, 1, 0, 0, 0, 1013, 1014, 3, 55, 20, 0, 1014, 1015, 1, 0, 0, 0, 1015, 1016, 6, 100, 10, 0, 1016, 216, 1, 0, 0, 0, 1017, 1018, 3, 57, 21, 0, 1018, 1019, 1, 0, 0, 0, 1019, 1020, 6, 101, 10, 0, 1020, 218, 1, 0, 0, 0, 1021, 1022, 3, 59, 22, 0, 1022, 1023, 1, 0, 0, 0, 1023, 1024, 6, 102, 10, 0, 1024, 220, 1, 0, 0, 0, 1025, 1026, 3, 63, 24, 0, 1026, 1027, 1, 0, 0, 0, 1027, 1028, 6, 103, 16, 0, 1028, 1029, 6, 103, 11, 0, 1029, 222, 1, 0, 0, 0, 1030, 1031, 3, 105, 45, 0, 1031, 1032, 1, 0, 0, 0, 1032, 1033, 6, 104, 22, 0, 1033, 224, 1, 0, 0, 0, 1034, 1035, 3, 101, 43, 0, 1035, 1036, 1, 0, 0, 0, 1036, 1037, 6, 105, 18, 0, 1037, 226, 1, 0, 0, 0, 1038, 1039, 4, 106, 4, 0, 1039, 1040, 3, 129, 57, 0, 1040, 1041, 1, 0, 0, 0, 1041, 1042, 6, 106, 23, 0, 1042, 228, 1, 0, 0, 0, 1043, 1044, 4, 107, 5, 0, 1044, 1045, 3, 165, 75, 0, 1045, 1046, 1, 0, 0, 0, 1046, 1047, 6, 107, 24, 0, 1047, 230, 1, 0, 0, 0, 1048, 1053, 3, 67, 26, 0, 1049, 1053, 3, 65, 25, 0, 1050, 1053, 3, 81, 33, 0, 1051, 1053, 3, 155, 70, 0, 1052, 1048, 1, 0, 0, 0, 1052, 1049, 1, 0, 0, 0, 1052, 1050, 1, 0, 0, 0, 1052, 1051, 1, 0, 0, 0, 1053, 232, 1, 0, 0, 0, 1054, 1057, 3, 67, 26, 0, 1055, 1057, 3, 155, 70, 0, 1056, 1054, 1, 0, 0, 0, 1056, 1055, 1, 0, 0, 0, 1057, 1061, 1, 0, 0, 0, 1058, 1060, 3, 231, 108, 0, 1059, 1058, 1, 0, 0, 0, 1060, 1063, 1, 0, 0, 0, 1061, 1059, 1, 0, 0, 0, 1061, 1062, 1, 0, 0, 0, 1062, 1074, 1, 0, 0, 0, 1063, 1061, 1, 0, 0, 0, 1064, 1067, 3, 81, 33, 0, 1065, 1067, 3, 75, 30, 0, 1066, 1064, 1, 0, 0, 0, 1066, 1065, 1, 0, 0, 0, 1067, 1069, 1, 0, 0, 0, 1068, 1070, 3, 231, 108, 0, 1069, 1068, 1, 0, 0, 0, 1070, 1071, 1, 0, 0, 0, 1071, 1069, 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1074, 1, 0, 0, 0, 1073, 1056, 1, 0, 0, 0, 1073, 1066, 1, 0, 0, 0, 1074, 234, 1, 0, 0, 0, 1075, 1078, 3, 233, 109, 0, 1076, 1078, 3, 173, 79, 0, 1077, 1075, 1, 0, 0, 0, 1077, 1076, 1, 0, 0, 0, 1078, 1079, 1, 0, 0, 0, 1079, 1077, 1, 0, 0, 0, 1079, 1080, 1, 0, 0, 0, 1080, 236, 1, 0, 0, 0, 1081, 1082, 3, 55, 20, 0, 1082, 1083, 1, 0, 0, 0, 1083, 1084, 6, 111, 10, 0, 1084, 238, 1, 0, 0, 0, 1085, 1086, 3, 57, 21, 0, 1086, 1087, 1, 0, 0, 0, 1087, 1088, 6, 112, 10, 0, 1088, 240, 1, 0, 0, 0, 1089, 1090, 3, 59, 22, 0, 1090, 1091, 1, 0, 0, 0, 1091, 1092, 6, 113, 10, 0, 1092, 242, 1, 0, 0, 0, 1093, 1094, 3, 63, 24, 0, 1094, 1095, 1, 0, 0, 0, 1095, 1096, 6, 114, 16, 0, 1096, 1097, 6, 114, 11, 0, 1097, 244, 1, 0, 0, 0, 1098, 1099, 3, 97, 41, 0, 1099, 1100, 1, 0, 0, 0, 1100, 1101, 6, 115, 19, 0, 1101, 246, 1, 0, 0, 0, 1102, 1103, 3, 101, 43, 0, 1103, 1104, 1, 0, 0, 0, 1104, 1105, 6, 116, 18, 0, 1105, 248, 1, 0, 0, 0, 1106, 1107, 3, 105, 45, 0, 1107, 1108, 1, 0, 0, 0, 1108, 1109, 6, 117, 22, 0, 1109, 250, 1, 0, 0, 0, 1110, 1111, 4, 118, 6, 0, 1111, 1112, 3, 129, 57, 0, 1112, 1113, 1, 0, 0, 0, 1113, 1114, 6, 118, 23, 0, 1114, 252, 1, 0, 0, 0, 1115, 1116, 4, 119, 7, 0, 1116, 1117, 3, 165, 75, 0, 1117, 1118, 1, 0, 0, 0, 1118, 1119, 6, 119, 24, 0, 1119, 254, 1, 0, 0, 0, 1120, 1121, 7, 12, 0, 0, 1121, 1122, 7, 2, 0, 0, 1122, 256, 1, 0, 0, 0, 1123, 1124, 3, 235, 110, 0, 1124, 1125, 1, 0, 0, 0, 1125, 1126, 6, 121, 25, 0, 1126, 258, 1, 0, 0, 0, 1127, 1128, 3, 55, 20, 0, 1128, 1129, 1, 0, 0, 0, 1129, 1130, 6, 122, 10, 0, 1130, 260, 1, 0, 0, 0, 1131, 1132, 3, 57, 21, 0, 1132, 1133, 1, 0, 0, 0, 1133, 1134, 6, 123, 10, 0, 1134, 262, 1, 0, 0, 0, 1135, 1136, 3, 59, 22, 0, 1136, 1137, 1, 0, 0, 0, 1137, 1138, 6, 124, 10, 0, 1138, 264, 1, 0, 0, 0, 1139, 1140, 3, 63, 24, 0, 1140, 1141, 1, 0, 0, 0, 1141, 1142, 6, 125, 16, 0, 1142, 1143, 6, 125, 11, 0, 1143, 266, 1, 0, 0, 0, 1144, 1145, 3, 167, 76, 0, 1145, 1146, 1, 0, 0, 0, 1146, 1147, 6, 126, 14, 0, 1147, 1148, 6, 126, 26, 0, 1148, 268, 1, 0, 0, 0, 1149, 1150, 7, 7, 0, 0, 1150, 1151, 7, 9, 0, 0, 1151, 1152, 1, 0, 0, 0, 1152, 1153, 6, 127, 27, 0, 1153, 270, 1, 0, 0, 0, 1154, 1155, 7, 19, 0, 0, 1155, 1156, 7, 1, 0, 0, 1156, 1157, 7, 5, 0, 0, 1157, 1158, 7, 10, 0, 0, 1158, 1159, 1, 0, 0, 0, 1159, 1160, 6, 128, 27, 0, 1160, 272, 1, 0, 0, 0, 1161, 1162, 8, 34, 0, 0, 1162, 274, 1, 0, 0, 0, 1163, 1165, 3, 273, 129, 0, 1164, 1163, 1, 0, 0, 0, 1165, 1166, 1, 0, 0, 0, 1166, 1164, 1, 0, 0, 0, 1166, 1167, 1, 0, 0, 0, 1167, 1168, 1, 0, 0, 0, 1168, 1169, 3, 61, 23, 0, 1169, 1171, 1, 0, 0, 0, 1170, 1164, 1, 0, 0, 0, 1170, 1171, 1, 0, 0, 0, 1171, 1173, 1, 0, 0, 0, 1172, 1174, 3, 273, 129, 0, 1173, 1172, 1, 0, 0, 0, 1174, 1175, 1, 0, 0, 0, 1175, 1173, 1, 0, 0, 0, 1175, 1176, 1, 0, 0, 0, 1176, 276, 1, 0, 0, 0, 1177, 1178, 3, 275, 130, 0, 1178, 1179, 1, 0, 0, 0, 1179, 1180, 6, 131, 28, 0, 1180, 278, 1, 0, 0, 0, 1181, 1182, 3, 55, 20, 0, 1182, 1183, 1, 0, 0, 0, 1183, 1184, 6, 132, 10, 0, 1184, 280, 1, 0, 0, 0, 1185, 1186, 3, 57, 21, 0, 1186, 1187, 1, 0, 0, 0, 1187, 1188, 6, 133, 10, 0, 1188, 282, 1, 0, 0, 0, 1189, 1190, 3, 59, 22, 0, 1190, 1191, 1, 0, 0, 0, 1191, 1192, 6, 134, 10, 0, 1192, 284, 1, 0, 0, 0, 1193, 1194, 3, 63, 24, 0, 1194, 1195, 1, 0, 0, 0, 1195, 1196, 6, 135, 16, 0, 1196, 1197, 6, 135, 11, 0, 1197, 1198, 6, 135, 11, 0, 1198, 286, 1, 0, 0, 0, 1199, 1200, 3, 97, 41, 0, 1200, 1201, 1, 0, 0, 0, 1201, 1202, 6, 136, 19, 0, 1202, 288, 1, 0, 0, 0, 1203, 1204, 3, 101, 43, 0, 1204, 1205, 1, 0, 0, 0, 1205, 1206, 6, 137, 18, 0, 1206, 290, 1, 0, 0, 0, 1207, 1208, 3, 105, 45, 0, 1208, 1209, 1, 0, 0, 0, 1209, 1210, 6, 138, 22, 0, 1210, 292, 1, 0, 0, 0, 1211, 1212, 3, 271, 128, 0, 1212, 1213, 1, 0, 0, 0, 1213, 1214, 6, 139, 29, 0, 1214, 294, 1, 0, 0, 0, 1215, 1216, 3, 235, 110, 0, 1216, 1217, 1, 0, 0, 0, 1217, 1218, 6, 140, 25, 0, 1218, 296, 1, 0, 0, 0, 1219, 1220, 3, 175, 80, 0, 1220, 1221, 1, 0, 0, 0, 1221, 1222, 6, 141, 30, 0, 1222, 298, 1, 0, 0, 0, 1223, 1224, 4, 142, 8, 0, 1224, 1225, 3, 129, 57, 0, 1225, 1226, 1, 0, 0, 0, 1226, 1227, 6, 142, 23, 0, 1227, 300, 1, 0, 0, 0, 1228, 1229, 4, 143, 9, 0, 1229, 1230, 3, 165, 75, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1232, 6, 143, 24, 0, 1232, 302, 1, 0, 0, 0, 1233, 1234, 3, 55, 20, 0, 1234, 1235, 1, 0, 0, 0, 1235, 1236, 6, 144, 10, 0, 1236, 304, 1, 0, 0, 0, 1237, 1238, 3, 57, 21, 0, 1238, 1239, 1, 0, 0, 0, 1239, 1240, 6, 145, 10, 0, 1240, 306, 1, 0, 0, 0, 1241, 1242, 3, 59, 22, 0, 1242, 1243, 1, 0, 0, 0, 1243, 1244, 6, 146, 10, 0, 1244, 308, 1, 0, 0, 0, 1245, 1246, 3, 63, 24, 0, 1246, 1247, 1, 0, 0, 0, 1247, 1248, 6, 147, 16, 0, 1248, 1249, 6, 147, 11, 0, 1249, 310, 1, 0, 0, 0, 1250, 1251, 3, 105, 45, 0, 1251, 1252, 1, 0, 0, 0, 1252, 1253, 6, 148, 22, 0, 1253, 312, 1, 0, 0, 0, 1254, 1255, 4, 149, 10, 0, 1255, 1256, 3, 129, 57, 0, 1256, 1257, 1, 0, 0, 0, 1257, 1258, 6, 149, 23, 0, 1258, 314, 1, 0, 0, 0, 1259, 1260, 4, 150, 11, 0, 1260, 1261, 3, 165, 75, 0, 1261, 1262, 1, 0, 0, 0, 1262, 1263, 6, 150, 24, 0, 1263, 316, 1, 0, 0, 0, 1264, 1265, 3, 175, 80, 0, 1265, 1266, 1, 0, 0, 0, 1266, 1267, 6, 151, 30, 0, 1267, 318, 1, 0, 0, 0, 1268, 1269, 3, 171, 78, 0, 1269, 1270, 1, 0, 0, 0, 1270, 1271, 6, 152, 31, 0, 1271, 320, 1, 0, 0, 0, 1272, 1273, 3, 55, 20, 0, 1273, 1274, 1, 0, 0, 0, 1274, 1275, 6, 153, 10, 0, 1275, 322, 1, 0, 0, 0, 1276, 1277, 3, 57, 21, 0, 1277, 1278, 1, 0, 0, 0, 1278, 1279, 6, 154, 10, 0, 1279, 324, 1, 0, 0, 0, 1280, 1281, 3, 59, 22, 0, 1281, 1282, 1, 0, 0, 0, 1282, 1283, 6, 155, 10, 0, 1283, 326, 1, 0, 0, 0, 1284, 1285, 3, 63, 24, 0, 1285, 1286, 1, 0, 0, 0, 1286, 1287, 6, 156, 16, 0, 1287, 1288, 6, 156, 11, 0, 1288, 328, 1, 0, 0, 0, 1289, 1290, 7, 1, 0, 0, 1290, 1291, 7, 9, 0, 0, 1291, 1292, 7, 15, 0, 0, 1292, 1293, 7, 7, 0, 0, 1293, 330, 1, 0, 0, 0, 1294, 1295, 3, 55, 20, 0, 1295, 1296, 1, 0, 0, 0, 1296, 1297, 6, 158, 10, 0, 1297, 332, 1, 0, 0, 0, 1298, 1299, 3, 57, 21, 0, 1299, 1300, 1, 0, 0, 0, 1300, 1301, 6, 159, 10, 0, 1301, 334, 1, 0, 0, 0, 1302, 1303, 3, 59, 22, 0, 1303, 1304, 1, 0, 0, 0, 1304, 1305, 6, 160, 10, 0, 1305, 336, 1, 0, 0, 0, 1306, 1307, 3, 169, 77, 0, 1307, 1308, 1, 0, 0, 0, 1308, 1309, 6, 161, 17, 0, 1309, 1310, 6, 161, 11, 0, 1310, 338, 1, 0, 0, 0, 1311, 1312, 3, 61, 23, 0, 1312, 1313, 1, 0, 0, 0, 1313, 1314, 6, 162, 12, 0, 1314, 340, 1, 0, 0, 0, 1315, 1321, 3, 75, 30, 0, 1316, 1321, 3, 65, 25, 0, 1317, 1321, 3, 105, 45, 0, 1318, 1321, 3, 67, 26, 0, 1319, 1321, 3, 81, 33, 0, 1320, 1315, 1, 0, 0, 0, 1320, 1316, 1, 0, 0, 0, 1320, 1317, 1, 0, 0, 0, 1320, 1318, 1, 0, 0, 0, 1320, 1319, 1, 0, 0, 0, 1321, 1322, 1, 0, 0, 0, 1322, 1320, 1, 0, 0, 0, 1322, 1323, 1, 0, 0, 0, 1323, 342, 1, 0, 0, 0, 1324, 1325, 3, 55, 20, 0, 1325, 1326, 1, 0, 0, 0, 1326, 1327, 6, 164, 10, 0, 1327, 344, 1, 0, 0, 0, 1328, 1329, 3, 57, 21, 0, 1329, 1330, 1, 0, 0, 0, 1330, 1331, 6, 165, 10, 0, 1331, 346, 1, 0, 0, 0, 1332, 1333, 3, 59, 22, 0, 1333, 1334, 1, 0, 0, 0, 1334, 1335, 6, 166, 10, 0, 1335, 348, 1, 0, 0, 0, 1336, 1337, 3, 63, 24, 0, 1337, 1338, 1, 0, 0, 0, 1338, 1339, 6, 167, 16, 0, 1339, 1340, 6, 167, 11, 0, 1340, 350, 1, 0, 0, 0, 1341, 1342, 3, 61, 23, 0, 1342, 1343, 1, 0, 0, 0, 1343, 1344, 6, 168, 12, 0, 1344, 352, 1, 0, 0, 0, 1345, 1346, 3, 101, 43, 0, 1346, 1347, 1, 0, 0, 0, 1347, 1348, 6, 169, 18, 0, 1348, 354, 1, 0, 0, 0, 1349, 1350, 3, 105, 45, 0, 1350, 1351, 1, 0, 0, 0, 1351, 1352, 6, 170, 22, 0, 1352, 356, 1, 0, 0, 0, 1353, 1354, 3, 269, 127, 0, 1354, 1355, 1, 0, 0, 0, 1355, 1356, 6, 171, 32, 0, 1356, 1357, 6, 171, 33, 0, 1357, 358, 1, 0, 0, 0, 1358, 1359, 3, 209, 97, 0, 1359, 1360, 1, 0, 0, 0, 1360, 1361, 6, 172, 20, 0, 1361, 360, 1, 0, 0, 0, 1362, 1363, 3, 85, 35, 0, 1363, 1364, 1, 0, 0, 0, 1364, 1365, 6, 173, 21, 0, 1365, 362, 1, 0, 0, 0, 1366, 1367, 3, 55, 20, 0, 1367, 1368, 1, 0, 0, 0, 1368, 1369, 6, 174, 10, 0, 1369, 364, 1, 0, 0, 0, 1370, 1371, 3, 57, 21, 0, 1371, 1372, 1, 0, 0, 0, 1372, 1373, 6, 175, 10, 0, 1373, 366, 1, 0, 0, 0, 1374, 1375, 3, 59, 22, 0, 1375, 1376, 1, 0, 0, 0, 1376, 1377, 6, 176, 10, 0, 1377, 368, 1, 0, 0, 0, 1378, 1379, 3, 63, 24, 0, 1379, 1380, 1, 0, 0, 0, 1380, 1381, 6, 177, 16, 0, 1381, 1382, 6, 177, 11, 0, 1382, 1383, 6, 177, 11, 0, 1383, 370, 1, 0, 0, 0, 1384, 1385, 3, 101, 43, 0, 1385, 1386, 1, 0, 0, 0, 1386, 1387, 6, 178, 18, 0, 1387, 372, 1, 0, 0, 0, 1388, 1389, 3, 105, 45, 0, 1389, 1390, 1, 0, 0, 0, 1390, 1391, 6, 179, 22, 0, 1391, 374, 1, 0, 0, 0, 1392, 1393, 3, 235, 110, 0, 1393, 1394, 1, 0, 0, 0, 1394, 1395, 6, 180, 25, 0, 1395, 376, 1, 0, 0, 0, 1396, 1397, 3, 55, 20, 0, 1397, 1398, 1, 0, 0, 0, 1398, 1399, 6, 181, 10, 0, 1399, 378, 1, 0, 0, 0, 1400, 1401, 3, 57, 21, 0, 1401, 1402, 1, 0, 0, 0, 1402, 1403, 6, 182, 10, 0, 1403, 380, 1, 0, 0, 0, 1404, 1405, 3, 59, 22, 0, 1405, 1406, 1, 0, 0, 0, 1406, 1407, 6, 183, 10, 0, 1407, 382, 1, 0, 0, 0, 1408, 1409, 3, 63, 24, 0, 1409, 1410, 1, 0, 0, 0, 1410, 1411, 6, 184, 16, 0, 1411, 1412, 6, 184, 11, 0, 1412, 384, 1, 0, 0, 0, 1413, 1414, 3, 209, 97, 0, 1414, 1415, 1, 0, 0, 0, 1415, 1416, 6, 185, 20, 0, 1416, 1417, 6, 185, 11, 0, 1417, 1418, 6, 185, 34, 0, 1418, 386, 1, 0, 0, 0, 1419, 1420, 3, 85, 35, 0, 1420, 1421, 1, 0, 0, 0, 1421, 1422, 6, 186, 21, 0, 1422, 1423, 6, 186, 11, 0, 1423, 1424, 6, 186, 34, 0, 1424, 388, 1, 0, 0, 0, 1425, 1426, 3, 55, 20, 0, 1426, 1427, 1, 0, 0, 0, 1427, 1428, 6, 187, 10, 0, 1428, 390, 1, 0, 0, 0, 1429, 1430, 3, 57, 21, 0, 1430, 1431, 1, 0, 0, 0, 1431, 1432, 6, 188, 10, 0, 1432, 392, 1, 0, 0, 0, 1433, 1434, 3, 59, 22, 0, 1434, 1435, 1, 0, 0, 0, 1435, 1436, 6, 189, 10, 0, 1436, 394, 1, 0, 0, 0, 1437, 1438, 3, 61, 23, 0, 1438, 1439, 1, 0, 0, 0, 1439, 1440, 6, 190, 12, 0, 1440, 1441, 6, 190, 11, 0, 1441, 1442, 6, 190, 9, 0, 1442, 396, 1, 0, 0, 0, 1443, 1444, 3, 101, 43, 0, 1444, 1445, 1, 0, 0, 0, 1445, 1446, 6, 191, 18, 0, 1446, 1447, 6, 191, 11, 0, 1447, 1448, 6, 191, 9, 0, 1448, 398, 1, 0, 0, 0, 1449, 1450, 3, 55, 20, 0, 1450, 1451, 1, 0, 0, 0, 1451, 1452, 6, 192, 10, 0, 1452, 400, 1, 0, 0, 0, 1453, 1454, 3, 57, 21, 0, 1454, 1455, 1, 0, 0, 0, 1455, 1456, 6, 193, 10, 0, 1456, 402, 1, 0, 0, 0, 1457, 1458, 3, 59, 22, 0, 1458, 1459, 1, 0, 0, 0, 1459, 1460, 6, 194, 10, 0, 1460, 404, 1, 0, 0, 0, 1461, 1462, 3, 175, 80, 0, 1462, 1463, 1, 0, 0, 0, 1463, 1464, 6, 195, 11, 0, 1464, 1465, 6, 195, 0, 0, 1465, 1466, 6, 195, 30, 0, 1466, 406, 1, 0, 0, 0, 1467, 1468, 3, 171, 78, 0, 1468, 1469, 1, 0, 0, 0, 1469, 1470, 6, 196, 11, 0, 1470, 1471, 6, 196, 0, 0, 1471, 1472, 6, 196, 31, 0, 1472, 408, 1, 0, 0, 0, 1473, 1474, 3, 91, 38, 0, 1474, 1475, 1, 0, 0, 0, 1475, 1476, 6, 197, 11, 0, 1476, 1477, 6, 197, 0, 0, 1477, 1478, 6, 197, 35, 0, 1478, 410, 1, 0, 0, 0, 1479, 1480, 3, 63, 24, 0, 1480, 1481, 1, 0, 0, 0, 1481, 1482, 6, 198, 16, 0, 1482, 1483, 6, 198, 11, 0, 1483, 412, 1, 0, 0, 0, 65, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 581, 591, 595, 598, 607, 609, 620, 641, 646, 655, 662, 667, 669, 680, 688, 691, 693, 698, 703, 709, 716, 721, 727, 730, 738, 742, 873, 878, 885, 887, 903, 908, 913, 915, 921, 998, 1003, 1052, 1056, 1061, 1066, 1071, 1073, 1077, 1079, 1166, 1170, 1175, 1320, 1322, 36, 5, 1, 0, 5, 4, 0, 5, 6, 0, 5, 2, 0, 5, 3, 0, 5, 8, 0, 5, 5, 0, 5, 9, 0, 5, 11, 0, 5, 13, 0, 0, 1, 0, 4, 0, 0, 7, 24, 0, 7, 16, 0, 7, 65, 0, 5, 0, 0, 7, 25, 0, 7, 66, 0, 7, 34, 0, 7, 32, 0, 7, 76, 0, 7, 26, 0, 7, 36, 0, 7, 48, 0, 7, 64, 0, 7, 80, 0, 5, 10, 0, 5, 7, 0, 7, 90, 0, 7, 89, 0, 7, 68, 0, 7, 67, 0, 7, 88, 0, 5, 12, 0, 5, 14, 0, 7, 29, 0] \ No newline at end of file +[4, 0, 128, 1601, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, 7, 198, 2, 199, 7, 199, 2, 200, 7, 200, 2, 201, 7, 201, 2, 202, 7, 202, 2, 203, 7, 203, 2, 204, 7, 204, 2, 205, 7, 205, 2, 206, 7, 206, 2, 207, 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, 2, 212, 7, 212, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 4, 24, 654, 8, 24, 11, 24, 12, 24, 655, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 5, 25, 664, 8, 25, 10, 25, 12, 25, 667, 9, 25, 1, 25, 3, 25, 670, 8, 25, 1, 25, 3, 25, 673, 8, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 682, 8, 26, 10, 26, 12, 26, 685, 9, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 4, 27, 693, 8, 27, 11, 27, 12, 27, 694, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 33, 1, 33, 3, 33, 714, 8, 33, 1, 33, 4, 33, 717, 8, 33, 11, 33, 12, 33, 718, 1, 34, 1, 34, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 3, 36, 728, 8, 36, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 3, 38, 735, 8, 38, 1, 39, 1, 39, 1, 39, 5, 39, 740, 8, 39, 10, 39, 12, 39, 743, 9, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 5, 39, 751, 8, 39, 10, 39, 12, 39, 754, 9, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 761, 8, 39, 1, 39, 3, 39, 764, 8, 39, 3, 39, 766, 8, 39, 1, 40, 4, 40, 769, 8, 40, 11, 40, 12, 40, 770, 1, 41, 4, 41, 774, 8, 41, 11, 41, 12, 41, 775, 1, 41, 1, 41, 5, 41, 780, 8, 41, 10, 41, 12, 41, 783, 9, 41, 1, 41, 1, 41, 4, 41, 787, 8, 41, 11, 41, 12, 41, 788, 1, 41, 4, 41, 792, 8, 41, 11, 41, 12, 41, 793, 1, 41, 1, 41, 5, 41, 798, 8, 41, 10, 41, 12, 41, 801, 9, 41, 3, 41, 803, 8, 41, 1, 41, 1, 41, 1, 41, 1, 41, 4, 41, 809, 8, 41, 11, 41, 12, 41, 810, 1, 41, 1, 41, 3, 41, 815, 8, 41, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 74, 1, 74, 1, 75, 1, 75, 1, 76, 1, 76, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 3, 79, 943, 8, 79, 1, 79, 5, 79, 946, 8, 79, 10, 79, 12, 79, 949, 9, 79, 1, 79, 1, 79, 4, 79, 953, 8, 79, 11, 79, 12, 79, 954, 3, 79, 957, 8, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 5, 82, 971, 8, 82, 10, 82, 12, 82, 974, 9, 82, 1, 82, 1, 82, 3, 82, 978, 8, 82, 1, 82, 4, 82, 981, 8, 82, 11, 82, 12, 82, 982, 3, 82, 985, 8, 82, 1, 83, 1, 83, 4, 83, 989, 8, 83, 11, 83, 12, 83, 990, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 3, 100, 1068, 8, 100, 1, 101, 4, 101, 1071, 8, 101, 11, 101, 12, 101, 1072, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 3, 112, 1122, 8, 112, 1, 113, 1, 113, 3, 113, 1126, 8, 113, 1, 113, 5, 113, 1129, 8, 113, 10, 113, 12, 113, 1132, 9, 113, 1, 113, 1, 113, 3, 113, 1136, 8, 113, 1, 113, 4, 113, 1139, 8, 113, 11, 113, 12, 113, 1140, 3, 113, 1143, 8, 113, 1, 114, 1, 114, 4, 114, 1147, 8, 114, 11, 114, 12, 114, 1148, 1, 115, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 134, 4, 134, 1234, 8, 134, 11, 134, 12, 134, 1235, 1, 134, 1, 134, 3, 134, 1240, 8, 134, 1, 134, 4, 134, 1243, 8, 134, 11, 134, 12, 134, 1244, 1, 135, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 164, 1, 164, 1, 164, 1, 164, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 166, 1, 166, 1, 166, 1, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 4, 167, 1390, 8, 167, 11, 167, 12, 167, 1391, 1, 168, 1, 168, 1, 168, 1, 168, 1, 169, 1, 169, 1, 169, 1, 169, 1, 170, 1, 170, 1, 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 185, 1, 186, 1, 186, 1, 186, 1, 186, 1, 187, 1, 187, 1, 187, 1, 187, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, 1, 189, 1, 189, 1, 190, 1, 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 1, 194, 1, 194, 1, 194, 1, 194, 1, 195, 1, 195, 1, 195, 1, 195, 1, 196, 1, 196, 1, 196, 1, 196, 1, 197, 1, 197, 1, 197, 1, 197, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 200, 1, 200, 1, 200, 1, 200, 1, 200, 1, 200, 1, 201, 1, 201, 1, 201, 1, 201, 1, 202, 1, 202, 1, 202, 1, 202, 1, 203, 1, 203, 1, 203, 1, 203, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 205, 1, 205, 1, 205, 1, 205, 1, 205, 1, 205, 1, 206, 1, 206, 1, 206, 1, 206, 1, 207, 1, 207, 1, 207, 1, 207, 1, 208, 1, 208, 1, 208, 1, 208, 1, 209, 1, 209, 1, 209, 1, 209, 1, 209, 1, 209, 1, 210, 1, 210, 1, 210, 1, 210, 1, 210, 1, 210, 1, 211, 1, 211, 1, 211, 1, 211, 1, 211, 1, 211, 1, 212, 1, 212, 1, 212, 1, 212, 1, 212, 2, 683, 752, 0, 213, 16, 1, 18, 2, 20, 3, 22, 4, 24, 5, 26, 6, 28, 7, 30, 8, 32, 9, 34, 10, 36, 11, 38, 12, 40, 13, 42, 14, 44, 15, 46, 16, 48, 17, 50, 18, 52, 19, 54, 20, 56, 21, 58, 22, 60, 23, 62, 24, 64, 25, 66, 26, 68, 27, 70, 28, 72, 29, 74, 0, 76, 0, 78, 0, 80, 0, 82, 0, 84, 0, 86, 0, 88, 0, 90, 0, 92, 0, 94, 30, 96, 31, 98, 32, 100, 33, 102, 34, 104, 35, 106, 36, 108, 37, 110, 38, 112, 39, 114, 40, 116, 41, 118, 42, 120, 43, 122, 44, 124, 45, 126, 46, 128, 47, 130, 48, 132, 49, 134, 50, 136, 51, 138, 52, 140, 53, 142, 54, 144, 55, 146, 56, 148, 57, 150, 58, 152, 59, 154, 60, 156, 61, 158, 62, 160, 63, 162, 64, 164, 65, 166, 66, 168, 67, 170, 68, 172, 0, 174, 69, 176, 70, 178, 71, 180, 72, 182, 0, 184, 73, 186, 74, 188, 75, 190, 76, 192, 0, 194, 0, 196, 77, 198, 78, 200, 79, 202, 0, 204, 0, 206, 0, 208, 0, 210, 0, 212, 0, 214, 80, 216, 0, 218, 81, 220, 0, 222, 0, 224, 82, 226, 83, 228, 84, 230, 0, 232, 0, 234, 0, 236, 0, 238, 0, 240, 0, 242, 0, 244, 85, 246, 86, 248, 87, 250, 88, 252, 0, 254, 0, 256, 0, 258, 0, 260, 0, 262, 0, 264, 89, 266, 0, 268, 90, 270, 91, 272, 92, 274, 0, 276, 0, 278, 93, 280, 94, 282, 0, 284, 95, 286, 0, 288, 96, 290, 97, 292, 98, 294, 0, 296, 0, 298, 0, 300, 0, 302, 0, 304, 0, 306, 0, 308, 0, 310, 0, 312, 99, 314, 100, 316, 101, 318, 0, 320, 0, 322, 0, 324, 0, 326, 0, 328, 0, 330, 102, 332, 103, 334, 104, 336, 0, 338, 105, 340, 106, 342, 107, 344, 108, 346, 0, 348, 0, 350, 109, 352, 110, 354, 111, 356, 112, 358, 0, 360, 0, 362, 0, 364, 0, 366, 0, 368, 0, 370, 0, 372, 113, 374, 114, 376, 115, 378, 0, 380, 0, 382, 0, 384, 0, 386, 116, 388, 117, 390, 118, 392, 0, 394, 0, 396, 0, 398, 0, 400, 119, 402, 0, 404, 0, 406, 120, 408, 121, 410, 122, 412, 0, 414, 0, 416, 0, 418, 123, 420, 124, 422, 125, 424, 0, 426, 0, 428, 126, 430, 127, 432, 128, 434, 0, 436, 0, 438, 0, 440, 0, 16, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 36, 2, 0, 68, 68, 100, 100, 2, 0, 73, 73, 105, 105, 2, 0, 83, 83, 115, 115, 2, 0, 69, 69, 101, 101, 2, 0, 67, 67, 99, 99, 2, 0, 84, 84, 116, 116, 2, 0, 82, 82, 114, 114, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 78, 78, 110, 110, 2, 0, 72, 72, 104, 104, 2, 0, 86, 86, 118, 118, 2, 0, 65, 65, 97, 97, 2, 0, 76, 76, 108, 108, 2, 0, 88, 88, 120, 120, 2, 0, 70, 70, 102, 102, 2, 0, 77, 77, 109, 109, 2, 0, 71, 71, 103, 103, 2, 0, 75, 75, 107, 107, 2, 0, 87, 87, 119, 119, 2, 0, 85, 85, 117, 117, 2, 0, 74, 74, 106, 106, 6, 0, 9, 10, 13, 13, 32, 32, 47, 47, 91, 91, 93, 93, 2, 0, 10, 10, 13, 13, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 48, 57, 2, 0, 65, 90, 97, 122, 8, 0, 34, 34, 78, 78, 82, 82, 84, 84, 92, 92, 110, 110, 114, 114, 116, 116, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 2, 0, 43, 43, 45, 45, 1, 0, 96, 96, 2, 0, 66, 66, 98, 98, 2, 0, 89, 89, 121, 121, 11, 0, 9, 10, 13, 13, 32, 32, 34, 34, 44, 44, 47, 47, 58, 58, 61, 61, 91, 91, 93, 93, 124, 124, 2, 0, 42, 42, 47, 47, 11, 0, 9, 10, 13, 13, 32, 32, 34, 35, 44, 44, 47, 47, 58, 58, 60, 60, 62, 63, 92, 92, 124, 124, 1628, 0, 16, 1, 0, 0, 0, 0, 18, 1, 0, 0, 0, 0, 20, 1, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 26, 1, 0, 0, 0, 0, 28, 1, 0, 0, 0, 0, 30, 1, 0, 0, 0, 0, 32, 1, 0, 0, 0, 0, 34, 1, 0, 0, 0, 0, 36, 1, 0, 0, 0, 0, 38, 1, 0, 0, 0, 0, 40, 1, 0, 0, 0, 0, 42, 1, 0, 0, 0, 0, 44, 1, 0, 0, 0, 0, 46, 1, 0, 0, 0, 0, 48, 1, 0, 0, 0, 0, 50, 1, 0, 0, 0, 0, 52, 1, 0, 0, 0, 0, 54, 1, 0, 0, 0, 0, 56, 1, 0, 0, 0, 0, 58, 1, 0, 0, 0, 0, 60, 1, 0, 0, 0, 0, 62, 1, 0, 0, 0, 0, 64, 1, 0, 0, 0, 0, 66, 1, 0, 0, 0, 0, 68, 1, 0, 0, 0, 0, 70, 1, 0, 0, 0, 1, 72, 1, 0, 0, 0, 1, 94, 1, 0, 0, 0, 1, 96, 1, 0, 0, 0, 1, 98, 1, 0, 0, 0, 1, 100, 1, 0, 0, 0, 1, 102, 1, 0, 0, 0, 1, 104, 1, 0, 0, 0, 1, 106, 1, 0, 0, 0, 1, 108, 1, 0, 0, 0, 1, 110, 1, 0, 0, 0, 1, 112, 1, 0, 0, 0, 1, 114, 1, 0, 0, 0, 1, 116, 1, 0, 0, 0, 1, 118, 1, 0, 0, 0, 1, 120, 1, 0, 0, 0, 1, 122, 1, 0, 0, 0, 1, 124, 1, 0, 0, 0, 1, 126, 1, 0, 0, 0, 1, 128, 1, 0, 0, 0, 1, 130, 1, 0, 0, 0, 1, 132, 1, 0, 0, 0, 1, 134, 1, 0, 0, 0, 1, 136, 1, 0, 0, 0, 1, 138, 1, 0, 0, 0, 1, 140, 1, 0, 0, 0, 1, 142, 1, 0, 0, 0, 1, 144, 1, 0, 0, 0, 1, 146, 1, 0, 0, 0, 1, 148, 1, 0, 0, 0, 1, 150, 1, 0, 0, 0, 1, 152, 1, 0, 0, 0, 1, 154, 1, 0, 0, 0, 1, 156, 1, 0, 0, 0, 1, 158, 1, 0, 0, 0, 1, 160, 1, 0, 0, 0, 1, 162, 1, 0, 0, 0, 1, 164, 1, 0, 0, 0, 1, 166, 1, 0, 0, 0, 1, 168, 1, 0, 0, 0, 1, 170, 1, 0, 0, 0, 1, 172, 1, 0, 0, 0, 1, 174, 1, 0, 0, 0, 1, 176, 1, 0, 0, 0, 1, 178, 1, 0, 0, 0, 1, 180, 1, 0, 0, 0, 1, 184, 1, 0, 0, 0, 1, 186, 1, 0, 0, 0, 1, 188, 1, 0, 0, 0, 1, 190, 1, 0, 0, 0, 2, 192, 1, 0, 0, 0, 2, 194, 1, 0, 0, 0, 2, 196, 1, 0, 0, 0, 2, 198, 1, 0, 0, 0, 2, 200, 1, 0, 0, 0, 3, 202, 1, 0, 0, 0, 3, 204, 1, 0, 0, 0, 3, 206, 1, 0, 0, 0, 3, 208, 1, 0, 0, 0, 3, 210, 1, 0, 0, 0, 3, 212, 1, 0, 0, 0, 3, 214, 1, 0, 0, 0, 3, 218, 1, 0, 0, 0, 3, 220, 1, 0, 0, 0, 3, 222, 1, 0, 0, 0, 3, 224, 1, 0, 0, 0, 3, 226, 1, 0, 0, 0, 3, 228, 1, 0, 0, 0, 4, 230, 1, 0, 0, 0, 4, 232, 1, 0, 0, 0, 4, 234, 1, 0, 0, 0, 4, 236, 1, 0, 0, 0, 4, 238, 1, 0, 0, 0, 4, 244, 1, 0, 0, 0, 4, 246, 1, 0, 0, 0, 4, 248, 1, 0, 0, 0, 4, 250, 1, 0, 0, 0, 5, 252, 1, 0, 0, 0, 5, 254, 1, 0, 0, 0, 5, 256, 1, 0, 0, 0, 5, 258, 1, 0, 0, 0, 5, 260, 1, 0, 0, 0, 5, 262, 1, 0, 0, 0, 5, 264, 1, 0, 0, 0, 5, 266, 1, 0, 0, 0, 5, 268, 1, 0, 0, 0, 5, 270, 1, 0, 0, 0, 5, 272, 1, 0, 0, 0, 6, 274, 1, 0, 0, 0, 6, 276, 1, 0, 0, 0, 6, 278, 1, 0, 0, 0, 6, 280, 1, 0, 0, 0, 6, 284, 1, 0, 0, 0, 6, 286, 1, 0, 0, 0, 6, 288, 1, 0, 0, 0, 6, 290, 1, 0, 0, 0, 6, 292, 1, 0, 0, 0, 7, 294, 1, 0, 0, 0, 7, 296, 1, 0, 0, 0, 7, 298, 1, 0, 0, 0, 7, 300, 1, 0, 0, 0, 7, 302, 1, 0, 0, 0, 7, 304, 1, 0, 0, 0, 7, 306, 1, 0, 0, 0, 7, 308, 1, 0, 0, 0, 7, 310, 1, 0, 0, 0, 7, 312, 1, 0, 0, 0, 7, 314, 1, 0, 0, 0, 7, 316, 1, 0, 0, 0, 8, 318, 1, 0, 0, 0, 8, 320, 1, 0, 0, 0, 8, 322, 1, 0, 0, 0, 8, 324, 1, 0, 0, 0, 8, 326, 1, 0, 0, 0, 8, 328, 1, 0, 0, 0, 8, 330, 1, 0, 0, 0, 8, 332, 1, 0, 0, 0, 8, 334, 1, 0, 0, 0, 9, 336, 1, 0, 0, 0, 9, 338, 1, 0, 0, 0, 9, 340, 1, 0, 0, 0, 9, 342, 1, 0, 0, 0, 9, 344, 1, 0, 0, 0, 10, 346, 1, 0, 0, 0, 10, 348, 1, 0, 0, 0, 10, 350, 1, 0, 0, 0, 10, 352, 1, 0, 0, 0, 10, 354, 1, 0, 0, 0, 10, 356, 1, 0, 0, 0, 11, 358, 1, 0, 0, 0, 11, 360, 1, 0, 0, 0, 11, 362, 1, 0, 0, 0, 11, 364, 1, 0, 0, 0, 11, 366, 1, 0, 0, 0, 11, 368, 1, 0, 0, 0, 11, 370, 1, 0, 0, 0, 11, 372, 1, 0, 0, 0, 11, 374, 1, 0, 0, 0, 11, 376, 1, 0, 0, 0, 12, 378, 1, 0, 0, 0, 12, 380, 1, 0, 0, 0, 12, 382, 1, 0, 0, 0, 12, 384, 1, 0, 0, 0, 12, 386, 1, 0, 0, 0, 12, 388, 1, 0, 0, 0, 12, 390, 1, 0, 0, 0, 13, 392, 1, 0, 0, 0, 13, 394, 1, 0, 0, 0, 13, 396, 1, 0, 0, 0, 13, 398, 1, 0, 0, 0, 13, 400, 1, 0, 0, 0, 13, 402, 1, 0, 0, 0, 13, 404, 1, 0, 0, 0, 13, 406, 1, 0, 0, 0, 13, 408, 1, 0, 0, 0, 13, 410, 1, 0, 0, 0, 14, 412, 1, 0, 0, 0, 14, 414, 1, 0, 0, 0, 14, 416, 1, 0, 0, 0, 14, 418, 1, 0, 0, 0, 14, 420, 1, 0, 0, 0, 14, 422, 1, 0, 0, 0, 15, 424, 1, 0, 0, 0, 15, 426, 1, 0, 0, 0, 15, 428, 1, 0, 0, 0, 15, 430, 1, 0, 0, 0, 15, 432, 1, 0, 0, 0, 15, 434, 1, 0, 0, 0, 15, 436, 1, 0, 0, 0, 15, 438, 1, 0, 0, 0, 15, 440, 1, 0, 0, 0, 16, 442, 1, 0, 0, 0, 18, 452, 1, 0, 0, 0, 20, 459, 1, 0, 0, 0, 22, 468, 1, 0, 0, 0, 24, 475, 1, 0, 0, 0, 26, 485, 1, 0, 0, 0, 28, 492, 1, 0, 0, 0, 30, 499, 1, 0, 0, 0, 32, 506, 1, 0, 0, 0, 34, 514, 1, 0, 0, 0, 36, 526, 1, 0, 0, 0, 38, 535, 1, 0, 0, 0, 40, 541, 1, 0, 0, 0, 42, 548, 1, 0, 0, 0, 44, 555, 1, 0, 0, 0, 46, 563, 1, 0, 0, 0, 48, 571, 1, 0, 0, 0, 50, 586, 1, 0, 0, 0, 52, 598, 1, 0, 0, 0, 54, 609, 1, 0, 0, 0, 56, 617, 1, 0, 0, 0, 58, 625, 1, 0, 0, 0, 60, 633, 1, 0, 0, 0, 62, 642, 1, 0, 0, 0, 64, 653, 1, 0, 0, 0, 66, 659, 1, 0, 0, 0, 68, 676, 1, 0, 0, 0, 70, 692, 1, 0, 0, 0, 72, 698, 1, 0, 0, 0, 74, 702, 1, 0, 0, 0, 76, 704, 1, 0, 0, 0, 78, 706, 1, 0, 0, 0, 80, 709, 1, 0, 0, 0, 82, 711, 1, 0, 0, 0, 84, 720, 1, 0, 0, 0, 86, 722, 1, 0, 0, 0, 88, 727, 1, 0, 0, 0, 90, 729, 1, 0, 0, 0, 92, 734, 1, 0, 0, 0, 94, 765, 1, 0, 0, 0, 96, 768, 1, 0, 0, 0, 98, 814, 1, 0, 0, 0, 100, 816, 1, 0, 0, 0, 102, 819, 1, 0, 0, 0, 104, 823, 1, 0, 0, 0, 106, 827, 1, 0, 0, 0, 108, 829, 1, 0, 0, 0, 110, 832, 1, 0, 0, 0, 112, 834, 1, 0, 0, 0, 114, 836, 1, 0, 0, 0, 116, 841, 1, 0, 0, 0, 118, 843, 1, 0, 0, 0, 120, 849, 1, 0, 0, 0, 122, 855, 1, 0, 0, 0, 124, 858, 1, 0, 0, 0, 126, 861, 1, 0, 0, 0, 128, 866, 1, 0, 0, 0, 130, 871, 1, 0, 0, 0, 132, 873, 1, 0, 0, 0, 134, 877, 1, 0, 0, 0, 136, 882, 1, 0, 0, 0, 138, 888, 1, 0, 0, 0, 140, 891, 1, 0, 0, 0, 142, 893, 1, 0, 0, 0, 144, 899, 1, 0, 0, 0, 146, 901, 1, 0, 0, 0, 148, 906, 1, 0, 0, 0, 150, 909, 1, 0, 0, 0, 152, 912, 1, 0, 0, 0, 154, 915, 1, 0, 0, 0, 156, 917, 1, 0, 0, 0, 158, 920, 1, 0, 0, 0, 160, 922, 1, 0, 0, 0, 162, 925, 1, 0, 0, 0, 164, 927, 1, 0, 0, 0, 166, 929, 1, 0, 0, 0, 168, 931, 1, 0, 0, 0, 170, 933, 1, 0, 0, 0, 172, 935, 1, 0, 0, 0, 174, 956, 1, 0, 0, 0, 176, 958, 1, 0, 0, 0, 178, 963, 1, 0, 0, 0, 180, 984, 1, 0, 0, 0, 182, 986, 1, 0, 0, 0, 184, 994, 1, 0, 0, 0, 186, 996, 1, 0, 0, 0, 188, 1000, 1, 0, 0, 0, 190, 1004, 1, 0, 0, 0, 192, 1008, 1, 0, 0, 0, 194, 1013, 1, 0, 0, 0, 196, 1018, 1, 0, 0, 0, 198, 1022, 1, 0, 0, 0, 200, 1026, 1, 0, 0, 0, 202, 1030, 1, 0, 0, 0, 204, 1035, 1, 0, 0, 0, 206, 1039, 1, 0, 0, 0, 208, 1043, 1, 0, 0, 0, 210, 1047, 1, 0, 0, 0, 212, 1051, 1, 0, 0, 0, 214, 1055, 1, 0, 0, 0, 216, 1067, 1, 0, 0, 0, 218, 1070, 1, 0, 0, 0, 220, 1074, 1, 0, 0, 0, 222, 1078, 1, 0, 0, 0, 224, 1082, 1, 0, 0, 0, 226, 1086, 1, 0, 0, 0, 228, 1090, 1, 0, 0, 0, 230, 1094, 1, 0, 0, 0, 232, 1099, 1, 0, 0, 0, 234, 1103, 1, 0, 0, 0, 236, 1107, 1, 0, 0, 0, 238, 1112, 1, 0, 0, 0, 240, 1121, 1, 0, 0, 0, 242, 1142, 1, 0, 0, 0, 244, 1146, 1, 0, 0, 0, 246, 1150, 1, 0, 0, 0, 248, 1154, 1, 0, 0, 0, 250, 1158, 1, 0, 0, 0, 252, 1162, 1, 0, 0, 0, 254, 1167, 1, 0, 0, 0, 256, 1171, 1, 0, 0, 0, 258, 1175, 1, 0, 0, 0, 260, 1179, 1, 0, 0, 0, 262, 1184, 1, 0, 0, 0, 264, 1189, 1, 0, 0, 0, 266, 1192, 1, 0, 0, 0, 268, 1196, 1, 0, 0, 0, 270, 1200, 1, 0, 0, 0, 272, 1204, 1, 0, 0, 0, 274, 1208, 1, 0, 0, 0, 276, 1213, 1, 0, 0, 0, 278, 1218, 1, 0, 0, 0, 280, 1223, 1, 0, 0, 0, 282, 1230, 1, 0, 0, 0, 284, 1239, 1, 0, 0, 0, 286, 1246, 1, 0, 0, 0, 288, 1250, 1, 0, 0, 0, 290, 1254, 1, 0, 0, 0, 292, 1258, 1, 0, 0, 0, 294, 1262, 1, 0, 0, 0, 296, 1268, 1, 0, 0, 0, 298, 1272, 1, 0, 0, 0, 300, 1276, 1, 0, 0, 0, 302, 1280, 1, 0, 0, 0, 304, 1284, 1, 0, 0, 0, 306, 1288, 1, 0, 0, 0, 308, 1292, 1, 0, 0, 0, 310, 1297, 1, 0, 0, 0, 312, 1302, 1, 0, 0, 0, 314, 1306, 1, 0, 0, 0, 316, 1310, 1, 0, 0, 0, 318, 1314, 1, 0, 0, 0, 320, 1319, 1, 0, 0, 0, 322, 1323, 1, 0, 0, 0, 324, 1328, 1, 0, 0, 0, 326, 1333, 1, 0, 0, 0, 328, 1337, 1, 0, 0, 0, 330, 1341, 1, 0, 0, 0, 332, 1345, 1, 0, 0, 0, 334, 1349, 1, 0, 0, 0, 336, 1353, 1, 0, 0, 0, 338, 1358, 1, 0, 0, 0, 340, 1363, 1, 0, 0, 0, 342, 1367, 1, 0, 0, 0, 344, 1371, 1, 0, 0, 0, 346, 1375, 1, 0, 0, 0, 348, 1380, 1, 0, 0, 0, 350, 1389, 1, 0, 0, 0, 352, 1393, 1, 0, 0, 0, 354, 1397, 1, 0, 0, 0, 356, 1401, 1, 0, 0, 0, 358, 1405, 1, 0, 0, 0, 360, 1410, 1, 0, 0, 0, 362, 1414, 1, 0, 0, 0, 364, 1418, 1, 0, 0, 0, 366, 1422, 1, 0, 0, 0, 368, 1427, 1, 0, 0, 0, 370, 1431, 1, 0, 0, 0, 372, 1435, 1, 0, 0, 0, 374, 1439, 1, 0, 0, 0, 376, 1443, 1, 0, 0, 0, 378, 1447, 1, 0, 0, 0, 380, 1453, 1, 0, 0, 0, 382, 1457, 1, 0, 0, 0, 384, 1461, 1, 0, 0, 0, 386, 1465, 1, 0, 0, 0, 388, 1469, 1, 0, 0, 0, 390, 1473, 1, 0, 0, 0, 392, 1477, 1, 0, 0, 0, 394, 1482, 1, 0, 0, 0, 396, 1486, 1, 0, 0, 0, 398, 1490, 1, 0, 0, 0, 400, 1496, 1, 0, 0, 0, 402, 1505, 1, 0, 0, 0, 404, 1509, 1, 0, 0, 0, 406, 1513, 1, 0, 0, 0, 408, 1517, 1, 0, 0, 0, 410, 1521, 1, 0, 0, 0, 412, 1525, 1, 0, 0, 0, 414, 1530, 1, 0, 0, 0, 416, 1536, 1, 0, 0, 0, 418, 1542, 1, 0, 0, 0, 420, 1546, 1, 0, 0, 0, 422, 1550, 1, 0, 0, 0, 424, 1554, 1, 0, 0, 0, 426, 1560, 1, 0, 0, 0, 428, 1566, 1, 0, 0, 0, 430, 1570, 1, 0, 0, 0, 432, 1574, 1, 0, 0, 0, 434, 1578, 1, 0, 0, 0, 436, 1584, 1, 0, 0, 0, 438, 1590, 1, 0, 0, 0, 440, 1596, 1, 0, 0, 0, 442, 443, 7, 0, 0, 0, 443, 444, 7, 1, 0, 0, 444, 445, 7, 2, 0, 0, 445, 446, 7, 2, 0, 0, 446, 447, 7, 3, 0, 0, 447, 448, 7, 4, 0, 0, 448, 449, 7, 5, 0, 0, 449, 450, 1, 0, 0, 0, 450, 451, 6, 0, 0, 0, 451, 17, 1, 0, 0, 0, 452, 453, 7, 0, 0, 0, 453, 454, 7, 6, 0, 0, 454, 455, 7, 7, 0, 0, 455, 456, 7, 8, 0, 0, 456, 457, 1, 0, 0, 0, 457, 458, 6, 1, 1, 0, 458, 19, 1, 0, 0, 0, 459, 460, 7, 3, 0, 0, 460, 461, 7, 9, 0, 0, 461, 462, 7, 6, 0, 0, 462, 463, 7, 1, 0, 0, 463, 464, 7, 4, 0, 0, 464, 465, 7, 10, 0, 0, 465, 466, 1, 0, 0, 0, 466, 467, 6, 2, 2, 0, 467, 21, 1, 0, 0, 0, 468, 469, 7, 3, 0, 0, 469, 470, 7, 11, 0, 0, 470, 471, 7, 12, 0, 0, 471, 472, 7, 13, 0, 0, 472, 473, 1, 0, 0, 0, 473, 474, 6, 3, 0, 0, 474, 23, 1, 0, 0, 0, 475, 476, 7, 3, 0, 0, 476, 477, 7, 14, 0, 0, 477, 478, 7, 8, 0, 0, 478, 479, 7, 13, 0, 0, 479, 480, 7, 12, 0, 0, 480, 481, 7, 1, 0, 0, 481, 482, 7, 9, 0, 0, 482, 483, 1, 0, 0, 0, 483, 484, 6, 4, 3, 0, 484, 25, 1, 0, 0, 0, 485, 486, 7, 15, 0, 0, 486, 487, 7, 6, 0, 0, 487, 488, 7, 7, 0, 0, 488, 489, 7, 16, 0, 0, 489, 490, 1, 0, 0, 0, 490, 491, 6, 5, 4, 0, 491, 27, 1, 0, 0, 0, 492, 493, 7, 17, 0, 0, 493, 494, 7, 6, 0, 0, 494, 495, 7, 7, 0, 0, 495, 496, 7, 18, 0, 0, 496, 497, 1, 0, 0, 0, 497, 498, 6, 6, 0, 0, 498, 29, 1, 0, 0, 0, 499, 500, 7, 18, 0, 0, 500, 501, 7, 3, 0, 0, 501, 502, 7, 3, 0, 0, 502, 503, 7, 8, 0, 0, 503, 504, 1, 0, 0, 0, 504, 505, 6, 7, 1, 0, 505, 31, 1, 0, 0, 0, 506, 507, 7, 13, 0, 0, 507, 508, 7, 1, 0, 0, 508, 509, 7, 16, 0, 0, 509, 510, 7, 1, 0, 0, 510, 511, 7, 5, 0, 0, 511, 512, 1, 0, 0, 0, 512, 513, 6, 8, 0, 0, 513, 33, 1, 0, 0, 0, 514, 515, 7, 16, 0, 0, 515, 516, 7, 11, 0, 0, 516, 517, 5, 95, 0, 0, 517, 518, 7, 3, 0, 0, 518, 519, 7, 14, 0, 0, 519, 520, 7, 8, 0, 0, 520, 521, 7, 12, 0, 0, 521, 522, 7, 9, 0, 0, 522, 523, 7, 0, 0, 0, 523, 524, 1, 0, 0, 0, 524, 525, 6, 9, 5, 0, 525, 35, 1, 0, 0, 0, 526, 527, 7, 6, 0, 0, 527, 528, 7, 3, 0, 0, 528, 529, 7, 9, 0, 0, 529, 530, 7, 12, 0, 0, 530, 531, 7, 16, 0, 0, 531, 532, 7, 3, 0, 0, 532, 533, 1, 0, 0, 0, 533, 534, 6, 10, 6, 0, 534, 37, 1, 0, 0, 0, 535, 536, 7, 6, 0, 0, 536, 537, 7, 7, 0, 0, 537, 538, 7, 19, 0, 0, 538, 539, 1, 0, 0, 0, 539, 540, 6, 11, 0, 0, 540, 39, 1, 0, 0, 0, 541, 542, 7, 2, 0, 0, 542, 543, 7, 10, 0, 0, 543, 544, 7, 7, 0, 0, 544, 545, 7, 19, 0, 0, 545, 546, 1, 0, 0, 0, 546, 547, 6, 12, 7, 0, 547, 41, 1, 0, 0, 0, 548, 549, 7, 2, 0, 0, 549, 550, 7, 7, 0, 0, 550, 551, 7, 6, 0, 0, 551, 552, 7, 5, 0, 0, 552, 553, 1, 0, 0, 0, 553, 554, 6, 13, 0, 0, 554, 43, 1, 0, 0, 0, 555, 556, 7, 2, 0, 0, 556, 557, 7, 5, 0, 0, 557, 558, 7, 12, 0, 0, 558, 559, 7, 5, 0, 0, 559, 560, 7, 2, 0, 0, 560, 561, 1, 0, 0, 0, 561, 562, 6, 14, 0, 0, 562, 45, 1, 0, 0, 0, 563, 564, 7, 19, 0, 0, 564, 565, 7, 10, 0, 0, 565, 566, 7, 3, 0, 0, 566, 567, 7, 6, 0, 0, 567, 568, 7, 3, 0, 0, 568, 569, 1, 0, 0, 0, 569, 570, 6, 15, 0, 0, 570, 47, 1, 0, 0, 0, 571, 572, 4, 16, 0, 0, 572, 573, 7, 1, 0, 0, 573, 574, 7, 9, 0, 0, 574, 575, 7, 13, 0, 0, 575, 576, 7, 1, 0, 0, 576, 577, 7, 9, 0, 0, 577, 578, 7, 3, 0, 0, 578, 579, 7, 2, 0, 0, 579, 580, 7, 5, 0, 0, 580, 581, 7, 12, 0, 0, 581, 582, 7, 5, 0, 0, 582, 583, 7, 2, 0, 0, 583, 584, 1, 0, 0, 0, 584, 585, 6, 16, 0, 0, 585, 49, 1, 0, 0, 0, 586, 587, 4, 17, 1, 0, 587, 588, 7, 13, 0, 0, 588, 589, 7, 7, 0, 0, 589, 590, 7, 7, 0, 0, 590, 591, 7, 18, 0, 0, 591, 592, 7, 20, 0, 0, 592, 593, 7, 8, 0, 0, 593, 594, 5, 95, 0, 0, 594, 595, 5, 128020, 0, 0, 595, 596, 1, 0, 0, 0, 596, 597, 6, 17, 8, 0, 597, 51, 1, 0, 0, 0, 598, 599, 4, 18, 2, 0, 599, 600, 7, 16, 0, 0, 600, 601, 7, 3, 0, 0, 601, 602, 7, 5, 0, 0, 602, 603, 7, 6, 0, 0, 603, 604, 7, 1, 0, 0, 604, 605, 7, 4, 0, 0, 605, 606, 7, 2, 0, 0, 606, 607, 1, 0, 0, 0, 607, 608, 6, 18, 9, 0, 608, 53, 1, 0, 0, 0, 609, 610, 4, 19, 3, 0, 610, 611, 7, 21, 0, 0, 611, 612, 7, 7, 0, 0, 612, 613, 7, 1, 0, 0, 613, 614, 7, 9, 0, 0, 614, 615, 1, 0, 0, 0, 615, 616, 6, 19, 10, 0, 616, 55, 1, 0, 0, 0, 617, 618, 4, 20, 4, 0, 618, 619, 7, 15, 0, 0, 619, 620, 7, 20, 0, 0, 620, 621, 7, 13, 0, 0, 621, 622, 7, 13, 0, 0, 622, 623, 1, 0, 0, 0, 623, 624, 6, 20, 10, 0, 624, 57, 1, 0, 0, 0, 625, 626, 4, 21, 5, 0, 626, 627, 7, 13, 0, 0, 627, 628, 7, 3, 0, 0, 628, 629, 7, 15, 0, 0, 629, 630, 7, 5, 0, 0, 630, 631, 1, 0, 0, 0, 631, 632, 6, 21, 10, 0, 632, 59, 1, 0, 0, 0, 633, 634, 4, 22, 6, 0, 634, 635, 7, 6, 0, 0, 635, 636, 7, 1, 0, 0, 636, 637, 7, 17, 0, 0, 637, 638, 7, 10, 0, 0, 638, 639, 7, 5, 0, 0, 639, 640, 1, 0, 0, 0, 640, 641, 6, 22, 10, 0, 641, 61, 1, 0, 0, 0, 642, 643, 4, 23, 7, 0, 643, 644, 7, 13, 0, 0, 644, 645, 7, 7, 0, 0, 645, 646, 7, 7, 0, 0, 646, 647, 7, 18, 0, 0, 647, 648, 7, 20, 0, 0, 648, 649, 7, 8, 0, 0, 649, 650, 1, 0, 0, 0, 650, 651, 6, 23, 10, 0, 651, 63, 1, 0, 0, 0, 652, 654, 8, 22, 0, 0, 653, 652, 1, 0, 0, 0, 654, 655, 1, 0, 0, 0, 655, 653, 1, 0, 0, 0, 655, 656, 1, 0, 0, 0, 656, 657, 1, 0, 0, 0, 657, 658, 6, 24, 0, 0, 658, 65, 1, 0, 0, 0, 659, 660, 5, 47, 0, 0, 660, 661, 5, 47, 0, 0, 661, 665, 1, 0, 0, 0, 662, 664, 8, 23, 0, 0, 663, 662, 1, 0, 0, 0, 664, 667, 1, 0, 0, 0, 665, 663, 1, 0, 0, 0, 665, 666, 1, 0, 0, 0, 666, 669, 1, 0, 0, 0, 667, 665, 1, 0, 0, 0, 668, 670, 5, 13, 0, 0, 669, 668, 1, 0, 0, 0, 669, 670, 1, 0, 0, 0, 670, 672, 1, 0, 0, 0, 671, 673, 5, 10, 0, 0, 672, 671, 1, 0, 0, 0, 672, 673, 1, 0, 0, 0, 673, 674, 1, 0, 0, 0, 674, 675, 6, 25, 11, 0, 675, 67, 1, 0, 0, 0, 676, 677, 5, 47, 0, 0, 677, 678, 5, 42, 0, 0, 678, 683, 1, 0, 0, 0, 679, 682, 3, 68, 26, 0, 680, 682, 9, 0, 0, 0, 681, 679, 1, 0, 0, 0, 681, 680, 1, 0, 0, 0, 682, 685, 1, 0, 0, 0, 683, 684, 1, 0, 0, 0, 683, 681, 1, 0, 0, 0, 684, 686, 1, 0, 0, 0, 685, 683, 1, 0, 0, 0, 686, 687, 5, 42, 0, 0, 687, 688, 5, 47, 0, 0, 688, 689, 1, 0, 0, 0, 689, 690, 6, 26, 11, 0, 690, 69, 1, 0, 0, 0, 691, 693, 7, 24, 0, 0, 692, 691, 1, 0, 0, 0, 693, 694, 1, 0, 0, 0, 694, 692, 1, 0, 0, 0, 694, 695, 1, 0, 0, 0, 695, 696, 1, 0, 0, 0, 696, 697, 6, 27, 11, 0, 697, 71, 1, 0, 0, 0, 698, 699, 5, 124, 0, 0, 699, 700, 1, 0, 0, 0, 700, 701, 6, 28, 12, 0, 701, 73, 1, 0, 0, 0, 702, 703, 7, 25, 0, 0, 703, 75, 1, 0, 0, 0, 704, 705, 7, 26, 0, 0, 705, 77, 1, 0, 0, 0, 706, 707, 5, 92, 0, 0, 707, 708, 7, 27, 0, 0, 708, 79, 1, 0, 0, 0, 709, 710, 8, 28, 0, 0, 710, 81, 1, 0, 0, 0, 711, 713, 7, 3, 0, 0, 712, 714, 7, 29, 0, 0, 713, 712, 1, 0, 0, 0, 713, 714, 1, 0, 0, 0, 714, 716, 1, 0, 0, 0, 715, 717, 3, 74, 29, 0, 716, 715, 1, 0, 0, 0, 717, 718, 1, 0, 0, 0, 718, 716, 1, 0, 0, 0, 718, 719, 1, 0, 0, 0, 719, 83, 1, 0, 0, 0, 720, 721, 5, 64, 0, 0, 721, 85, 1, 0, 0, 0, 722, 723, 5, 96, 0, 0, 723, 87, 1, 0, 0, 0, 724, 728, 8, 30, 0, 0, 725, 726, 5, 96, 0, 0, 726, 728, 5, 96, 0, 0, 727, 724, 1, 0, 0, 0, 727, 725, 1, 0, 0, 0, 728, 89, 1, 0, 0, 0, 729, 730, 5, 95, 0, 0, 730, 91, 1, 0, 0, 0, 731, 735, 3, 76, 30, 0, 732, 735, 3, 74, 29, 0, 733, 735, 3, 90, 37, 0, 734, 731, 1, 0, 0, 0, 734, 732, 1, 0, 0, 0, 734, 733, 1, 0, 0, 0, 735, 93, 1, 0, 0, 0, 736, 741, 5, 34, 0, 0, 737, 740, 3, 78, 31, 0, 738, 740, 3, 80, 32, 0, 739, 737, 1, 0, 0, 0, 739, 738, 1, 0, 0, 0, 740, 743, 1, 0, 0, 0, 741, 739, 1, 0, 0, 0, 741, 742, 1, 0, 0, 0, 742, 744, 1, 0, 0, 0, 743, 741, 1, 0, 0, 0, 744, 766, 5, 34, 0, 0, 745, 746, 5, 34, 0, 0, 746, 747, 5, 34, 0, 0, 747, 748, 5, 34, 0, 0, 748, 752, 1, 0, 0, 0, 749, 751, 8, 23, 0, 0, 750, 749, 1, 0, 0, 0, 751, 754, 1, 0, 0, 0, 752, 753, 1, 0, 0, 0, 752, 750, 1, 0, 0, 0, 753, 755, 1, 0, 0, 0, 754, 752, 1, 0, 0, 0, 755, 756, 5, 34, 0, 0, 756, 757, 5, 34, 0, 0, 757, 758, 5, 34, 0, 0, 758, 760, 1, 0, 0, 0, 759, 761, 5, 34, 0, 0, 760, 759, 1, 0, 0, 0, 760, 761, 1, 0, 0, 0, 761, 763, 1, 0, 0, 0, 762, 764, 5, 34, 0, 0, 763, 762, 1, 0, 0, 0, 763, 764, 1, 0, 0, 0, 764, 766, 1, 0, 0, 0, 765, 736, 1, 0, 0, 0, 765, 745, 1, 0, 0, 0, 766, 95, 1, 0, 0, 0, 767, 769, 3, 74, 29, 0, 768, 767, 1, 0, 0, 0, 769, 770, 1, 0, 0, 0, 770, 768, 1, 0, 0, 0, 770, 771, 1, 0, 0, 0, 771, 97, 1, 0, 0, 0, 772, 774, 3, 74, 29, 0, 773, 772, 1, 0, 0, 0, 774, 775, 1, 0, 0, 0, 775, 773, 1, 0, 0, 0, 775, 776, 1, 0, 0, 0, 776, 777, 1, 0, 0, 0, 777, 781, 3, 116, 50, 0, 778, 780, 3, 74, 29, 0, 779, 778, 1, 0, 0, 0, 780, 783, 1, 0, 0, 0, 781, 779, 1, 0, 0, 0, 781, 782, 1, 0, 0, 0, 782, 815, 1, 0, 0, 0, 783, 781, 1, 0, 0, 0, 784, 786, 3, 116, 50, 0, 785, 787, 3, 74, 29, 0, 786, 785, 1, 0, 0, 0, 787, 788, 1, 0, 0, 0, 788, 786, 1, 0, 0, 0, 788, 789, 1, 0, 0, 0, 789, 815, 1, 0, 0, 0, 790, 792, 3, 74, 29, 0, 791, 790, 1, 0, 0, 0, 792, 793, 1, 0, 0, 0, 793, 791, 1, 0, 0, 0, 793, 794, 1, 0, 0, 0, 794, 802, 1, 0, 0, 0, 795, 799, 3, 116, 50, 0, 796, 798, 3, 74, 29, 0, 797, 796, 1, 0, 0, 0, 798, 801, 1, 0, 0, 0, 799, 797, 1, 0, 0, 0, 799, 800, 1, 0, 0, 0, 800, 803, 1, 0, 0, 0, 801, 799, 1, 0, 0, 0, 802, 795, 1, 0, 0, 0, 802, 803, 1, 0, 0, 0, 803, 804, 1, 0, 0, 0, 804, 805, 3, 82, 33, 0, 805, 815, 1, 0, 0, 0, 806, 808, 3, 116, 50, 0, 807, 809, 3, 74, 29, 0, 808, 807, 1, 0, 0, 0, 809, 810, 1, 0, 0, 0, 810, 808, 1, 0, 0, 0, 810, 811, 1, 0, 0, 0, 811, 812, 1, 0, 0, 0, 812, 813, 3, 82, 33, 0, 813, 815, 1, 0, 0, 0, 814, 773, 1, 0, 0, 0, 814, 784, 1, 0, 0, 0, 814, 791, 1, 0, 0, 0, 814, 806, 1, 0, 0, 0, 815, 99, 1, 0, 0, 0, 816, 817, 7, 31, 0, 0, 817, 818, 7, 32, 0, 0, 818, 101, 1, 0, 0, 0, 819, 820, 7, 12, 0, 0, 820, 821, 7, 9, 0, 0, 821, 822, 7, 0, 0, 0, 822, 103, 1, 0, 0, 0, 823, 824, 7, 12, 0, 0, 824, 825, 7, 2, 0, 0, 825, 826, 7, 4, 0, 0, 826, 105, 1, 0, 0, 0, 827, 828, 5, 61, 0, 0, 828, 107, 1, 0, 0, 0, 829, 830, 5, 58, 0, 0, 830, 831, 5, 58, 0, 0, 831, 109, 1, 0, 0, 0, 832, 833, 5, 58, 0, 0, 833, 111, 1, 0, 0, 0, 834, 835, 5, 44, 0, 0, 835, 113, 1, 0, 0, 0, 836, 837, 7, 0, 0, 0, 837, 838, 7, 3, 0, 0, 838, 839, 7, 2, 0, 0, 839, 840, 7, 4, 0, 0, 840, 115, 1, 0, 0, 0, 841, 842, 5, 46, 0, 0, 842, 117, 1, 0, 0, 0, 843, 844, 7, 15, 0, 0, 844, 845, 7, 12, 0, 0, 845, 846, 7, 13, 0, 0, 846, 847, 7, 2, 0, 0, 847, 848, 7, 3, 0, 0, 848, 119, 1, 0, 0, 0, 849, 850, 7, 15, 0, 0, 850, 851, 7, 1, 0, 0, 851, 852, 7, 6, 0, 0, 852, 853, 7, 2, 0, 0, 853, 854, 7, 5, 0, 0, 854, 121, 1, 0, 0, 0, 855, 856, 7, 1, 0, 0, 856, 857, 7, 9, 0, 0, 857, 123, 1, 0, 0, 0, 858, 859, 7, 1, 0, 0, 859, 860, 7, 2, 0, 0, 860, 125, 1, 0, 0, 0, 861, 862, 7, 13, 0, 0, 862, 863, 7, 12, 0, 0, 863, 864, 7, 2, 0, 0, 864, 865, 7, 5, 0, 0, 865, 127, 1, 0, 0, 0, 866, 867, 7, 13, 0, 0, 867, 868, 7, 1, 0, 0, 868, 869, 7, 18, 0, 0, 869, 870, 7, 3, 0, 0, 870, 129, 1, 0, 0, 0, 871, 872, 5, 40, 0, 0, 872, 131, 1, 0, 0, 0, 873, 874, 7, 9, 0, 0, 874, 875, 7, 7, 0, 0, 875, 876, 7, 5, 0, 0, 876, 133, 1, 0, 0, 0, 877, 878, 7, 9, 0, 0, 878, 879, 7, 20, 0, 0, 879, 880, 7, 13, 0, 0, 880, 881, 7, 13, 0, 0, 881, 135, 1, 0, 0, 0, 882, 883, 7, 9, 0, 0, 883, 884, 7, 20, 0, 0, 884, 885, 7, 13, 0, 0, 885, 886, 7, 13, 0, 0, 886, 887, 7, 2, 0, 0, 887, 137, 1, 0, 0, 0, 888, 889, 7, 7, 0, 0, 889, 890, 7, 6, 0, 0, 890, 139, 1, 0, 0, 0, 891, 892, 5, 63, 0, 0, 892, 141, 1, 0, 0, 0, 893, 894, 7, 6, 0, 0, 894, 895, 7, 13, 0, 0, 895, 896, 7, 1, 0, 0, 896, 897, 7, 18, 0, 0, 897, 898, 7, 3, 0, 0, 898, 143, 1, 0, 0, 0, 899, 900, 5, 41, 0, 0, 900, 145, 1, 0, 0, 0, 901, 902, 7, 5, 0, 0, 902, 903, 7, 6, 0, 0, 903, 904, 7, 20, 0, 0, 904, 905, 7, 3, 0, 0, 905, 147, 1, 0, 0, 0, 906, 907, 5, 61, 0, 0, 907, 908, 5, 61, 0, 0, 908, 149, 1, 0, 0, 0, 909, 910, 5, 61, 0, 0, 910, 911, 5, 126, 0, 0, 911, 151, 1, 0, 0, 0, 912, 913, 5, 33, 0, 0, 913, 914, 5, 61, 0, 0, 914, 153, 1, 0, 0, 0, 915, 916, 5, 60, 0, 0, 916, 155, 1, 0, 0, 0, 917, 918, 5, 60, 0, 0, 918, 919, 5, 61, 0, 0, 919, 157, 1, 0, 0, 0, 920, 921, 5, 62, 0, 0, 921, 159, 1, 0, 0, 0, 922, 923, 5, 62, 0, 0, 923, 924, 5, 61, 0, 0, 924, 161, 1, 0, 0, 0, 925, 926, 5, 43, 0, 0, 926, 163, 1, 0, 0, 0, 927, 928, 5, 45, 0, 0, 928, 165, 1, 0, 0, 0, 929, 930, 5, 42, 0, 0, 930, 167, 1, 0, 0, 0, 931, 932, 5, 47, 0, 0, 932, 169, 1, 0, 0, 0, 933, 934, 5, 37, 0, 0, 934, 171, 1, 0, 0, 0, 935, 936, 3, 46, 15, 0, 936, 937, 1, 0, 0, 0, 937, 938, 6, 78, 13, 0, 938, 173, 1, 0, 0, 0, 939, 942, 3, 140, 62, 0, 940, 943, 3, 76, 30, 0, 941, 943, 3, 90, 37, 0, 942, 940, 1, 0, 0, 0, 942, 941, 1, 0, 0, 0, 943, 947, 1, 0, 0, 0, 944, 946, 3, 92, 38, 0, 945, 944, 1, 0, 0, 0, 946, 949, 1, 0, 0, 0, 947, 945, 1, 0, 0, 0, 947, 948, 1, 0, 0, 0, 948, 957, 1, 0, 0, 0, 949, 947, 1, 0, 0, 0, 950, 952, 3, 140, 62, 0, 951, 953, 3, 74, 29, 0, 952, 951, 1, 0, 0, 0, 953, 954, 1, 0, 0, 0, 954, 952, 1, 0, 0, 0, 954, 955, 1, 0, 0, 0, 955, 957, 1, 0, 0, 0, 956, 939, 1, 0, 0, 0, 956, 950, 1, 0, 0, 0, 957, 175, 1, 0, 0, 0, 958, 959, 5, 91, 0, 0, 959, 960, 1, 0, 0, 0, 960, 961, 6, 80, 0, 0, 961, 962, 6, 80, 0, 0, 962, 177, 1, 0, 0, 0, 963, 964, 5, 93, 0, 0, 964, 965, 1, 0, 0, 0, 965, 966, 6, 81, 12, 0, 966, 967, 6, 81, 12, 0, 967, 179, 1, 0, 0, 0, 968, 972, 3, 76, 30, 0, 969, 971, 3, 92, 38, 0, 970, 969, 1, 0, 0, 0, 971, 974, 1, 0, 0, 0, 972, 970, 1, 0, 0, 0, 972, 973, 1, 0, 0, 0, 973, 985, 1, 0, 0, 0, 974, 972, 1, 0, 0, 0, 975, 978, 3, 90, 37, 0, 976, 978, 3, 84, 34, 0, 977, 975, 1, 0, 0, 0, 977, 976, 1, 0, 0, 0, 978, 980, 1, 0, 0, 0, 979, 981, 3, 92, 38, 0, 980, 979, 1, 0, 0, 0, 981, 982, 1, 0, 0, 0, 982, 980, 1, 0, 0, 0, 982, 983, 1, 0, 0, 0, 983, 985, 1, 0, 0, 0, 984, 968, 1, 0, 0, 0, 984, 977, 1, 0, 0, 0, 985, 181, 1, 0, 0, 0, 986, 988, 3, 86, 35, 0, 987, 989, 3, 88, 36, 0, 988, 987, 1, 0, 0, 0, 989, 990, 1, 0, 0, 0, 990, 988, 1, 0, 0, 0, 990, 991, 1, 0, 0, 0, 991, 992, 1, 0, 0, 0, 992, 993, 3, 86, 35, 0, 993, 183, 1, 0, 0, 0, 994, 995, 3, 182, 83, 0, 995, 185, 1, 0, 0, 0, 996, 997, 3, 66, 25, 0, 997, 998, 1, 0, 0, 0, 998, 999, 6, 85, 11, 0, 999, 187, 1, 0, 0, 0, 1000, 1001, 3, 68, 26, 0, 1001, 1002, 1, 0, 0, 0, 1002, 1003, 6, 86, 11, 0, 1003, 189, 1, 0, 0, 0, 1004, 1005, 3, 70, 27, 0, 1005, 1006, 1, 0, 0, 0, 1006, 1007, 6, 87, 11, 0, 1007, 191, 1, 0, 0, 0, 1008, 1009, 3, 176, 80, 0, 1009, 1010, 1, 0, 0, 0, 1010, 1011, 6, 88, 14, 0, 1011, 1012, 6, 88, 15, 0, 1012, 193, 1, 0, 0, 0, 1013, 1014, 3, 72, 28, 0, 1014, 1015, 1, 0, 0, 0, 1015, 1016, 6, 89, 16, 0, 1016, 1017, 6, 89, 12, 0, 1017, 195, 1, 0, 0, 0, 1018, 1019, 3, 70, 27, 0, 1019, 1020, 1, 0, 0, 0, 1020, 1021, 6, 90, 11, 0, 1021, 197, 1, 0, 0, 0, 1022, 1023, 3, 66, 25, 0, 1023, 1024, 1, 0, 0, 0, 1024, 1025, 6, 91, 11, 0, 1025, 199, 1, 0, 0, 0, 1026, 1027, 3, 68, 26, 0, 1027, 1028, 1, 0, 0, 0, 1028, 1029, 6, 92, 11, 0, 1029, 201, 1, 0, 0, 0, 1030, 1031, 3, 72, 28, 0, 1031, 1032, 1, 0, 0, 0, 1032, 1033, 6, 93, 16, 0, 1033, 1034, 6, 93, 12, 0, 1034, 203, 1, 0, 0, 0, 1035, 1036, 3, 176, 80, 0, 1036, 1037, 1, 0, 0, 0, 1037, 1038, 6, 94, 14, 0, 1038, 205, 1, 0, 0, 0, 1039, 1040, 3, 178, 81, 0, 1040, 1041, 1, 0, 0, 0, 1041, 1042, 6, 95, 17, 0, 1042, 207, 1, 0, 0, 0, 1043, 1044, 3, 110, 47, 0, 1044, 1045, 1, 0, 0, 0, 1045, 1046, 6, 96, 18, 0, 1046, 209, 1, 0, 0, 0, 1047, 1048, 3, 112, 48, 0, 1048, 1049, 1, 0, 0, 0, 1049, 1050, 6, 97, 19, 0, 1050, 211, 1, 0, 0, 0, 1051, 1052, 3, 106, 45, 0, 1052, 1053, 1, 0, 0, 0, 1053, 1054, 6, 98, 20, 0, 1054, 213, 1, 0, 0, 0, 1055, 1056, 7, 16, 0, 0, 1056, 1057, 7, 3, 0, 0, 1057, 1058, 7, 5, 0, 0, 1058, 1059, 7, 12, 0, 0, 1059, 1060, 7, 0, 0, 0, 1060, 1061, 7, 12, 0, 0, 1061, 1062, 7, 5, 0, 0, 1062, 1063, 7, 12, 0, 0, 1063, 215, 1, 0, 0, 0, 1064, 1068, 8, 33, 0, 0, 1065, 1066, 5, 47, 0, 0, 1066, 1068, 8, 34, 0, 0, 1067, 1064, 1, 0, 0, 0, 1067, 1065, 1, 0, 0, 0, 1068, 217, 1, 0, 0, 0, 1069, 1071, 3, 216, 100, 0, 1070, 1069, 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1070, 1, 0, 0, 0, 1072, 1073, 1, 0, 0, 0, 1073, 219, 1, 0, 0, 0, 1074, 1075, 3, 218, 101, 0, 1075, 1076, 1, 0, 0, 0, 1076, 1077, 6, 102, 21, 0, 1077, 221, 1, 0, 0, 0, 1078, 1079, 3, 94, 39, 0, 1079, 1080, 1, 0, 0, 0, 1080, 1081, 6, 103, 22, 0, 1081, 223, 1, 0, 0, 0, 1082, 1083, 3, 66, 25, 0, 1083, 1084, 1, 0, 0, 0, 1084, 1085, 6, 104, 11, 0, 1085, 225, 1, 0, 0, 0, 1086, 1087, 3, 68, 26, 0, 1087, 1088, 1, 0, 0, 0, 1088, 1089, 6, 105, 11, 0, 1089, 227, 1, 0, 0, 0, 1090, 1091, 3, 70, 27, 0, 1091, 1092, 1, 0, 0, 0, 1092, 1093, 6, 106, 11, 0, 1093, 229, 1, 0, 0, 0, 1094, 1095, 3, 72, 28, 0, 1095, 1096, 1, 0, 0, 0, 1096, 1097, 6, 107, 16, 0, 1097, 1098, 6, 107, 12, 0, 1098, 231, 1, 0, 0, 0, 1099, 1100, 3, 116, 50, 0, 1100, 1101, 1, 0, 0, 0, 1101, 1102, 6, 108, 23, 0, 1102, 233, 1, 0, 0, 0, 1103, 1104, 3, 112, 48, 0, 1104, 1105, 1, 0, 0, 0, 1105, 1106, 6, 109, 19, 0, 1106, 235, 1, 0, 0, 0, 1107, 1108, 4, 110, 8, 0, 1108, 1109, 3, 140, 62, 0, 1109, 1110, 1, 0, 0, 0, 1110, 1111, 6, 110, 24, 0, 1111, 237, 1, 0, 0, 0, 1112, 1113, 4, 111, 9, 0, 1113, 1114, 3, 174, 79, 0, 1114, 1115, 1, 0, 0, 0, 1115, 1116, 6, 111, 25, 0, 1116, 239, 1, 0, 0, 0, 1117, 1122, 3, 76, 30, 0, 1118, 1122, 3, 74, 29, 0, 1119, 1122, 3, 90, 37, 0, 1120, 1122, 3, 166, 75, 0, 1121, 1117, 1, 0, 0, 0, 1121, 1118, 1, 0, 0, 0, 1121, 1119, 1, 0, 0, 0, 1121, 1120, 1, 0, 0, 0, 1122, 241, 1, 0, 0, 0, 1123, 1126, 3, 76, 30, 0, 1124, 1126, 3, 166, 75, 0, 1125, 1123, 1, 0, 0, 0, 1125, 1124, 1, 0, 0, 0, 1126, 1130, 1, 0, 0, 0, 1127, 1129, 3, 240, 112, 0, 1128, 1127, 1, 0, 0, 0, 1129, 1132, 1, 0, 0, 0, 1130, 1128, 1, 0, 0, 0, 1130, 1131, 1, 0, 0, 0, 1131, 1143, 1, 0, 0, 0, 1132, 1130, 1, 0, 0, 0, 1133, 1136, 3, 90, 37, 0, 1134, 1136, 3, 84, 34, 0, 1135, 1133, 1, 0, 0, 0, 1135, 1134, 1, 0, 0, 0, 1136, 1138, 1, 0, 0, 0, 1137, 1139, 3, 240, 112, 0, 1138, 1137, 1, 0, 0, 0, 1139, 1140, 1, 0, 0, 0, 1140, 1138, 1, 0, 0, 0, 1140, 1141, 1, 0, 0, 0, 1141, 1143, 1, 0, 0, 0, 1142, 1125, 1, 0, 0, 0, 1142, 1135, 1, 0, 0, 0, 1143, 243, 1, 0, 0, 0, 1144, 1147, 3, 242, 113, 0, 1145, 1147, 3, 182, 83, 0, 1146, 1144, 1, 0, 0, 0, 1146, 1145, 1, 0, 0, 0, 1147, 1148, 1, 0, 0, 0, 1148, 1146, 1, 0, 0, 0, 1148, 1149, 1, 0, 0, 0, 1149, 245, 1, 0, 0, 0, 1150, 1151, 3, 66, 25, 0, 1151, 1152, 1, 0, 0, 0, 1152, 1153, 6, 115, 11, 0, 1153, 247, 1, 0, 0, 0, 1154, 1155, 3, 68, 26, 0, 1155, 1156, 1, 0, 0, 0, 1156, 1157, 6, 116, 11, 0, 1157, 249, 1, 0, 0, 0, 1158, 1159, 3, 70, 27, 0, 1159, 1160, 1, 0, 0, 0, 1160, 1161, 6, 117, 11, 0, 1161, 251, 1, 0, 0, 0, 1162, 1163, 3, 72, 28, 0, 1163, 1164, 1, 0, 0, 0, 1164, 1165, 6, 118, 16, 0, 1165, 1166, 6, 118, 12, 0, 1166, 253, 1, 0, 0, 0, 1167, 1168, 3, 106, 45, 0, 1168, 1169, 1, 0, 0, 0, 1169, 1170, 6, 119, 20, 0, 1170, 255, 1, 0, 0, 0, 1171, 1172, 3, 112, 48, 0, 1172, 1173, 1, 0, 0, 0, 1173, 1174, 6, 120, 19, 0, 1174, 257, 1, 0, 0, 0, 1175, 1176, 3, 116, 50, 0, 1176, 1177, 1, 0, 0, 0, 1177, 1178, 6, 121, 23, 0, 1178, 259, 1, 0, 0, 0, 1179, 1180, 4, 122, 10, 0, 1180, 1181, 3, 140, 62, 0, 1181, 1182, 1, 0, 0, 0, 1182, 1183, 6, 122, 24, 0, 1183, 261, 1, 0, 0, 0, 1184, 1185, 4, 123, 11, 0, 1185, 1186, 3, 174, 79, 0, 1186, 1187, 1, 0, 0, 0, 1187, 1188, 6, 123, 25, 0, 1188, 263, 1, 0, 0, 0, 1189, 1190, 7, 12, 0, 0, 1190, 1191, 7, 2, 0, 0, 1191, 265, 1, 0, 0, 0, 1192, 1193, 3, 244, 114, 0, 1193, 1194, 1, 0, 0, 0, 1194, 1195, 6, 125, 26, 0, 1195, 267, 1, 0, 0, 0, 1196, 1197, 3, 66, 25, 0, 1197, 1198, 1, 0, 0, 0, 1198, 1199, 6, 126, 11, 0, 1199, 269, 1, 0, 0, 0, 1200, 1201, 3, 68, 26, 0, 1201, 1202, 1, 0, 0, 0, 1202, 1203, 6, 127, 11, 0, 1203, 271, 1, 0, 0, 0, 1204, 1205, 3, 70, 27, 0, 1205, 1206, 1, 0, 0, 0, 1206, 1207, 6, 128, 11, 0, 1207, 273, 1, 0, 0, 0, 1208, 1209, 3, 72, 28, 0, 1209, 1210, 1, 0, 0, 0, 1210, 1211, 6, 129, 16, 0, 1211, 1212, 6, 129, 12, 0, 1212, 275, 1, 0, 0, 0, 1213, 1214, 3, 176, 80, 0, 1214, 1215, 1, 0, 0, 0, 1215, 1216, 6, 130, 14, 0, 1216, 1217, 6, 130, 27, 0, 1217, 277, 1, 0, 0, 0, 1218, 1219, 7, 7, 0, 0, 1219, 1220, 7, 9, 0, 0, 1220, 1221, 1, 0, 0, 0, 1221, 1222, 6, 131, 28, 0, 1222, 279, 1, 0, 0, 0, 1223, 1224, 7, 19, 0, 0, 1224, 1225, 7, 1, 0, 0, 1225, 1226, 7, 5, 0, 0, 1226, 1227, 7, 10, 0, 0, 1227, 1228, 1, 0, 0, 0, 1228, 1229, 6, 132, 28, 0, 1229, 281, 1, 0, 0, 0, 1230, 1231, 8, 35, 0, 0, 1231, 283, 1, 0, 0, 0, 1232, 1234, 3, 282, 133, 0, 1233, 1232, 1, 0, 0, 0, 1234, 1235, 1, 0, 0, 0, 1235, 1233, 1, 0, 0, 0, 1235, 1236, 1, 0, 0, 0, 1236, 1237, 1, 0, 0, 0, 1237, 1238, 3, 110, 47, 0, 1238, 1240, 1, 0, 0, 0, 1239, 1233, 1, 0, 0, 0, 1239, 1240, 1, 0, 0, 0, 1240, 1242, 1, 0, 0, 0, 1241, 1243, 3, 282, 133, 0, 1242, 1241, 1, 0, 0, 0, 1243, 1244, 1, 0, 0, 0, 1244, 1242, 1, 0, 0, 0, 1244, 1245, 1, 0, 0, 0, 1245, 285, 1, 0, 0, 0, 1246, 1247, 3, 284, 134, 0, 1247, 1248, 1, 0, 0, 0, 1248, 1249, 6, 135, 29, 0, 1249, 287, 1, 0, 0, 0, 1250, 1251, 3, 66, 25, 0, 1251, 1252, 1, 0, 0, 0, 1252, 1253, 6, 136, 11, 0, 1253, 289, 1, 0, 0, 0, 1254, 1255, 3, 68, 26, 0, 1255, 1256, 1, 0, 0, 0, 1256, 1257, 6, 137, 11, 0, 1257, 291, 1, 0, 0, 0, 1258, 1259, 3, 70, 27, 0, 1259, 1260, 1, 0, 0, 0, 1260, 1261, 6, 138, 11, 0, 1261, 293, 1, 0, 0, 0, 1262, 1263, 3, 72, 28, 0, 1263, 1264, 1, 0, 0, 0, 1264, 1265, 6, 139, 16, 0, 1265, 1266, 6, 139, 12, 0, 1266, 1267, 6, 139, 12, 0, 1267, 295, 1, 0, 0, 0, 1268, 1269, 3, 106, 45, 0, 1269, 1270, 1, 0, 0, 0, 1270, 1271, 6, 140, 20, 0, 1271, 297, 1, 0, 0, 0, 1272, 1273, 3, 112, 48, 0, 1273, 1274, 1, 0, 0, 0, 1274, 1275, 6, 141, 19, 0, 1275, 299, 1, 0, 0, 0, 1276, 1277, 3, 116, 50, 0, 1277, 1278, 1, 0, 0, 0, 1278, 1279, 6, 142, 23, 0, 1279, 301, 1, 0, 0, 0, 1280, 1281, 3, 280, 132, 0, 1281, 1282, 1, 0, 0, 0, 1282, 1283, 6, 143, 30, 0, 1283, 303, 1, 0, 0, 0, 1284, 1285, 3, 244, 114, 0, 1285, 1286, 1, 0, 0, 0, 1286, 1287, 6, 144, 26, 0, 1287, 305, 1, 0, 0, 0, 1288, 1289, 3, 184, 84, 0, 1289, 1290, 1, 0, 0, 0, 1290, 1291, 6, 145, 31, 0, 1291, 307, 1, 0, 0, 0, 1292, 1293, 4, 146, 12, 0, 1293, 1294, 3, 140, 62, 0, 1294, 1295, 1, 0, 0, 0, 1295, 1296, 6, 146, 24, 0, 1296, 309, 1, 0, 0, 0, 1297, 1298, 4, 147, 13, 0, 1298, 1299, 3, 174, 79, 0, 1299, 1300, 1, 0, 0, 0, 1300, 1301, 6, 147, 25, 0, 1301, 311, 1, 0, 0, 0, 1302, 1303, 3, 66, 25, 0, 1303, 1304, 1, 0, 0, 0, 1304, 1305, 6, 148, 11, 0, 1305, 313, 1, 0, 0, 0, 1306, 1307, 3, 68, 26, 0, 1307, 1308, 1, 0, 0, 0, 1308, 1309, 6, 149, 11, 0, 1309, 315, 1, 0, 0, 0, 1310, 1311, 3, 70, 27, 0, 1311, 1312, 1, 0, 0, 0, 1312, 1313, 6, 150, 11, 0, 1313, 317, 1, 0, 0, 0, 1314, 1315, 3, 72, 28, 0, 1315, 1316, 1, 0, 0, 0, 1316, 1317, 6, 151, 16, 0, 1317, 1318, 6, 151, 12, 0, 1318, 319, 1, 0, 0, 0, 1319, 1320, 3, 116, 50, 0, 1320, 1321, 1, 0, 0, 0, 1321, 1322, 6, 152, 23, 0, 1322, 321, 1, 0, 0, 0, 1323, 1324, 4, 153, 14, 0, 1324, 1325, 3, 140, 62, 0, 1325, 1326, 1, 0, 0, 0, 1326, 1327, 6, 153, 24, 0, 1327, 323, 1, 0, 0, 0, 1328, 1329, 4, 154, 15, 0, 1329, 1330, 3, 174, 79, 0, 1330, 1331, 1, 0, 0, 0, 1331, 1332, 6, 154, 25, 0, 1332, 325, 1, 0, 0, 0, 1333, 1334, 3, 184, 84, 0, 1334, 1335, 1, 0, 0, 0, 1335, 1336, 6, 155, 31, 0, 1336, 327, 1, 0, 0, 0, 1337, 1338, 3, 180, 82, 0, 1338, 1339, 1, 0, 0, 0, 1339, 1340, 6, 156, 32, 0, 1340, 329, 1, 0, 0, 0, 1341, 1342, 3, 66, 25, 0, 1342, 1343, 1, 0, 0, 0, 1343, 1344, 6, 157, 11, 0, 1344, 331, 1, 0, 0, 0, 1345, 1346, 3, 68, 26, 0, 1346, 1347, 1, 0, 0, 0, 1347, 1348, 6, 158, 11, 0, 1348, 333, 1, 0, 0, 0, 1349, 1350, 3, 70, 27, 0, 1350, 1351, 1, 0, 0, 0, 1351, 1352, 6, 159, 11, 0, 1352, 335, 1, 0, 0, 0, 1353, 1354, 3, 72, 28, 0, 1354, 1355, 1, 0, 0, 0, 1355, 1356, 6, 160, 16, 0, 1356, 1357, 6, 160, 12, 0, 1357, 337, 1, 0, 0, 0, 1358, 1359, 7, 1, 0, 0, 1359, 1360, 7, 9, 0, 0, 1360, 1361, 7, 15, 0, 0, 1361, 1362, 7, 7, 0, 0, 1362, 339, 1, 0, 0, 0, 1363, 1364, 3, 66, 25, 0, 1364, 1365, 1, 0, 0, 0, 1365, 1366, 6, 162, 11, 0, 1366, 341, 1, 0, 0, 0, 1367, 1368, 3, 68, 26, 0, 1368, 1369, 1, 0, 0, 0, 1369, 1370, 6, 163, 11, 0, 1370, 343, 1, 0, 0, 0, 1371, 1372, 3, 70, 27, 0, 1372, 1373, 1, 0, 0, 0, 1373, 1374, 6, 164, 11, 0, 1374, 345, 1, 0, 0, 0, 1375, 1376, 3, 178, 81, 0, 1376, 1377, 1, 0, 0, 0, 1377, 1378, 6, 165, 17, 0, 1378, 1379, 6, 165, 12, 0, 1379, 347, 1, 0, 0, 0, 1380, 1381, 3, 110, 47, 0, 1381, 1382, 1, 0, 0, 0, 1382, 1383, 6, 166, 18, 0, 1383, 349, 1, 0, 0, 0, 1384, 1390, 3, 84, 34, 0, 1385, 1390, 3, 74, 29, 0, 1386, 1390, 3, 116, 50, 0, 1387, 1390, 3, 76, 30, 0, 1388, 1390, 3, 90, 37, 0, 1389, 1384, 1, 0, 0, 0, 1389, 1385, 1, 0, 0, 0, 1389, 1386, 1, 0, 0, 0, 1389, 1387, 1, 0, 0, 0, 1389, 1388, 1, 0, 0, 0, 1390, 1391, 1, 0, 0, 0, 1391, 1389, 1, 0, 0, 0, 1391, 1392, 1, 0, 0, 0, 1392, 351, 1, 0, 0, 0, 1393, 1394, 3, 66, 25, 0, 1394, 1395, 1, 0, 0, 0, 1395, 1396, 6, 168, 11, 0, 1396, 353, 1, 0, 0, 0, 1397, 1398, 3, 68, 26, 0, 1398, 1399, 1, 0, 0, 0, 1399, 1400, 6, 169, 11, 0, 1400, 355, 1, 0, 0, 0, 1401, 1402, 3, 70, 27, 0, 1402, 1403, 1, 0, 0, 0, 1403, 1404, 6, 170, 11, 0, 1404, 357, 1, 0, 0, 0, 1405, 1406, 3, 72, 28, 0, 1406, 1407, 1, 0, 0, 0, 1407, 1408, 6, 171, 16, 0, 1408, 1409, 6, 171, 12, 0, 1409, 359, 1, 0, 0, 0, 1410, 1411, 3, 110, 47, 0, 1411, 1412, 1, 0, 0, 0, 1412, 1413, 6, 172, 18, 0, 1413, 361, 1, 0, 0, 0, 1414, 1415, 3, 112, 48, 0, 1415, 1416, 1, 0, 0, 0, 1416, 1417, 6, 173, 19, 0, 1417, 363, 1, 0, 0, 0, 1418, 1419, 3, 116, 50, 0, 1419, 1420, 1, 0, 0, 0, 1420, 1421, 6, 174, 23, 0, 1421, 365, 1, 0, 0, 0, 1422, 1423, 3, 278, 131, 0, 1423, 1424, 1, 0, 0, 0, 1424, 1425, 6, 175, 33, 0, 1425, 1426, 6, 175, 34, 0, 1426, 367, 1, 0, 0, 0, 1427, 1428, 3, 218, 101, 0, 1428, 1429, 1, 0, 0, 0, 1429, 1430, 6, 176, 21, 0, 1430, 369, 1, 0, 0, 0, 1431, 1432, 3, 94, 39, 0, 1432, 1433, 1, 0, 0, 0, 1433, 1434, 6, 177, 22, 0, 1434, 371, 1, 0, 0, 0, 1435, 1436, 3, 66, 25, 0, 1436, 1437, 1, 0, 0, 0, 1437, 1438, 6, 178, 11, 0, 1438, 373, 1, 0, 0, 0, 1439, 1440, 3, 68, 26, 0, 1440, 1441, 1, 0, 0, 0, 1441, 1442, 6, 179, 11, 0, 1442, 375, 1, 0, 0, 0, 1443, 1444, 3, 70, 27, 0, 1444, 1445, 1, 0, 0, 0, 1445, 1446, 6, 180, 11, 0, 1446, 377, 1, 0, 0, 0, 1447, 1448, 3, 72, 28, 0, 1448, 1449, 1, 0, 0, 0, 1449, 1450, 6, 181, 16, 0, 1450, 1451, 6, 181, 12, 0, 1451, 1452, 6, 181, 12, 0, 1452, 379, 1, 0, 0, 0, 1453, 1454, 3, 112, 48, 0, 1454, 1455, 1, 0, 0, 0, 1455, 1456, 6, 182, 19, 0, 1456, 381, 1, 0, 0, 0, 1457, 1458, 3, 116, 50, 0, 1458, 1459, 1, 0, 0, 0, 1459, 1460, 6, 183, 23, 0, 1460, 383, 1, 0, 0, 0, 1461, 1462, 3, 244, 114, 0, 1462, 1463, 1, 0, 0, 0, 1463, 1464, 6, 184, 26, 0, 1464, 385, 1, 0, 0, 0, 1465, 1466, 3, 66, 25, 0, 1466, 1467, 1, 0, 0, 0, 1467, 1468, 6, 185, 11, 0, 1468, 387, 1, 0, 0, 0, 1469, 1470, 3, 68, 26, 0, 1470, 1471, 1, 0, 0, 0, 1471, 1472, 6, 186, 11, 0, 1472, 389, 1, 0, 0, 0, 1473, 1474, 3, 70, 27, 0, 1474, 1475, 1, 0, 0, 0, 1475, 1476, 6, 187, 11, 0, 1476, 391, 1, 0, 0, 0, 1477, 1478, 3, 72, 28, 0, 1478, 1479, 1, 0, 0, 0, 1479, 1480, 6, 188, 16, 0, 1480, 1481, 6, 188, 12, 0, 1481, 393, 1, 0, 0, 0, 1482, 1483, 3, 54, 19, 0, 1483, 1484, 1, 0, 0, 0, 1484, 1485, 6, 189, 35, 0, 1485, 395, 1, 0, 0, 0, 1486, 1487, 3, 264, 124, 0, 1487, 1488, 1, 0, 0, 0, 1488, 1489, 6, 190, 36, 0, 1489, 397, 1, 0, 0, 0, 1490, 1491, 3, 278, 131, 0, 1491, 1492, 1, 0, 0, 0, 1492, 1493, 6, 191, 33, 0, 1493, 1494, 6, 191, 12, 0, 1494, 1495, 6, 191, 0, 0, 1495, 399, 1, 0, 0, 0, 1496, 1497, 7, 20, 0, 0, 1497, 1498, 7, 2, 0, 0, 1498, 1499, 7, 1, 0, 0, 1499, 1500, 7, 9, 0, 0, 1500, 1501, 7, 17, 0, 0, 1501, 1502, 1, 0, 0, 0, 1502, 1503, 6, 192, 12, 0, 1503, 1504, 6, 192, 0, 0, 1504, 401, 1, 0, 0, 0, 1505, 1506, 3, 180, 82, 0, 1506, 1507, 1, 0, 0, 0, 1507, 1508, 6, 193, 32, 0, 1508, 403, 1, 0, 0, 0, 1509, 1510, 3, 184, 84, 0, 1510, 1511, 1, 0, 0, 0, 1511, 1512, 6, 194, 31, 0, 1512, 405, 1, 0, 0, 0, 1513, 1514, 3, 66, 25, 0, 1514, 1515, 1, 0, 0, 0, 1515, 1516, 6, 195, 11, 0, 1516, 407, 1, 0, 0, 0, 1517, 1518, 3, 68, 26, 0, 1518, 1519, 1, 0, 0, 0, 1519, 1520, 6, 196, 11, 0, 1520, 409, 1, 0, 0, 0, 1521, 1522, 3, 70, 27, 0, 1522, 1523, 1, 0, 0, 0, 1523, 1524, 6, 197, 11, 0, 1524, 411, 1, 0, 0, 0, 1525, 1526, 3, 72, 28, 0, 1526, 1527, 1, 0, 0, 0, 1527, 1528, 6, 198, 16, 0, 1528, 1529, 6, 198, 12, 0, 1529, 413, 1, 0, 0, 0, 1530, 1531, 3, 218, 101, 0, 1531, 1532, 1, 0, 0, 0, 1532, 1533, 6, 199, 21, 0, 1533, 1534, 6, 199, 12, 0, 1534, 1535, 6, 199, 37, 0, 1535, 415, 1, 0, 0, 0, 1536, 1537, 3, 94, 39, 0, 1537, 1538, 1, 0, 0, 0, 1538, 1539, 6, 200, 22, 0, 1539, 1540, 6, 200, 12, 0, 1540, 1541, 6, 200, 37, 0, 1541, 417, 1, 0, 0, 0, 1542, 1543, 3, 66, 25, 0, 1543, 1544, 1, 0, 0, 0, 1544, 1545, 6, 201, 11, 0, 1545, 419, 1, 0, 0, 0, 1546, 1547, 3, 68, 26, 0, 1547, 1548, 1, 0, 0, 0, 1548, 1549, 6, 202, 11, 0, 1549, 421, 1, 0, 0, 0, 1550, 1551, 3, 70, 27, 0, 1551, 1552, 1, 0, 0, 0, 1552, 1553, 6, 203, 11, 0, 1553, 423, 1, 0, 0, 0, 1554, 1555, 3, 110, 47, 0, 1555, 1556, 1, 0, 0, 0, 1556, 1557, 6, 204, 18, 0, 1557, 1558, 6, 204, 12, 0, 1558, 1559, 6, 204, 9, 0, 1559, 425, 1, 0, 0, 0, 1560, 1561, 3, 112, 48, 0, 1561, 1562, 1, 0, 0, 0, 1562, 1563, 6, 205, 19, 0, 1563, 1564, 6, 205, 12, 0, 1564, 1565, 6, 205, 9, 0, 1565, 427, 1, 0, 0, 0, 1566, 1567, 3, 66, 25, 0, 1567, 1568, 1, 0, 0, 0, 1568, 1569, 6, 206, 11, 0, 1569, 429, 1, 0, 0, 0, 1570, 1571, 3, 68, 26, 0, 1571, 1572, 1, 0, 0, 0, 1572, 1573, 6, 207, 11, 0, 1573, 431, 1, 0, 0, 0, 1574, 1575, 3, 70, 27, 0, 1575, 1576, 1, 0, 0, 0, 1576, 1577, 6, 208, 11, 0, 1577, 433, 1, 0, 0, 0, 1578, 1579, 3, 184, 84, 0, 1579, 1580, 1, 0, 0, 0, 1580, 1581, 6, 209, 12, 0, 1581, 1582, 6, 209, 0, 0, 1582, 1583, 6, 209, 31, 0, 1583, 435, 1, 0, 0, 0, 1584, 1585, 3, 180, 82, 0, 1585, 1586, 1, 0, 0, 0, 1586, 1587, 6, 210, 12, 0, 1587, 1588, 6, 210, 0, 0, 1588, 1589, 6, 210, 32, 0, 1589, 437, 1, 0, 0, 0, 1590, 1591, 3, 100, 42, 0, 1591, 1592, 1, 0, 0, 0, 1592, 1593, 6, 211, 12, 0, 1593, 1594, 6, 211, 0, 0, 1594, 1595, 6, 211, 38, 0, 1595, 439, 1, 0, 0, 0, 1596, 1597, 3, 72, 28, 0, 1597, 1598, 1, 0, 0, 0, 1598, 1599, 6, 212, 16, 0, 1599, 1600, 6, 212, 12, 0, 1600, 441, 1, 0, 0, 0, 66, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 655, 665, 669, 672, 681, 683, 694, 713, 718, 727, 734, 739, 741, 752, 760, 763, 765, 770, 775, 781, 788, 793, 799, 802, 810, 814, 942, 947, 954, 956, 972, 977, 982, 984, 990, 1067, 1072, 1121, 1125, 1130, 1135, 1140, 1142, 1146, 1148, 1235, 1239, 1244, 1389, 1391, 39, 5, 1, 0, 5, 4, 0, 5, 6, 0, 5, 2, 0, 5, 3, 0, 5, 8, 0, 5, 5, 0, 5, 9, 0, 5, 11, 0, 5, 14, 0, 5, 13, 0, 0, 1, 0, 4, 0, 0, 7, 16, 0, 7, 70, 0, 5, 0, 0, 7, 29, 0, 7, 71, 0, 7, 38, 0, 7, 39, 0, 7, 36, 0, 7, 81, 0, 7, 30, 0, 7, 41, 0, 7, 53, 0, 7, 69, 0, 7, 85, 0, 5, 10, 0, 5, 7, 0, 7, 95, 0, 7, 94, 0, 7, 73, 0, 7, 72, 0, 7, 93, 0, 5, 12, 0, 7, 20, 0, 7, 89, 0, 5, 15, 0, 7, 33, 0] \ No newline at end of file diff --git a/packages/kbn-esql-ast/src/antlr/esql_lexer.tokens b/packages/kbn-esql-ast/src/antlr/esql_lexer.tokens index 3dd1a2c754038..b1a16987dd8ce 100644 --- a/packages/kbn-esql-ast/src/antlr/esql_lexer.tokens +++ b/packages/kbn-esql-ast/src/antlr/esql_lexer.tokens @@ -17,106 +17,115 @@ WHERE=16 DEV_INLINESTATS=17 DEV_LOOKUP=18 DEV_METRICS=19 -UNKNOWN_CMD=20 -LINE_COMMENT=21 -MULTILINE_COMMENT=22 -WS=23 -COLON=24 -PIPE=25 -QUOTED_STRING=26 -INTEGER_LITERAL=27 -DECIMAL_LITERAL=28 -BY=29 -AND=30 -ASC=31 -ASSIGN=32 -CAST_OP=33 -COMMA=34 -DESC=35 -DOT=36 -FALSE=37 -FIRST=38 -IN=39 -IS=40 -LAST=41 -LIKE=42 -LP=43 -NOT=44 -NULL=45 -NULLS=46 -OR=47 -PARAM=48 -RLIKE=49 -RP=50 -TRUE=51 -EQ=52 -CIEQ=53 -NEQ=54 -LT=55 -LTE=56 -GT=57 -GTE=58 -PLUS=59 -MINUS=60 -ASTERISK=61 -SLASH=62 -PERCENT=63 -NAMED_OR_POSITIONAL_PARAM=64 -OPENING_BRACKET=65 -CLOSING_BRACKET=66 -UNQUOTED_IDENTIFIER=67 -QUOTED_IDENTIFIER=68 -EXPR_LINE_COMMENT=69 -EXPR_MULTILINE_COMMENT=70 -EXPR_WS=71 -EXPLAIN_WS=72 -EXPLAIN_LINE_COMMENT=73 -EXPLAIN_MULTILINE_COMMENT=74 -METADATA=75 -UNQUOTED_SOURCE=76 -FROM_LINE_COMMENT=77 -FROM_MULTILINE_COMMENT=78 -FROM_WS=79 -ID_PATTERN=80 -PROJECT_LINE_COMMENT=81 -PROJECT_MULTILINE_COMMENT=82 -PROJECT_WS=83 -AS=84 -RENAME_LINE_COMMENT=85 -RENAME_MULTILINE_COMMENT=86 -RENAME_WS=87 -ON=88 -WITH=89 -ENRICH_POLICY_NAME=90 -ENRICH_LINE_COMMENT=91 -ENRICH_MULTILINE_COMMENT=92 -ENRICH_WS=93 -ENRICH_FIELD_LINE_COMMENT=94 -ENRICH_FIELD_MULTILINE_COMMENT=95 -ENRICH_FIELD_WS=96 -MVEXPAND_LINE_COMMENT=97 -MVEXPAND_MULTILINE_COMMENT=98 -MVEXPAND_WS=99 -INFO=100 -SHOW_LINE_COMMENT=101 -SHOW_MULTILINE_COMMENT=102 -SHOW_WS=103 -SETTING=104 -SETTING_LINE_COMMENT=105 -SETTTING_MULTILINE_COMMENT=106 -SETTING_WS=107 -LOOKUP_LINE_COMMENT=108 -LOOKUP_MULTILINE_COMMENT=109 -LOOKUP_WS=110 -LOOKUP_FIELD_LINE_COMMENT=111 -LOOKUP_FIELD_MULTILINE_COMMENT=112 -LOOKUP_FIELD_WS=113 -METRICS_LINE_COMMENT=114 -METRICS_MULTILINE_COMMENT=115 -METRICS_WS=116 -CLOSING_METRICS_LINE_COMMENT=117 -CLOSING_METRICS_MULTILINE_COMMENT=118 -CLOSING_METRICS_WS=119 +DEV_JOIN=20 +DEV_JOIN_FULL=21 +DEV_JOIN_LEFT=22 +DEV_JOIN_RIGHT=23 +DEV_JOIN_LOOKUP=24 +UNKNOWN_CMD=25 +LINE_COMMENT=26 +MULTILINE_COMMENT=27 +WS=28 +PIPE=29 +QUOTED_STRING=30 +INTEGER_LITERAL=31 +DECIMAL_LITERAL=32 +BY=33 +AND=34 +ASC=35 +ASSIGN=36 +CAST_OP=37 +COLON=38 +COMMA=39 +DESC=40 +DOT=41 +FALSE=42 +FIRST=43 +IN=44 +IS=45 +LAST=46 +LIKE=47 +LP=48 +NOT=49 +NULL=50 +NULLS=51 +OR=52 +PARAM=53 +RLIKE=54 +RP=55 +TRUE=56 +EQ=57 +CIEQ=58 +NEQ=59 +LT=60 +LTE=61 +GT=62 +GTE=63 +PLUS=64 +MINUS=65 +ASTERISK=66 +SLASH=67 +PERCENT=68 +NAMED_OR_POSITIONAL_PARAM=69 +OPENING_BRACKET=70 +CLOSING_BRACKET=71 +UNQUOTED_IDENTIFIER=72 +QUOTED_IDENTIFIER=73 +EXPR_LINE_COMMENT=74 +EXPR_MULTILINE_COMMENT=75 +EXPR_WS=76 +EXPLAIN_WS=77 +EXPLAIN_LINE_COMMENT=78 +EXPLAIN_MULTILINE_COMMENT=79 +METADATA=80 +UNQUOTED_SOURCE=81 +FROM_LINE_COMMENT=82 +FROM_MULTILINE_COMMENT=83 +FROM_WS=84 +ID_PATTERN=85 +PROJECT_LINE_COMMENT=86 +PROJECT_MULTILINE_COMMENT=87 +PROJECT_WS=88 +AS=89 +RENAME_LINE_COMMENT=90 +RENAME_MULTILINE_COMMENT=91 +RENAME_WS=92 +ON=93 +WITH=94 +ENRICH_POLICY_NAME=95 +ENRICH_LINE_COMMENT=96 +ENRICH_MULTILINE_COMMENT=97 +ENRICH_WS=98 +ENRICH_FIELD_LINE_COMMENT=99 +ENRICH_FIELD_MULTILINE_COMMENT=100 +ENRICH_FIELD_WS=101 +MVEXPAND_LINE_COMMENT=102 +MVEXPAND_MULTILINE_COMMENT=103 +MVEXPAND_WS=104 +INFO=105 +SHOW_LINE_COMMENT=106 +SHOW_MULTILINE_COMMENT=107 +SHOW_WS=108 +SETTING=109 +SETTING_LINE_COMMENT=110 +SETTTING_MULTILINE_COMMENT=111 +SETTING_WS=112 +LOOKUP_LINE_COMMENT=113 +LOOKUP_MULTILINE_COMMENT=114 +LOOKUP_WS=115 +LOOKUP_FIELD_LINE_COMMENT=116 +LOOKUP_FIELD_MULTILINE_COMMENT=117 +LOOKUP_FIELD_WS=118 +USING=119 +JOIN_LINE_COMMENT=120 +JOIN_MULTILINE_COMMENT=121 +JOIN_WS=122 +METRICS_LINE_COMMENT=123 +METRICS_MULTILINE_COMMENT=124 +METRICS_WS=125 +CLOSING_METRICS_LINE_COMMENT=126 +CLOSING_METRICS_MULTILINE_COMMENT=127 +CLOSING_METRICS_WS=128 'dissect'=1 'drop'=2 'enrich'=3 @@ -133,46 +142,47 @@ CLOSING_METRICS_WS=119 'sort'=14 'stats'=15 'where'=16 -':'=24 -'|'=25 -'by'=29 -'and'=30 -'asc'=31 -'='=32 -'::'=33 -','=34 -'desc'=35 -'.'=36 -'false'=37 -'first'=38 -'in'=39 -'is'=40 -'last'=41 -'like'=42 -'('=43 -'not'=44 -'null'=45 -'nulls'=46 -'or'=47 -'?'=48 -'rlike'=49 -')'=50 -'true'=51 -'=='=52 -'=~'=53 -'!='=54 -'<'=55 -'<='=56 -'>'=57 -'>='=58 -'+'=59 -'-'=60 -'*'=61 -'/'=62 -'%'=63 -']'=66 -'metadata'=75 -'as'=84 -'on'=88 -'with'=89 -'info'=100 +'|'=29 +'by'=33 +'and'=34 +'asc'=35 +'='=36 +'::'=37 +':'=38 +','=39 +'desc'=40 +'.'=41 +'false'=42 +'first'=43 +'in'=44 +'is'=45 +'last'=46 +'like'=47 +'('=48 +'not'=49 +'null'=50 +'nulls'=51 +'or'=52 +'?'=53 +'rlike'=54 +')'=55 +'true'=56 +'=='=57 +'=~'=58 +'!='=59 +'<'=60 +'<='=61 +'>'=62 +'>='=63 +'+'=64 +'-'=65 +'*'=66 +'/'=67 +'%'=68 +']'=71 +'metadata'=80 +'as'=89 +'on'=93 +'with'=94 +'info'=105 +'USING'=119 diff --git a/packages/kbn-esql-ast/src/antlr/esql_lexer.ts b/packages/kbn-esql-ast/src/antlr/esql_lexer.ts index 54546fef85904..5c25d0233576f 100644 --- a/packages/kbn-esql-ast/src/antlr/esql_lexer.ts +++ b/packages/kbn-esql-ast/src/antlr/esql_lexer.ts @@ -42,106 +42,115 @@ export default class esql_lexer extends lexer_config { public static readonly DEV_INLINESTATS = 17; public static readonly DEV_LOOKUP = 18; public static readonly DEV_METRICS = 19; - public static readonly UNKNOWN_CMD = 20; - public static readonly LINE_COMMENT = 21; - public static readonly MULTILINE_COMMENT = 22; - public static readonly WS = 23; - public static readonly COLON = 24; - public static readonly PIPE = 25; - public static readonly QUOTED_STRING = 26; - public static readonly INTEGER_LITERAL = 27; - public static readonly DECIMAL_LITERAL = 28; - public static readonly BY = 29; - public static readonly AND = 30; - public static readonly ASC = 31; - public static readonly ASSIGN = 32; - public static readonly CAST_OP = 33; - public static readonly COMMA = 34; - public static readonly DESC = 35; - public static readonly DOT = 36; - public static readonly FALSE = 37; - public static readonly FIRST = 38; - public static readonly IN = 39; - public static readonly IS = 40; - public static readonly LAST = 41; - public static readonly LIKE = 42; - public static readonly LP = 43; - public static readonly NOT = 44; - public static readonly NULL = 45; - public static readonly NULLS = 46; - public static readonly OR = 47; - public static readonly PARAM = 48; - public static readonly RLIKE = 49; - public static readonly RP = 50; - public static readonly TRUE = 51; - public static readonly EQ = 52; - public static readonly CIEQ = 53; - public static readonly NEQ = 54; - public static readonly LT = 55; - public static readonly LTE = 56; - public static readonly GT = 57; - public static readonly GTE = 58; - public static readonly PLUS = 59; - public static readonly MINUS = 60; - public static readonly ASTERISK = 61; - public static readonly SLASH = 62; - public static readonly PERCENT = 63; - public static readonly NAMED_OR_POSITIONAL_PARAM = 64; - public static readonly OPENING_BRACKET = 65; - public static readonly CLOSING_BRACKET = 66; - public static readonly UNQUOTED_IDENTIFIER = 67; - public static readonly QUOTED_IDENTIFIER = 68; - public static readonly EXPR_LINE_COMMENT = 69; - public static readonly EXPR_MULTILINE_COMMENT = 70; - public static readonly EXPR_WS = 71; - public static readonly EXPLAIN_WS = 72; - public static readonly EXPLAIN_LINE_COMMENT = 73; - public static readonly EXPLAIN_MULTILINE_COMMENT = 74; - public static readonly METADATA = 75; - public static readonly UNQUOTED_SOURCE = 76; - public static readonly FROM_LINE_COMMENT = 77; - public static readonly FROM_MULTILINE_COMMENT = 78; - public static readonly FROM_WS = 79; - public static readonly ID_PATTERN = 80; - public static readonly PROJECT_LINE_COMMENT = 81; - public static readonly PROJECT_MULTILINE_COMMENT = 82; - public static readonly PROJECT_WS = 83; - public static readonly AS = 84; - public static readonly RENAME_LINE_COMMENT = 85; - public static readonly RENAME_MULTILINE_COMMENT = 86; - public static readonly RENAME_WS = 87; - public static readonly ON = 88; - public static readonly WITH = 89; - public static readonly ENRICH_POLICY_NAME = 90; - public static readonly ENRICH_LINE_COMMENT = 91; - public static readonly ENRICH_MULTILINE_COMMENT = 92; - public static readonly ENRICH_WS = 93; - public static readonly ENRICH_FIELD_LINE_COMMENT = 94; - public static readonly ENRICH_FIELD_MULTILINE_COMMENT = 95; - public static readonly ENRICH_FIELD_WS = 96; - public static readonly MVEXPAND_LINE_COMMENT = 97; - public static readonly MVEXPAND_MULTILINE_COMMENT = 98; - public static readonly MVEXPAND_WS = 99; - public static readonly INFO = 100; - public static readonly SHOW_LINE_COMMENT = 101; - public static readonly SHOW_MULTILINE_COMMENT = 102; - public static readonly SHOW_WS = 103; - public static readonly SETTING = 104; - public static readonly SETTING_LINE_COMMENT = 105; - public static readonly SETTTING_MULTILINE_COMMENT = 106; - public static readonly SETTING_WS = 107; - public static readonly LOOKUP_LINE_COMMENT = 108; - public static readonly LOOKUP_MULTILINE_COMMENT = 109; - public static readonly LOOKUP_WS = 110; - public static readonly LOOKUP_FIELD_LINE_COMMENT = 111; - public static readonly LOOKUP_FIELD_MULTILINE_COMMENT = 112; - public static readonly LOOKUP_FIELD_WS = 113; - public static readonly METRICS_LINE_COMMENT = 114; - public static readonly METRICS_MULTILINE_COMMENT = 115; - public static readonly METRICS_WS = 116; - public static readonly CLOSING_METRICS_LINE_COMMENT = 117; - public static readonly CLOSING_METRICS_MULTILINE_COMMENT = 118; - public static readonly CLOSING_METRICS_WS = 119; + public static readonly DEV_JOIN = 20; + public static readonly DEV_JOIN_FULL = 21; + public static readonly DEV_JOIN_LEFT = 22; + public static readonly DEV_JOIN_RIGHT = 23; + public static readonly DEV_JOIN_LOOKUP = 24; + public static readonly UNKNOWN_CMD = 25; + public static readonly LINE_COMMENT = 26; + public static readonly MULTILINE_COMMENT = 27; + public static readonly WS = 28; + public static readonly PIPE = 29; + public static readonly QUOTED_STRING = 30; + public static readonly INTEGER_LITERAL = 31; + public static readonly DECIMAL_LITERAL = 32; + public static readonly BY = 33; + public static readonly AND = 34; + public static readonly ASC = 35; + public static readonly ASSIGN = 36; + public static readonly CAST_OP = 37; + public static readonly COLON = 38; + public static readonly COMMA = 39; + public static readonly DESC = 40; + public static readonly DOT = 41; + public static readonly FALSE = 42; + public static readonly FIRST = 43; + public static readonly IN = 44; + public static readonly IS = 45; + public static readonly LAST = 46; + public static readonly LIKE = 47; + public static readonly LP = 48; + public static readonly NOT = 49; + public static readonly NULL = 50; + public static readonly NULLS = 51; + public static readonly OR = 52; + public static readonly PARAM = 53; + public static readonly RLIKE = 54; + public static readonly RP = 55; + public static readonly TRUE = 56; + public static readonly EQ = 57; + public static readonly CIEQ = 58; + public static readonly NEQ = 59; + public static readonly LT = 60; + public static readonly LTE = 61; + public static readonly GT = 62; + public static readonly GTE = 63; + public static readonly PLUS = 64; + public static readonly MINUS = 65; + public static readonly ASTERISK = 66; + public static readonly SLASH = 67; + public static readonly PERCENT = 68; + public static readonly NAMED_OR_POSITIONAL_PARAM = 69; + public static readonly OPENING_BRACKET = 70; + public static readonly CLOSING_BRACKET = 71; + public static readonly UNQUOTED_IDENTIFIER = 72; + public static readonly QUOTED_IDENTIFIER = 73; + public static readonly EXPR_LINE_COMMENT = 74; + public static readonly EXPR_MULTILINE_COMMENT = 75; + public static readonly EXPR_WS = 76; + public static readonly EXPLAIN_WS = 77; + public static readonly EXPLAIN_LINE_COMMENT = 78; + public static readonly EXPLAIN_MULTILINE_COMMENT = 79; + public static readonly METADATA = 80; + public static readonly UNQUOTED_SOURCE = 81; + public static readonly FROM_LINE_COMMENT = 82; + public static readonly FROM_MULTILINE_COMMENT = 83; + public static readonly FROM_WS = 84; + public static readonly ID_PATTERN = 85; + public static readonly PROJECT_LINE_COMMENT = 86; + public static readonly PROJECT_MULTILINE_COMMENT = 87; + public static readonly PROJECT_WS = 88; + public static readonly AS = 89; + public static readonly RENAME_LINE_COMMENT = 90; + public static readonly RENAME_MULTILINE_COMMENT = 91; + public static readonly RENAME_WS = 92; + public static readonly ON = 93; + public static readonly WITH = 94; + public static readonly ENRICH_POLICY_NAME = 95; + public static readonly ENRICH_LINE_COMMENT = 96; + public static readonly ENRICH_MULTILINE_COMMENT = 97; + public static readonly ENRICH_WS = 98; + public static readonly ENRICH_FIELD_LINE_COMMENT = 99; + public static readonly ENRICH_FIELD_MULTILINE_COMMENT = 100; + public static readonly ENRICH_FIELD_WS = 101; + public static readonly MVEXPAND_LINE_COMMENT = 102; + public static readonly MVEXPAND_MULTILINE_COMMENT = 103; + public static readonly MVEXPAND_WS = 104; + public static readonly INFO = 105; + public static readonly SHOW_LINE_COMMENT = 106; + public static readonly SHOW_MULTILINE_COMMENT = 107; + public static readonly SHOW_WS = 108; + public static readonly SETTING = 109; + public static readonly SETTING_LINE_COMMENT = 110; + public static readonly SETTTING_MULTILINE_COMMENT = 111; + public static readonly SETTING_WS = 112; + public static readonly LOOKUP_LINE_COMMENT = 113; + public static readonly LOOKUP_MULTILINE_COMMENT = 114; + public static readonly LOOKUP_WS = 115; + public static readonly LOOKUP_FIELD_LINE_COMMENT = 116; + public static readonly LOOKUP_FIELD_MULTILINE_COMMENT = 117; + public static readonly LOOKUP_FIELD_WS = 118; + public static readonly USING = 119; + public static readonly JOIN_LINE_COMMENT = 120; + public static readonly JOIN_MULTILINE_COMMENT = 121; + public static readonly JOIN_WS = 122; + public static readonly METRICS_LINE_COMMENT = 123; + public static readonly METRICS_MULTILINE_COMMENT = 124; + public static readonly METRICS_WS = 125; + public static readonly CLOSING_METRICS_LINE_COMMENT = 126; + public static readonly CLOSING_METRICS_MULTILINE_COMMENT = 127; + public static readonly CLOSING_METRICS_WS = 128; public static readonly EOF = Token.EOF; public static readonly EXPRESSION_MODE = 1; public static readonly EXPLAIN_MODE = 2; @@ -155,8 +164,9 @@ export default class esql_lexer extends lexer_config { public static readonly SETTING_MODE = 10; public static readonly LOOKUP_MODE = 11; public static readonly LOOKUP_FIELD_MODE = 12; - public static readonly METRICS_MODE = 13; - public static readonly CLOSING_METRICS_MODE = 14; + public static readonly JOIN_MODE = 13; + public static readonly METRICS_MODE = 14; + public static readonly CLOSING_METRICS_MODE = 15; public static readonly channelNames: string[] = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ]; public static readonly literalNames: (string | null)[] = [ null, "'dissect'", @@ -172,32 +182,35 @@ export default class esql_lexer extends lexer_config { null, null, null, null, null, null, - "':'", "'|'", + null, null, + null, null, + null, "'|'", null, null, null, "'by'", "'and'", "'asc'", "'='", "'::'", - "','", "'desc'", - "'.'", "'false'", - "'first'", "'in'", - "'is'", "'last'", - "'like'", "'('", - "'not'", "'null'", - "'nulls'", "'or'", - "'?'", "'rlike'", - "')'", "'true'", - "'=='", "'=~'", - "'!='", "'<'", - "'<='", "'>'", - "'>='", "'+'", - "'-'", "'*'", - "'/'", "'%'", + "':'", "','", + "'desc'", "'.'", + "'false'", "'first'", + "'in'", "'is'", + "'last'", "'like'", + "'('", "'not'", + "'null'", "'nulls'", + "'or'", "'?'", + "'rlike'", "')'", + "'true'", "'=='", + "'=~'", "'!='", + "'<'", "'<='", + "'>'", "'>='", + "'+'", "'-'", + "'*'", "'/'", + "'%'", null, + null, "']'", null, null, - "']'", null, null, null, null, null, null, null, - null, "'metadata'", + "'metadata'", null, null, null, null, null, null, @@ -210,7 +223,14 @@ export default class esql_lexer extends lexer_config { null, null, null, null, null, null, - "'info'" ]; + "'info'", null, + null, null, + null, null, + null, null, + null, null, + null, null, + null, null, + "'USING'" ]; public static readonly symbolicNames: (string | null)[] = [ null, "DISSECT", "DROP", "ENRICH", "EVAL", "EXPLAIN", @@ -223,30 +243,36 @@ export default class esql_lexer extends lexer_config { "DEV_INLINESTATS", "DEV_LOOKUP", "DEV_METRICS", + "DEV_JOIN", + "DEV_JOIN_FULL", + "DEV_JOIN_LEFT", + "DEV_JOIN_RIGHT", + "DEV_JOIN_LOOKUP", "UNKNOWN_CMD", "LINE_COMMENT", "MULTILINE_COMMENT", - "WS", "COLON", - "PIPE", "QUOTED_STRING", + "WS", "PIPE", + "QUOTED_STRING", "INTEGER_LITERAL", "DECIMAL_LITERAL", "BY", "AND", "ASC", "ASSIGN", "CAST_OP", - "COMMA", "DESC", - "DOT", "FALSE", - "FIRST", "IN", - "IS", "LAST", - "LIKE", "LP", - "NOT", "NULL", - "NULLS", "OR", - "PARAM", "RLIKE", - "RP", "TRUE", - "EQ", "CIEQ", - "NEQ", "LT", - "LTE", "GT", - "GTE", "PLUS", - "MINUS", "ASTERISK", + "COLON", "COMMA", + "DESC", "DOT", + "FALSE", "FIRST", + "IN", "IS", + "LAST", "LIKE", + "LP", "NOT", + "NULL", "NULLS", + "OR", "PARAM", + "RLIKE", "RP", + "TRUE", "EQ", + "CIEQ", "NEQ", + "LT", "LTE", + "GT", "GTE", + "PLUS", "MINUS", + "ASTERISK", "SLASH", "PERCENT", "NAMED_OR_POSITIONAL_PARAM", "OPENING_BRACKET", @@ -295,6 +321,9 @@ export default class esql_lexer extends lexer_config { "LOOKUP_FIELD_LINE_COMMENT", "LOOKUP_FIELD_MULTILINE_COMMENT", "LOOKUP_FIELD_WS", + "USING", "JOIN_LINE_COMMENT", + "JOIN_MULTILINE_COMMENT", + "JOIN_WS", "METRICS_LINE_COMMENT", "METRICS_MULTILINE_COMMENT", "METRICS_WS", @@ -307,20 +336,21 @@ export default class esql_lexer extends lexer_config { "ENRICH_MODE", "ENRICH_FIELD_MODE", "MVEXPAND_MODE", "SHOW_MODE", "SETTING_MODE", "LOOKUP_MODE", - "LOOKUP_FIELD_MODE", "METRICS_MODE", - "CLOSING_METRICS_MODE", ]; + "LOOKUP_FIELD_MODE", "JOIN_MODE", + "METRICS_MODE", "CLOSING_METRICS_MODE", ]; public static readonly ruleNames: string[] = [ "DISSECT", "DROP", "ENRICH", "EVAL", "EXPLAIN", "FROM", "GROK", "KEEP", "LIMIT", "MV_EXPAND", "RENAME", "ROW", "SHOW", "SORT", "STATS", "WHERE", - "DEV_INLINESTATS", "DEV_LOOKUP", "DEV_METRICS", "UNKNOWN_CMD", "LINE_COMMENT", - "MULTILINE_COMMENT", "WS", "COLON", "PIPE", "DIGIT", "LETTER", "ESCAPE_SEQUENCE", + "DEV_INLINESTATS", "DEV_LOOKUP", "DEV_METRICS", "DEV_JOIN", "DEV_JOIN_FULL", + "DEV_JOIN_LEFT", "DEV_JOIN_RIGHT", "DEV_JOIN_LOOKUP", "UNKNOWN_CMD", "LINE_COMMENT", + "MULTILINE_COMMENT", "WS", "PIPE", "DIGIT", "LETTER", "ESCAPE_SEQUENCE", "UNESCAPED_CHARS", "EXPONENT", "ASPERAND", "BACKQUOTE", "BACKQUOTE_BLOCK", "UNDERSCORE", "UNQUOTED_ID_BODY", "QUOTED_STRING", "INTEGER_LITERAL", - "DECIMAL_LITERAL", "BY", "AND", "ASC", "ASSIGN", "CAST_OP", "COMMA", "DESC", - "DOT", "FALSE", "FIRST", "IN", "IS", "LAST", "LIKE", "LP", "NOT", "NULL", - "NULLS", "OR", "PARAM", "RLIKE", "RP", "TRUE", "EQ", "CIEQ", "NEQ", "LT", - "LTE", "GT", "GTE", "PLUS", "MINUS", "ASTERISK", "SLASH", "PERCENT", "EXPRESSION_COLON", + "DECIMAL_LITERAL", "BY", "AND", "ASC", "ASSIGN", "CAST_OP", "COLON", "COMMA", + "DESC", "DOT", "FALSE", "FIRST", "IN", "IS", "LAST", "LIKE", "LP", "NOT", + "NULL", "NULLS", "OR", "PARAM", "RLIKE", "RP", "TRUE", "EQ", "CIEQ", "NEQ", + "LT", "LTE", "GT", "GTE", "PLUS", "MINUS", "ASTERISK", "SLASH", "PERCENT", "NESTED_WHERE", "NAMED_OR_POSITIONAL_PARAM", "OPENING_BRACKET", "CLOSING_BRACKET", "UNQUOTED_IDENTIFIER", "QUOTED_ID", "QUOTED_IDENTIFIER", "EXPR_LINE_COMMENT", "EXPR_MULTILINE_COMMENT", "EXPR_WS", "EXPLAIN_OPENING_BRACKET", "EXPLAIN_PIPE", @@ -349,11 +379,14 @@ export default class esql_lexer extends lexer_config { "LOOKUP_UNQUOTED_SOURCE", "LOOKUP_QUOTED_SOURCE", "LOOKUP_LINE_COMMENT", "LOOKUP_MULTILINE_COMMENT", "LOOKUP_WS", "LOOKUP_FIELD_PIPE", "LOOKUP_FIELD_COMMA", "LOOKUP_FIELD_DOT", "LOOKUP_FIELD_ID_PATTERN", "LOOKUP_FIELD_LINE_COMMENT", - "LOOKUP_FIELD_MULTILINE_COMMENT", "LOOKUP_FIELD_WS", "METRICS_PIPE", "METRICS_UNQUOTED_SOURCE", - "METRICS_QUOTED_SOURCE", "METRICS_LINE_COMMENT", "METRICS_MULTILINE_COMMENT", - "METRICS_WS", "CLOSING_METRICS_COLON", "CLOSING_METRICS_COMMA", "CLOSING_METRICS_LINE_COMMENT", - "CLOSING_METRICS_MULTILINE_COMMENT", "CLOSING_METRICS_WS", "CLOSING_METRICS_QUOTED_IDENTIFIER", - "CLOSING_METRICS_UNQUOTED_IDENTIFIER", "CLOSING_METRICS_BY", "CLOSING_METRICS_PIPE", + "LOOKUP_FIELD_MULTILINE_COMMENT", "LOOKUP_FIELD_WS", "JOIN_PIPE", "JOIN_JOIN", + "JOIN_AS", "JOIN_ON", "USING", "JOIN_UNQUOTED_IDENTIFER", "JOIN_QUOTED_IDENTIFIER", + "JOIN_LINE_COMMENT", "JOIN_MULTILINE_COMMENT", "JOIN_WS", "METRICS_PIPE", + "METRICS_UNQUOTED_SOURCE", "METRICS_QUOTED_SOURCE", "METRICS_LINE_COMMENT", + "METRICS_MULTILINE_COMMENT", "METRICS_WS", "CLOSING_METRICS_COLON", "CLOSING_METRICS_COMMA", + "CLOSING_METRICS_LINE_COMMENT", "CLOSING_METRICS_MULTILINE_COMMENT", "CLOSING_METRICS_WS", + "CLOSING_METRICS_QUOTED_IDENTIFIER", "CLOSING_METRICS_UNQUOTED_IDENTIFIER", + "CLOSING_METRICS_BY", "CLOSING_METRICS_PIPE", ]; @@ -383,23 +416,31 @@ export default class esql_lexer extends lexer_config { return this.DEV_LOOKUP_sempred(localctx, predIndex); case 18: return this.DEV_METRICS_sempred(localctx, predIndex); - case 73: - return this.EXPRESSION_COLON_sempred(localctx, predIndex); - case 106: + case 19: + return this.DEV_JOIN_sempred(localctx, predIndex); + case 20: + return this.DEV_JOIN_FULL_sempred(localctx, predIndex); + case 21: + return this.DEV_JOIN_LEFT_sempred(localctx, predIndex); + case 22: + return this.DEV_JOIN_RIGHT_sempred(localctx, predIndex); + case 23: + return this.DEV_JOIN_LOOKUP_sempred(localctx, predIndex); + case 110: return this.PROJECT_PARAM_sempred(localctx, predIndex); - case 107: + case 111: return this.PROJECT_NAMED_OR_POSITIONAL_PARAM_sempred(localctx, predIndex); - case 118: + case 122: return this.RENAME_PARAM_sempred(localctx, predIndex); - case 119: + case 123: return this.RENAME_NAMED_OR_POSITIONAL_PARAM_sempred(localctx, predIndex); - case 142: + case 146: return this.ENRICH_FIELD_PARAM_sempred(localctx, predIndex); - case 143: + case 147: return this.ENRICH_FIELD_NAMED_OR_POSITIONAL_PARAM_sempred(localctx, predIndex); - case 149: + case 153: return this.MVEXPAND_PARAM_sempred(localctx, predIndex); - case 150: + case 154: return this.MVEXPAND_NAMED_OR_POSITIONAL_PARAM_sempred(localctx, predIndex); } return true; @@ -425,86 +466,114 @@ export default class esql_lexer extends lexer_config { } return true; } - private EXPRESSION_COLON_sempred(localctx: RuleContext, predIndex: number): boolean { + private DEV_JOIN_sempred(localctx: RuleContext, predIndex: number): boolean { switch (predIndex) { case 3: return this.isDevVersion(); } return true; } - private PROJECT_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + private DEV_JOIN_FULL_sempred(localctx: RuleContext, predIndex: number): boolean { switch (predIndex) { case 4: return this.isDevVersion(); } return true; } - private PROJECT_NAMED_OR_POSITIONAL_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + private DEV_JOIN_LEFT_sempred(localctx: RuleContext, predIndex: number): boolean { switch (predIndex) { case 5: return this.isDevVersion(); } return true; } - private RENAME_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + private DEV_JOIN_RIGHT_sempred(localctx: RuleContext, predIndex: number): boolean { switch (predIndex) { case 6: return this.isDevVersion(); } return true; } - private RENAME_NAMED_OR_POSITIONAL_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + private DEV_JOIN_LOOKUP_sempred(localctx: RuleContext, predIndex: number): boolean { switch (predIndex) { case 7: return this.isDevVersion(); } return true; } - private ENRICH_FIELD_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + private PROJECT_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { switch (predIndex) { case 8: return this.isDevVersion(); } return true; } - private ENRICH_FIELD_NAMED_OR_POSITIONAL_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + private PROJECT_NAMED_OR_POSITIONAL_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { switch (predIndex) { case 9: return this.isDevVersion(); } return true; } - private MVEXPAND_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + private RENAME_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { switch (predIndex) { case 10: return this.isDevVersion(); } return true; } - private MVEXPAND_NAMED_OR_POSITIONAL_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + private RENAME_NAMED_OR_POSITIONAL_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { switch (predIndex) { case 11: return this.isDevVersion(); } return true; } + private ENRICH_FIELD_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + switch (predIndex) { + case 12: + return this.isDevVersion(); + } + return true; + } + private ENRICH_FIELD_NAMED_OR_POSITIONAL_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + switch (predIndex) { + case 13: + return this.isDevVersion(); + } + return true; + } + private MVEXPAND_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + switch (predIndex) { + case 14: + return this.isDevVersion(); + } + return true; + } + private MVEXPAND_NAMED_OR_POSITIONAL_PARAM_sempred(localctx: RuleContext, predIndex: number): boolean { + switch (predIndex) { + case 15: + return this.isDevVersion(); + } + return true; + } - public static readonly _serializedATN: number[] = [4,0,119,1484,6,-1,6, - -1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,2,0, - 7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9, - 7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7, - 16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23, - 2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2, - 31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38, - 7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7, - 45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52, - 2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2, - 60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2,65,7,65,2,66,7,66,2,67, - 7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7, - 74,2,75,7,75,2,76,7,76,2,77,7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81, - 2,82,7,82,2,83,7,83,2,84,7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2, - 89,7,89,2,90,7,90,2,91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96, - 7,96,2,97,7,97,2,98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102, + public static readonly _serializedATN: number[] = [4,0,128,1601,6,-1,6, + -1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1, + 2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8, + 2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16, + 7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7, + 23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30, + 2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2, + 38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45, + 7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7, + 52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59, + 2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2,65,7,65,2,66,7,66,2, + 67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74, + 7,74,2,75,7,75,2,76,7,76,2,77,7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7, + 81,2,82,7,82,2,83,7,83,2,84,7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88, + 2,89,7,89,2,90,7,90,2,91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2, + 96,7,96,2,97,7,97,2,98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102, 2,103,7,103,2,104,7,104,2,105,7,105,2,106,7,106,2,107,7,107,2,108,7,108, 2,109,7,109,2,110,7,110,2,111,7,111,2,112,7,112,2,113,7,113,2,114,7,114, 2,115,7,115,2,116,7,116,2,117,7,117,2,118,7,118,2,119,7,119,2,120,7,120, @@ -521,484 +590,526 @@ export default class esql_lexer extends lexer_config { 2,181,7,181,2,182,7,182,2,183,7,183,2,184,7,184,2,185,7,185,2,186,7,186, 2,187,7,187,2,188,7,188,2,189,7,189,2,190,7,190,2,191,7,191,2,192,7,192, 2,193,7,193,2,194,7,194,2,195,7,195,2,196,7,196,2,197,7,197,2,198,7,198, - 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, - 1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4, - 1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6, - 1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8, - 1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10, - 1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1, - 12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14, - 1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1, - 16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17, - 1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, - 18,1,18,1,18,1,18,1,19,4,19,580,8,19,11,19,12,19,581,1,19,1,19,1,20,1,20, - 1,20,1,20,5,20,590,8,20,10,20,12,20,593,9,20,1,20,3,20,596,8,20,1,20,3, - 20,599,8,20,1,20,1,20,1,21,1,21,1,21,1,21,1,21,5,21,608,8,21,10,21,12,21, - 611,9,21,1,21,1,21,1,21,1,21,1,21,1,22,4,22,619,8,22,11,22,12,22,620,1, - 22,1,22,1,23,1,23,1,24,1,24,1,24,1,24,1,25,1,25,1,26,1,26,1,27,1,27,1,27, - 1,28,1,28,1,29,1,29,3,29,642,8,29,1,29,4,29,645,8,29,11,29,12,29,646,1, - 30,1,30,1,31,1,31,1,32,1,32,1,32,3,32,656,8,32,1,33,1,33,1,34,1,34,1,34, - 3,34,663,8,34,1,35,1,35,1,35,5,35,668,8,35,10,35,12,35,671,9,35,1,35,1, - 35,1,35,1,35,1,35,1,35,5,35,679,8,35,10,35,12,35,682,9,35,1,35,1,35,1,35, - 1,35,1,35,3,35,689,8,35,1,35,3,35,692,8,35,3,35,694,8,35,1,36,4,36,697, - 8,36,11,36,12,36,698,1,37,4,37,702,8,37,11,37,12,37,703,1,37,1,37,5,37, - 708,8,37,10,37,12,37,711,9,37,1,37,1,37,4,37,715,8,37,11,37,12,37,716,1, - 37,4,37,720,8,37,11,37,12,37,721,1,37,1,37,5,37,726,8,37,10,37,12,37,729, - 9,37,3,37,731,8,37,1,37,1,37,1,37,1,37,4,37,737,8,37,11,37,12,37,738,1, - 37,1,37,3,37,743,8,37,1,38,1,38,1,38,1,39,1,39,1,39,1,39,1,40,1,40,1,40, - 1,40,1,41,1,41,1,42,1,42,1,42,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,45,1, - 45,1,46,1,46,1,46,1,46,1,46,1,46,1,47,1,47,1,47,1,47,1,47,1,47,1,48,1,48, - 1,48,1,49,1,49,1,49,1,50,1,50,1,50,1,50,1,50,1,51,1,51,1,51,1,51,1,51,1, - 52,1,52,1,53,1,53,1,53,1,53,1,54,1,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55, - 1,55,1,55,1,56,1,56,1,56,1,57,1,57,1,58,1,58,1,58,1,58,1,58,1,58,1,59,1, - 59,1,60,1,60,1,60,1,60,1,60,1,61,1,61,1,61,1,62,1,62,1,62,1,63,1,63,1,63, - 1,64,1,64,1,65,1,65,1,65,1,66,1,66,1,67,1,67,1,67,1,68,1,68,1,69,1,69,1, - 70,1,70,1,71,1,71,1,72,1,72,1,73,1,73,1,73,1,73,1,73,1,74,1,74,1,74,1,74, - 1,75,1,75,1,75,3,75,874,8,75,1,75,5,75,877,8,75,10,75,12,75,880,9,75,1, - 75,1,75,4,75,884,8,75,11,75,12,75,885,3,75,888,8,75,1,76,1,76,1,76,1,76, - 1,76,1,77,1,77,1,77,1,77,1,77,1,78,1,78,5,78,902,8,78,10,78,12,78,905,9, - 78,1,78,1,78,3,78,909,8,78,1,78,4,78,912,8,78,11,78,12,78,913,3,78,916, - 8,78,1,79,1,79,4,79,920,8,79,11,79,12,79,921,1,79,1,79,1,80,1,80,1,81,1, - 81,1,81,1,81,1,82,1,82,1,82,1,82,1,83,1,83,1,83,1,83,1,84,1,84,1,84,1,84, - 1,84,1,85,1,85,1,85,1,85,1,85,1,86,1,86,1,86,1,86,1,87,1,87,1,87,1,87,1, - 88,1,88,1,88,1,88,1,89,1,89,1,89,1,89,1,89,1,90,1,90,1,90,1,90,1,91,1,91, - 1,91,1,91,1,92,1,92,1,92,1,92,1,93,1,93,1,93,1,93,1,94,1,94,1,94,1,94,1, - 95,1,95,1,95,1,95,1,95,1,95,1,95,1,95,1,95,1,96,1,96,1,96,3,96,999,8,96, - 1,97,4,97,1002,8,97,11,97,12,97,1003,1,98,1,98,1,98,1,98,1,99,1,99,1,99, - 1,99,1,100,1,100,1,100,1,100,1,101,1,101,1,101,1,101,1,102,1,102,1,102, - 1,102,1,103,1,103,1,103,1,103,1,103,1,104,1,104,1,104,1,104,1,105,1,105, - 1,105,1,105,1,106,1,106,1,106,1,106,1,106,1,107,1,107,1,107,1,107,1,107, - 1,108,1,108,1,108,1,108,3,108,1053,8,108,1,109,1,109,3,109,1057,8,109,1, - 109,5,109,1060,8,109,10,109,12,109,1063,9,109,1,109,1,109,3,109,1067,8, - 109,1,109,4,109,1070,8,109,11,109,12,109,1071,3,109,1074,8,109,1,110,1, - 110,4,110,1078,8,110,11,110,12,110,1079,1,111,1,111,1,111,1,111,1,112,1, - 112,1,112,1,112,1,113,1,113,1,113,1,113,1,114,1,114,1,114,1,114,1,114,1, - 115,1,115,1,115,1,115,1,116,1,116,1,116,1,116,1,117,1,117,1,117,1,117,1, - 118,1,118,1,118,1,118,1,118,1,119,1,119,1,119,1,119,1,119,1,120,1,120,1, - 120,1,121,1,121,1,121,1,121,1,122,1,122,1,122,1,122,1,123,1,123,1,123,1, - 123,1,124,1,124,1,124,1,124,1,125,1,125,1,125,1,125,1,125,1,126,1,126,1, - 126,1,126,1,126,1,127,1,127,1,127,1,127,1,127,1,128,1,128,1,128,1,128,1, - 128,1,128,1,128,1,129,1,129,1,130,4,130,1165,8,130,11,130,12,130,1166,1, - 130,1,130,3,130,1171,8,130,1,130,4,130,1174,8,130,11,130,12,130,1175,1, - 131,1,131,1,131,1,131,1,132,1,132,1,132,1,132,1,133,1,133,1,133,1,133,1, - 134,1,134,1,134,1,134,1,135,1,135,1,135,1,135,1,135,1,135,1,136,1,136,1, - 136,1,136,1,137,1,137,1,137,1,137,1,138,1,138,1,138,1,138,1,139,1,139,1, - 139,1,139,1,140,1,140,1,140,1,140,1,141,1,141,1,141,1,141,1,142,1,142,1, - 142,1,142,1,142,1,143,1,143,1,143,1,143,1,143,1,144,1,144,1,144,1,144,1, - 145,1,145,1,145,1,145,1,146,1,146,1,146,1,146,1,147,1,147,1,147,1,147,1, - 147,1,148,1,148,1,148,1,148,1,149,1,149,1,149,1,149,1,149,1,150,1,150,1, - 150,1,150,1,150,1,151,1,151,1,151,1,151,1,152,1,152,1,152,1,152,1,153,1, - 153,1,153,1,153,1,154,1,154,1,154,1,154,1,155,1,155,1,155,1,155,1,156,1, - 156,1,156,1,156,1,156,1,157,1,157,1,157,1,157,1,157,1,158,1,158,1,158,1, - 158,1,159,1,159,1,159,1,159,1,160,1,160,1,160,1,160,1,161,1,161,1,161,1, - 161,1,161,1,162,1,162,1,162,1,162,1,163,1,163,1,163,1,163,1,163,4,163,1321, - 8,163,11,163,12,163,1322,1,164,1,164,1,164,1,164,1,165,1,165,1,165,1,165, - 1,166,1,166,1,166,1,166,1,167,1,167,1,167,1,167,1,167,1,168,1,168,1,168, - 1,168,1,169,1,169,1,169,1,169,1,170,1,170,1,170,1,170,1,171,1,171,1,171, - 1,171,1,171,1,172,1,172,1,172,1,172,1,173,1,173,1,173,1,173,1,174,1,174, - 1,174,1,174,1,175,1,175,1,175,1,175,1,176,1,176,1,176,1,176,1,177,1,177, - 1,177,1,177,1,177,1,177,1,178,1,178,1,178,1,178,1,179,1,179,1,179,1,179, - 1,180,1,180,1,180,1,180,1,181,1,181,1,181,1,181,1,182,1,182,1,182,1,182, - 1,183,1,183,1,183,1,183,1,184,1,184,1,184,1,184,1,184,1,185,1,185,1,185, - 1,185,1,185,1,185,1,186,1,186,1,186,1,186,1,186,1,186,1,187,1,187,1,187, - 1,187,1,188,1,188,1,188,1,188,1,189,1,189,1,189,1,189,1,190,1,190,1,190, - 1,190,1,190,1,190,1,191,1,191,1,191,1,191,1,191,1,191,1,192,1,192,1,192, - 1,192,1,193,1,193,1,193,1,193,1,194,1,194,1,194,1,194,1,195,1,195,1,195, - 1,195,1,195,1,195,1,196,1,196,1,196,1,196,1,196,1,196,1,197,1,197,1,197, - 1,197,1,197,1,197,1,198,1,198,1,198,1,198,1,198,2,609,680,0,199,15,1,17, - 2,19,3,21,4,23,5,25,6,27,7,29,8,31,9,33,10,35,11,37,12,39,13,41,14,43,15, - 45,16,47,17,49,18,51,19,53,20,55,21,57,22,59,23,61,24,63,25,65,0,67,0,69, - 0,71,0,73,0,75,0,77,0,79,0,81,0,83,0,85,26,87,27,89,28,91,29,93,30,95,31, - 97,32,99,33,101,34,103,35,105,36,107,37,109,38,111,39,113,40,115,41,117, - 42,119,43,121,44,123,45,125,46,127,47,129,48,131,49,133,50,135,51,137,52, - 139,53,141,54,143,55,145,56,147,57,149,58,151,59,153,60,155,61,157,62,159, - 63,161,0,163,0,165,64,167,65,169,66,171,67,173,0,175,68,177,69,179,70,181, - 71,183,0,185,0,187,72,189,73,191,74,193,0,195,0,197,0,199,0,201,0,203,0, - 205,75,207,0,209,76,211,0,213,0,215,77,217,78,219,79,221,0,223,0,225,0, - 227,0,229,0,231,0,233,0,235,80,237,81,239,82,241,83,243,0,245,0,247,0,249, - 0,251,0,253,0,255,84,257,0,259,85,261,86,263,87,265,0,267,0,269,88,271, - 89,273,0,275,90,277,0,279,91,281,92,283,93,285,0,287,0,289,0,291,0,293, - 0,295,0,297,0,299,0,301,0,303,94,305,95,307,96,309,0,311,0,313,0,315,0, - 317,0,319,0,321,97,323,98,325,99,327,0,329,100,331,101,333,102,335,103, - 337,0,339,0,341,104,343,105,345,106,347,107,349,0,351,0,353,0,355,0,357, - 0,359,0,361,0,363,108,365,109,367,110,369,0,371,0,373,0,375,0,377,111,379, - 112,381,113,383,0,385,0,387,0,389,114,391,115,393,116,395,0,397,0,399,117, - 401,118,403,119,405,0,407,0,409,0,411,0,15,0,1,2,3,4,5,6,7,8,9,10,11,12, - 13,14,35,2,0,68,68,100,100,2,0,73,73,105,105,2,0,83,83,115,115,2,0,69,69, - 101,101,2,0,67,67,99,99,2,0,84,84,116,116,2,0,82,82,114,114,2,0,79,79,111, - 111,2,0,80,80,112,112,2,0,78,78,110,110,2,0,72,72,104,104,2,0,86,86,118, - 118,2,0,65,65,97,97,2,0,76,76,108,108,2,0,88,88,120,120,2,0,70,70,102,102, - 2,0,77,77,109,109,2,0,71,71,103,103,2,0,75,75,107,107,2,0,87,87,119,119, - 2,0,85,85,117,117,6,0,9,10,13,13,32,32,47,47,91,91,93,93,2,0,10,10,13,13, - 3,0,9,10,13,13,32,32,1,0,48,57,2,0,65,90,97,122,8,0,34,34,78,78,82,82,84, - 84,92,92,110,110,114,114,116,116,4,0,10,10,13,13,34,34,92,92,2,0,43,43, - 45,45,1,0,96,96,2,0,66,66,98,98,2,0,89,89,121,121,11,0,9,10,13,13,32,32, - 34,34,44,44,47,47,58,58,61,61,91,91,93,93,124,124,2,0,42,42,47,47,11,0, - 9,10,13,13,32,32,34,35,44,44,47,47,58,58,60,60,62,63,92,92,124,124,1512, - 0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1, - 0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0, - 0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1, - 0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0, - 0,59,1,0,0,0,0,61,1,0,0,0,1,63,1,0,0,0,1,85,1,0,0,0,1,87,1,0,0,0,1,89,1, - 0,0,0,1,91,1,0,0,0,1,93,1,0,0,0,1,95,1,0,0,0,1,97,1,0,0,0,1,99,1,0,0,0, - 1,101,1,0,0,0,1,103,1,0,0,0,1,105,1,0,0,0,1,107,1,0,0,0,1,109,1,0,0,0,1, - 111,1,0,0,0,1,113,1,0,0,0,1,115,1,0,0,0,1,117,1,0,0,0,1,119,1,0,0,0,1,121, - 1,0,0,0,1,123,1,0,0,0,1,125,1,0,0,0,1,127,1,0,0,0,1,129,1,0,0,0,1,131,1, - 0,0,0,1,133,1,0,0,0,1,135,1,0,0,0,1,137,1,0,0,0,1,139,1,0,0,0,1,141,1,0, - 0,0,1,143,1,0,0,0,1,145,1,0,0,0,1,147,1,0,0,0,1,149,1,0,0,0,1,151,1,0,0, - 0,1,153,1,0,0,0,1,155,1,0,0,0,1,157,1,0,0,0,1,159,1,0,0,0,1,161,1,0,0,0, - 1,163,1,0,0,0,1,165,1,0,0,0,1,167,1,0,0,0,1,169,1,0,0,0,1,171,1,0,0,0,1, - 175,1,0,0,0,1,177,1,0,0,0,1,179,1,0,0,0,1,181,1,0,0,0,2,183,1,0,0,0,2,185, - 1,0,0,0,2,187,1,0,0,0,2,189,1,0,0,0,2,191,1,0,0,0,3,193,1,0,0,0,3,195,1, - 0,0,0,3,197,1,0,0,0,3,199,1,0,0,0,3,201,1,0,0,0,3,203,1,0,0,0,3,205,1,0, - 0,0,3,209,1,0,0,0,3,211,1,0,0,0,3,213,1,0,0,0,3,215,1,0,0,0,3,217,1,0,0, - 0,3,219,1,0,0,0,4,221,1,0,0,0,4,223,1,0,0,0,4,225,1,0,0,0,4,227,1,0,0,0, - 4,229,1,0,0,0,4,235,1,0,0,0,4,237,1,0,0,0,4,239,1,0,0,0,4,241,1,0,0,0,5, - 243,1,0,0,0,5,245,1,0,0,0,5,247,1,0,0,0,5,249,1,0,0,0,5,251,1,0,0,0,5,253, - 1,0,0,0,5,255,1,0,0,0,5,257,1,0,0,0,5,259,1,0,0,0,5,261,1,0,0,0,5,263,1, - 0,0,0,6,265,1,0,0,0,6,267,1,0,0,0,6,269,1,0,0,0,6,271,1,0,0,0,6,275,1,0, - 0,0,6,277,1,0,0,0,6,279,1,0,0,0,6,281,1,0,0,0,6,283,1,0,0,0,7,285,1,0,0, - 0,7,287,1,0,0,0,7,289,1,0,0,0,7,291,1,0,0,0,7,293,1,0,0,0,7,295,1,0,0,0, - 7,297,1,0,0,0,7,299,1,0,0,0,7,301,1,0,0,0,7,303,1,0,0,0,7,305,1,0,0,0,7, - 307,1,0,0,0,8,309,1,0,0,0,8,311,1,0,0,0,8,313,1,0,0,0,8,315,1,0,0,0,8,317, - 1,0,0,0,8,319,1,0,0,0,8,321,1,0,0,0,8,323,1,0,0,0,8,325,1,0,0,0,9,327,1, - 0,0,0,9,329,1,0,0,0,9,331,1,0,0,0,9,333,1,0,0,0,9,335,1,0,0,0,10,337,1, - 0,0,0,10,339,1,0,0,0,10,341,1,0,0,0,10,343,1,0,0,0,10,345,1,0,0,0,10,347, - 1,0,0,0,11,349,1,0,0,0,11,351,1,0,0,0,11,353,1,0,0,0,11,355,1,0,0,0,11, - 357,1,0,0,0,11,359,1,0,0,0,11,361,1,0,0,0,11,363,1,0,0,0,11,365,1,0,0,0, - 11,367,1,0,0,0,12,369,1,0,0,0,12,371,1,0,0,0,12,373,1,0,0,0,12,375,1,0, - 0,0,12,377,1,0,0,0,12,379,1,0,0,0,12,381,1,0,0,0,13,383,1,0,0,0,13,385, - 1,0,0,0,13,387,1,0,0,0,13,389,1,0,0,0,13,391,1,0,0,0,13,393,1,0,0,0,14, - 395,1,0,0,0,14,397,1,0,0,0,14,399,1,0,0,0,14,401,1,0,0,0,14,403,1,0,0,0, - 14,405,1,0,0,0,14,407,1,0,0,0,14,409,1,0,0,0,14,411,1,0,0,0,15,413,1,0, - 0,0,17,423,1,0,0,0,19,430,1,0,0,0,21,439,1,0,0,0,23,446,1,0,0,0,25,456, - 1,0,0,0,27,463,1,0,0,0,29,470,1,0,0,0,31,477,1,0,0,0,33,485,1,0,0,0,35, - 497,1,0,0,0,37,506,1,0,0,0,39,512,1,0,0,0,41,519,1,0,0,0,43,526,1,0,0,0, - 45,534,1,0,0,0,47,542,1,0,0,0,49,557,1,0,0,0,51,567,1,0,0,0,53,579,1,0, - 0,0,55,585,1,0,0,0,57,602,1,0,0,0,59,618,1,0,0,0,61,624,1,0,0,0,63,626, - 1,0,0,0,65,630,1,0,0,0,67,632,1,0,0,0,69,634,1,0,0,0,71,637,1,0,0,0,73, - 639,1,0,0,0,75,648,1,0,0,0,77,650,1,0,0,0,79,655,1,0,0,0,81,657,1,0,0,0, - 83,662,1,0,0,0,85,693,1,0,0,0,87,696,1,0,0,0,89,742,1,0,0,0,91,744,1,0, - 0,0,93,747,1,0,0,0,95,751,1,0,0,0,97,755,1,0,0,0,99,757,1,0,0,0,101,760, - 1,0,0,0,103,762,1,0,0,0,105,767,1,0,0,0,107,769,1,0,0,0,109,775,1,0,0,0, - 111,781,1,0,0,0,113,784,1,0,0,0,115,787,1,0,0,0,117,792,1,0,0,0,119,797, - 1,0,0,0,121,799,1,0,0,0,123,803,1,0,0,0,125,808,1,0,0,0,127,814,1,0,0,0, - 129,817,1,0,0,0,131,819,1,0,0,0,133,825,1,0,0,0,135,827,1,0,0,0,137,832, - 1,0,0,0,139,835,1,0,0,0,141,838,1,0,0,0,143,841,1,0,0,0,145,843,1,0,0,0, - 147,846,1,0,0,0,149,848,1,0,0,0,151,851,1,0,0,0,153,853,1,0,0,0,155,855, - 1,0,0,0,157,857,1,0,0,0,159,859,1,0,0,0,161,861,1,0,0,0,163,866,1,0,0,0, - 165,887,1,0,0,0,167,889,1,0,0,0,169,894,1,0,0,0,171,915,1,0,0,0,173,917, - 1,0,0,0,175,925,1,0,0,0,177,927,1,0,0,0,179,931,1,0,0,0,181,935,1,0,0,0, - 183,939,1,0,0,0,185,944,1,0,0,0,187,949,1,0,0,0,189,953,1,0,0,0,191,957, - 1,0,0,0,193,961,1,0,0,0,195,966,1,0,0,0,197,970,1,0,0,0,199,974,1,0,0,0, - 201,978,1,0,0,0,203,982,1,0,0,0,205,986,1,0,0,0,207,998,1,0,0,0,209,1001, - 1,0,0,0,211,1005,1,0,0,0,213,1009,1,0,0,0,215,1013,1,0,0,0,217,1017,1,0, - 0,0,219,1021,1,0,0,0,221,1025,1,0,0,0,223,1030,1,0,0,0,225,1034,1,0,0,0, - 227,1038,1,0,0,0,229,1043,1,0,0,0,231,1052,1,0,0,0,233,1073,1,0,0,0,235, - 1077,1,0,0,0,237,1081,1,0,0,0,239,1085,1,0,0,0,241,1089,1,0,0,0,243,1093, - 1,0,0,0,245,1098,1,0,0,0,247,1102,1,0,0,0,249,1106,1,0,0,0,251,1110,1,0, - 0,0,253,1115,1,0,0,0,255,1120,1,0,0,0,257,1123,1,0,0,0,259,1127,1,0,0,0, - 261,1131,1,0,0,0,263,1135,1,0,0,0,265,1139,1,0,0,0,267,1144,1,0,0,0,269, - 1149,1,0,0,0,271,1154,1,0,0,0,273,1161,1,0,0,0,275,1170,1,0,0,0,277,1177, - 1,0,0,0,279,1181,1,0,0,0,281,1185,1,0,0,0,283,1189,1,0,0,0,285,1193,1,0, - 0,0,287,1199,1,0,0,0,289,1203,1,0,0,0,291,1207,1,0,0,0,293,1211,1,0,0,0, - 295,1215,1,0,0,0,297,1219,1,0,0,0,299,1223,1,0,0,0,301,1228,1,0,0,0,303, - 1233,1,0,0,0,305,1237,1,0,0,0,307,1241,1,0,0,0,309,1245,1,0,0,0,311,1250, - 1,0,0,0,313,1254,1,0,0,0,315,1259,1,0,0,0,317,1264,1,0,0,0,319,1268,1,0, - 0,0,321,1272,1,0,0,0,323,1276,1,0,0,0,325,1280,1,0,0,0,327,1284,1,0,0,0, - 329,1289,1,0,0,0,331,1294,1,0,0,0,333,1298,1,0,0,0,335,1302,1,0,0,0,337, - 1306,1,0,0,0,339,1311,1,0,0,0,341,1320,1,0,0,0,343,1324,1,0,0,0,345,1328, - 1,0,0,0,347,1332,1,0,0,0,349,1336,1,0,0,0,351,1341,1,0,0,0,353,1345,1,0, - 0,0,355,1349,1,0,0,0,357,1353,1,0,0,0,359,1358,1,0,0,0,361,1362,1,0,0,0, - 363,1366,1,0,0,0,365,1370,1,0,0,0,367,1374,1,0,0,0,369,1378,1,0,0,0,371, - 1384,1,0,0,0,373,1388,1,0,0,0,375,1392,1,0,0,0,377,1396,1,0,0,0,379,1400, - 1,0,0,0,381,1404,1,0,0,0,383,1408,1,0,0,0,385,1413,1,0,0,0,387,1419,1,0, - 0,0,389,1425,1,0,0,0,391,1429,1,0,0,0,393,1433,1,0,0,0,395,1437,1,0,0,0, - 397,1443,1,0,0,0,399,1449,1,0,0,0,401,1453,1,0,0,0,403,1457,1,0,0,0,405, - 1461,1,0,0,0,407,1467,1,0,0,0,409,1473,1,0,0,0,411,1479,1,0,0,0,413,414, - 7,0,0,0,414,415,7,1,0,0,415,416,7,2,0,0,416,417,7,2,0,0,417,418,7,3,0,0, - 418,419,7,4,0,0,419,420,7,5,0,0,420,421,1,0,0,0,421,422,6,0,0,0,422,16, - 1,0,0,0,423,424,7,0,0,0,424,425,7,6,0,0,425,426,7,7,0,0,426,427,7,8,0,0, - 427,428,1,0,0,0,428,429,6,1,1,0,429,18,1,0,0,0,430,431,7,3,0,0,431,432, - 7,9,0,0,432,433,7,6,0,0,433,434,7,1,0,0,434,435,7,4,0,0,435,436,7,10,0, - 0,436,437,1,0,0,0,437,438,6,2,2,0,438,20,1,0,0,0,439,440,7,3,0,0,440,441, - 7,11,0,0,441,442,7,12,0,0,442,443,7,13,0,0,443,444,1,0,0,0,444,445,6,3, - 0,0,445,22,1,0,0,0,446,447,7,3,0,0,447,448,7,14,0,0,448,449,7,8,0,0,449, - 450,7,13,0,0,450,451,7,12,0,0,451,452,7,1,0,0,452,453,7,9,0,0,453,454,1, - 0,0,0,454,455,6,4,3,0,455,24,1,0,0,0,456,457,7,15,0,0,457,458,7,6,0,0,458, - 459,7,7,0,0,459,460,7,16,0,0,460,461,1,0,0,0,461,462,6,5,4,0,462,26,1,0, - 0,0,463,464,7,17,0,0,464,465,7,6,0,0,465,466,7,7,0,0,466,467,7,18,0,0,467, - 468,1,0,0,0,468,469,6,6,0,0,469,28,1,0,0,0,470,471,7,18,0,0,471,472,7,3, - 0,0,472,473,7,3,0,0,473,474,7,8,0,0,474,475,1,0,0,0,475,476,6,7,1,0,476, - 30,1,0,0,0,477,478,7,13,0,0,478,479,7,1,0,0,479,480,7,16,0,0,480,481,7, - 1,0,0,481,482,7,5,0,0,482,483,1,0,0,0,483,484,6,8,0,0,484,32,1,0,0,0,485, - 486,7,16,0,0,486,487,7,11,0,0,487,488,5,95,0,0,488,489,7,3,0,0,489,490, - 7,14,0,0,490,491,7,8,0,0,491,492,7,12,0,0,492,493,7,9,0,0,493,494,7,0,0, - 0,494,495,1,0,0,0,495,496,6,9,5,0,496,34,1,0,0,0,497,498,7,6,0,0,498,499, - 7,3,0,0,499,500,7,9,0,0,500,501,7,12,0,0,501,502,7,16,0,0,502,503,7,3,0, - 0,503,504,1,0,0,0,504,505,6,10,6,0,505,36,1,0,0,0,506,507,7,6,0,0,507,508, - 7,7,0,0,508,509,7,19,0,0,509,510,1,0,0,0,510,511,6,11,0,0,511,38,1,0,0, - 0,512,513,7,2,0,0,513,514,7,10,0,0,514,515,7,7,0,0,515,516,7,19,0,0,516, - 517,1,0,0,0,517,518,6,12,7,0,518,40,1,0,0,0,519,520,7,2,0,0,520,521,7,7, - 0,0,521,522,7,6,0,0,522,523,7,5,0,0,523,524,1,0,0,0,524,525,6,13,0,0,525, - 42,1,0,0,0,526,527,7,2,0,0,527,528,7,5,0,0,528,529,7,12,0,0,529,530,7,5, - 0,0,530,531,7,2,0,0,531,532,1,0,0,0,532,533,6,14,0,0,533,44,1,0,0,0,534, - 535,7,19,0,0,535,536,7,10,0,0,536,537,7,3,0,0,537,538,7,6,0,0,538,539,7, - 3,0,0,539,540,1,0,0,0,540,541,6,15,0,0,541,46,1,0,0,0,542,543,4,16,0,0, - 543,544,7,1,0,0,544,545,7,9,0,0,545,546,7,13,0,0,546,547,7,1,0,0,547,548, - 7,9,0,0,548,549,7,3,0,0,549,550,7,2,0,0,550,551,7,5,0,0,551,552,7,12,0, - 0,552,553,7,5,0,0,553,554,7,2,0,0,554,555,1,0,0,0,555,556,6,16,0,0,556, - 48,1,0,0,0,557,558,4,17,1,0,558,559,7,13,0,0,559,560,7,7,0,0,560,561,7, - 7,0,0,561,562,7,18,0,0,562,563,7,20,0,0,563,564,7,8,0,0,564,565,1,0,0,0, - 565,566,6,17,8,0,566,50,1,0,0,0,567,568,4,18,2,0,568,569,7,16,0,0,569,570, - 7,3,0,0,570,571,7,5,0,0,571,572,7,6,0,0,572,573,7,1,0,0,573,574,7,4,0,0, - 574,575,7,2,0,0,575,576,1,0,0,0,576,577,6,18,9,0,577,52,1,0,0,0,578,580, - 8,21,0,0,579,578,1,0,0,0,580,581,1,0,0,0,581,579,1,0,0,0,581,582,1,0,0, - 0,582,583,1,0,0,0,583,584,6,19,0,0,584,54,1,0,0,0,585,586,5,47,0,0,586, - 587,5,47,0,0,587,591,1,0,0,0,588,590,8,22,0,0,589,588,1,0,0,0,590,593,1, - 0,0,0,591,589,1,0,0,0,591,592,1,0,0,0,592,595,1,0,0,0,593,591,1,0,0,0,594, - 596,5,13,0,0,595,594,1,0,0,0,595,596,1,0,0,0,596,598,1,0,0,0,597,599,5, - 10,0,0,598,597,1,0,0,0,598,599,1,0,0,0,599,600,1,0,0,0,600,601,6,20,10, - 0,601,56,1,0,0,0,602,603,5,47,0,0,603,604,5,42,0,0,604,609,1,0,0,0,605, - 608,3,57,21,0,606,608,9,0,0,0,607,605,1,0,0,0,607,606,1,0,0,0,608,611,1, - 0,0,0,609,610,1,0,0,0,609,607,1,0,0,0,610,612,1,0,0,0,611,609,1,0,0,0,612, - 613,5,42,0,0,613,614,5,47,0,0,614,615,1,0,0,0,615,616,6,21,10,0,616,58, - 1,0,0,0,617,619,7,23,0,0,618,617,1,0,0,0,619,620,1,0,0,0,620,618,1,0,0, - 0,620,621,1,0,0,0,621,622,1,0,0,0,622,623,6,22,10,0,623,60,1,0,0,0,624, - 625,5,58,0,0,625,62,1,0,0,0,626,627,5,124,0,0,627,628,1,0,0,0,628,629,6, - 24,11,0,629,64,1,0,0,0,630,631,7,24,0,0,631,66,1,0,0,0,632,633,7,25,0,0, - 633,68,1,0,0,0,634,635,5,92,0,0,635,636,7,26,0,0,636,70,1,0,0,0,637,638, - 8,27,0,0,638,72,1,0,0,0,639,641,7,3,0,0,640,642,7,28,0,0,641,640,1,0,0, - 0,641,642,1,0,0,0,642,644,1,0,0,0,643,645,3,65,25,0,644,643,1,0,0,0,645, - 646,1,0,0,0,646,644,1,0,0,0,646,647,1,0,0,0,647,74,1,0,0,0,648,649,5,64, - 0,0,649,76,1,0,0,0,650,651,5,96,0,0,651,78,1,0,0,0,652,656,8,29,0,0,653, - 654,5,96,0,0,654,656,5,96,0,0,655,652,1,0,0,0,655,653,1,0,0,0,656,80,1, - 0,0,0,657,658,5,95,0,0,658,82,1,0,0,0,659,663,3,67,26,0,660,663,3,65,25, - 0,661,663,3,81,33,0,662,659,1,0,0,0,662,660,1,0,0,0,662,661,1,0,0,0,663, - 84,1,0,0,0,664,669,5,34,0,0,665,668,3,69,27,0,666,668,3,71,28,0,667,665, - 1,0,0,0,667,666,1,0,0,0,668,671,1,0,0,0,669,667,1,0,0,0,669,670,1,0,0,0, - 670,672,1,0,0,0,671,669,1,0,0,0,672,694,5,34,0,0,673,674,5,34,0,0,674,675, - 5,34,0,0,675,676,5,34,0,0,676,680,1,0,0,0,677,679,8,22,0,0,678,677,1,0, - 0,0,679,682,1,0,0,0,680,681,1,0,0,0,680,678,1,0,0,0,681,683,1,0,0,0,682, - 680,1,0,0,0,683,684,5,34,0,0,684,685,5,34,0,0,685,686,5,34,0,0,686,688, - 1,0,0,0,687,689,5,34,0,0,688,687,1,0,0,0,688,689,1,0,0,0,689,691,1,0,0, - 0,690,692,5,34,0,0,691,690,1,0,0,0,691,692,1,0,0,0,692,694,1,0,0,0,693, - 664,1,0,0,0,693,673,1,0,0,0,694,86,1,0,0,0,695,697,3,65,25,0,696,695,1, - 0,0,0,697,698,1,0,0,0,698,696,1,0,0,0,698,699,1,0,0,0,699,88,1,0,0,0,700, - 702,3,65,25,0,701,700,1,0,0,0,702,703,1,0,0,0,703,701,1,0,0,0,703,704,1, - 0,0,0,704,705,1,0,0,0,705,709,3,105,45,0,706,708,3,65,25,0,707,706,1,0, - 0,0,708,711,1,0,0,0,709,707,1,0,0,0,709,710,1,0,0,0,710,743,1,0,0,0,711, - 709,1,0,0,0,712,714,3,105,45,0,713,715,3,65,25,0,714,713,1,0,0,0,715,716, - 1,0,0,0,716,714,1,0,0,0,716,717,1,0,0,0,717,743,1,0,0,0,718,720,3,65,25, - 0,719,718,1,0,0,0,720,721,1,0,0,0,721,719,1,0,0,0,721,722,1,0,0,0,722,730, - 1,0,0,0,723,727,3,105,45,0,724,726,3,65,25,0,725,724,1,0,0,0,726,729,1, - 0,0,0,727,725,1,0,0,0,727,728,1,0,0,0,728,731,1,0,0,0,729,727,1,0,0,0,730, - 723,1,0,0,0,730,731,1,0,0,0,731,732,1,0,0,0,732,733,3,73,29,0,733,743,1, - 0,0,0,734,736,3,105,45,0,735,737,3,65,25,0,736,735,1,0,0,0,737,738,1,0, - 0,0,738,736,1,0,0,0,738,739,1,0,0,0,739,740,1,0,0,0,740,741,3,73,29,0,741, - 743,1,0,0,0,742,701,1,0,0,0,742,712,1,0,0,0,742,719,1,0,0,0,742,734,1,0, - 0,0,743,90,1,0,0,0,744,745,7,30,0,0,745,746,7,31,0,0,746,92,1,0,0,0,747, - 748,7,12,0,0,748,749,7,9,0,0,749,750,7,0,0,0,750,94,1,0,0,0,751,752,7,12, - 0,0,752,753,7,2,0,0,753,754,7,4,0,0,754,96,1,0,0,0,755,756,5,61,0,0,756, - 98,1,0,0,0,757,758,5,58,0,0,758,759,5,58,0,0,759,100,1,0,0,0,760,761,5, - 44,0,0,761,102,1,0,0,0,762,763,7,0,0,0,763,764,7,3,0,0,764,765,7,2,0,0, - 765,766,7,4,0,0,766,104,1,0,0,0,767,768,5,46,0,0,768,106,1,0,0,0,769,770, - 7,15,0,0,770,771,7,12,0,0,771,772,7,13,0,0,772,773,7,2,0,0,773,774,7,3, - 0,0,774,108,1,0,0,0,775,776,7,15,0,0,776,777,7,1,0,0,777,778,7,6,0,0,778, - 779,7,2,0,0,779,780,7,5,0,0,780,110,1,0,0,0,781,782,7,1,0,0,782,783,7,9, - 0,0,783,112,1,0,0,0,784,785,7,1,0,0,785,786,7,2,0,0,786,114,1,0,0,0,787, - 788,7,13,0,0,788,789,7,12,0,0,789,790,7,2,0,0,790,791,7,5,0,0,791,116,1, - 0,0,0,792,793,7,13,0,0,793,794,7,1,0,0,794,795,7,18,0,0,795,796,7,3,0,0, - 796,118,1,0,0,0,797,798,5,40,0,0,798,120,1,0,0,0,799,800,7,9,0,0,800,801, - 7,7,0,0,801,802,7,5,0,0,802,122,1,0,0,0,803,804,7,9,0,0,804,805,7,20,0, - 0,805,806,7,13,0,0,806,807,7,13,0,0,807,124,1,0,0,0,808,809,7,9,0,0,809, - 810,7,20,0,0,810,811,7,13,0,0,811,812,7,13,0,0,812,813,7,2,0,0,813,126, - 1,0,0,0,814,815,7,7,0,0,815,816,7,6,0,0,816,128,1,0,0,0,817,818,5,63,0, - 0,818,130,1,0,0,0,819,820,7,6,0,0,820,821,7,13,0,0,821,822,7,1,0,0,822, - 823,7,18,0,0,823,824,7,3,0,0,824,132,1,0,0,0,825,826,5,41,0,0,826,134,1, - 0,0,0,827,828,7,5,0,0,828,829,7,6,0,0,829,830,7,20,0,0,830,831,7,3,0,0, - 831,136,1,0,0,0,832,833,5,61,0,0,833,834,5,61,0,0,834,138,1,0,0,0,835,836, - 5,61,0,0,836,837,5,126,0,0,837,140,1,0,0,0,838,839,5,33,0,0,839,840,5,61, - 0,0,840,142,1,0,0,0,841,842,5,60,0,0,842,144,1,0,0,0,843,844,5,60,0,0,844, - 845,5,61,0,0,845,146,1,0,0,0,846,847,5,62,0,0,847,148,1,0,0,0,848,849,5, - 62,0,0,849,850,5,61,0,0,850,150,1,0,0,0,851,852,5,43,0,0,852,152,1,0,0, - 0,853,854,5,45,0,0,854,154,1,0,0,0,855,856,5,42,0,0,856,156,1,0,0,0,857, - 858,5,47,0,0,858,158,1,0,0,0,859,860,5,37,0,0,860,160,1,0,0,0,861,862,4, - 73,3,0,862,863,3,61,23,0,863,864,1,0,0,0,864,865,6,73,12,0,865,162,1,0, - 0,0,866,867,3,45,15,0,867,868,1,0,0,0,868,869,6,74,13,0,869,164,1,0,0,0, - 870,873,3,129,57,0,871,874,3,67,26,0,872,874,3,81,33,0,873,871,1,0,0,0, - 873,872,1,0,0,0,874,878,1,0,0,0,875,877,3,83,34,0,876,875,1,0,0,0,877,880, - 1,0,0,0,878,876,1,0,0,0,878,879,1,0,0,0,879,888,1,0,0,0,880,878,1,0,0,0, - 881,883,3,129,57,0,882,884,3,65,25,0,883,882,1,0,0,0,884,885,1,0,0,0,885, - 883,1,0,0,0,885,886,1,0,0,0,886,888,1,0,0,0,887,870,1,0,0,0,887,881,1,0, - 0,0,888,166,1,0,0,0,889,890,5,91,0,0,890,891,1,0,0,0,891,892,6,76,0,0,892, - 893,6,76,0,0,893,168,1,0,0,0,894,895,5,93,0,0,895,896,1,0,0,0,896,897,6, - 77,11,0,897,898,6,77,11,0,898,170,1,0,0,0,899,903,3,67,26,0,900,902,3,83, - 34,0,901,900,1,0,0,0,902,905,1,0,0,0,903,901,1,0,0,0,903,904,1,0,0,0,904, - 916,1,0,0,0,905,903,1,0,0,0,906,909,3,81,33,0,907,909,3,75,30,0,908,906, - 1,0,0,0,908,907,1,0,0,0,909,911,1,0,0,0,910,912,3,83,34,0,911,910,1,0,0, - 0,912,913,1,0,0,0,913,911,1,0,0,0,913,914,1,0,0,0,914,916,1,0,0,0,915,899, - 1,0,0,0,915,908,1,0,0,0,916,172,1,0,0,0,917,919,3,77,31,0,918,920,3,79, - 32,0,919,918,1,0,0,0,920,921,1,0,0,0,921,919,1,0,0,0,921,922,1,0,0,0,922, - 923,1,0,0,0,923,924,3,77,31,0,924,174,1,0,0,0,925,926,3,173,79,0,926,176, - 1,0,0,0,927,928,3,55,20,0,928,929,1,0,0,0,929,930,6,81,10,0,930,178,1,0, - 0,0,931,932,3,57,21,0,932,933,1,0,0,0,933,934,6,82,10,0,934,180,1,0,0,0, - 935,936,3,59,22,0,936,937,1,0,0,0,937,938,6,83,10,0,938,182,1,0,0,0,939, - 940,3,167,76,0,940,941,1,0,0,0,941,942,6,84,14,0,942,943,6,84,15,0,943, - 184,1,0,0,0,944,945,3,63,24,0,945,946,1,0,0,0,946,947,6,85,16,0,947,948, - 6,85,11,0,948,186,1,0,0,0,949,950,3,59,22,0,950,951,1,0,0,0,951,952,6,86, - 10,0,952,188,1,0,0,0,953,954,3,55,20,0,954,955,1,0,0,0,955,956,6,87,10, - 0,956,190,1,0,0,0,957,958,3,57,21,0,958,959,1,0,0,0,959,960,6,88,10,0,960, - 192,1,0,0,0,961,962,3,63,24,0,962,963,1,0,0,0,963,964,6,89,16,0,964,965, - 6,89,11,0,965,194,1,0,0,0,966,967,3,167,76,0,967,968,1,0,0,0,968,969,6, - 90,14,0,969,196,1,0,0,0,970,971,3,169,77,0,971,972,1,0,0,0,972,973,6,91, - 17,0,973,198,1,0,0,0,974,975,3,61,23,0,975,976,1,0,0,0,976,977,6,92,12, - 0,977,200,1,0,0,0,978,979,3,101,43,0,979,980,1,0,0,0,980,981,6,93,18,0, - 981,202,1,0,0,0,982,983,3,97,41,0,983,984,1,0,0,0,984,985,6,94,19,0,985, - 204,1,0,0,0,986,987,7,16,0,0,987,988,7,3,0,0,988,989,7,5,0,0,989,990,7, - 12,0,0,990,991,7,0,0,0,991,992,7,12,0,0,992,993,7,5,0,0,993,994,7,12,0, - 0,994,206,1,0,0,0,995,999,8,32,0,0,996,997,5,47,0,0,997,999,8,33,0,0,998, - 995,1,0,0,0,998,996,1,0,0,0,999,208,1,0,0,0,1000,1002,3,207,96,0,1001,1000, - 1,0,0,0,1002,1003,1,0,0,0,1003,1001,1,0,0,0,1003,1004,1,0,0,0,1004,210, - 1,0,0,0,1005,1006,3,209,97,0,1006,1007,1,0,0,0,1007,1008,6,98,20,0,1008, - 212,1,0,0,0,1009,1010,3,85,35,0,1010,1011,1,0,0,0,1011,1012,6,99,21,0,1012, - 214,1,0,0,0,1013,1014,3,55,20,0,1014,1015,1,0,0,0,1015,1016,6,100,10,0, - 1016,216,1,0,0,0,1017,1018,3,57,21,0,1018,1019,1,0,0,0,1019,1020,6,101, - 10,0,1020,218,1,0,0,0,1021,1022,3,59,22,0,1022,1023,1,0,0,0,1023,1024,6, - 102,10,0,1024,220,1,0,0,0,1025,1026,3,63,24,0,1026,1027,1,0,0,0,1027,1028, - 6,103,16,0,1028,1029,6,103,11,0,1029,222,1,0,0,0,1030,1031,3,105,45,0,1031, - 1032,1,0,0,0,1032,1033,6,104,22,0,1033,224,1,0,0,0,1034,1035,3,101,43,0, - 1035,1036,1,0,0,0,1036,1037,6,105,18,0,1037,226,1,0,0,0,1038,1039,4,106, - 4,0,1039,1040,3,129,57,0,1040,1041,1,0,0,0,1041,1042,6,106,23,0,1042,228, - 1,0,0,0,1043,1044,4,107,5,0,1044,1045,3,165,75,0,1045,1046,1,0,0,0,1046, - 1047,6,107,24,0,1047,230,1,0,0,0,1048,1053,3,67,26,0,1049,1053,3,65,25, - 0,1050,1053,3,81,33,0,1051,1053,3,155,70,0,1052,1048,1,0,0,0,1052,1049, - 1,0,0,0,1052,1050,1,0,0,0,1052,1051,1,0,0,0,1053,232,1,0,0,0,1054,1057, - 3,67,26,0,1055,1057,3,155,70,0,1056,1054,1,0,0,0,1056,1055,1,0,0,0,1057, - 1061,1,0,0,0,1058,1060,3,231,108,0,1059,1058,1,0,0,0,1060,1063,1,0,0,0, - 1061,1059,1,0,0,0,1061,1062,1,0,0,0,1062,1074,1,0,0,0,1063,1061,1,0,0,0, - 1064,1067,3,81,33,0,1065,1067,3,75,30,0,1066,1064,1,0,0,0,1066,1065,1,0, - 0,0,1067,1069,1,0,0,0,1068,1070,3,231,108,0,1069,1068,1,0,0,0,1070,1071, - 1,0,0,0,1071,1069,1,0,0,0,1071,1072,1,0,0,0,1072,1074,1,0,0,0,1073,1056, - 1,0,0,0,1073,1066,1,0,0,0,1074,234,1,0,0,0,1075,1078,3,233,109,0,1076,1078, - 3,173,79,0,1077,1075,1,0,0,0,1077,1076,1,0,0,0,1078,1079,1,0,0,0,1079,1077, - 1,0,0,0,1079,1080,1,0,0,0,1080,236,1,0,0,0,1081,1082,3,55,20,0,1082,1083, - 1,0,0,0,1083,1084,6,111,10,0,1084,238,1,0,0,0,1085,1086,3,57,21,0,1086, - 1087,1,0,0,0,1087,1088,6,112,10,0,1088,240,1,0,0,0,1089,1090,3,59,22,0, - 1090,1091,1,0,0,0,1091,1092,6,113,10,0,1092,242,1,0,0,0,1093,1094,3,63, - 24,0,1094,1095,1,0,0,0,1095,1096,6,114,16,0,1096,1097,6,114,11,0,1097,244, - 1,0,0,0,1098,1099,3,97,41,0,1099,1100,1,0,0,0,1100,1101,6,115,19,0,1101, - 246,1,0,0,0,1102,1103,3,101,43,0,1103,1104,1,0,0,0,1104,1105,6,116,18,0, - 1105,248,1,0,0,0,1106,1107,3,105,45,0,1107,1108,1,0,0,0,1108,1109,6,117, - 22,0,1109,250,1,0,0,0,1110,1111,4,118,6,0,1111,1112,3,129,57,0,1112,1113, - 1,0,0,0,1113,1114,6,118,23,0,1114,252,1,0,0,0,1115,1116,4,119,7,0,1116, - 1117,3,165,75,0,1117,1118,1,0,0,0,1118,1119,6,119,24,0,1119,254,1,0,0,0, - 1120,1121,7,12,0,0,1121,1122,7,2,0,0,1122,256,1,0,0,0,1123,1124,3,235,110, - 0,1124,1125,1,0,0,0,1125,1126,6,121,25,0,1126,258,1,0,0,0,1127,1128,3,55, - 20,0,1128,1129,1,0,0,0,1129,1130,6,122,10,0,1130,260,1,0,0,0,1131,1132, - 3,57,21,0,1132,1133,1,0,0,0,1133,1134,6,123,10,0,1134,262,1,0,0,0,1135, - 1136,3,59,22,0,1136,1137,1,0,0,0,1137,1138,6,124,10,0,1138,264,1,0,0,0, - 1139,1140,3,63,24,0,1140,1141,1,0,0,0,1141,1142,6,125,16,0,1142,1143,6, - 125,11,0,1143,266,1,0,0,0,1144,1145,3,167,76,0,1145,1146,1,0,0,0,1146,1147, - 6,126,14,0,1147,1148,6,126,26,0,1148,268,1,0,0,0,1149,1150,7,7,0,0,1150, - 1151,7,9,0,0,1151,1152,1,0,0,0,1152,1153,6,127,27,0,1153,270,1,0,0,0,1154, - 1155,7,19,0,0,1155,1156,7,1,0,0,1156,1157,7,5,0,0,1157,1158,7,10,0,0,1158, - 1159,1,0,0,0,1159,1160,6,128,27,0,1160,272,1,0,0,0,1161,1162,8,34,0,0,1162, - 274,1,0,0,0,1163,1165,3,273,129,0,1164,1163,1,0,0,0,1165,1166,1,0,0,0,1166, - 1164,1,0,0,0,1166,1167,1,0,0,0,1167,1168,1,0,0,0,1168,1169,3,61,23,0,1169, - 1171,1,0,0,0,1170,1164,1,0,0,0,1170,1171,1,0,0,0,1171,1173,1,0,0,0,1172, - 1174,3,273,129,0,1173,1172,1,0,0,0,1174,1175,1,0,0,0,1175,1173,1,0,0,0, - 1175,1176,1,0,0,0,1176,276,1,0,0,0,1177,1178,3,275,130,0,1178,1179,1,0, - 0,0,1179,1180,6,131,28,0,1180,278,1,0,0,0,1181,1182,3,55,20,0,1182,1183, - 1,0,0,0,1183,1184,6,132,10,0,1184,280,1,0,0,0,1185,1186,3,57,21,0,1186, - 1187,1,0,0,0,1187,1188,6,133,10,0,1188,282,1,0,0,0,1189,1190,3,59,22,0, - 1190,1191,1,0,0,0,1191,1192,6,134,10,0,1192,284,1,0,0,0,1193,1194,3,63, - 24,0,1194,1195,1,0,0,0,1195,1196,6,135,16,0,1196,1197,6,135,11,0,1197,1198, - 6,135,11,0,1198,286,1,0,0,0,1199,1200,3,97,41,0,1200,1201,1,0,0,0,1201, - 1202,6,136,19,0,1202,288,1,0,0,0,1203,1204,3,101,43,0,1204,1205,1,0,0,0, - 1205,1206,6,137,18,0,1206,290,1,0,0,0,1207,1208,3,105,45,0,1208,1209,1, - 0,0,0,1209,1210,6,138,22,0,1210,292,1,0,0,0,1211,1212,3,271,128,0,1212, - 1213,1,0,0,0,1213,1214,6,139,29,0,1214,294,1,0,0,0,1215,1216,3,235,110, - 0,1216,1217,1,0,0,0,1217,1218,6,140,25,0,1218,296,1,0,0,0,1219,1220,3,175, - 80,0,1220,1221,1,0,0,0,1221,1222,6,141,30,0,1222,298,1,0,0,0,1223,1224, - 4,142,8,0,1224,1225,3,129,57,0,1225,1226,1,0,0,0,1226,1227,6,142,23,0,1227, - 300,1,0,0,0,1228,1229,4,143,9,0,1229,1230,3,165,75,0,1230,1231,1,0,0,0, - 1231,1232,6,143,24,0,1232,302,1,0,0,0,1233,1234,3,55,20,0,1234,1235,1,0, - 0,0,1235,1236,6,144,10,0,1236,304,1,0,0,0,1237,1238,3,57,21,0,1238,1239, - 1,0,0,0,1239,1240,6,145,10,0,1240,306,1,0,0,0,1241,1242,3,59,22,0,1242, - 1243,1,0,0,0,1243,1244,6,146,10,0,1244,308,1,0,0,0,1245,1246,3,63,24,0, - 1246,1247,1,0,0,0,1247,1248,6,147,16,0,1248,1249,6,147,11,0,1249,310,1, - 0,0,0,1250,1251,3,105,45,0,1251,1252,1,0,0,0,1252,1253,6,148,22,0,1253, - 312,1,0,0,0,1254,1255,4,149,10,0,1255,1256,3,129,57,0,1256,1257,1,0,0,0, - 1257,1258,6,149,23,0,1258,314,1,0,0,0,1259,1260,4,150,11,0,1260,1261,3, - 165,75,0,1261,1262,1,0,0,0,1262,1263,6,150,24,0,1263,316,1,0,0,0,1264,1265, - 3,175,80,0,1265,1266,1,0,0,0,1266,1267,6,151,30,0,1267,318,1,0,0,0,1268, - 1269,3,171,78,0,1269,1270,1,0,0,0,1270,1271,6,152,31,0,1271,320,1,0,0,0, - 1272,1273,3,55,20,0,1273,1274,1,0,0,0,1274,1275,6,153,10,0,1275,322,1,0, - 0,0,1276,1277,3,57,21,0,1277,1278,1,0,0,0,1278,1279,6,154,10,0,1279,324, - 1,0,0,0,1280,1281,3,59,22,0,1281,1282,1,0,0,0,1282,1283,6,155,10,0,1283, - 326,1,0,0,0,1284,1285,3,63,24,0,1285,1286,1,0,0,0,1286,1287,6,156,16,0, - 1287,1288,6,156,11,0,1288,328,1,0,0,0,1289,1290,7,1,0,0,1290,1291,7,9,0, - 0,1291,1292,7,15,0,0,1292,1293,7,7,0,0,1293,330,1,0,0,0,1294,1295,3,55, - 20,0,1295,1296,1,0,0,0,1296,1297,6,158,10,0,1297,332,1,0,0,0,1298,1299, - 3,57,21,0,1299,1300,1,0,0,0,1300,1301,6,159,10,0,1301,334,1,0,0,0,1302, - 1303,3,59,22,0,1303,1304,1,0,0,0,1304,1305,6,160,10,0,1305,336,1,0,0,0, - 1306,1307,3,169,77,0,1307,1308,1,0,0,0,1308,1309,6,161,17,0,1309,1310,6, - 161,11,0,1310,338,1,0,0,0,1311,1312,3,61,23,0,1312,1313,1,0,0,0,1313,1314, - 6,162,12,0,1314,340,1,0,0,0,1315,1321,3,75,30,0,1316,1321,3,65,25,0,1317, - 1321,3,105,45,0,1318,1321,3,67,26,0,1319,1321,3,81,33,0,1320,1315,1,0,0, - 0,1320,1316,1,0,0,0,1320,1317,1,0,0,0,1320,1318,1,0,0,0,1320,1319,1,0,0, - 0,1321,1322,1,0,0,0,1322,1320,1,0,0,0,1322,1323,1,0,0,0,1323,342,1,0,0, - 0,1324,1325,3,55,20,0,1325,1326,1,0,0,0,1326,1327,6,164,10,0,1327,344,1, - 0,0,0,1328,1329,3,57,21,0,1329,1330,1,0,0,0,1330,1331,6,165,10,0,1331,346, - 1,0,0,0,1332,1333,3,59,22,0,1333,1334,1,0,0,0,1334,1335,6,166,10,0,1335, - 348,1,0,0,0,1336,1337,3,63,24,0,1337,1338,1,0,0,0,1338,1339,6,167,16,0, - 1339,1340,6,167,11,0,1340,350,1,0,0,0,1341,1342,3,61,23,0,1342,1343,1,0, - 0,0,1343,1344,6,168,12,0,1344,352,1,0,0,0,1345,1346,3,101,43,0,1346,1347, - 1,0,0,0,1347,1348,6,169,18,0,1348,354,1,0,0,0,1349,1350,3,105,45,0,1350, - 1351,1,0,0,0,1351,1352,6,170,22,0,1352,356,1,0,0,0,1353,1354,3,269,127, - 0,1354,1355,1,0,0,0,1355,1356,6,171,32,0,1356,1357,6,171,33,0,1357,358, - 1,0,0,0,1358,1359,3,209,97,0,1359,1360,1,0,0,0,1360,1361,6,172,20,0,1361, - 360,1,0,0,0,1362,1363,3,85,35,0,1363,1364,1,0,0,0,1364,1365,6,173,21,0, - 1365,362,1,0,0,0,1366,1367,3,55,20,0,1367,1368,1,0,0,0,1368,1369,6,174, - 10,0,1369,364,1,0,0,0,1370,1371,3,57,21,0,1371,1372,1,0,0,0,1372,1373,6, - 175,10,0,1373,366,1,0,0,0,1374,1375,3,59,22,0,1375,1376,1,0,0,0,1376,1377, - 6,176,10,0,1377,368,1,0,0,0,1378,1379,3,63,24,0,1379,1380,1,0,0,0,1380, - 1381,6,177,16,0,1381,1382,6,177,11,0,1382,1383,6,177,11,0,1383,370,1,0, - 0,0,1384,1385,3,101,43,0,1385,1386,1,0,0,0,1386,1387,6,178,18,0,1387,372, - 1,0,0,0,1388,1389,3,105,45,0,1389,1390,1,0,0,0,1390,1391,6,179,22,0,1391, - 374,1,0,0,0,1392,1393,3,235,110,0,1393,1394,1,0,0,0,1394,1395,6,180,25, - 0,1395,376,1,0,0,0,1396,1397,3,55,20,0,1397,1398,1,0,0,0,1398,1399,6,181, - 10,0,1399,378,1,0,0,0,1400,1401,3,57,21,0,1401,1402,1,0,0,0,1402,1403,6, - 182,10,0,1403,380,1,0,0,0,1404,1405,3,59,22,0,1405,1406,1,0,0,0,1406,1407, - 6,183,10,0,1407,382,1,0,0,0,1408,1409,3,63,24,0,1409,1410,1,0,0,0,1410, - 1411,6,184,16,0,1411,1412,6,184,11,0,1412,384,1,0,0,0,1413,1414,3,209,97, - 0,1414,1415,1,0,0,0,1415,1416,6,185,20,0,1416,1417,6,185,11,0,1417,1418, - 6,185,34,0,1418,386,1,0,0,0,1419,1420,3,85,35,0,1420,1421,1,0,0,0,1421, - 1422,6,186,21,0,1422,1423,6,186,11,0,1423,1424,6,186,34,0,1424,388,1,0, - 0,0,1425,1426,3,55,20,0,1426,1427,1,0,0,0,1427,1428,6,187,10,0,1428,390, - 1,0,0,0,1429,1430,3,57,21,0,1430,1431,1,0,0,0,1431,1432,6,188,10,0,1432, - 392,1,0,0,0,1433,1434,3,59,22,0,1434,1435,1,0,0,0,1435,1436,6,189,10,0, - 1436,394,1,0,0,0,1437,1438,3,61,23,0,1438,1439,1,0,0,0,1439,1440,6,190, - 12,0,1440,1441,6,190,11,0,1441,1442,6,190,9,0,1442,396,1,0,0,0,1443,1444, - 3,101,43,0,1444,1445,1,0,0,0,1445,1446,6,191,18,0,1446,1447,6,191,11,0, - 1447,1448,6,191,9,0,1448,398,1,0,0,0,1449,1450,3,55,20,0,1450,1451,1,0, - 0,0,1451,1452,6,192,10,0,1452,400,1,0,0,0,1453,1454,3,57,21,0,1454,1455, - 1,0,0,0,1455,1456,6,193,10,0,1456,402,1,0,0,0,1457,1458,3,59,22,0,1458, - 1459,1,0,0,0,1459,1460,6,194,10,0,1460,404,1,0,0,0,1461,1462,3,175,80,0, - 1462,1463,1,0,0,0,1463,1464,6,195,11,0,1464,1465,6,195,0,0,1465,1466,6, - 195,30,0,1466,406,1,0,0,0,1467,1468,3,171,78,0,1468,1469,1,0,0,0,1469,1470, - 6,196,11,0,1470,1471,6,196,0,0,1471,1472,6,196,31,0,1472,408,1,0,0,0,1473, - 1474,3,91,38,0,1474,1475,1,0,0,0,1475,1476,6,197,11,0,1476,1477,6,197,0, - 0,1477,1478,6,197,35,0,1478,410,1,0,0,0,1479,1480,3,63,24,0,1480,1481,1, - 0,0,0,1481,1482,6,198,16,0,1482,1483,6,198,11,0,1483,412,1,0,0,0,65,0,1, - 2,3,4,5,6,7,8,9,10,11,12,13,14,581,591,595,598,607,609,620,641,646,655, - 662,667,669,680,688,691,693,698,703,709,716,721,727,730,738,742,873,878, - 885,887,903,908,913,915,921,998,1003,1052,1056,1061,1066,1071,1073,1077, - 1079,1166,1170,1175,1320,1322,36,5,1,0,5,4,0,5,6,0,5,2,0,5,3,0,5,8,0,5, - 5,0,5,9,0,5,11,0,5,13,0,0,1,0,4,0,0,7,24,0,7,16,0,7,65,0,5,0,0,7,25,0,7, - 66,0,7,34,0,7,32,0,7,76,0,7,26,0,7,36,0,7,48,0,7,64,0,7,80,0,5,10,0,5,7, - 0,7,90,0,7,89,0,7,68,0,7,67,0,7,88,0,5,12,0,5,14,0,7,29,0]; + 2,199,7,199,2,200,7,200,2,201,7,201,2,202,7,202,2,203,7,203,2,204,7,204, + 2,205,7,205,2,206,7,206,2,207,7,207,2,208,7,208,2,209,7,209,2,210,7,210, + 2,211,7,211,2,212,7,212,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3, + 1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5, + 1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8, + 1,8,1,8,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9, + 1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1, + 11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13, + 1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1, + 15,1,15,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16, + 1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1,19, + 1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,21,1,21,1, + 21,1,21,1,21,1,21,1,21,1,21,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22, + 1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,24,4,24,654,8,24,11, + 24,12,24,655,1,24,1,24,1,25,1,25,1,25,1,25,5,25,664,8,25,10,25,12,25,667, + 9,25,1,25,3,25,670,8,25,1,25,3,25,673,8,25,1,25,1,25,1,26,1,26,1,26,1,26, + 1,26,5,26,682,8,26,10,26,12,26,685,9,26,1,26,1,26,1,26,1,26,1,26,1,27,4, + 27,693,8,27,11,27,12,27,694,1,27,1,27,1,28,1,28,1,28,1,28,1,29,1,29,1,30, + 1,30,1,31,1,31,1,31,1,32,1,32,1,33,1,33,3,33,714,8,33,1,33,4,33,717,8,33, + 11,33,12,33,718,1,34,1,34,1,35,1,35,1,36,1,36,1,36,3,36,728,8,36,1,37,1, + 37,1,38,1,38,1,38,3,38,735,8,38,1,39,1,39,1,39,5,39,740,8,39,10,39,12,39, + 743,9,39,1,39,1,39,1,39,1,39,1,39,1,39,5,39,751,8,39,10,39,12,39,754,9, + 39,1,39,1,39,1,39,1,39,1,39,3,39,761,8,39,1,39,3,39,764,8,39,3,39,766,8, + 39,1,40,4,40,769,8,40,11,40,12,40,770,1,41,4,41,774,8,41,11,41,12,41,775, + 1,41,1,41,5,41,780,8,41,10,41,12,41,783,9,41,1,41,1,41,4,41,787,8,41,11, + 41,12,41,788,1,41,4,41,792,8,41,11,41,12,41,793,1,41,1,41,5,41,798,8,41, + 10,41,12,41,801,9,41,3,41,803,8,41,1,41,1,41,1,41,1,41,4,41,809,8,41,11, + 41,12,41,810,1,41,1,41,3,41,815,8,41,1,42,1,42,1,42,1,43,1,43,1,43,1,43, + 1,44,1,44,1,44,1,44,1,45,1,45,1,46,1,46,1,46,1,47,1,47,1,48,1,48,1,49,1, + 49,1,49,1,49,1,49,1,50,1,50,1,51,1,51,1,51,1,51,1,51,1,51,1,52,1,52,1,52, + 1,52,1,52,1,52,1,53,1,53,1,53,1,54,1,54,1,54,1,55,1,55,1,55,1,55,1,55,1, + 56,1,56,1,56,1,56,1,56,1,57,1,57,1,58,1,58,1,58,1,58,1,59,1,59,1,59,1,59, + 1,59,1,60,1,60,1,60,1,60,1,60,1,60,1,61,1,61,1,61,1,62,1,62,1,63,1,63,1, + 63,1,63,1,63,1,63,1,64,1,64,1,65,1,65,1,65,1,65,1,65,1,66,1,66,1,66,1,67, + 1,67,1,67,1,68,1,68,1,68,1,69,1,69,1,70,1,70,1,70,1,71,1,71,1,72,1,72,1, + 72,1,73,1,73,1,74,1,74,1,75,1,75,1,76,1,76,1,77,1,77,1,78,1,78,1,78,1,78, + 1,79,1,79,1,79,3,79,943,8,79,1,79,5,79,946,8,79,10,79,12,79,949,9,79,1, + 79,1,79,4,79,953,8,79,11,79,12,79,954,3,79,957,8,79,1,80,1,80,1,80,1,80, + 1,80,1,81,1,81,1,81,1,81,1,81,1,82,1,82,5,82,971,8,82,10,82,12,82,974,9, + 82,1,82,1,82,3,82,978,8,82,1,82,4,82,981,8,82,11,82,12,82,982,3,82,985, + 8,82,1,83,1,83,4,83,989,8,83,11,83,12,83,990,1,83,1,83,1,84,1,84,1,85,1, + 85,1,85,1,85,1,86,1,86,1,86,1,86,1,87,1,87,1,87,1,87,1,88,1,88,1,88,1,88, + 1,88,1,89,1,89,1,89,1,89,1,89,1,90,1,90,1,90,1,90,1,91,1,91,1,91,1,91,1, + 92,1,92,1,92,1,92,1,93,1,93,1,93,1,93,1,93,1,94,1,94,1,94,1,94,1,95,1,95, + 1,95,1,95,1,96,1,96,1,96,1,96,1,97,1,97,1,97,1,97,1,98,1,98,1,98,1,98,1, + 99,1,99,1,99,1,99,1,99,1,99,1,99,1,99,1,99,1,100,1,100,1,100,3,100,1068, + 8,100,1,101,4,101,1071,8,101,11,101,12,101,1072,1,102,1,102,1,102,1,102, + 1,103,1,103,1,103,1,103,1,104,1,104,1,104,1,104,1,105,1,105,1,105,1,105, + 1,106,1,106,1,106,1,106,1,107,1,107,1,107,1,107,1,107,1,108,1,108,1,108, + 1,108,1,109,1,109,1,109,1,109,1,110,1,110,1,110,1,110,1,110,1,111,1,111, + 1,111,1,111,1,111,1,112,1,112,1,112,1,112,3,112,1122,8,112,1,113,1,113, + 3,113,1126,8,113,1,113,5,113,1129,8,113,10,113,12,113,1132,9,113,1,113, + 1,113,3,113,1136,8,113,1,113,4,113,1139,8,113,11,113,12,113,1140,3,113, + 1143,8,113,1,114,1,114,4,114,1147,8,114,11,114,12,114,1148,1,115,1,115, + 1,115,1,115,1,116,1,116,1,116,1,116,1,117,1,117,1,117,1,117,1,118,1,118, + 1,118,1,118,1,118,1,119,1,119,1,119,1,119,1,120,1,120,1,120,1,120,1,121, + 1,121,1,121,1,121,1,122,1,122,1,122,1,122,1,122,1,123,1,123,1,123,1,123, + 1,123,1,124,1,124,1,124,1,125,1,125,1,125,1,125,1,126,1,126,1,126,1,126, + 1,127,1,127,1,127,1,127,1,128,1,128,1,128,1,128,1,129,1,129,1,129,1,129, + 1,129,1,130,1,130,1,130,1,130,1,130,1,131,1,131,1,131,1,131,1,131,1,132, + 1,132,1,132,1,132,1,132,1,132,1,132,1,133,1,133,1,134,4,134,1234,8,134, + 11,134,12,134,1235,1,134,1,134,3,134,1240,8,134,1,134,4,134,1243,8,134, + 11,134,12,134,1244,1,135,1,135,1,135,1,135,1,136,1,136,1,136,1,136,1,137, + 1,137,1,137,1,137,1,138,1,138,1,138,1,138,1,139,1,139,1,139,1,139,1,139, + 1,139,1,140,1,140,1,140,1,140,1,141,1,141,1,141,1,141,1,142,1,142,1,142, + 1,142,1,143,1,143,1,143,1,143,1,144,1,144,1,144,1,144,1,145,1,145,1,145, + 1,145,1,146,1,146,1,146,1,146,1,146,1,147,1,147,1,147,1,147,1,147,1,148, + 1,148,1,148,1,148,1,149,1,149,1,149,1,149,1,150,1,150,1,150,1,150,1,151, + 1,151,1,151,1,151,1,151,1,152,1,152,1,152,1,152,1,153,1,153,1,153,1,153, + 1,153,1,154,1,154,1,154,1,154,1,154,1,155,1,155,1,155,1,155,1,156,1,156, + 1,156,1,156,1,157,1,157,1,157,1,157,1,158,1,158,1,158,1,158,1,159,1,159, + 1,159,1,159,1,160,1,160,1,160,1,160,1,160,1,161,1,161,1,161,1,161,1,161, + 1,162,1,162,1,162,1,162,1,163,1,163,1,163,1,163,1,164,1,164,1,164,1,164, + 1,165,1,165,1,165,1,165,1,165,1,166,1,166,1,166,1,166,1,167,1,167,1,167, + 1,167,1,167,4,167,1390,8,167,11,167,12,167,1391,1,168,1,168,1,168,1,168, + 1,169,1,169,1,169,1,169,1,170,1,170,1,170,1,170,1,171,1,171,1,171,1,171, + 1,171,1,172,1,172,1,172,1,172,1,173,1,173,1,173,1,173,1,174,1,174,1,174, + 1,174,1,175,1,175,1,175,1,175,1,175,1,176,1,176,1,176,1,176,1,177,1,177, + 1,177,1,177,1,178,1,178,1,178,1,178,1,179,1,179,1,179,1,179,1,180,1,180, + 1,180,1,180,1,181,1,181,1,181,1,181,1,181,1,181,1,182,1,182,1,182,1,182, + 1,183,1,183,1,183,1,183,1,184,1,184,1,184,1,184,1,185,1,185,1,185,1,185, + 1,186,1,186,1,186,1,186,1,187,1,187,1,187,1,187,1,188,1,188,1,188,1,188, + 1,188,1,189,1,189,1,189,1,189,1,190,1,190,1,190,1,190,1,191,1,191,1,191, + 1,191,1,191,1,191,1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192, + 1,193,1,193,1,193,1,193,1,194,1,194,1,194,1,194,1,195,1,195,1,195,1,195, + 1,196,1,196,1,196,1,196,1,197,1,197,1,197,1,197,1,198,1,198,1,198,1,198, + 1,198,1,199,1,199,1,199,1,199,1,199,1,199,1,200,1,200,1,200,1,200,1,200, + 1,200,1,201,1,201,1,201,1,201,1,202,1,202,1,202,1,202,1,203,1,203,1,203, + 1,203,1,204,1,204,1,204,1,204,1,204,1,204,1,205,1,205,1,205,1,205,1,205, + 1,205,1,206,1,206,1,206,1,206,1,207,1,207,1,207,1,207,1,208,1,208,1,208, + 1,208,1,209,1,209,1,209,1,209,1,209,1,209,1,210,1,210,1,210,1,210,1,210, + 1,210,1,211,1,211,1,211,1,211,1,211,1,211,1,212,1,212,1,212,1,212,1,212, + 2,683,752,0,213,16,1,18,2,20,3,22,4,24,5,26,6,28,7,30,8,32,9,34,10,36,11, + 38,12,40,13,42,14,44,15,46,16,48,17,50,18,52,19,54,20,56,21,58,22,60,23, + 62,24,64,25,66,26,68,27,70,28,72,29,74,0,76,0,78,0,80,0,82,0,84,0,86,0, + 88,0,90,0,92,0,94,30,96,31,98,32,100,33,102,34,104,35,106,36,108,37,110, + 38,112,39,114,40,116,41,118,42,120,43,122,44,124,45,126,46,128,47,130,48, + 132,49,134,50,136,51,138,52,140,53,142,54,144,55,146,56,148,57,150,58,152, + 59,154,60,156,61,158,62,160,63,162,64,164,65,166,66,168,67,170,68,172,0, + 174,69,176,70,178,71,180,72,182,0,184,73,186,74,188,75,190,76,192,0,194, + 0,196,77,198,78,200,79,202,0,204,0,206,0,208,0,210,0,212,0,214,80,216,0, + 218,81,220,0,222,0,224,82,226,83,228,84,230,0,232,0,234,0,236,0,238,0,240, + 0,242,0,244,85,246,86,248,87,250,88,252,0,254,0,256,0,258,0,260,0,262,0, + 264,89,266,0,268,90,270,91,272,92,274,0,276,0,278,93,280,94,282,0,284,95, + 286,0,288,96,290,97,292,98,294,0,296,0,298,0,300,0,302,0,304,0,306,0,308, + 0,310,0,312,99,314,100,316,101,318,0,320,0,322,0,324,0,326,0,328,0,330, + 102,332,103,334,104,336,0,338,105,340,106,342,107,344,108,346,0,348,0,350, + 109,352,110,354,111,356,112,358,0,360,0,362,0,364,0,366,0,368,0,370,0,372, + 113,374,114,376,115,378,0,380,0,382,0,384,0,386,116,388,117,390,118,392, + 0,394,0,396,0,398,0,400,119,402,0,404,0,406,120,408,121,410,122,412,0,414, + 0,416,0,418,123,420,124,422,125,424,0,426,0,428,126,430,127,432,128,434, + 0,436,0,438,0,440,0,16,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,36,2,0,68, + 68,100,100,2,0,73,73,105,105,2,0,83,83,115,115,2,0,69,69,101,101,2,0,67, + 67,99,99,2,0,84,84,116,116,2,0,82,82,114,114,2,0,79,79,111,111,2,0,80,80, + 112,112,2,0,78,78,110,110,2,0,72,72,104,104,2,0,86,86,118,118,2,0,65,65, + 97,97,2,0,76,76,108,108,2,0,88,88,120,120,2,0,70,70,102,102,2,0,77,77,109, + 109,2,0,71,71,103,103,2,0,75,75,107,107,2,0,87,87,119,119,2,0,85,85,117, + 117,2,0,74,74,106,106,6,0,9,10,13,13,32,32,47,47,91,91,93,93,2,0,10,10, + 13,13,3,0,9,10,13,13,32,32,1,0,48,57,2,0,65,90,97,122,8,0,34,34,78,78,82, + 82,84,84,92,92,110,110,114,114,116,116,4,0,10,10,13,13,34,34,92,92,2,0, + 43,43,45,45,1,0,96,96,2,0,66,66,98,98,2,0,89,89,121,121,11,0,9,10,13,13, + 32,32,34,34,44,44,47,47,58,58,61,61,91,91,93,93,124,124,2,0,42,42,47,47, + 11,0,9,10,13,13,32,32,34,35,44,44,47,47,58,58,60,60,62,63,92,92,124,124, + 1628,0,16,1,0,0,0,0,18,1,0,0,0,0,20,1,0,0,0,0,22,1,0,0,0,0,24,1,0,0,0,0, + 26,1,0,0,0,0,28,1,0,0,0,0,30,1,0,0,0,0,32,1,0,0,0,0,34,1,0,0,0,0,36,1,0, + 0,0,0,38,1,0,0,0,0,40,1,0,0,0,0,42,1,0,0,0,0,44,1,0,0,0,0,46,1,0,0,0,0, + 48,1,0,0,0,0,50,1,0,0,0,0,52,1,0,0,0,0,54,1,0,0,0,0,56,1,0,0,0,0,58,1,0, + 0,0,0,60,1,0,0,0,0,62,1,0,0,0,0,64,1,0,0,0,0,66,1,0,0,0,0,68,1,0,0,0,0, + 70,1,0,0,0,1,72,1,0,0,0,1,94,1,0,0,0,1,96,1,0,0,0,1,98,1,0,0,0,1,100,1, + 0,0,0,1,102,1,0,0,0,1,104,1,0,0,0,1,106,1,0,0,0,1,108,1,0,0,0,1,110,1,0, + 0,0,1,112,1,0,0,0,1,114,1,0,0,0,1,116,1,0,0,0,1,118,1,0,0,0,1,120,1,0,0, + 0,1,122,1,0,0,0,1,124,1,0,0,0,1,126,1,0,0,0,1,128,1,0,0,0,1,130,1,0,0,0, + 1,132,1,0,0,0,1,134,1,0,0,0,1,136,1,0,0,0,1,138,1,0,0,0,1,140,1,0,0,0,1, + 142,1,0,0,0,1,144,1,0,0,0,1,146,1,0,0,0,1,148,1,0,0,0,1,150,1,0,0,0,1,152, + 1,0,0,0,1,154,1,0,0,0,1,156,1,0,0,0,1,158,1,0,0,0,1,160,1,0,0,0,1,162,1, + 0,0,0,1,164,1,0,0,0,1,166,1,0,0,0,1,168,1,0,0,0,1,170,1,0,0,0,1,172,1,0, + 0,0,1,174,1,0,0,0,1,176,1,0,0,0,1,178,1,0,0,0,1,180,1,0,0,0,1,184,1,0,0, + 0,1,186,1,0,0,0,1,188,1,0,0,0,1,190,1,0,0,0,2,192,1,0,0,0,2,194,1,0,0,0, + 2,196,1,0,0,0,2,198,1,0,0,0,2,200,1,0,0,0,3,202,1,0,0,0,3,204,1,0,0,0,3, + 206,1,0,0,0,3,208,1,0,0,0,3,210,1,0,0,0,3,212,1,0,0,0,3,214,1,0,0,0,3,218, + 1,0,0,0,3,220,1,0,0,0,3,222,1,0,0,0,3,224,1,0,0,0,3,226,1,0,0,0,3,228,1, + 0,0,0,4,230,1,0,0,0,4,232,1,0,0,0,4,234,1,0,0,0,4,236,1,0,0,0,4,238,1,0, + 0,0,4,244,1,0,0,0,4,246,1,0,0,0,4,248,1,0,0,0,4,250,1,0,0,0,5,252,1,0,0, + 0,5,254,1,0,0,0,5,256,1,0,0,0,5,258,1,0,0,0,5,260,1,0,0,0,5,262,1,0,0,0, + 5,264,1,0,0,0,5,266,1,0,0,0,5,268,1,0,0,0,5,270,1,0,0,0,5,272,1,0,0,0,6, + 274,1,0,0,0,6,276,1,0,0,0,6,278,1,0,0,0,6,280,1,0,0,0,6,284,1,0,0,0,6,286, + 1,0,0,0,6,288,1,0,0,0,6,290,1,0,0,0,6,292,1,0,0,0,7,294,1,0,0,0,7,296,1, + 0,0,0,7,298,1,0,0,0,7,300,1,0,0,0,7,302,1,0,0,0,7,304,1,0,0,0,7,306,1,0, + 0,0,7,308,1,0,0,0,7,310,1,0,0,0,7,312,1,0,0,0,7,314,1,0,0,0,7,316,1,0,0, + 0,8,318,1,0,0,0,8,320,1,0,0,0,8,322,1,0,0,0,8,324,1,0,0,0,8,326,1,0,0,0, + 8,328,1,0,0,0,8,330,1,0,0,0,8,332,1,0,0,0,8,334,1,0,0,0,9,336,1,0,0,0,9, + 338,1,0,0,0,9,340,1,0,0,0,9,342,1,0,0,0,9,344,1,0,0,0,10,346,1,0,0,0,10, + 348,1,0,0,0,10,350,1,0,0,0,10,352,1,0,0,0,10,354,1,0,0,0,10,356,1,0,0,0, + 11,358,1,0,0,0,11,360,1,0,0,0,11,362,1,0,0,0,11,364,1,0,0,0,11,366,1,0, + 0,0,11,368,1,0,0,0,11,370,1,0,0,0,11,372,1,0,0,0,11,374,1,0,0,0,11,376, + 1,0,0,0,12,378,1,0,0,0,12,380,1,0,0,0,12,382,1,0,0,0,12,384,1,0,0,0,12, + 386,1,0,0,0,12,388,1,0,0,0,12,390,1,0,0,0,13,392,1,0,0,0,13,394,1,0,0,0, + 13,396,1,0,0,0,13,398,1,0,0,0,13,400,1,0,0,0,13,402,1,0,0,0,13,404,1,0, + 0,0,13,406,1,0,0,0,13,408,1,0,0,0,13,410,1,0,0,0,14,412,1,0,0,0,14,414, + 1,0,0,0,14,416,1,0,0,0,14,418,1,0,0,0,14,420,1,0,0,0,14,422,1,0,0,0,15, + 424,1,0,0,0,15,426,1,0,0,0,15,428,1,0,0,0,15,430,1,0,0,0,15,432,1,0,0,0, + 15,434,1,0,0,0,15,436,1,0,0,0,15,438,1,0,0,0,15,440,1,0,0,0,16,442,1,0, + 0,0,18,452,1,0,0,0,20,459,1,0,0,0,22,468,1,0,0,0,24,475,1,0,0,0,26,485, + 1,0,0,0,28,492,1,0,0,0,30,499,1,0,0,0,32,506,1,0,0,0,34,514,1,0,0,0,36, + 526,1,0,0,0,38,535,1,0,0,0,40,541,1,0,0,0,42,548,1,0,0,0,44,555,1,0,0,0, + 46,563,1,0,0,0,48,571,1,0,0,0,50,586,1,0,0,0,52,598,1,0,0,0,54,609,1,0, + 0,0,56,617,1,0,0,0,58,625,1,0,0,0,60,633,1,0,0,0,62,642,1,0,0,0,64,653, + 1,0,0,0,66,659,1,0,0,0,68,676,1,0,0,0,70,692,1,0,0,0,72,698,1,0,0,0,74, + 702,1,0,0,0,76,704,1,0,0,0,78,706,1,0,0,0,80,709,1,0,0,0,82,711,1,0,0,0, + 84,720,1,0,0,0,86,722,1,0,0,0,88,727,1,0,0,0,90,729,1,0,0,0,92,734,1,0, + 0,0,94,765,1,0,0,0,96,768,1,0,0,0,98,814,1,0,0,0,100,816,1,0,0,0,102,819, + 1,0,0,0,104,823,1,0,0,0,106,827,1,0,0,0,108,829,1,0,0,0,110,832,1,0,0,0, + 112,834,1,0,0,0,114,836,1,0,0,0,116,841,1,0,0,0,118,843,1,0,0,0,120,849, + 1,0,0,0,122,855,1,0,0,0,124,858,1,0,0,0,126,861,1,0,0,0,128,866,1,0,0,0, + 130,871,1,0,0,0,132,873,1,0,0,0,134,877,1,0,0,0,136,882,1,0,0,0,138,888, + 1,0,0,0,140,891,1,0,0,0,142,893,1,0,0,0,144,899,1,0,0,0,146,901,1,0,0,0, + 148,906,1,0,0,0,150,909,1,0,0,0,152,912,1,0,0,0,154,915,1,0,0,0,156,917, + 1,0,0,0,158,920,1,0,0,0,160,922,1,0,0,0,162,925,1,0,0,0,164,927,1,0,0,0, + 166,929,1,0,0,0,168,931,1,0,0,0,170,933,1,0,0,0,172,935,1,0,0,0,174,956, + 1,0,0,0,176,958,1,0,0,0,178,963,1,0,0,0,180,984,1,0,0,0,182,986,1,0,0,0, + 184,994,1,0,0,0,186,996,1,0,0,0,188,1000,1,0,0,0,190,1004,1,0,0,0,192,1008, + 1,0,0,0,194,1013,1,0,0,0,196,1018,1,0,0,0,198,1022,1,0,0,0,200,1026,1,0, + 0,0,202,1030,1,0,0,0,204,1035,1,0,0,0,206,1039,1,0,0,0,208,1043,1,0,0,0, + 210,1047,1,0,0,0,212,1051,1,0,0,0,214,1055,1,0,0,0,216,1067,1,0,0,0,218, + 1070,1,0,0,0,220,1074,1,0,0,0,222,1078,1,0,0,0,224,1082,1,0,0,0,226,1086, + 1,0,0,0,228,1090,1,0,0,0,230,1094,1,0,0,0,232,1099,1,0,0,0,234,1103,1,0, + 0,0,236,1107,1,0,0,0,238,1112,1,0,0,0,240,1121,1,0,0,0,242,1142,1,0,0,0, + 244,1146,1,0,0,0,246,1150,1,0,0,0,248,1154,1,0,0,0,250,1158,1,0,0,0,252, + 1162,1,0,0,0,254,1167,1,0,0,0,256,1171,1,0,0,0,258,1175,1,0,0,0,260,1179, + 1,0,0,0,262,1184,1,0,0,0,264,1189,1,0,0,0,266,1192,1,0,0,0,268,1196,1,0, + 0,0,270,1200,1,0,0,0,272,1204,1,0,0,0,274,1208,1,0,0,0,276,1213,1,0,0,0, + 278,1218,1,0,0,0,280,1223,1,0,0,0,282,1230,1,0,0,0,284,1239,1,0,0,0,286, + 1246,1,0,0,0,288,1250,1,0,0,0,290,1254,1,0,0,0,292,1258,1,0,0,0,294,1262, + 1,0,0,0,296,1268,1,0,0,0,298,1272,1,0,0,0,300,1276,1,0,0,0,302,1280,1,0, + 0,0,304,1284,1,0,0,0,306,1288,1,0,0,0,308,1292,1,0,0,0,310,1297,1,0,0,0, + 312,1302,1,0,0,0,314,1306,1,0,0,0,316,1310,1,0,0,0,318,1314,1,0,0,0,320, + 1319,1,0,0,0,322,1323,1,0,0,0,324,1328,1,0,0,0,326,1333,1,0,0,0,328,1337, + 1,0,0,0,330,1341,1,0,0,0,332,1345,1,0,0,0,334,1349,1,0,0,0,336,1353,1,0, + 0,0,338,1358,1,0,0,0,340,1363,1,0,0,0,342,1367,1,0,0,0,344,1371,1,0,0,0, + 346,1375,1,0,0,0,348,1380,1,0,0,0,350,1389,1,0,0,0,352,1393,1,0,0,0,354, + 1397,1,0,0,0,356,1401,1,0,0,0,358,1405,1,0,0,0,360,1410,1,0,0,0,362,1414, + 1,0,0,0,364,1418,1,0,0,0,366,1422,1,0,0,0,368,1427,1,0,0,0,370,1431,1,0, + 0,0,372,1435,1,0,0,0,374,1439,1,0,0,0,376,1443,1,0,0,0,378,1447,1,0,0,0, + 380,1453,1,0,0,0,382,1457,1,0,0,0,384,1461,1,0,0,0,386,1465,1,0,0,0,388, + 1469,1,0,0,0,390,1473,1,0,0,0,392,1477,1,0,0,0,394,1482,1,0,0,0,396,1486, + 1,0,0,0,398,1490,1,0,0,0,400,1496,1,0,0,0,402,1505,1,0,0,0,404,1509,1,0, + 0,0,406,1513,1,0,0,0,408,1517,1,0,0,0,410,1521,1,0,0,0,412,1525,1,0,0,0, + 414,1530,1,0,0,0,416,1536,1,0,0,0,418,1542,1,0,0,0,420,1546,1,0,0,0,422, + 1550,1,0,0,0,424,1554,1,0,0,0,426,1560,1,0,0,0,428,1566,1,0,0,0,430,1570, + 1,0,0,0,432,1574,1,0,0,0,434,1578,1,0,0,0,436,1584,1,0,0,0,438,1590,1,0, + 0,0,440,1596,1,0,0,0,442,443,7,0,0,0,443,444,7,1,0,0,444,445,7,2,0,0,445, + 446,7,2,0,0,446,447,7,3,0,0,447,448,7,4,0,0,448,449,7,5,0,0,449,450,1,0, + 0,0,450,451,6,0,0,0,451,17,1,0,0,0,452,453,7,0,0,0,453,454,7,6,0,0,454, + 455,7,7,0,0,455,456,7,8,0,0,456,457,1,0,0,0,457,458,6,1,1,0,458,19,1,0, + 0,0,459,460,7,3,0,0,460,461,7,9,0,0,461,462,7,6,0,0,462,463,7,1,0,0,463, + 464,7,4,0,0,464,465,7,10,0,0,465,466,1,0,0,0,466,467,6,2,2,0,467,21,1,0, + 0,0,468,469,7,3,0,0,469,470,7,11,0,0,470,471,7,12,0,0,471,472,7,13,0,0, + 472,473,1,0,0,0,473,474,6,3,0,0,474,23,1,0,0,0,475,476,7,3,0,0,476,477, + 7,14,0,0,477,478,7,8,0,0,478,479,7,13,0,0,479,480,7,12,0,0,480,481,7,1, + 0,0,481,482,7,9,0,0,482,483,1,0,0,0,483,484,6,4,3,0,484,25,1,0,0,0,485, + 486,7,15,0,0,486,487,7,6,0,0,487,488,7,7,0,0,488,489,7,16,0,0,489,490,1, + 0,0,0,490,491,6,5,4,0,491,27,1,0,0,0,492,493,7,17,0,0,493,494,7,6,0,0,494, + 495,7,7,0,0,495,496,7,18,0,0,496,497,1,0,0,0,497,498,6,6,0,0,498,29,1,0, + 0,0,499,500,7,18,0,0,500,501,7,3,0,0,501,502,7,3,0,0,502,503,7,8,0,0,503, + 504,1,0,0,0,504,505,6,7,1,0,505,31,1,0,0,0,506,507,7,13,0,0,507,508,7,1, + 0,0,508,509,7,16,0,0,509,510,7,1,0,0,510,511,7,5,0,0,511,512,1,0,0,0,512, + 513,6,8,0,0,513,33,1,0,0,0,514,515,7,16,0,0,515,516,7,11,0,0,516,517,5, + 95,0,0,517,518,7,3,0,0,518,519,7,14,0,0,519,520,7,8,0,0,520,521,7,12,0, + 0,521,522,7,9,0,0,522,523,7,0,0,0,523,524,1,0,0,0,524,525,6,9,5,0,525,35, + 1,0,0,0,526,527,7,6,0,0,527,528,7,3,0,0,528,529,7,9,0,0,529,530,7,12,0, + 0,530,531,7,16,0,0,531,532,7,3,0,0,532,533,1,0,0,0,533,534,6,10,6,0,534, + 37,1,0,0,0,535,536,7,6,0,0,536,537,7,7,0,0,537,538,7,19,0,0,538,539,1,0, + 0,0,539,540,6,11,0,0,540,39,1,0,0,0,541,542,7,2,0,0,542,543,7,10,0,0,543, + 544,7,7,0,0,544,545,7,19,0,0,545,546,1,0,0,0,546,547,6,12,7,0,547,41,1, + 0,0,0,548,549,7,2,0,0,549,550,7,7,0,0,550,551,7,6,0,0,551,552,7,5,0,0,552, + 553,1,0,0,0,553,554,6,13,0,0,554,43,1,0,0,0,555,556,7,2,0,0,556,557,7,5, + 0,0,557,558,7,12,0,0,558,559,7,5,0,0,559,560,7,2,0,0,560,561,1,0,0,0,561, + 562,6,14,0,0,562,45,1,0,0,0,563,564,7,19,0,0,564,565,7,10,0,0,565,566,7, + 3,0,0,566,567,7,6,0,0,567,568,7,3,0,0,568,569,1,0,0,0,569,570,6,15,0,0, + 570,47,1,0,0,0,571,572,4,16,0,0,572,573,7,1,0,0,573,574,7,9,0,0,574,575, + 7,13,0,0,575,576,7,1,0,0,576,577,7,9,0,0,577,578,7,3,0,0,578,579,7,2,0, + 0,579,580,7,5,0,0,580,581,7,12,0,0,581,582,7,5,0,0,582,583,7,2,0,0,583, + 584,1,0,0,0,584,585,6,16,0,0,585,49,1,0,0,0,586,587,4,17,1,0,587,588,7, + 13,0,0,588,589,7,7,0,0,589,590,7,7,0,0,590,591,7,18,0,0,591,592,7,20,0, + 0,592,593,7,8,0,0,593,594,5,95,0,0,594,595,5,128020,0,0,595,596,1,0,0,0, + 596,597,6,17,8,0,597,51,1,0,0,0,598,599,4,18,2,0,599,600,7,16,0,0,600,601, + 7,3,0,0,601,602,7,5,0,0,602,603,7,6,0,0,603,604,7,1,0,0,604,605,7,4,0,0, + 605,606,7,2,0,0,606,607,1,0,0,0,607,608,6,18,9,0,608,53,1,0,0,0,609,610, + 4,19,3,0,610,611,7,21,0,0,611,612,7,7,0,0,612,613,7,1,0,0,613,614,7,9,0, + 0,614,615,1,0,0,0,615,616,6,19,10,0,616,55,1,0,0,0,617,618,4,20,4,0,618, + 619,7,15,0,0,619,620,7,20,0,0,620,621,7,13,0,0,621,622,7,13,0,0,622,623, + 1,0,0,0,623,624,6,20,10,0,624,57,1,0,0,0,625,626,4,21,5,0,626,627,7,13, + 0,0,627,628,7,3,0,0,628,629,7,15,0,0,629,630,7,5,0,0,630,631,1,0,0,0,631, + 632,6,21,10,0,632,59,1,0,0,0,633,634,4,22,6,0,634,635,7,6,0,0,635,636,7, + 1,0,0,636,637,7,17,0,0,637,638,7,10,0,0,638,639,7,5,0,0,639,640,1,0,0,0, + 640,641,6,22,10,0,641,61,1,0,0,0,642,643,4,23,7,0,643,644,7,13,0,0,644, + 645,7,7,0,0,645,646,7,7,0,0,646,647,7,18,0,0,647,648,7,20,0,0,648,649,7, + 8,0,0,649,650,1,0,0,0,650,651,6,23,10,0,651,63,1,0,0,0,652,654,8,22,0,0, + 653,652,1,0,0,0,654,655,1,0,0,0,655,653,1,0,0,0,655,656,1,0,0,0,656,657, + 1,0,0,0,657,658,6,24,0,0,658,65,1,0,0,0,659,660,5,47,0,0,660,661,5,47,0, + 0,661,665,1,0,0,0,662,664,8,23,0,0,663,662,1,0,0,0,664,667,1,0,0,0,665, + 663,1,0,0,0,665,666,1,0,0,0,666,669,1,0,0,0,667,665,1,0,0,0,668,670,5,13, + 0,0,669,668,1,0,0,0,669,670,1,0,0,0,670,672,1,0,0,0,671,673,5,10,0,0,672, + 671,1,0,0,0,672,673,1,0,0,0,673,674,1,0,0,0,674,675,6,25,11,0,675,67,1, + 0,0,0,676,677,5,47,0,0,677,678,5,42,0,0,678,683,1,0,0,0,679,682,3,68,26, + 0,680,682,9,0,0,0,681,679,1,0,0,0,681,680,1,0,0,0,682,685,1,0,0,0,683,684, + 1,0,0,0,683,681,1,0,0,0,684,686,1,0,0,0,685,683,1,0,0,0,686,687,5,42,0, + 0,687,688,5,47,0,0,688,689,1,0,0,0,689,690,6,26,11,0,690,69,1,0,0,0,691, + 693,7,24,0,0,692,691,1,0,0,0,693,694,1,0,0,0,694,692,1,0,0,0,694,695,1, + 0,0,0,695,696,1,0,0,0,696,697,6,27,11,0,697,71,1,0,0,0,698,699,5,124,0, + 0,699,700,1,0,0,0,700,701,6,28,12,0,701,73,1,0,0,0,702,703,7,25,0,0,703, + 75,1,0,0,0,704,705,7,26,0,0,705,77,1,0,0,0,706,707,5,92,0,0,707,708,7,27, + 0,0,708,79,1,0,0,0,709,710,8,28,0,0,710,81,1,0,0,0,711,713,7,3,0,0,712, + 714,7,29,0,0,713,712,1,0,0,0,713,714,1,0,0,0,714,716,1,0,0,0,715,717,3, + 74,29,0,716,715,1,0,0,0,717,718,1,0,0,0,718,716,1,0,0,0,718,719,1,0,0,0, + 719,83,1,0,0,0,720,721,5,64,0,0,721,85,1,0,0,0,722,723,5,96,0,0,723,87, + 1,0,0,0,724,728,8,30,0,0,725,726,5,96,0,0,726,728,5,96,0,0,727,724,1,0, + 0,0,727,725,1,0,0,0,728,89,1,0,0,0,729,730,5,95,0,0,730,91,1,0,0,0,731, + 735,3,76,30,0,732,735,3,74,29,0,733,735,3,90,37,0,734,731,1,0,0,0,734,732, + 1,0,0,0,734,733,1,0,0,0,735,93,1,0,0,0,736,741,5,34,0,0,737,740,3,78,31, + 0,738,740,3,80,32,0,739,737,1,0,0,0,739,738,1,0,0,0,740,743,1,0,0,0,741, + 739,1,0,0,0,741,742,1,0,0,0,742,744,1,0,0,0,743,741,1,0,0,0,744,766,5,34, + 0,0,745,746,5,34,0,0,746,747,5,34,0,0,747,748,5,34,0,0,748,752,1,0,0,0, + 749,751,8,23,0,0,750,749,1,0,0,0,751,754,1,0,0,0,752,753,1,0,0,0,752,750, + 1,0,0,0,753,755,1,0,0,0,754,752,1,0,0,0,755,756,5,34,0,0,756,757,5,34,0, + 0,757,758,5,34,0,0,758,760,1,0,0,0,759,761,5,34,0,0,760,759,1,0,0,0,760, + 761,1,0,0,0,761,763,1,0,0,0,762,764,5,34,0,0,763,762,1,0,0,0,763,764,1, + 0,0,0,764,766,1,0,0,0,765,736,1,0,0,0,765,745,1,0,0,0,766,95,1,0,0,0,767, + 769,3,74,29,0,768,767,1,0,0,0,769,770,1,0,0,0,770,768,1,0,0,0,770,771,1, + 0,0,0,771,97,1,0,0,0,772,774,3,74,29,0,773,772,1,0,0,0,774,775,1,0,0,0, + 775,773,1,0,0,0,775,776,1,0,0,0,776,777,1,0,0,0,777,781,3,116,50,0,778, + 780,3,74,29,0,779,778,1,0,0,0,780,783,1,0,0,0,781,779,1,0,0,0,781,782,1, + 0,0,0,782,815,1,0,0,0,783,781,1,0,0,0,784,786,3,116,50,0,785,787,3,74,29, + 0,786,785,1,0,0,0,787,788,1,0,0,0,788,786,1,0,0,0,788,789,1,0,0,0,789,815, + 1,0,0,0,790,792,3,74,29,0,791,790,1,0,0,0,792,793,1,0,0,0,793,791,1,0,0, + 0,793,794,1,0,0,0,794,802,1,0,0,0,795,799,3,116,50,0,796,798,3,74,29,0, + 797,796,1,0,0,0,798,801,1,0,0,0,799,797,1,0,0,0,799,800,1,0,0,0,800,803, + 1,0,0,0,801,799,1,0,0,0,802,795,1,0,0,0,802,803,1,0,0,0,803,804,1,0,0,0, + 804,805,3,82,33,0,805,815,1,0,0,0,806,808,3,116,50,0,807,809,3,74,29,0, + 808,807,1,0,0,0,809,810,1,0,0,0,810,808,1,0,0,0,810,811,1,0,0,0,811,812, + 1,0,0,0,812,813,3,82,33,0,813,815,1,0,0,0,814,773,1,0,0,0,814,784,1,0,0, + 0,814,791,1,0,0,0,814,806,1,0,0,0,815,99,1,0,0,0,816,817,7,31,0,0,817,818, + 7,32,0,0,818,101,1,0,0,0,819,820,7,12,0,0,820,821,7,9,0,0,821,822,7,0,0, + 0,822,103,1,0,0,0,823,824,7,12,0,0,824,825,7,2,0,0,825,826,7,4,0,0,826, + 105,1,0,0,0,827,828,5,61,0,0,828,107,1,0,0,0,829,830,5,58,0,0,830,831,5, + 58,0,0,831,109,1,0,0,0,832,833,5,58,0,0,833,111,1,0,0,0,834,835,5,44,0, + 0,835,113,1,0,0,0,836,837,7,0,0,0,837,838,7,3,0,0,838,839,7,2,0,0,839,840, + 7,4,0,0,840,115,1,0,0,0,841,842,5,46,0,0,842,117,1,0,0,0,843,844,7,15,0, + 0,844,845,7,12,0,0,845,846,7,13,0,0,846,847,7,2,0,0,847,848,7,3,0,0,848, + 119,1,0,0,0,849,850,7,15,0,0,850,851,7,1,0,0,851,852,7,6,0,0,852,853,7, + 2,0,0,853,854,7,5,0,0,854,121,1,0,0,0,855,856,7,1,0,0,856,857,7,9,0,0,857, + 123,1,0,0,0,858,859,7,1,0,0,859,860,7,2,0,0,860,125,1,0,0,0,861,862,7,13, + 0,0,862,863,7,12,0,0,863,864,7,2,0,0,864,865,7,5,0,0,865,127,1,0,0,0,866, + 867,7,13,0,0,867,868,7,1,0,0,868,869,7,18,0,0,869,870,7,3,0,0,870,129,1, + 0,0,0,871,872,5,40,0,0,872,131,1,0,0,0,873,874,7,9,0,0,874,875,7,7,0,0, + 875,876,7,5,0,0,876,133,1,0,0,0,877,878,7,9,0,0,878,879,7,20,0,0,879,880, + 7,13,0,0,880,881,7,13,0,0,881,135,1,0,0,0,882,883,7,9,0,0,883,884,7,20, + 0,0,884,885,7,13,0,0,885,886,7,13,0,0,886,887,7,2,0,0,887,137,1,0,0,0,888, + 889,7,7,0,0,889,890,7,6,0,0,890,139,1,0,0,0,891,892,5,63,0,0,892,141,1, + 0,0,0,893,894,7,6,0,0,894,895,7,13,0,0,895,896,7,1,0,0,896,897,7,18,0,0, + 897,898,7,3,0,0,898,143,1,0,0,0,899,900,5,41,0,0,900,145,1,0,0,0,901,902, + 7,5,0,0,902,903,7,6,0,0,903,904,7,20,0,0,904,905,7,3,0,0,905,147,1,0,0, + 0,906,907,5,61,0,0,907,908,5,61,0,0,908,149,1,0,0,0,909,910,5,61,0,0,910, + 911,5,126,0,0,911,151,1,0,0,0,912,913,5,33,0,0,913,914,5,61,0,0,914,153, + 1,0,0,0,915,916,5,60,0,0,916,155,1,0,0,0,917,918,5,60,0,0,918,919,5,61, + 0,0,919,157,1,0,0,0,920,921,5,62,0,0,921,159,1,0,0,0,922,923,5,62,0,0,923, + 924,5,61,0,0,924,161,1,0,0,0,925,926,5,43,0,0,926,163,1,0,0,0,927,928,5, + 45,0,0,928,165,1,0,0,0,929,930,5,42,0,0,930,167,1,0,0,0,931,932,5,47,0, + 0,932,169,1,0,0,0,933,934,5,37,0,0,934,171,1,0,0,0,935,936,3,46,15,0,936, + 937,1,0,0,0,937,938,6,78,13,0,938,173,1,0,0,0,939,942,3,140,62,0,940,943, + 3,76,30,0,941,943,3,90,37,0,942,940,1,0,0,0,942,941,1,0,0,0,943,947,1,0, + 0,0,944,946,3,92,38,0,945,944,1,0,0,0,946,949,1,0,0,0,947,945,1,0,0,0,947, + 948,1,0,0,0,948,957,1,0,0,0,949,947,1,0,0,0,950,952,3,140,62,0,951,953, + 3,74,29,0,952,951,1,0,0,0,953,954,1,0,0,0,954,952,1,0,0,0,954,955,1,0,0, + 0,955,957,1,0,0,0,956,939,1,0,0,0,956,950,1,0,0,0,957,175,1,0,0,0,958,959, + 5,91,0,0,959,960,1,0,0,0,960,961,6,80,0,0,961,962,6,80,0,0,962,177,1,0, + 0,0,963,964,5,93,0,0,964,965,1,0,0,0,965,966,6,81,12,0,966,967,6,81,12, + 0,967,179,1,0,0,0,968,972,3,76,30,0,969,971,3,92,38,0,970,969,1,0,0,0,971, + 974,1,0,0,0,972,970,1,0,0,0,972,973,1,0,0,0,973,985,1,0,0,0,974,972,1,0, + 0,0,975,978,3,90,37,0,976,978,3,84,34,0,977,975,1,0,0,0,977,976,1,0,0,0, + 978,980,1,0,0,0,979,981,3,92,38,0,980,979,1,0,0,0,981,982,1,0,0,0,982,980, + 1,0,0,0,982,983,1,0,0,0,983,985,1,0,0,0,984,968,1,0,0,0,984,977,1,0,0,0, + 985,181,1,0,0,0,986,988,3,86,35,0,987,989,3,88,36,0,988,987,1,0,0,0,989, + 990,1,0,0,0,990,988,1,0,0,0,990,991,1,0,0,0,991,992,1,0,0,0,992,993,3,86, + 35,0,993,183,1,0,0,0,994,995,3,182,83,0,995,185,1,0,0,0,996,997,3,66,25, + 0,997,998,1,0,0,0,998,999,6,85,11,0,999,187,1,0,0,0,1000,1001,3,68,26,0, + 1001,1002,1,0,0,0,1002,1003,6,86,11,0,1003,189,1,0,0,0,1004,1005,3,70,27, + 0,1005,1006,1,0,0,0,1006,1007,6,87,11,0,1007,191,1,0,0,0,1008,1009,3,176, + 80,0,1009,1010,1,0,0,0,1010,1011,6,88,14,0,1011,1012,6,88,15,0,1012,193, + 1,0,0,0,1013,1014,3,72,28,0,1014,1015,1,0,0,0,1015,1016,6,89,16,0,1016, + 1017,6,89,12,0,1017,195,1,0,0,0,1018,1019,3,70,27,0,1019,1020,1,0,0,0,1020, + 1021,6,90,11,0,1021,197,1,0,0,0,1022,1023,3,66,25,0,1023,1024,1,0,0,0,1024, + 1025,6,91,11,0,1025,199,1,0,0,0,1026,1027,3,68,26,0,1027,1028,1,0,0,0,1028, + 1029,6,92,11,0,1029,201,1,0,0,0,1030,1031,3,72,28,0,1031,1032,1,0,0,0,1032, + 1033,6,93,16,0,1033,1034,6,93,12,0,1034,203,1,0,0,0,1035,1036,3,176,80, + 0,1036,1037,1,0,0,0,1037,1038,6,94,14,0,1038,205,1,0,0,0,1039,1040,3,178, + 81,0,1040,1041,1,0,0,0,1041,1042,6,95,17,0,1042,207,1,0,0,0,1043,1044,3, + 110,47,0,1044,1045,1,0,0,0,1045,1046,6,96,18,0,1046,209,1,0,0,0,1047,1048, + 3,112,48,0,1048,1049,1,0,0,0,1049,1050,6,97,19,0,1050,211,1,0,0,0,1051, + 1052,3,106,45,0,1052,1053,1,0,0,0,1053,1054,6,98,20,0,1054,213,1,0,0,0, + 1055,1056,7,16,0,0,1056,1057,7,3,0,0,1057,1058,7,5,0,0,1058,1059,7,12,0, + 0,1059,1060,7,0,0,0,1060,1061,7,12,0,0,1061,1062,7,5,0,0,1062,1063,7,12, + 0,0,1063,215,1,0,0,0,1064,1068,8,33,0,0,1065,1066,5,47,0,0,1066,1068,8, + 34,0,0,1067,1064,1,0,0,0,1067,1065,1,0,0,0,1068,217,1,0,0,0,1069,1071,3, + 216,100,0,1070,1069,1,0,0,0,1071,1072,1,0,0,0,1072,1070,1,0,0,0,1072,1073, + 1,0,0,0,1073,219,1,0,0,0,1074,1075,3,218,101,0,1075,1076,1,0,0,0,1076,1077, + 6,102,21,0,1077,221,1,0,0,0,1078,1079,3,94,39,0,1079,1080,1,0,0,0,1080, + 1081,6,103,22,0,1081,223,1,0,0,0,1082,1083,3,66,25,0,1083,1084,1,0,0,0, + 1084,1085,6,104,11,0,1085,225,1,0,0,0,1086,1087,3,68,26,0,1087,1088,1,0, + 0,0,1088,1089,6,105,11,0,1089,227,1,0,0,0,1090,1091,3,70,27,0,1091,1092, + 1,0,0,0,1092,1093,6,106,11,0,1093,229,1,0,0,0,1094,1095,3,72,28,0,1095, + 1096,1,0,0,0,1096,1097,6,107,16,0,1097,1098,6,107,12,0,1098,231,1,0,0,0, + 1099,1100,3,116,50,0,1100,1101,1,0,0,0,1101,1102,6,108,23,0,1102,233,1, + 0,0,0,1103,1104,3,112,48,0,1104,1105,1,0,0,0,1105,1106,6,109,19,0,1106, + 235,1,0,0,0,1107,1108,4,110,8,0,1108,1109,3,140,62,0,1109,1110,1,0,0,0, + 1110,1111,6,110,24,0,1111,237,1,0,0,0,1112,1113,4,111,9,0,1113,1114,3,174, + 79,0,1114,1115,1,0,0,0,1115,1116,6,111,25,0,1116,239,1,0,0,0,1117,1122, + 3,76,30,0,1118,1122,3,74,29,0,1119,1122,3,90,37,0,1120,1122,3,166,75,0, + 1121,1117,1,0,0,0,1121,1118,1,0,0,0,1121,1119,1,0,0,0,1121,1120,1,0,0,0, + 1122,241,1,0,0,0,1123,1126,3,76,30,0,1124,1126,3,166,75,0,1125,1123,1,0, + 0,0,1125,1124,1,0,0,0,1126,1130,1,0,0,0,1127,1129,3,240,112,0,1128,1127, + 1,0,0,0,1129,1132,1,0,0,0,1130,1128,1,0,0,0,1130,1131,1,0,0,0,1131,1143, + 1,0,0,0,1132,1130,1,0,0,0,1133,1136,3,90,37,0,1134,1136,3,84,34,0,1135, + 1133,1,0,0,0,1135,1134,1,0,0,0,1136,1138,1,0,0,0,1137,1139,3,240,112,0, + 1138,1137,1,0,0,0,1139,1140,1,0,0,0,1140,1138,1,0,0,0,1140,1141,1,0,0,0, + 1141,1143,1,0,0,0,1142,1125,1,0,0,0,1142,1135,1,0,0,0,1143,243,1,0,0,0, + 1144,1147,3,242,113,0,1145,1147,3,182,83,0,1146,1144,1,0,0,0,1146,1145, + 1,0,0,0,1147,1148,1,0,0,0,1148,1146,1,0,0,0,1148,1149,1,0,0,0,1149,245, + 1,0,0,0,1150,1151,3,66,25,0,1151,1152,1,0,0,0,1152,1153,6,115,11,0,1153, + 247,1,0,0,0,1154,1155,3,68,26,0,1155,1156,1,0,0,0,1156,1157,6,116,11,0, + 1157,249,1,0,0,0,1158,1159,3,70,27,0,1159,1160,1,0,0,0,1160,1161,6,117, + 11,0,1161,251,1,0,0,0,1162,1163,3,72,28,0,1163,1164,1,0,0,0,1164,1165,6, + 118,16,0,1165,1166,6,118,12,0,1166,253,1,0,0,0,1167,1168,3,106,45,0,1168, + 1169,1,0,0,0,1169,1170,6,119,20,0,1170,255,1,0,0,0,1171,1172,3,112,48,0, + 1172,1173,1,0,0,0,1173,1174,6,120,19,0,1174,257,1,0,0,0,1175,1176,3,116, + 50,0,1176,1177,1,0,0,0,1177,1178,6,121,23,0,1178,259,1,0,0,0,1179,1180, + 4,122,10,0,1180,1181,3,140,62,0,1181,1182,1,0,0,0,1182,1183,6,122,24,0, + 1183,261,1,0,0,0,1184,1185,4,123,11,0,1185,1186,3,174,79,0,1186,1187,1, + 0,0,0,1187,1188,6,123,25,0,1188,263,1,0,0,0,1189,1190,7,12,0,0,1190,1191, + 7,2,0,0,1191,265,1,0,0,0,1192,1193,3,244,114,0,1193,1194,1,0,0,0,1194,1195, + 6,125,26,0,1195,267,1,0,0,0,1196,1197,3,66,25,0,1197,1198,1,0,0,0,1198, + 1199,6,126,11,0,1199,269,1,0,0,0,1200,1201,3,68,26,0,1201,1202,1,0,0,0, + 1202,1203,6,127,11,0,1203,271,1,0,0,0,1204,1205,3,70,27,0,1205,1206,1,0, + 0,0,1206,1207,6,128,11,0,1207,273,1,0,0,0,1208,1209,3,72,28,0,1209,1210, + 1,0,0,0,1210,1211,6,129,16,0,1211,1212,6,129,12,0,1212,275,1,0,0,0,1213, + 1214,3,176,80,0,1214,1215,1,0,0,0,1215,1216,6,130,14,0,1216,1217,6,130, + 27,0,1217,277,1,0,0,0,1218,1219,7,7,0,0,1219,1220,7,9,0,0,1220,1221,1,0, + 0,0,1221,1222,6,131,28,0,1222,279,1,0,0,0,1223,1224,7,19,0,0,1224,1225, + 7,1,0,0,1225,1226,7,5,0,0,1226,1227,7,10,0,0,1227,1228,1,0,0,0,1228,1229, + 6,132,28,0,1229,281,1,0,0,0,1230,1231,8,35,0,0,1231,283,1,0,0,0,1232,1234, + 3,282,133,0,1233,1232,1,0,0,0,1234,1235,1,0,0,0,1235,1233,1,0,0,0,1235, + 1236,1,0,0,0,1236,1237,1,0,0,0,1237,1238,3,110,47,0,1238,1240,1,0,0,0,1239, + 1233,1,0,0,0,1239,1240,1,0,0,0,1240,1242,1,0,0,0,1241,1243,3,282,133,0, + 1242,1241,1,0,0,0,1243,1244,1,0,0,0,1244,1242,1,0,0,0,1244,1245,1,0,0,0, + 1245,285,1,0,0,0,1246,1247,3,284,134,0,1247,1248,1,0,0,0,1248,1249,6,135, + 29,0,1249,287,1,0,0,0,1250,1251,3,66,25,0,1251,1252,1,0,0,0,1252,1253,6, + 136,11,0,1253,289,1,0,0,0,1254,1255,3,68,26,0,1255,1256,1,0,0,0,1256,1257, + 6,137,11,0,1257,291,1,0,0,0,1258,1259,3,70,27,0,1259,1260,1,0,0,0,1260, + 1261,6,138,11,0,1261,293,1,0,0,0,1262,1263,3,72,28,0,1263,1264,1,0,0,0, + 1264,1265,6,139,16,0,1265,1266,6,139,12,0,1266,1267,6,139,12,0,1267,295, + 1,0,0,0,1268,1269,3,106,45,0,1269,1270,1,0,0,0,1270,1271,6,140,20,0,1271, + 297,1,0,0,0,1272,1273,3,112,48,0,1273,1274,1,0,0,0,1274,1275,6,141,19,0, + 1275,299,1,0,0,0,1276,1277,3,116,50,0,1277,1278,1,0,0,0,1278,1279,6,142, + 23,0,1279,301,1,0,0,0,1280,1281,3,280,132,0,1281,1282,1,0,0,0,1282,1283, + 6,143,30,0,1283,303,1,0,0,0,1284,1285,3,244,114,0,1285,1286,1,0,0,0,1286, + 1287,6,144,26,0,1287,305,1,0,0,0,1288,1289,3,184,84,0,1289,1290,1,0,0,0, + 1290,1291,6,145,31,0,1291,307,1,0,0,0,1292,1293,4,146,12,0,1293,1294,3, + 140,62,0,1294,1295,1,0,0,0,1295,1296,6,146,24,0,1296,309,1,0,0,0,1297,1298, + 4,147,13,0,1298,1299,3,174,79,0,1299,1300,1,0,0,0,1300,1301,6,147,25,0, + 1301,311,1,0,0,0,1302,1303,3,66,25,0,1303,1304,1,0,0,0,1304,1305,6,148, + 11,0,1305,313,1,0,0,0,1306,1307,3,68,26,0,1307,1308,1,0,0,0,1308,1309,6, + 149,11,0,1309,315,1,0,0,0,1310,1311,3,70,27,0,1311,1312,1,0,0,0,1312,1313, + 6,150,11,0,1313,317,1,0,0,0,1314,1315,3,72,28,0,1315,1316,1,0,0,0,1316, + 1317,6,151,16,0,1317,1318,6,151,12,0,1318,319,1,0,0,0,1319,1320,3,116,50, + 0,1320,1321,1,0,0,0,1321,1322,6,152,23,0,1322,321,1,0,0,0,1323,1324,4,153, + 14,0,1324,1325,3,140,62,0,1325,1326,1,0,0,0,1326,1327,6,153,24,0,1327,323, + 1,0,0,0,1328,1329,4,154,15,0,1329,1330,3,174,79,0,1330,1331,1,0,0,0,1331, + 1332,6,154,25,0,1332,325,1,0,0,0,1333,1334,3,184,84,0,1334,1335,1,0,0,0, + 1335,1336,6,155,31,0,1336,327,1,0,0,0,1337,1338,3,180,82,0,1338,1339,1, + 0,0,0,1339,1340,6,156,32,0,1340,329,1,0,0,0,1341,1342,3,66,25,0,1342,1343, + 1,0,0,0,1343,1344,6,157,11,0,1344,331,1,0,0,0,1345,1346,3,68,26,0,1346, + 1347,1,0,0,0,1347,1348,6,158,11,0,1348,333,1,0,0,0,1349,1350,3,70,27,0, + 1350,1351,1,0,0,0,1351,1352,6,159,11,0,1352,335,1,0,0,0,1353,1354,3,72, + 28,0,1354,1355,1,0,0,0,1355,1356,6,160,16,0,1356,1357,6,160,12,0,1357,337, + 1,0,0,0,1358,1359,7,1,0,0,1359,1360,7,9,0,0,1360,1361,7,15,0,0,1361,1362, + 7,7,0,0,1362,339,1,0,0,0,1363,1364,3,66,25,0,1364,1365,1,0,0,0,1365,1366, + 6,162,11,0,1366,341,1,0,0,0,1367,1368,3,68,26,0,1368,1369,1,0,0,0,1369, + 1370,6,163,11,0,1370,343,1,0,0,0,1371,1372,3,70,27,0,1372,1373,1,0,0,0, + 1373,1374,6,164,11,0,1374,345,1,0,0,0,1375,1376,3,178,81,0,1376,1377,1, + 0,0,0,1377,1378,6,165,17,0,1378,1379,6,165,12,0,1379,347,1,0,0,0,1380,1381, + 3,110,47,0,1381,1382,1,0,0,0,1382,1383,6,166,18,0,1383,349,1,0,0,0,1384, + 1390,3,84,34,0,1385,1390,3,74,29,0,1386,1390,3,116,50,0,1387,1390,3,76, + 30,0,1388,1390,3,90,37,0,1389,1384,1,0,0,0,1389,1385,1,0,0,0,1389,1386, + 1,0,0,0,1389,1387,1,0,0,0,1389,1388,1,0,0,0,1390,1391,1,0,0,0,1391,1389, + 1,0,0,0,1391,1392,1,0,0,0,1392,351,1,0,0,0,1393,1394,3,66,25,0,1394,1395, + 1,0,0,0,1395,1396,6,168,11,0,1396,353,1,0,0,0,1397,1398,3,68,26,0,1398, + 1399,1,0,0,0,1399,1400,6,169,11,0,1400,355,1,0,0,0,1401,1402,3,70,27,0, + 1402,1403,1,0,0,0,1403,1404,6,170,11,0,1404,357,1,0,0,0,1405,1406,3,72, + 28,0,1406,1407,1,0,0,0,1407,1408,6,171,16,0,1408,1409,6,171,12,0,1409,359, + 1,0,0,0,1410,1411,3,110,47,0,1411,1412,1,0,0,0,1412,1413,6,172,18,0,1413, + 361,1,0,0,0,1414,1415,3,112,48,0,1415,1416,1,0,0,0,1416,1417,6,173,19,0, + 1417,363,1,0,0,0,1418,1419,3,116,50,0,1419,1420,1,0,0,0,1420,1421,6,174, + 23,0,1421,365,1,0,0,0,1422,1423,3,278,131,0,1423,1424,1,0,0,0,1424,1425, + 6,175,33,0,1425,1426,6,175,34,0,1426,367,1,0,0,0,1427,1428,3,218,101,0, + 1428,1429,1,0,0,0,1429,1430,6,176,21,0,1430,369,1,0,0,0,1431,1432,3,94, + 39,0,1432,1433,1,0,0,0,1433,1434,6,177,22,0,1434,371,1,0,0,0,1435,1436, + 3,66,25,0,1436,1437,1,0,0,0,1437,1438,6,178,11,0,1438,373,1,0,0,0,1439, + 1440,3,68,26,0,1440,1441,1,0,0,0,1441,1442,6,179,11,0,1442,375,1,0,0,0, + 1443,1444,3,70,27,0,1444,1445,1,0,0,0,1445,1446,6,180,11,0,1446,377,1,0, + 0,0,1447,1448,3,72,28,0,1448,1449,1,0,0,0,1449,1450,6,181,16,0,1450,1451, + 6,181,12,0,1451,1452,6,181,12,0,1452,379,1,0,0,0,1453,1454,3,112,48,0,1454, + 1455,1,0,0,0,1455,1456,6,182,19,0,1456,381,1,0,0,0,1457,1458,3,116,50,0, + 1458,1459,1,0,0,0,1459,1460,6,183,23,0,1460,383,1,0,0,0,1461,1462,3,244, + 114,0,1462,1463,1,0,0,0,1463,1464,6,184,26,0,1464,385,1,0,0,0,1465,1466, + 3,66,25,0,1466,1467,1,0,0,0,1467,1468,6,185,11,0,1468,387,1,0,0,0,1469, + 1470,3,68,26,0,1470,1471,1,0,0,0,1471,1472,6,186,11,0,1472,389,1,0,0,0, + 1473,1474,3,70,27,0,1474,1475,1,0,0,0,1475,1476,6,187,11,0,1476,391,1,0, + 0,0,1477,1478,3,72,28,0,1478,1479,1,0,0,0,1479,1480,6,188,16,0,1480,1481, + 6,188,12,0,1481,393,1,0,0,0,1482,1483,3,54,19,0,1483,1484,1,0,0,0,1484, + 1485,6,189,35,0,1485,395,1,0,0,0,1486,1487,3,264,124,0,1487,1488,1,0,0, + 0,1488,1489,6,190,36,0,1489,397,1,0,0,0,1490,1491,3,278,131,0,1491,1492, + 1,0,0,0,1492,1493,6,191,33,0,1493,1494,6,191,12,0,1494,1495,6,191,0,0,1495, + 399,1,0,0,0,1496,1497,7,20,0,0,1497,1498,7,2,0,0,1498,1499,7,1,0,0,1499, + 1500,7,9,0,0,1500,1501,7,17,0,0,1501,1502,1,0,0,0,1502,1503,6,192,12,0, + 1503,1504,6,192,0,0,1504,401,1,0,0,0,1505,1506,3,180,82,0,1506,1507,1,0, + 0,0,1507,1508,6,193,32,0,1508,403,1,0,0,0,1509,1510,3,184,84,0,1510,1511, + 1,0,0,0,1511,1512,6,194,31,0,1512,405,1,0,0,0,1513,1514,3,66,25,0,1514, + 1515,1,0,0,0,1515,1516,6,195,11,0,1516,407,1,0,0,0,1517,1518,3,68,26,0, + 1518,1519,1,0,0,0,1519,1520,6,196,11,0,1520,409,1,0,0,0,1521,1522,3,70, + 27,0,1522,1523,1,0,0,0,1523,1524,6,197,11,0,1524,411,1,0,0,0,1525,1526, + 3,72,28,0,1526,1527,1,0,0,0,1527,1528,6,198,16,0,1528,1529,6,198,12,0,1529, + 413,1,0,0,0,1530,1531,3,218,101,0,1531,1532,1,0,0,0,1532,1533,6,199,21, + 0,1533,1534,6,199,12,0,1534,1535,6,199,37,0,1535,415,1,0,0,0,1536,1537, + 3,94,39,0,1537,1538,1,0,0,0,1538,1539,6,200,22,0,1539,1540,6,200,12,0,1540, + 1541,6,200,37,0,1541,417,1,0,0,0,1542,1543,3,66,25,0,1543,1544,1,0,0,0, + 1544,1545,6,201,11,0,1545,419,1,0,0,0,1546,1547,3,68,26,0,1547,1548,1,0, + 0,0,1548,1549,6,202,11,0,1549,421,1,0,0,0,1550,1551,3,70,27,0,1551,1552, + 1,0,0,0,1552,1553,6,203,11,0,1553,423,1,0,0,0,1554,1555,3,110,47,0,1555, + 1556,1,0,0,0,1556,1557,6,204,18,0,1557,1558,6,204,12,0,1558,1559,6,204, + 9,0,1559,425,1,0,0,0,1560,1561,3,112,48,0,1561,1562,1,0,0,0,1562,1563,6, + 205,19,0,1563,1564,6,205,12,0,1564,1565,6,205,9,0,1565,427,1,0,0,0,1566, + 1567,3,66,25,0,1567,1568,1,0,0,0,1568,1569,6,206,11,0,1569,429,1,0,0,0, + 1570,1571,3,68,26,0,1571,1572,1,0,0,0,1572,1573,6,207,11,0,1573,431,1,0, + 0,0,1574,1575,3,70,27,0,1575,1576,1,0,0,0,1576,1577,6,208,11,0,1577,433, + 1,0,0,0,1578,1579,3,184,84,0,1579,1580,1,0,0,0,1580,1581,6,209,12,0,1581, + 1582,6,209,0,0,1582,1583,6,209,31,0,1583,435,1,0,0,0,1584,1585,3,180,82, + 0,1585,1586,1,0,0,0,1586,1587,6,210,12,0,1587,1588,6,210,0,0,1588,1589, + 6,210,32,0,1589,437,1,0,0,0,1590,1591,3,100,42,0,1591,1592,1,0,0,0,1592, + 1593,6,211,12,0,1593,1594,6,211,0,0,1594,1595,6,211,38,0,1595,439,1,0,0, + 0,1596,1597,3,72,28,0,1597,1598,1,0,0,0,1598,1599,6,212,16,0,1599,1600, + 6,212,12,0,1600,441,1,0,0,0,66,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,655, + 665,669,672,681,683,694,713,718,727,734,739,741,752,760,763,765,770,775, + 781,788,793,799,802,810,814,942,947,954,956,972,977,982,984,990,1067,1072, + 1121,1125,1130,1135,1140,1142,1146,1148,1235,1239,1244,1389,1391,39,5,1, + 0,5,4,0,5,6,0,5,2,0,5,3,0,5,8,0,5,5,0,5,9,0,5,11,0,5,14,0,5,13,0,0,1,0, + 4,0,0,7,16,0,7,70,0,5,0,0,7,29,0,7,71,0,7,38,0,7,39,0,7,36,0,7,81,0,7,30, + 0,7,41,0,7,53,0,7,69,0,7,85,0,5,10,0,5,7,0,7,95,0,7,94,0,7,73,0,7,72,0, + 7,93,0,5,12,0,7,20,0,7,89,0,5,15,0,7,33,0]; private static __ATN: ATN; public static get _ATN(): ATN { diff --git a/packages/kbn-esql-ast/src/antlr/esql_parser.g4 b/packages/kbn-esql-ast/src/antlr/esql_parser.g4 index 6a76e32d28f36..0857f14f9d0f0 100644 --- a/packages/kbn-esql-ast/src/antlr/esql_parser.g4 +++ b/packages/kbn-esql-ast/src/antlr/esql_parser.g4 @@ -56,6 +56,7 @@ processingCommand // in development | {this.isDevVersion()}? inlinestatsCommand | {this.isDevVersion()}? lookupCommand + | {this.isDevVersion()}? joinCommand ; whereCommand @@ -70,7 +71,7 @@ booleanExpression | left=booleanExpression operator=OR right=booleanExpression #logicalBinary | valueExpression (NOT)? IN LP valueExpression (COMMA valueExpression)* RP #logicalIn | valueExpression IS NOT? NULL #isNull - | {this.isDevVersion()}? matchBooleanExpression #matchExpression + | matchBooleanExpression #matchExpression ; regexBooleanExpression @@ -323,4 +324,20 @@ lookupCommand inlinestatsCommand : DEV_INLINESTATS stats=aggFields (BY grouping=fields)? + ; + +joinCommand + : type=(DEV_JOIN_LOOKUP | DEV_JOIN_LEFT | DEV_JOIN_RIGHT)? DEV_JOIN joinTarget joinCondition + ; + +joinTarget + : index=identifier (AS alias=identifier)? + ; + +joinCondition + : ON joinPredicate (COMMA joinPredicate)* + ; + +joinPredicate + : valueExpression ; \ No newline at end of file diff --git a/packages/kbn-esql-ast/src/antlr/esql_parser.interp b/packages/kbn-esql-ast/src/antlr/esql_parser.interp index a2b339f378f12..50493f584fe4c 100644 --- a/packages/kbn-esql-ast/src/antlr/esql_parser.interp +++ b/packages/kbn-esql-ast/src/antlr/esql_parser.interp @@ -23,7 +23,11 @@ null null null null -':' +null +null +null +null +null '|' null null @@ -33,6 +37,7 @@ null 'asc' '=' '::' +':' ',' 'desc' '.' @@ -113,6 +118,10 @@ null null null null +'USING' +null +null +null null null null @@ -141,11 +150,15 @@ WHERE DEV_INLINESTATS DEV_LOOKUP DEV_METRICS +DEV_JOIN +DEV_JOIN_FULL +DEV_JOIN_LEFT +DEV_JOIN_RIGHT +DEV_JOIN_LOOKUP UNKNOWN_CMD LINE_COMMENT MULTILINE_COMMENT WS -COLON PIPE QUOTED_STRING INTEGER_LITERAL @@ -155,6 +168,7 @@ AND ASC ASSIGN CAST_OP +COLON COMMA DESC DOT @@ -235,6 +249,10 @@ LOOKUP_WS LOOKUP_FIELD_LINE_COMMENT LOOKUP_FIELD_MULTILINE_COMMENT LOOKUP_FIELD_WS +USING +JOIN_LINE_COMMENT +JOIN_MULTILINE_COMMENT +JOIN_WS METRICS_LINE_COMMENT METRICS_MULTILINE_COMMENT METRICS_WS @@ -305,7 +323,11 @@ enrichCommand enrichWithClause lookupCommand inlinestatsCommand +joinCommand +joinTarget +joinCondition +joinPredicate atn: -[4, 1, 119, 603, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 134, 8, 1, 10, 1, 12, 1, 137, 9, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 145, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 163, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 175, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 182, 8, 5, 10, 5, 12, 5, 185, 9, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 192, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 198, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 206, 8, 5, 10, 5, 12, 5, 209, 9, 5, 1, 6, 1, 6, 3, 6, 213, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 220, 8, 6, 1, 6, 1, 6, 1, 6, 3, 6, 225, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 236, 8, 8, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 242, 8, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 5, 9, 250, 8, 9, 10, 9, 12, 9, 253, 9, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 263, 8, 10, 1, 10, 1, 10, 1, 10, 5, 10, 268, 8, 10, 10, 10, 12, 10, 271, 9, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 279, 8, 11, 10, 11, 12, 11, 282, 9, 11, 3, 11, 284, 8, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 5, 15, 298, 8, 15, 10, 15, 12, 15, 301, 9, 15, 1, 16, 1, 16, 1, 16, 3, 16, 306, 8, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 5, 17, 314, 8, 17, 10, 17, 12, 17, 317, 9, 17, 1, 17, 3, 17, 320, 8, 17, 1, 18, 1, 18, 1, 18, 3, 18, 325, 8, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 3, 21, 335, 8, 21, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 341, 8, 22, 10, 22, 12, 22, 344, 9, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 5, 24, 354, 8, 24, 10, 24, 12, 24, 357, 9, 24, 1, 24, 3, 24, 360, 8, 24, 1, 24, 1, 24, 3, 24, 364, 8, 24, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 3, 26, 371, 8, 26, 1, 26, 1, 26, 3, 26, 375, 8, 26, 1, 27, 1, 27, 1, 27, 5, 27, 380, 8, 27, 10, 27, 12, 27, 383, 9, 27, 1, 28, 1, 28, 1, 28, 3, 28, 388, 8, 28, 1, 29, 1, 29, 1, 29, 5, 29, 393, 8, 29, 10, 29, 12, 29, 396, 9, 29, 1, 30, 1, 30, 1, 30, 5, 30, 401, 8, 30, 10, 30, 12, 30, 404, 9, 30, 1, 31, 1, 31, 1, 31, 5, 31, 409, 8, 31, 10, 31, 12, 31, 412, 9, 31, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 3, 33, 419, 8, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 434, 8, 34, 10, 34, 12, 34, 437, 9, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 445, 8, 34, 10, 34, 12, 34, 448, 9, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 456, 8, 34, 10, 34, 12, 34, 459, 9, 34, 1, 34, 1, 34, 3, 34, 463, 8, 34, 1, 35, 1, 35, 3, 35, 467, 8, 35, 1, 36, 1, 36, 1, 36, 3, 36, 472, 8, 36, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 481, 8, 38, 10, 38, 12, 38, 484, 9, 38, 1, 39, 1, 39, 3, 39, 488, 8, 39, 1, 39, 1, 39, 3, 39, 492, 8, 39, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 504, 8, 42, 10, 42, 12, 42, 507, 9, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 517, 8, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 5, 47, 529, 8, 47, 10, 47, 12, 47, 532, 9, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 50, 1, 50, 3, 50, 542, 8, 50, 1, 51, 3, 51, 545, 8, 51, 1, 51, 1, 51, 1, 52, 3, 52, 550, 8, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 3, 58, 572, 8, 58, 1, 58, 1, 58, 1, 58, 1, 58, 5, 58, 578, 8, 58, 10, 58, 12, 58, 581, 9, 58, 3, 58, 583, 8, 58, 1, 59, 1, 59, 1, 59, 3, 59, 588, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 601, 8, 61, 1, 61, 0, 4, 2, 10, 18, 20, 62, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 0, 8, 1, 0, 59, 60, 1, 0, 61, 63, 2, 0, 26, 26, 76, 76, 1, 0, 67, 68, 2, 0, 31, 31, 35, 35, 2, 0, 38, 38, 41, 41, 2, 0, 37, 37, 51, 51, 2, 0, 52, 52, 54, 58, 628, 0, 124, 1, 0, 0, 0, 2, 127, 1, 0, 0, 0, 4, 144, 1, 0, 0, 0, 6, 162, 1, 0, 0, 0, 8, 164, 1, 0, 0, 0, 10, 197, 1, 0, 0, 0, 12, 224, 1, 0, 0, 0, 14, 226, 1, 0, 0, 0, 16, 235, 1, 0, 0, 0, 18, 241, 1, 0, 0, 0, 20, 262, 1, 0, 0, 0, 22, 272, 1, 0, 0, 0, 24, 287, 1, 0, 0, 0, 26, 289, 1, 0, 0, 0, 28, 291, 1, 0, 0, 0, 30, 294, 1, 0, 0, 0, 32, 305, 1, 0, 0, 0, 34, 309, 1, 0, 0, 0, 36, 324, 1, 0, 0, 0, 38, 328, 1, 0, 0, 0, 40, 330, 1, 0, 0, 0, 42, 334, 1, 0, 0, 0, 44, 336, 1, 0, 0, 0, 46, 345, 1, 0, 0, 0, 48, 349, 1, 0, 0, 0, 50, 365, 1, 0, 0, 0, 52, 368, 1, 0, 0, 0, 54, 376, 1, 0, 0, 0, 56, 384, 1, 0, 0, 0, 58, 389, 1, 0, 0, 0, 60, 397, 1, 0, 0, 0, 62, 405, 1, 0, 0, 0, 64, 413, 1, 0, 0, 0, 66, 418, 1, 0, 0, 0, 68, 462, 1, 0, 0, 0, 70, 466, 1, 0, 0, 0, 72, 471, 1, 0, 0, 0, 74, 473, 1, 0, 0, 0, 76, 476, 1, 0, 0, 0, 78, 485, 1, 0, 0, 0, 80, 493, 1, 0, 0, 0, 82, 496, 1, 0, 0, 0, 84, 499, 1, 0, 0, 0, 86, 508, 1, 0, 0, 0, 88, 512, 1, 0, 0, 0, 90, 518, 1, 0, 0, 0, 92, 522, 1, 0, 0, 0, 94, 525, 1, 0, 0, 0, 96, 533, 1, 0, 0, 0, 98, 537, 1, 0, 0, 0, 100, 541, 1, 0, 0, 0, 102, 544, 1, 0, 0, 0, 104, 549, 1, 0, 0, 0, 106, 553, 1, 0, 0, 0, 108, 555, 1, 0, 0, 0, 110, 557, 1, 0, 0, 0, 112, 560, 1, 0, 0, 0, 114, 564, 1, 0, 0, 0, 116, 567, 1, 0, 0, 0, 118, 587, 1, 0, 0, 0, 120, 591, 1, 0, 0, 0, 122, 596, 1, 0, 0, 0, 124, 125, 3, 2, 1, 0, 125, 126, 5, 0, 0, 1, 126, 1, 1, 0, 0, 0, 127, 128, 6, 1, -1, 0, 128, 129, 3, 4, 2, 0, 129, 135, 1, 0, 0, 0, 130, 131, 10, 1, 0, 0, 131, 132, 5, 25, 0, 0, 132, 134, 3, 6, 3, 0, 133, 130, 1, 0, 0, 0, 134, 137, 1, 0, 0, 0, 135, 133, 1, 0, 0, 0, 135, 136, 1, 0, 0, 0, 136, 3, 1, 0, 0, 0, 137, 135, 1, 0, 0, 0, 138, 145, 3, 110, 55, 0, 139, 145, 3, 34, 17, 0, 140, 145, 3, 28, 14, 0, 141, 145, 3, 114, 57, 0, 142, 143, 4, 2, 1, 0, 143, 145, 3, 48, 24, 0, 144, 138, 1, 0, 0, 0, 144, 139, 1, 0, 0, 0, 144, 140, 1, 0, 0, 0, 144, 141, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 145, 5, 1, 0, 0, 0, 146, 163, 3, 50, 25, 0, 147, 163, 3, 8, 4, 0, 148, 163, 3, 80, 40, 0, 149, 163, 3, 74, 37, 0, 150, 163, 3, 52, 26, 0, 151, 163, 3, 76, 38, 0, 152, 163, 3, 82, 41, 0, 153, 163, 3, 84, 42, 0, 154, 163, 3, 88, 44, 0, 155, 163, 3, 90, 45, 0, 156, 163, 3, 116, 58, 0, 157, 163, 3, 92, 46, 0, 158, 159, 4, 3, 2, 0, 159, 163, 3, 122, 61, 0, 160, 161, 4, 3, 3, 0, 161, 163, 3, 120, 60, 0, 162, 146, 1, 0, 0, 0, 162, 147, 1, 0, 0, 0, 162, 148, 1, 0, 0, 0, 162, 149, 1, 0, 0, 0, 162, 150, 1, 0, 0, 0, 162, 151, 1, 0, 0, 0, 162, 152, 1, 0, 0, 0, 162, 153, 1, 0, 0, 0, 162, 154, 1, 0, 0, 0, 162, 155, 1, 0, 0, 0, 162, 156, 1, 0, 0, 0, 162, 157, 1, 0, 0, 0, 162, 158, 1, 0, 0, 0, 162, 160, 1, 0, 0, 0, 163, 7, 1, 0, 0, 0, 164, 165, 5, 16, 0, 0, 165, 166, 3, 10, 5, 0, 166, 9, 1, 0, 0, 0, 167, 168, 6, 5, -1, 0, 168, 169, 5, 44, 0, 0, 169, 198, 3, 10, 5, 8, 170, 198, 3, 16, 8, 0, 171, 198, 3, 12, 6, 0, 172, 174, 3, 16, 8, 0, 173, 175, 5, 44, 0, 0, 174, 173, 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 176, 1, 0, 0, 0, 176, 177, 5, 39, 0, 0, 177, 178, 5, 43, 0, 0, 178, 183, 3, 16, 8, 0, 179, 180, 5, 34, 0, 0, 180, 182, 3, 16, 8, 0, 181, 179, 1, 0, 0, 0, 182, 185, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 186, 1, 0, 0, 0, 185, 183, 1, 0, 0, 0, 186, 187, 5, 50, 0, 0, 187, 198, 1, 0, 0, 0, 188, 189, 3, 16, 8, 0, 189, 191, 5, 40, 0, 0, 190, 192, 5, 44, 0, 0, 191, 190, 1, 0, 0, 0, 191, 192, 1, 0, 0, 0, 192, 193, 1, 0, 0, 0, 193, 194, 5, 45, 0, 0, 194, 198, 1, 0, 0, 0, 195, 196, 4, 5, 4, 0, 196, 198, 3, 14, 7, 0, 197, 167, 1, 0, 0, 0, 197, 170, 1, 0, 0, 0, 197, 171, 1, 0, 0, 0, 197, 172, 1, 0, 0, 0, 197, 188, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 198, 207, 1, 0, 0, 0, 199, 200, 10, 5, 0, 0, 200, 201, 5, 30, 0, 0, 201, 206, 3, 10, 5, 6, 202, 203, 10, 4, 0, 0, 203, 204, 5, 47, 0, 0, 204, 206, 3, 10, 5, 5, 205, 199, 1, 0, 0, 0, 205, 202, 1, 0, 0, 0, 206, 209, 1, 0, 0, 0, 207, 205, 1, 0, 0, 0, 207, 208, 1, 0, 0, 0, 208, 11, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 210, 212, 3, 16, 8, 0, 211, 213, 5, 44, 0, 0, 212, 211, 1, 0, 0, 0, 212, 213, 1, 0, 0, 0, 213, 214, 1, 0, 0, 0, 214, 215, 5, 42, 0, 0, 215, 216, 3, 106, 53, 0, 216, 225, 1, 0, 0, 0, 217, 219, 3, 16, 8, 0, 218, 220, 5, 44, 0, 0, 219, 218, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 222, 5, 49, 0, 0, 222, 223, 3, 106, 53, 0, 223, 225, 1, 0, 0, 0, 224, 210, 1, 0, 0, 0, 224, 217, 1, 0, 0, 0, 225, 13, 1, 0, 0, 0, 226, 227, 3, 58, 29, 0, 227, 228, 5, 24, 0, 0, 228, 229, 3, 68, 34, 0, 229, 15, 1, 0, 0, 0, 230, 236, 3, 18, 9, 0, 231, 232, 3, 18, 9, 0, 232, 233, 3, 108, 54, 0, 233, 234, 3, 18, 9, 0, 234, 236, 1, 0, 0, 0, 235, 230, 1, 0, 0, 0, 235, 231, 1, 0, 0, 0, 236, 17, 1, 0, 0, 0, 237, 238, 6, 9, -1, 0, 238, 242, 3, 20, 10, 0, 239, 240, 7, 0, 0, 0, 240, 242, 3, 18, 9, 3, 241, 237, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 242, 251, 1, 0, 0, 0, 243, 244, 10, 2, 0, 0, 244, 245, 7, 1, 0, 0, 245, 250, 3, 18, 9, 3, 246, 247, 10, 1, 0, 0, 247, 248, 7, 0, 0, 0, 248, 250, 3, 18, 9, 2, 249, 243, 1, 0, 0, 0, 249, 246, 1, 0, 0, 0, 250, 253, 1, 0, 0, 0, 251, 249, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 19, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 254, 255, 6, 10, -1, 0, 255, 263, 3, 68, 34, 0, 256, 263, 3, 58, 29, 0, 257, 263, 3, 22, 11, 0, 258, 259, 5, 43, 0, 0, 259, 260, 3, 10, 5, 0, 260, 261, 5, 50, 0, 0, 261, 263, 1, 0, 0, 0, 262, 254, 1, 0, 0, 0, 262, 256, 1, 0, 0, 0, 262, 257, 1, 0, 0, 0, 262, 258, 1, 0, 0, 0, 263, 269, 1, 0, 0, 0, 264, 265, 10, 1, 0, 0, 265, 266, 5, 33, 0, 0, 266, 268, 3, 26, 13, 0, 267, 264, 1, 0, 0, 0, 268, 271, 1, 0, 0, 0, 269, 267, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 21, 1, 0, 0, 0, 271, 269, 1, 0, 0, 0, 272, 273, 3, 24, 12, 0, 273, 283, 5, 43, 0, 0, 274, 284, 5, 61, 0, 0, 275, 280, 3, 10, 5, 0, 276, 277, 5, 34, 0, 0, 277, 279, 3, 10, 5, 0, 278, 276, 1, 0, 0, 0, 279, 282, 1, 0, 0, 0, 280, 278, 1, 0, 0, 0, 280, 281, 1, 0, 0, 0, 281, 284, 1, 0, 0, 0, 282, 280, 1, 0, 0, 0, 283, 274, 1, 0, 0, 0, 283, 275, 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 285, 1, 0, 0, 0, 285, 286, 5, 50, 0, 0, 286, 23, 1, 0, 0, 0, 287, 288, 3, 72, 36, 0, 288, 25, 1, 0, 0, 0, 289, 290, 3, 64, 32, 0, 290, 27, 1, 0, 0, 0, 291, 292, 5, 12, 0, 0, 292, 293, 3, 30, 15, 0, 293, 29, 1, 0, 0, 0, 294, 299, 3, 32, 16, 0, 295, 296, 5, 34, 0, 0, 296, 298, 3, 32, 16, 0, 297, 295, 1, 0, 0, 0, 298, 301, 1, 0, 0, 0, 299, 297, 1, 0, 0, 0, 299, 300, 1, 0, 0, 0, 300, 31, 1, 0, 0, 0, 301, 299, 1, 0, 0, 0, 302, 303, 3, 58, 29, 0, 303, 304, 5, 32, 0, 0, 304, 306, 1, 0, 0, 0, 305, 302, 1, 0, 0, 0, 305, 306, 1, 0, 0, 0, 306, 307, 1, 0, 0, 0, 307, 308, 3, 10, 5, 0, 308, 33, 1, 0, 0, 0, 309, 310, 5, 6, 0, 0, 310, 315, 3, 36, 18, 0, 311, 312, 5, 34, 0, 0, 312, 314, 3, 36, 18, 0, 313, 311, 1, 0, 0, 0, 314, 317, 1, 0, 0, 0, 315, 313, 1, 0, 0, 0, 315, 316, 1, 0, 0, 0, 316, 319, 1, 0, 0, 0, 317, 315, 1, 0, 0, 0, 318, 320, 3, 42, 21, 0, 319, 318, 1, 0, 0, 0, 319, 320, 1, 0, 0, 0, 320, 35, 1, 0, 0, 0, 321, 322, 3, 38, 19, 0, 322, 323, 5, 24, 0, 0, 323, 325, 1, 0, 0, 0, 324, 321, 1, 0, 0, 0, 324, 325, 1, 0, 0, 0, 325, 326, 1, 0, 0, 0, 326, 327, 3, 40, 20, 0, 327, 37, 1, 0, 0, 0, 328, 329, 5, 76, 0, 0, 329, 39, 1, 0, 0, 0, 330, 331, 7, 2, 0, 0, 331, 41, 1, 0, 0, 0, 332, 335, 3, 44, 22, 0, 333, 335, 3, 46, 23, 0, 334, 332, 1, 0, 0, 0, 334, 333, 1, 0, 0, 0, 335, 43, 1, 0, 0, 0, 336, 337, 5, 75, 0, 0, 337, 342, 5, 76, 0, 0, 338, 339, 5, 34, 0, 0, 339, 341, 5, 76, 0, 0, 340, 338, 1, 0, 0, 0, 341, 344, 1, 0, 0, 0, 342, 340, 1, 0, 0, 0, 342, 343, 1, 0, 0, 0, 343, 45, 1, 0, 0, 0, 344, 342, 1, 0, 0, 0, 345, 346, 5, 65, 0, 0, 346, 347, 3, 44, 22, 0, 347, 348, 5, 66, 0, 0, 348, 47, 1, 0, 0, 0, 349, 350, 5, 19, 0, 0, 350, 355, 3, 36, 18, 0, 351, 352, 5, 34, 0, 0, 352, 354, 3, 36, 18, 0, 353, 351, 1, 0, 0, 0, 354, 357, 1, 0, 0, 0, 355, 353, 1, 0, 0, 0, 355, 356, 1, 0, 0, 0, 356, 359, 1, 0, 0, 0, 357, 355, 1, 0, 0, 0, 358, 360, 3, 54, 27, 0, 359, 358, 1, 0, 0, 0, 359, 360, 1, 0, 0, 0, 360, 363, 1, 0, 0, 0, 361, 362, 5, 29, 0, 0, 362, 364, 3, 30, 15, 0, 363, 361, 1, 0, 0, 0, 363, 364, 1, 0, 0, 0, 364, 49, 1, 0, 0, 0, 365, 366, 5, 4, 0, 0, 366, 367, 3, 30, 15, 0, 367, 51, 1, 0, 0, 0, 368, 370, 5, 15, 0, 0, 369, 371, 3, 54, 27, 0, 370, 369, 1, 0, 0, 0, 370, 371, 1, 0, 0, 0, 371, 374, 1, 0, 0, 0, 372, 373, 5, 29, 0, 0, 373, 375, 3, 30, 15, 0, 374, 372, 1, 0, 0, 0, 374, 375, 1, 0, 0, 0, 375, 53, 1, 0, 0, 0, 376, 381, 3, 56, 28, 0, 377, 378, 5, 34, 0, 0, 378, 380, 3, 56, 28, 0, 379, 377, 1, 0, 0, 0, 380, 383, 1, 0, 0, 0, 381, 379, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 55, 1, 0, 0, 0, 383, 381, 1, 0, 0, 0, 384, 387, 3, 32, 16, 0, 385, 386, 5, 16, 0, 0, 386, 388, 3, 10, 5, 0, 387, 385, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 57, 1, 0, 0, 0, 389, 394, 3, 72, 36, 0, 390, 391, 5, 36, 0, 0, 391, 393, 3, 72, 36, 0, 392, 390, 1, 0, 0, 0, 393, 396, 1, 0, 0, 0, 394, 392, 1, 0, 0, 0, 394, 395, 1, 0, 0, 0, 395, 59, 1, 0, 0, 0, 396, 394, 1, 0, 0, 0, 397, 402, 3, 66, 33, 0, 398, 399, 5, 36, 0, 0, 399, 401, 3, 66, 33, 0, 400, 398, 1, 0, 0, 0, 401, 404, 1, 0, 0, 0, 402, 400, 1, 0, 0, 0, 402, 403, 1, 0, 0, 0, 403, 61, 1, 0, 0, 0, 404, 402, 1, 0, 0, 0, 405, 410, 3, 60, 30, 0, 406, 407, 5, 34, 0, 0, 407, 409, 3, 60, 30, 0, 408, 406, 1, 0, 0, 0, 409, 412, 1, 0, 0, 0, 410, 408, 1, 0, 0, 0, 410, 411, 1, 0, 0, 0, 411, 63, 1, 0, 0, 0, 412, 410, 1, 0, 0, 0, 413, 414, 7, 3, 0, 0, 414, 65, 1, 0, 0, 0, 415, 419, 5, 80, 0, 0, 416, 417, 4, 33, 10, 0, 417, 419, 3, 70, 35, 0, 418, 415, 1, 0, 0, 0, 418, 416, 1, 0, 0, 0, 419, 67, 1, 0, 0, 0, 420, 463, 5, 45, 0, 0, 421, 422, 3, 104, 52, 0, 422, 423, 5, 67, 0, 0, 423, 463, 1, 0, 0, 0, 424, 463, 3, 102, 51, 0, 425, 463, 3, 104, 52, 0, 426, 463, 3, 98, 49, 0, 427, 463, 3, 70, 35, 0, 428, 463, 3, 106, 53, 0, 429, 430, 5, 65, 0, 0, 430, 435, 3, 100, 50, 0, 431, 432, 5, 34, 0, 0, 432, 434, 3, 100, 50, 0, 433, 431, 1, 0, 0, 0, 434, 437, 1, 0, 0, 0, 435, 433, 1, 0, 0, 0, 435, 436, 1, 0, 0, 0, 436, 438, 1, 0, 0, 0, 437, 435, 1, 0, 0, 0, 438, 439, 5, 66, 0, 0, 439, 463, 1, 0, 0, 0, 440, 441, 5, 65, 0, 0, 441, 446, 3, 98, 49, 0, 442, 443, 5, 34, 0, 0, 443, 445, 3, 98, 49, 0, 444, 442, 1, 0, 0, 0, 445, 448, 1, 0, 0, 0, 446, 444, 1, 0, 0, 0, 446, 447, 1, 0, 0, 0, 447, 449, 1, 0, 0, 0, 448, 446, 1, 0, 0, 0, 449, 450, 5, 66, 0, 0, 450, 463, 1, 0, 0, 0, 451, 452, 5, 65, 0, 0, 452, 457, 3, 106, 53, 0, 453, 454, 5, 34, 0, 0, 454, 456, 3, 106, 53, 0, 455, 453, 1, 0, 0, 0, 456, 459, 1, 0, 0, 0, 457, 455, 1, 0, 0, 0, 457, 458, 1, 0, 0, 0, 458, 460, 1, 0, 0, 0, 459, 457, 1, 0, 0, 0, 460, 461, 5, 66, 0, 0, 461, 463, 1, 0, 0, 0, 462, 420, 1, 0, 0, 0, 462, 421, 1, 0, 0, 0, 462, 424, 1, 0, 0, 0, 462, 425, 1, 0, 0, 0, 462, 426, 1, 0, 0, 0, 462, 427, 1, 0, 0, 0, 462, 428, 1, 0, 0, 0, 462, 429, 1, 0, 0, 0, 462, 440, 1, 0, 0, 0, 462, 451, 1, 0, 0, 0, 463, 69, 1, 0, 0, 0, 464, 467, 5, 48, 0, 0, 465, 467, 5, 64, 0, 0, 466, 464, 1, 0, 0, 0, 466, 465, 1, 0, 0, 0, 467, 71, 1, 0, 0, 0, 468, 472, 3, 64, 32, 0, 469, 470, 4, 36, 11, 0, 470, 472, 3, 70, 35, 0, 471, 468, 1, 0, 0, 0, 471, 469, 1, 0, 0, 0, 472, 73, 1, 0, 0, 0, 473, 474, 5, 9, 0, 0, 474, 475, 5, 27, 0, 0, 475, 75, 1, 0, 0, 0, 476, 477, 5, 14, 0, 0, 477, 482, 3, 78, 39, 0, 478, 479, 5, 34, 0, 0, 479, 481, 3, 78, 39, 0, 480, 478, 1, 0, 0, 0, 481, 484, 1, 0, 0, 0, 482, 480, 1, 0, 0, 0, 482, 483, 1, 0, 0, 0, 483, 77, 1, 0, 0, 0, 484, 482, 1, 0, 0, 0, 485, 487, 3, 10, 5, 0, 486, 488, 7, 4, 0, 0, 487, 486, 1, 0, 0, 0, 487, 488, 1, 0, 0, 0, 488, 491, 1, 0, 0, 0, 489, 490, 5, 46, 0, 0, 490, 492, 7, 5, 0, 0, 491, 489, 1, 0, 0, 0, 491, 492, 1, 0, 0, 0, 492, 79, 1, 0, 0, 0, 493, 494, 5, 8, 0, 0, 494, 495, 3, 62, 31, 0, 495, 81, 1, 0, 0, 0, 496, 497, 5, 2, 0, 0, 497, 498, 3, 62, 31, 0, 498, 83, 1, 0, 0, 0, 499, 500, 5, 11, 0, 0, 500, 505, 3, 86, 43, 0, 501, 502, 5, 34, 0, 0, 502, 504, 3, 86, 43, 0, 503, 501, 1, 0, 0, 0, 504, 507, 1, 0, 0, 0, 505, 503, 1, 0, 0, 0, 505, 506, 1, 0, 0, 0, 506, 85, 1, 0, 0, 0, 507, 505, 1, 0, 0, 0, 508, 509, 3, 60, 30, 0, 509, 510, 5, 84, 0, 0, 510, 511, 3, 60, 30, 0, 511, 87, 1, 0, 0, 0, 512, 513, 5, 1, 0, 0, 513, 514, 3, 20, 10, 0, 514, 516, 3, 106, 53, 0, 515, 517, 3, 94, 47, 0, 516, 515, 1, 0, 0, 0, 516, 517, 1, 0, 0, 0, 517, 89, 1, 0, 0, 0, 518, 519, 5, 7, 0, 0, 519, 520, 3, 20, 10, 0, 520, 521, 3, 106, 53, 0, 521, 91, 1, 0, 0, 0, 522, 523, 5, 10, 0, 0, 523, 524, 3, 58, 29, 0, 524, 93, 1, 0, 0, 0, 525, 530, 3, 96, 48, 0, 526, 527, 5, 34, 0, 0, 527, 529, 3, 96, 48, 0, 528, 526, 1, 0, 0, 0, 529, 532, 1, 0, 0, 0, 530, 528, 1, 0, 0, 0, 530, 531, 1, 0, 0, 0, 531, 95, 1, 0, 0, 0, 532, 530, 1, 0, 0, 0, 533, 534, 3, 64, 32, 0, 534, 535, 5, 32, 0, 0, 535, 536, 3, 68, 34, 0, 536, 97, 1, 0, 0, 0, 537, 538, 7, 6, 0, 0, 538, 99, 1, 0, 0, 0, 539, 542, 3, 102, 51, 0, 540, 542, 3, 104, 52, 0, 541, 539, 1, 0, 0, 0, 541, 540, 1, 0, 0, 0, 542, 101, 1, 0, 0, 0, 543, 545, 7, 0, 0, 0, 544, 543, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 546, 1, 0, 0, 0, 546, 547, 5, 28, 0, 0, 547, 103, 1, 0, 0, 0, 548, 550, 7, 0, 0, 0, 549, 548, 1, 0, 0, 0, 549, 550, 1, 0, 0, 0, 550, 551, 1, 0, 0, 0, 551, 552, 5, 27, 0, 0, 552, 105, 1, 0, 0, 0, 553, 554, 5, 26, 0, 0, 554, 107, 1, 0, 0, 0, 555, 556, 7, 7, 0, 0, 556, 109, 1, 0, 0, 0, 557, 558, 5, 5, 0, 0, 558, 559, 3, 112, 56, 0, 559, 111, 1, 0, 0, 0, 560, 561, 5, 65, 0, 0, 561, 562, 3, 2, 1, 0, 562, 563, 5, 66, 0, 0, 563, 113, 1, 0, 0, 0, 564, 565, 5, 13, 0, 0, 565, 566, 5, 100, 0, 0, 566, 115, 1, 0, 0, 0, 567, 568, 5, 3, 0, 0, 568, 571, 5, 90, 0, 0, 569, 570, 5, 88, 0, 0, 570, 572, 3, 60, 30, 0, 571, 569, 1, 0, 0, 0, 571, 572, 1, 0, 0, 0, 572, 582, 1, 0, 0, 0, 573, 574, 5, 89, 0, 0, 574, 579, 3, 118, 59, 0, 575, 576, 5, 34, 0, 0, 576, 578, 3, 118, 59, 0, 577, 575, 1, 0, 0, 0, 578, 581, 1, 0, 0, 0, 579, 577, 1, 0, 0, 0, 579, 580, 1, 0, 0, 0, 580, 583, 1, 0, 0, 0, 581, 579, 1, 0, 0, 0, 582, 573, 1, 0, 0, 0, 582, 583, 1, 0, 0, 0, 583, 117, 1, 0, 0, 0, 584, 585, 3, 60, 30, 0, 585, 586, 5, 32, 0, 0, 586, 588, 1, 0, 0, 0, 587, 584, 1, 0, 0, 0, 587, 588, 1, 0, 0, 0, 588, 589, 1, 0, 0, 0, 589, 590, 3, 60, 30, 0, 590, 119, 1, 0, 0, 0, 591, 592, 5, 18, 0, 0, 592, 593, 3, 36, 18, 0, 593, 594, 5, 88, 0, 0, 594, 595, 3, 62, 31, 0, 595, 121, 1, 0, 0, 0, 596, 597, 5, 17, 0, 0, 597, 600, 3, 54, 27, 0, 598, 599, 5, 29, 0, 0, 599, 601, 3, 30, 15, 0, 600, 598, 1, 0, 0, 0, 600, 601, 1, 0, 0, 0, 601, 123, 1, 0, 0, 0, 58, 135, 144, 162, 174, 183, 191, 197, 205, 207, 212, 219, 224, 235, 241, 249, 251, 262, 269, 280, 283, 299, 305, 315, 319, 324, 334, 342, 355, 359, 363, 370, 374, 381, 387, 394, 402, 410, 418, 435, 446, 457, 462, 466, 471, 482, 487, 491, 505, 516, 530, 541, 544, 549, 571, 579, 582, 587, 600] \ No newline at end of file +[4, 1, 128, 635, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 142, 8, 1, 10, 1, 12, 1, 145, 9, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 153, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 173, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 185, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 192, 8, 5, 10, 5, 12, 5, 195, 9, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 202, 8, 5, 1, 5, 1, 5, 1, 5, 3, 5, 207, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 215, 8, 5, 10, 5, 12, 5, 218, 9, 5, 1, 6, 1, 6, 3, 6, 222, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 229, 8, 6, 1, 6, 1, 6, 1, 6, 3, 6, 234, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 245, 8, 8, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 251, 8, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 5, 9, 259, 8, 9, 10, 9, 12, 9, 262, 9, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 272, 8, 10, 1, 10, 1, 10, 1, 10, 5, 10, 277, 8, 10, 10, 10, 12, 10, 280, 9, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 288, 8, 11, 10, 11, 12, 11, 291, 9, 11, 3, 11, 293, 8, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 5, 15, 307, 8, 15, 10, 15, 12, 15, 310, 9, 15, 1, 16, 1, 16, 1, 16, 3, 16, 315, 8, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 5, 17, 323, 8, 17, 10, 17, 12, 17, 326, 9, 17, 1, 17, 3, 17, 329, 8, 17, 1, 18, 1, 18, 1, 18, 3, 18, 334, 8, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 3, 21, 344, 8, 21, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 350, 8, 22, 10, 22, 12, 22, 353, 9, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 5, 24, 363, 8, 24, 10, 24, 12, 24, 366, 9, 24, 1, 24, 3, 24, 369, 8, 24, 1, 24, 1, 24, 3, 24, 373, 8, 24, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 3, 26, 380, 8, 26, 1, 26, 1, 26, 3, 26, 384, 8, 26, 1, 27, 1, 27, 1, 27, 5, 27, 389, 8, 27, 10, 27, 12, 27, 392, 9, 27, 1, 28, 1, 28, 1, 28, 3, 28, 397, 8, 28, 1, 29, 1, 29, 1, 29, 5, 29, 402, 8, 29, 10, 29, 12, 29, 405, 9, 29, 1, 30, 1, 30, 1, 30, 5, 30, 410, 8, 30, 10, 30, 12, 30, 413, 9, 30, 1, 31, 1, 31, 1, 31, 5, 31, 418, 8, 31, 10, 31, 12, 31, 421, 9, 31, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 3, 33, 428, 8, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 443, 8, 34, 10, 34, 12, 34, 446, 9, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 454, 8, 34, 10, 34, 12, 34, 457, 9, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 465, 8, 34, 10, 34, 12, 34, 468, 9, 34, 1, 34, 1, 34, 3, 34, 472, 8, 34, 1, 35, 1, 35, 3, 35, 476, 8, 35, 1, 36, 1, 36, 1, 36, 3, 36, 481, 8, 36, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 490, 8, 38, 10, 38, 12, 38, 493, 9, 38, 1, 39, 1, 39, 3, 39, 497, 8, 39, 1, 39, 1, 39, 3, 39, 501, 8, 39, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 513, 8, 42, 10, 42, 12, 42, 516, 9, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 526, 8, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 5, 47, 538, 8, 47, 10, 47, 12, 47, 541, 9, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 50, 1, 50, 3, 50, 551, 8, 50, 1, 51, 3, 51, 554, 8, 51, 1, 51, 1, 51, 1, 52, 3, 52, 559, 8, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 3, 58, 581, 8, 58, 1, 58, 1, 58, 1, 58, 1, 58, 5, 58, 587, 8, 58, 10, 58, 12, 58, 590, 9, 58, 3, 58, 592, 8, 58, 1, 59, 1, 59, 1, 59, 3, 59, 597, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 610, 8, 61, 1, 62, 3, 62, 613, 8, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 3, 63, 622, 8, 63, 1, 64, 1, 64, 1, 64, 1, 64, 5, 64, 628, 8, 64, 10, 64, 12, 64, 631, 9, 64, 1, 65, 1, 65, 1, 65, 0, 4, 2, 10, 18, 20, 66, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 0, 9, 1, 0, 64, 65, 1, 0, 66, 68, 2, 0, 30, 30, 81, 81, 1, 0, 72, 73, 2, 0, 35, 35, 40, 40, 2, 0, 43, 43, 46, 46, 2, 0, 42, 42, 56, 56, 2, 0, 57, 57, 59, 63, 1, 0, 22, 24, 660, 0, 132, 1, 0, 0, 0, 2, 135, 1, 0, 0, 0, 4, 152, 1, 0, 0, 0, 6, 172, 1, 0, 0, 0, 8, 174, 1, 0, 0, 0, 10, 206, 1, 0, 0, 0, 12, 233, 1, 0, 0, 0, 14, 235, 1, 0, 0, 0, 16, 244, 1, 0, 0, 0, 18, 250, 1, 0, 0, 0, 20, 271, 1, 0, 0, 0, 22, 281, 1, 0, 0, 0, 24, 296, 1, 0, 0, 0, 26, 298, 1, 0, 0, 0, 28, 300, 1, 0, 0, 0, 30, 303, 1, 0, 0, 0, 32, 314, 1, 0, 0, 0, 34, 318, 1, 0, 0, 0, 36, 333, 1, 0, 0, 0, 38, 337, 1, 0, 0, 0, 40, 339, 1, 0, 0, 0, 42, 343, 1, 0, 0, 0, 44, 345, 1, 0, 0, 0, 46, 354, 1, 0, 0, 0, 48, 358, 1, 0, 0, 0, 50, 374, 1, 0, 0, 0, 52, 377, 1, 0, 0, 0, 54, 385, 1, 0, 0, 0, 56, 393, 1, 0, 0, 0, 58, 398, 1, 0, 0, 0, 60, 406, 1, 0, 0, 0, 62, 414, 1, 0, 0, 0, 64, 422, 1, 0, 0, 0, 66, 427, 1, 0, 0, 0, 68, 471, 1, 0, 0, 0, 70, 475, 1, 0, 0, 0, 72, 480, 1, 0, 0, 0, 74, 482, 1, 0, 0, 0, 76, 485, 1, 0, 0, 0, 78, 494, 1, 0, 0, 0, 80, 502, 1, 0, 0, 0, 82, 505, 1, 0, 0, 0, 84, 508, 1, 0, 0, 0, 86, 517, 1, 0, 0, 0, 88, 521, 1, 0, 0, 0, 90, 527, 1, 0, 0, 0, 92, 531, 1, 0, 0, 0, 94, 534, 1, 0, 0, 0, 96, 542, 1, 0, 0, 0, 98, 546, 1, 0, 0, 0, 100, 550, 1, 0, 0, 0, 102, 553, 1, 0, 0, 0, 104, 558, 1, 0, 0, 0, 106, 562, 1, 0, 0, 0, 108, 564, 1, 0, 0, 0, 110, 566, 1, 0, 0, 0, 112, 569, 1, 0, 0, 0, 114, 573, 1, 0, 0, 0, 116, 576, 1, 0, 0, 0, 118, 596, 1, 0, 0, 0, 120, 600, 1, 0, 0, 0, 122, 605, 1, 0, 0, 0, 124, 612, 1, 0, 0, 0, 126, 618, 1, 0, 0, 0, 128, 623, 1, 0, 0, 0, 130, 632, 1, 0, 0, 0, 132, 133, 3, 2, 1, 0, 133, 134, 5, 0, 0, 1, 134, 1, 1, 0, 0, 0, 135, 136, 6, 1, -1, 0, 136, 137, 3, 4, 2, 0, 137, 143, 1, 0, 0, 0, 138, 139, 10, 1, 0, 0, 139, 140, 5, 29, 0, 0, 140, 142, 3, 6, 3, 0, 141, 138, 1, 0, 0, 0, 142, 145, 1, 0, 0, 0, 143, 141, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 3, 1, 0, 0, 0, 145, 143, 1, 0, 0, 0, 146, 153, 3, 110, 55, 0, 147, 153, 3, 34, 17, 0, 148, 153, 3, 28, 14, 0, 149, 153, 3, 114, 57, 0, 150, 151, 4, 2, 1, 0, 151, 153, 3, 48, 24, 0, 152, 146, 1, 0, 0, 0, 152, 147, 1, 0, 0, 0, 152, 148, 1, 0, 0, 0, 152, 149, 1, 0, 0, 0, 152, 150, 1, 0, 0, 0, 153, 5, 1, 0, 0, 0, 154, 173, 3, 50, 25, 0, 155, 173, 3, 8, 4, 0, 156, 173, 3, 80, 40, 0, 157, 173, 3, 74, 37, 0, 158, 173, 3, 52, 26, 0, 159, 173, 3, 76, 38, 0, 160, 173, 3, 82, 41, 0, 161, 173, 3, 84, 42, 0, 162, 173, 3, 88, 44, 0, 163, 173, 3, 90, 45, 0, 164, 173, 3, 116, 58, 0, 165, 173, 3, 92, 46, 0, 166, 167, 4, 3, 2, 0, 167, 173, 3, 122, 61, 0, 168, 169, 4, 3, 3, 0, 169, 173, 3, 120, 60, 0, 170, 171, 4, 3, 4, 0, 171, 173, 3, 124, 62, 0, 172, 154, 1, 0, 0, 0, 172, 155, 1, 0, 0, 0, 172, 156, 1, 0, 0, 0, 172, 157, 1, 0, 0, 0, 172, 158, 1, 0, 0, 0, 172, 159, 1, 0, 0, 0, 172, 160, 1, 0, 0, 0, 172, 161, 1, 0, 0, 0, 172, 162, 1, 0, 0, 0, 172, 163, 1, 0, 0, 0, 172, 164, 1, 0, 0, 0, 172, 165, 1, 0, 0, 0, 172, 166, 1, 0, 0, 0, 172, 168, 1, 0, 0, 0, 172, 170, 1, 0, 0, 0, 173, 7, 1, 0, 0, 0, 174, 175, 5, 16, 0, 0, 175, 176, 3, 10, 5, 0, 176, 9, 1, 0, 0, 0, 177, 178, 6, 5, -1, 0, 178, 179, 5, 49, 0, 0, 179, 207, 3, 10, 5, 8, 180, 207, 3, 16, 8, 0, 181, 207, 3, 12, 6, 0, 182, 184, 3, 16, 8, 0, 183, 185, 5, 49, 0, 0, 184, 183, 1, 0, 0, 0, 184, 185, 1, 0, 0, 0, 185, 186, 1, 0, 0, 0, 186, 187, 5, 44, 0, 0, 187, 188, 5, 48, 0, 0, 188, 193, 3, 16, 8, 0, 189, 190, 5, 39, 0, 0, 190, 192, 3, 16, 8, 0, 191, 189, 1, 0, 0, 0, 192, 195, 1, 0, 0, 0, 193, 191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 196, 1, 0, 0, 0, 195, 193, 1, 0, 0, 0, 196, 197, 5, 55, 0, 0, 197, 207, 1, 0, 0, 0, 198, 199, 3, 16, 8, 0, 199, 201, 5, 45, 0, 0, 200, 202, 5, 49, 0, 0, 201, 200, 1, 0, 0, 0, 201, 202, 1, 0, 0, 0, 202, 203, 1, 0, 0, 0, 203, 204, 5, 50, 0, 0, 204, 207, 1, 0, 0, 0, 205, 207, 3, 14, 7, 0, 206, 177, 1, 0, 0, 0, 206, 180, 1, 0, 0, 0, 206, 181, 1, 0, 0, 0, 206, 182, 1, 0, 0, 0, 206, 198, 1, 0, 0, 0, 206, 205, 1, 0, 0, 0, 207, 216, 1, 0, 0, 0, 208, 209, 10, 5, 0, 0, 209, 210, 5, 34, 0, 0, 210, 215, 3, 10, 5, 6, 211, 212, 10, 4, 0, 0, 212, 213, 5, 52, 0, 0, 213, 215, 3, 10, 5, 5, 214, 208, 1, 0, 0, 0, 214, 211, 1, 0, 0, 0, 215, 218, 1, 0, 0, 0, 216, 214, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 11, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 219, 221, 3, 16, 8, 0, 220, 222, 5, 49, 0, 0, 221, 220, 1, 0, 0, 0, 221, 222, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223, 224, 5, 47, 0, 0, 224, 225, 3, 106, 53, 0, 225, 234, 1, 0, 0, 0, 226, 228, 3, 16, 8, 0, 227, 229, 5, 49, 0, 0, 228, 227, 1, 0, 0, 0, 228, 229, 1, 0, 0, 0, 229, 230, 1, 0, 0, 0, 230, 231, 5, 54, 0, 0, 231, 232, 3, 106, 53, 0, 232, 234, 1, 0, 0, 0, 233, 219, 1, 0, 0, 0, 233, 226, 1, 0, 0, 0, 234, 13, 1, 0, 0, 0, 235, 236, 3, 58, 29, 0, 236, 237, 5, 38, 0, 0, 237, 238, 3, 68, 34, 0, 238, 15, 1, 0, 0, 0, 239, 245, 3, 18, 9, 0, 240, 241, 3, 18, 9, 0, 241, 242, 3, 108, 54, 0, 242, 243, 3, 18, 9, 0, 243, 245, 1, 0, 0, 0, 244, 239, 1, 0, 0, 0, 244, 240, 1, 0, 0, 0, 245, 17, 1, 0, 0, 0, 246, 247, 6, 9, -1, 0, 247, 251, 3, 20, 10, 0, 248, 249, 7, 0, 0, 0, 249, 251, 3, 18, 9, 3, 250, 246, 1, 0, 0, 0, 250, 248, 1, 0, 0, 0, 251, 260, 1, 0, 0, 0, 252, 253, 10, 2, 0, 0, 253, 254, 7, 1, 0, 0, 254, 259, 3, 18, 9, 3, 255, 256, 10, 1, 0, 0, 256, 257, 7, 0, 0, 0, 257, 259, 3, 18, 9, 2, 258, 252, 1, 0, 0, 0, 258, 255, 1, 0, 0, 0, 259, 262, 1, 0, 0, 0, 260, 258, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 19, 1, 0, 0, 0, 262, 260, 1, 0, 0, 0, 263, 264, 6, 10, -1, 0, 264, 272, 3, 68, 34, 0, 265, 272, 3, 58, 29, 0, 266, 272, 3, 22, 11, 0, 267, 268, 5, 48, 0, 0, 268, 269, 3, 10, 5, 0, 269, 270, 5, 55, 0, 0, 270, 272, 1, 0, 0, 0, 271, 263, 1, 0, 0, 0, 271, 265, 1, 0, 0, 0, 271, 266, 1, 0, 0, 0, 271, 267, 1, 0, 0, 0, 272, 278, 1, 0, 0, 0, 273, 274, 10, 1, 0, 0, 274, 275, 5, 37, 0, 0, 275, 277, 3, 26, 13, 0, 276, 273, 1, 0, 0, 0, 277, 280, 1, 0, 0, 0, 278, 276, 1, 0, 0, 0, 278, 279, 1, 0, 0, 0, 279, 21, 1, 0, 0, 0, 280, 278, 1, 0, 0, 0, 281, 282, 3, 24, 12, 0, 282, 292, 5, 48, 0, 0, 283, 293, 5, 66, 0, 0, 284, 289, 3, 10, 5, 0, 285, 286, 5, 39, 0, 0, 286, 288, 3, 10, 5, 0, 287, 285, 1, 0, 0, 0, 288, 291, 1, 0, 0, 0, 289, 287, 1, 0, 0, 0, 289, 290, 1, 0, 0, 0, 290, 293, 1, 0, 0, 0, 291, 289, 1, 0, 0, 0, 292, 283, 1, 0, 0, 0, 292, 284, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 294, 1, 0, 0, 0, 294, 295, 5, 55, 0, 0, 295, 23, 1, 0, 0, 0, 296, 297, 3, 72, 36, 0, 297, 25, 1, 0, 0, 0, 298, 299, 3, 64, 32, 0, 299, 27, 1, 0, 0, 0, 300, 301, 5, 12, 0, 0, 301, 302, 3, 30, 15, 0, 302, 29, 1, 0, 0, 0, 303, 308, 3, 32, 16, 0, 304, 305, 5, 39, 0, 0, 305, 307, 3, 32, 16, 0, 306, 304, 1, 0, 0, 0, 307, 310, 1, 0, 0, 0, 308, 306, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 31, 1, 0, 0, 0, 310, 308, 1, 0, 0, 0, 311, 312, 3, 58, 29, 0, 312, 313, 5, 36, 0, 0, 313, 315, 1, 0, 0, 0, 314, 311, 1, 0, 0, 0, 314, 315, 1, 0, 0, 0, 315, 316, 1, 0, 0, 0, 316, 317, 3, 10, 5, 0, 317, 33, 1, 0, 0, 0, 318, 319, 5, 6, 0, 0, 319, 324, 3, 36, 18, 0, 320, 321, 5, 39, 0, 0, 321, 323, 3, 36, 18, 0, 322, 320, 1, 0, 0, 0, 323, 326, 1, 0, 0, 0, 324, 322, 1, 0, 0, 0, 324, 325, 1, 0, 0, 0, 325, 328, 1, 0, 0, 0, 326, 324, 1, 0, 0, 0, 327, 329, 3, 42, 21, 0, 328, 327, 1, 0, 0, 0, 328, 329, 1, 0, 0, 0, 329, 35, 1, 0, 0, 0, 330, 331, 3, 38, 19, 0, 331, 332, 5, 38, 0, 0, 332, 334, 1, 0, 0, 0, 333, 330, 1, 0, 0, 0, 333, 334, 1, 0, 0, 0, 334, 335, 1, 0, 0, 0, 335, 336, 3, 40, 20, 0, 336, 37, 1, 0, 0, 0, 337, 338, 5, 81, 0, 0, 338, 39, 1, 0, 0, 0, 339, 340, 7, 2, 0, 0, 340, 41, 1, 0, 0, 0, 341, 344, 3, 44, 22, 0, 342, 344, 3, 46, 23, 0, 343, 341, 1, 0, 0, 0, 343, 342, 1, 0, 0, 0, 344, 43, 1, 0, 0, 0, 345, 346, 5, 80, 0, 0, 346, 351, 5, 81, 0, 0, 347, 348, 5, 39, 0, 0, 348, 350, 5, 81, 0, 0, 349, 347, 1, 0, 0, 0, 350, 353, 1, 0, 0, 0, 351, 349, 1, 0, 0, 0, 351, 352, 1, 0, 0, 0, 352, 45, 1, 0, 0, 0, 353, 351, 1, 0, 0, 0, 354, 355, 5, 70, 0, 0, 355, 356, 3, 44, 22, 0, 356, 357, 5, 71, 0, 0, 357, 47, 1, 0, 0, 0, 358, 359, 5, 19, 0, 0, 359, 364, 3, 36, 18, 0, 360, 361, 5, 39, 0, 0, 361, 363, 3, 36, 18, 0, 362, 360, 1, 0, 0, 0, 363, 366, 1, 0, 0, 0, 364, 362, 1, 0, 0, 0, 364, 365, 1, 0, 0, 0, 365, 368, 1, 0, 0, 0, 366, 364, 1, 0, 0, 0, 367, 369, 3, 54, 27, 0, 368, 367, 1, 0, 0, 0, 368, 369, 1, 0, 0, 0, 369, 372, 1, 0, 0, 0, 370, 371, 5, 33, 0, 0, 371, 373, 3, 30, 15, 0, 372, 370, 1, 0, 0, 0, 372, 373, 1, 0, 0, 0, 373, 49, 1, 0, 0, 0, 374, 375, 5, 4, 0, 0, 375, 376, 3, 30, 15, 0, 376, 51, 1, 0, 0, 0, 377, 379, 5, 15, 0, 0, 378, 380, 3, 54, 27, 0, 379, 378, 1, 0, 0, 0, 379, 380, 1, 0, 0, 0, 380, 383, 1, 0, 0, 0, 381, 382, 5, 33, 0, 0, 382, 384, 3, 30, 15, 0, 383, 381, 1, 0, 0, 0, 383, 384, 1, 0, 0, 0, 384, 53, 1, 0, 0, 0, 385, 390, 3, 56, 28, 0, 386, 387, 5, 39, 0, 0, 387, 389, 3, 56, 28, 0, 388, 386, 1, 0, 0, 0, 389, 392, 1, 0, 0, 0, 390, 388, 1, 0, 0, 0, 390, 391, 1, 0, 0, 0, 391, 55, 1, 0, 0, 0, 392, 390, 1, 0, 0, 0, 393, 396, 3, 32, 16, 0, 394, 395, 5, 16, 0, 0, 395, 397, 3, 10, 5, 0, 396, 394, 1, 0, 0, 0, 396, 397, 1, 0, 0, 0, 397, 57, 1, 0, 0, 0, 398, 403, 3, 72, 36, 0, 399, 400, 5, 41, 0, 0, 400, 402, 3, 72, 36, 0, 401, 399, 1, 0, 0, 0, 402, 405, 1, 0, 0, 0, 403, 401, 1, 0, 0, 0, 403, 404, 1, 0, 0, 0, 404, 59, 1, 0, 0, 0, 405, 403, 1, 0, 0, 0, 406, 411, 3, 66, 33, 0, 407, 408, 5, 41, 0, 0, 408, 410, 3, 66, 33, 0, 409, 407, 1, 0, 0, 0, 410, 413, 1, 0, 0, 0, 411, 409, 1, 0, 0, 0, 411, 412, 1, 0, 0, 0, 412, 61, 1, 0, 0, 0, 413, 411, 1, 0, 0, 0, 414, 419, 3, 60, 30, 0, 415, 416, 5, 39, 0, 0, 416, 418, 3, 60, 30, 0, 417, 415, 1, 0, 0, 0, 418, 421, 1, 0, 0, 0, 419, 417, 1, 0, 0, 0, 419, 420, 1, 0, 0, 0, 420, 63, 1, 0, 0, 0, 421, 419, 1, 0, 0, 0, 422, 423, 7, 3, 0, 0, 423, 65, 1, 0, 0, 0, 424, 428, 5, 85, 0, 0, 425, 426, 4, 33, 10, 0, 426, 428, 3, 70, 35, 0, 427, 424, 1, 0, 0, 0, 427, 425, 1, 0, 0, 0, 428, 67, 1, 0, 0, 0, 429, 472, 5, 50, 0, 0, 430, 431, 3, 104, 52, 0, 431, 432, 5, 72, 0, 0, 432, 472, 1, 0, 0, 0, 433, 472, 3, 102, 51, 0, 434, 472, 3, 104, 52, 0, 435, 472, 3, 98, 49, 0, 436, 472, 3, 70, 35, 0, 437, 472, 3, 106, 53, 0, 438, 439, 5, 70, 0, 0, 439, 444, 3, 100, 50, 0, 440, 441, 5, 39, 0, 0, 441, 443, 3, 100, 50, 0, 442, 440, 1, 0, 0, 0, 443, 446, 1, 0, 0, 0, 444, 442, 1, 0, 0, 0, 444, 445, 1, 0, 0, 0, 445, 447, 1, 0, 0, 0, 446, 444, 1, 0, 0, 0, 447, 448, 5, 71, 0, 0, 448, 472, 1, 0, 0, 0, 449, 450, 5, 70, 0, 0, 450, 455, 3, 98, 49, 0, 451, 452, 5, 39, 0, 0, 452, 454, 3, 98, 49, 0, 453, 451, 1, 0, 0, 0, 454, 457, 1, 0, 0, 0, 455, 453, 1, 0, 0, 0, 455, 456, 1, 0, 0, 0, 456, 458, 1, 0, 0, 0, 457, 455, 1, 0, 0, 0, 458, 459, 5, 71, 0, 0, 459, 472, 1, 0, 0, 0, 460, 461, 5, 70, 0, 0, 461, 466, 3, 106, 53, 0, 462, 463, 5, 39, 0, 0, 463, 465, 3, 106, 53, 0, 464, 462, 1, 0, 0, 0, 465, 468, 1, 0, 0, 0, 466, 464, 1, 0, 0, 0, 466, 467, 1, 0, 0, 0, 467, 469, 1, 0, 0, 0, 468, 466, 1, 0, 0, 0, 469, 470, 5, 71, 0, 0, 470, 472, 1, 0, 0, 0, 471, 429, 1, 0, 0, 0, 471, 430, 1, 0, 0, 0, 471, 433, 1, 0, 0, 0, 471, 434, 1, 0, 0, 0, 471, 435, 1, 0, 0, 0, 471, 436, 1, 0, 0, 0, 471, 437, 1, 0, 0, 0, 471, 438, 1, 0, 0, 0, 471, 449, 1, 0, 0, 0, 471, 460, 1, 0, 0, 0, 472, 69, 1, 0, 0, 0, 473, 476, 5, 53, 0, 0, 474, 476, 5, 69, 0, 0, 475, 473, 1, 0, 0, 0, 475, 474, 1, 0, 0, 0, 476, 71, 1, 0, 0, 0, 477, 481, 3, 64, 32, 0, 478, 479, 4, 36, 11, 0, 479, 481, 3, 70, 35, 0, 480, 477, 1, 0, 0, 0, 480, 478, 1, 0, 0, 0, 481, 73, 1, 0, 0, 0, 482, 483, 5, 9, 0, 0, 483, 484, 5, 31, 0, 0, 484, 75, 1, 0, 0, 0, 485, 486, 5, 14, 0, 0, 486, 491, 3, 78, 39, 0, 487, 488, 5, 39, 0, 0, 488, 490, 3, 78, 39, 0, 489, 487, 1, 0, 0, 0, 490, 493, 1, 0, 0, 0, 491, 489, 1, 0, 0, 0, 491, 492, 1, 0, 0, 0, 492, 77, 1, 0, 0, 0, 493, 491, 1, 0, 0, 0, 494, 496, 3, 10, 5, 0, 495, 497, 7, 4, 0, 0, 496, 495, 1, 0, 0, 0, 496, 497, 1, 0, 0, 0, 497, 500, 1, 0, 0, 0, 498, 499, 5, 51, 0, 0, 499, 501, 7, 5, 0, 0, 500, 498, 1, 0, 0, 0, 500, 501, 1, 0, 0, 0, 501, 79, 1, 0, 0, 0, 502, 503, 5, 8, 0, 0, 503, 504, 3, 62, 31, 0, 504, 81, 1, 0, 0, 0, 505, 506, 5, 2, 0, 0, 506, 507, 3, 62, 31, 0, 507, 83, 1, 0, 0, 0, 508, 509, 5, 11, 0, 0, 509, 514, 3, 86, 43, 0, 510, 511, 5, 39, 0, 0, 511, 513, 3, 86, 43, 0, 512, 510, 1, 0, 0, 0, 513, 516, 1, 0, 0, 0, 514, 512, 1, 0, 0, 0, 514, 515, 1, 0, 0, 0, 515, 85, 1, 0, 0, 0, 516, 514, 1, 0, 0, 0, 517, 518, 3, 60, 30, 0, 518, 519, 5, 89, 0, 0, 519, 520, 3, 60, 30, 0, 520, 87, 1, 0, 0, 0, 521, 522, 5, 1, 0, 0, 522, 523, 3, 20, 10, 0, 523, 525, 3, 106, 53, 0, 524, 526, 3, 94, 47, 0, 525, 524, 1, 0, 0, 0, 525, 526, 1, 0, 0, 0, 526, 89, 1, 0, 0, 0, 527, 528, 5, 7, 0, 0, 528, 529, 3, 20, 10, 0, 529, 530, 3, 106, 53, 0, 530, 91, 1, 0, 0, 0, 531, 532, 5, 10, 0, 0, 532, 533, 3, 58, 29, 0, 533, 93, 1, 0, 0, 0, 534, 539, 3, 96, 48, 0, 535, 536, 5, 39, 0, 0, 536, 538, 3, 96, 48, 0, 537, 535, 1, 0, 0, 0, 538, 541, 1, 0, 0, 0, 539, 537, 1, 0, 0, 0, 539, 540, 1, 0, 0, 0, 540, 95, 1, 0, 0, 0, 541, 539, 1, 0, 0, 0, 542, 543, 3, 64, 32, 0, 543, 544, 5, 36, 0, 0, 544, 545, 3, 68, 34, 0, 545, 97, 1, 0, 0, 0, 546, 547, 7, 6, 0, 0, 547, 99, 1, 0, 0, 0, 548, 551, 3, 102, 51, 0, 549, 551, 3, 104, 52, 0, 550, 548, 1, 0, 0, 0, 550, 549, 1, 0, 0, 0, 551, 101, 1, 0, 0, 0, 552, 554, 7, 0, 0, 0, 553, 552, 1, 0, 0, 0, 553, 554, 1, 0, 0, 0, 554, 555, 1, 0, 0, 0, 555, 556, 5, 32, 0, 0, 556, 103, 1, 0, 0, 0, 557, 559, 7, 0, 0, 0, 558, 557, 1, 0, 0, 0, 558, 559, 1, 0, 0, 0, 559, 560, 1, 0, 0, 0, 560, 561, 5, 31, 0, 0, 561, 105, 1, 0, 0, 0, 562, 563, 5, 30, 0, 0, 563, 107, 1, 0, 0, 0, 564, 565, 7, 7, 0, 0, 565, 109, 1, 0, 0, 0, 566, 567, 5, 5, 0, 0, 567, 568, 3, 112, 56, 0, 568, 111, 1, 0, 0, 0, 569, 570, 5, 70, 0, 0, 570, 571, 3, 2, 1, 0, 571, 572, 5, 71, 0, 0, 572, 113, 1, 0, 0, 0, 573, 574, 5, 13, 0, 0, 574, 575, 5, 105, 0, 0, 575, 115, 1, 0, 0, 0, 576, 577, 5, 3, 0, 0, 577, 580, 5, 95, 0, 0, 578, 579, 5, 93, 0, 0, 579, 581, 3, 60, 30, 0, 580, 578, 1, 0, 0, 0, 580, 581, 1, 0, 0, 0, 581, 591, 1, 0, 0, 0, 582, 583, 5, 94, 0, 0, 583, 588, 3, 118, 59, 0, 584, 585, 5, 39, 0, 0, 585, 587, 3, 118, 59, 0, 586, 584, 1, 0, 0, 0, 587, 590, 1, 0, 0, 0, 588, 586, 1, 0, 0, 0, 588, 589, 1, 0, 0, 0, 589, 592, 1, 0, 0, 0, 590, 588, 1, 0, 0, 0, 591, 582, 1, 0, 0, 0, 591, 592, 1, 0, 0, 0, 592, 117, 1, 0, 0, 0, 593, 594, 3, 60, 30, 0, 594, 595, 5, 36, 0, 0, 595, 597, 1, 0, 0, 0, 596, 593, 1, 0, 0, 0, 596, 597, 1, 0, 0, 0, 597, 598, 1, 0, 0, 0, 598, 599, 3, 60, 30, 0, 599, 119, 1, 0, 0, 0, 600, 601, 5, 18, 0, 0, 601, 602, 3, 36, 18, 0, 602, 603, 5, 93, 0, 0, 603, 604, 3, 62, 31, 0, 604, 121, 1, 0, 0, 0, 605, 606, 5, 17, 0, 0, 606, 609, 3, 54, 27, 0, 607, 608, 5, 33, 0, 0, 608, 610, 3, 30, 15, 0, 609, 607, 1, 0, 0, 0, 609, 610, 1, 0, 0, 0, 610, 123, 1, 0, 0, 0, 611, 613, 7, 8, 0, 0, 612, 611, 1, 0, 0, 0, 612, 613, 1, 0, 0, 0, 613, 614, 1, 0, 0, 0, 614, 615, 5, 20, 0, 0, 615, 616, 3, 126, 63, 0, 616, 617, 3, 128, 64, 0, 617, 125, 1, 0, 0, 0, 618, 621, 3, 64, 32, 0, 619, 620, 5, 89, 0, 0, 620, 622, 3, 64, 32, 0, 621, 619, 1, 0, 0, 0, 621, 622, 1, 0, 0, 0, 622, 127, 1, 0, 0, 0, 623, 624, 5, 93, 0, 0, 624, 629, 3, 130, 65, 0, 625, 626, 5, 39, 0, 0, 626, 628, 3, 130, 65, 0, 627, 625, 1, 0, 0, 0, 628, 631, 1, 0, 0, 0, 629, 627, 1, 0, 0, 0, 629, 630, 1, 0, 0, 0, 630, 129, 1, 0, 0, 0, 631, 629, 1, 0, 0, 0, 632, 633, 3, 16, 8, 0, 633, 131, 1, 0, 0, 0, 61, 143, 152, 172, 184, 193, 201, 206, 214, 216, 221, 228, 233, 244, 250, 258, 260, 271, 278, 289, 292, 308, 314, 324, 328, 333, 343, 351, 364, 368, 372, 379, 383, 390, 396, 403, 411, 419, 427, 444, 455, 466, 471, 475, 480, 491, 496, 500, 514, 525, 539, 550, 553, 558, 580, 588, 591, 596, 609, 612, 621, 629] \ No newline at end of file diff --git a/packages/kbn-esql-ast/src/antlr/esql_parser.tokens b/packages/kbn-esql-ast/src/antlr/esql_parser.tokens index 3dd1a2c754038..b1a16987dd8ce 100644 --- a/packages/kbn-esql-ast/src/antlr/esql_parser.tokens +++ b/packages/kbn-esql-ast/src/antlr/esql_parser.tokens @@ -17,106 +17,115 @@ WHERE=16 DEV_INLINESTATS=17 DEV_LOOKUP=18 DEV_METRICS=19 -UNKNOWN_CMD=20 -LINE_COMMENT=21 -MULTILINE_COMMENT=22 -WS=23 -COLON=24 -PIPE=25 -QUOTED_STRING=26 -INTEGER_LITERAL=27 -DECIMAL_LITERAL=28 -BY=29 -AND=30 -ASC=31 -ASSIGN=32 -CAST_OP=33 -COMMA=34 -DESC=35 -DOT=36 -FALSE=37 -FIRST=38 -IN=39 -IS=40 -LAST=41 -LIKE=42 -LP=43 -NOT=44 -NULL=45 -NULLS=46 -OR=47 -PARAM=48 -RLIKE=49 -RP=50 -TRUE=51 -EQ=52 -CIEQ=53 -NEQ=54 -LT=55 -LTE=56 -GT=57 -GTE=58 -PLUS=59 -MINUS=60 -ASTERISK=61 -SLASH=62 -PERCENT=63 -NAMED_OR_POSITIONAL_PARAM=64 -OPENING_BRACKET=65 -CLOSING_BRACKET=66 -UNQUOTED_IDENTIFIER=67 -QUOTED_IDENTIFIER=68 -EXPR_LINE_COMMENT=69 -EXPR_MULTILINE_COMMENT=70 -EXPR_WS=71 -EXPLAIN_WS=72 -EXPLAIN_LINE_COMMENT=73 -EXPLAIN_MULTILINE_COMMENT=74 -METADATA=75 -UNQUOTED_SOURCE=76 -FROM_LINE_COMMENT=77 -FROM_MULTILINE_COMMENT=78 -FROM_WS=79 -ID_PATTERN=80 -PROJECT_LINE_COMMENT=81 -PROJECT_MULTILINE_COMMENT=82 -PROJECT_WS=83 -AS=84 -RENAME_LINE_COMMENT=85 -RENAME_MULTILINE_COMMENT=86 -RENAME_WS=87 -ON=88 -WITH=89 -ENRICH_POLICY_NAME=90 -ENRICH_LINE_COMMENT=91 -ENRICH_MULTILINE_COMMENT=92 -ENRICH_WS=93 -ENRICH_FIELD_LINE_COMMENT=94 -ENRICH_FIELD_MULTILINE_COMMENT=95 -ENRICH_FIELD_WS=96 -MVEXPAND_LINE_COMMENT=97 -MVEXPAND_MULTILINE_COMMENT=98 -MVEXPAND_WS=99 -INFO=100 -SHOW_LINE_COMMENT=101 -SHOW_MULTILINE_COMMENT=102 -SHOW_WS=103 -SETTING=104 -SETTING_LINE_COMMENT=105 -SETTTING_MULTILINE_COMMENT=106 -SETTING_WS=107 -LOOKUP_LINE_COMMENT=108 -LOOKUP_MULTILINE_COMMENT=109 -LOOKUP_WS=110 -LOOKUP_FIELD_LINE_COMMENT=111 -LOOKUP_FIELD_MULTILINE_COMMENT=112 -LOOKUP_FIELD_WS=113 -METRICS_LINE_COMMENT=114 -METRICS_MULTILINE_COMMENT=115 -METRICS_WS=116 -CLOSING_METRICS_LINE_COMMENT=117 -CLOSING_METRICS_MULTILINE_COMMENT=118 -CLOSING_METRICS_WS=119 +DEV_JOIN=20 +DEV_JOIN_FULL=21 +DEV_JOIN_LEFT=22 +DEV_JOIN_RIGHT=23 +DEV_JOIN_LOOKUP=24 +UNKNOWN_CMD=25 +LINE_COMMENT=26 +MULTILINE_COMMENT=27 +WS=28 +PIPE=29 +QUOTED_STRING=30 +INTEGER_LITERAL=31 +DECIMAL_LITERAL=32 +BY=33 +AND=34 +ASC=35 +ASSIGN=36 +CAST_OP=37 +COLON=38 +COMMA=39 +DESC=40 +DOT=41 +FALSE=42 +FIRST=43 +IN=44 +IS=45 +LAST=46 +LIKE=47 +LP=48 +NOT=49 +NULL=50 +NULLS=51 +OR=52 +PARAM=53 +RLIKE=54 +RP=55 +TRUE=56 +EQ=57 +CIEQ=58 +NEQ=59 +LT=60 +LTE=61 +GT=62 +GTE=63 +PLUS=64 +MINUS=65 +ASTERISK=66 +SLASH=67 +PERCENT=68 +NAMED_OR_POSITIONAL_PARAM=69 +OPENING_BRACKET=70 +CLOSING_BRACKET=71 +UNQUOTED_IDENTIFIER=72 +QUOTED_IDENTIFIER=73 +EXPR_LINE_COMMENT=74 +EXPR_MULTILINE_COMMENT=75 +EXPR_WS=76 +EXPLAIN_WS=77 +EXPLAIN_LINE_COMMENT=78 +EXPLAIN_MULTILINE_COMMENT=79 +METADATA=80 +UNQUOTED_SOURCE=81 +FROM_LINE_COMMENT=82 +FROM_MULTILINE_COMMENT=83 +FROM_WS=84 +ID_PATTERN=85 +PROJECT_LINE_COMMENT=86 +PROJECT_MULTILINE_COMMENT=87 +PROJECT_WS=88 +AS=89 +RENAME_LINE_COMMENT=90 +RENAME_MULTILINE_COMMENT=91 +RENAME_WS=92 +ON=93 +WITH=94 +ENRICH_POLICY_NAME=95 +ENRICH_LINE_COMMENT=96 +ENRICH_MULTILINE_COMMENT=97 +ENRICH_WS=98 +ENRICH_FIELD_LINE_COMMENT=99 +ENRICH_FIELD_MULTILINE_COMMENT=100 +ENRICH_FIELD_WS=101 +MVEXPAND_LINE_COMMENT=102 +MVEXPAND_MULTILINE_COMMENT=103 +MVEXPAND_WS=104 +INFO=105 +SHOW_LINE_COMMENT=106 +SHOW_MULTILINE_COMMENT=107 +SHOW_WS=108 +SETTING=109 +SETTING_LINE_COMMENT=110 +SETTTING_MULTILINE_COMMENT=111 +SETTING_WS=112 +LOOKUP_LINE_COMMENT=113 +LOOKUP_MULTILINE_COMMENT=114 +LOOKUP_WS=115 +LOOKUP_FIELD_LINE_COMMENT=116 +LOOKUP_FIELD_MULTILINE_COMMENT=117 +LOOKUP_FIELD_WS=118 +USING=119 +JOIN_LINE_COMMENT=120 +JOIN_MULTILINE_COMMENT=121 +JOIN_WS=122 +METRICS_LINE_COMMENT=123 +METRICS_MULTILINE_COMMENT=124 +METRICS_WS=125 +CLOSING_METRICS_LINE_COMMENT=126 +CLOSING_METRICS_MULTILINE_COMMENT=127 +CLOSING_METRICS_WS=128 'dissect'=1 'drop'=2 'enrich'=3 @@ -133,46 +142,47 @@ CLOSING_METRICS_WS=119 'sort'=14 'stats'=15 'where'=16 -':'=24 -'|'=25 -'by'=29 -'and'=30 -'asc'=31 -'='=32 -'::'=33 -','=34 -'desc'=35 -'.'=36 -'false'=37 -'first'=38 -'in'=39 -'is'=40 -'last'=41 -'like'=42 -'('=43 -'not'=44 -'null'=45 -'nulls'=46 -'or'=47 -'?'=48 -'rlike'=49 -')'=50 -'true'=51 -'=='=52 -'=~'=53 -'!='=54 -'<'=55 -'<='=56 -'>'=57 -'>='=58 -'+'=59 -'-'=60 -'*'=61 -'/'=62 -'%'=63 -']'=66 -'metadata'=75 -'as'=84 -'on'=88 -'with'=89 -'info'=100 +'|'=29 +'by'=33 +'and'=34 +'asc'=35 +'='=36 +'::'=37 +':'=38 +','=39 +'desc'=40 +'.'=41 +'false'=42 +'first'=43 +'in'=44 +'is'=45 +'last'=46 +'like'=47 +'('=48 +'not'=49 +'null'=50 +'nulls'=51 +'or'=52 +'?'=53 +'rlike'=54 +')'=55 +'true'=56 +'=='=57 +'=~'=58 +'!='=59 +'<'=60 +'<='=61 +'>'=62 +'>='=63 +'+'=64 +'-'=65 +'*'=66 +'/'=67 +'%'=68 +']'=71 +'metadata'=80 +'as'=89 +'on'=93 +'with'=94 +'info'=105 +'USING'=119 diff --git a/packages/kbn-esql-ast/src/antlr/esql_parser.ts b/packages/kbn-esql-ast/src/antlr/esql_parser.ts index 4dc0c5c628e37..ec261299493a5 100644 --- a/packages/kbn-esql-ast/src/antlr/esql_parser.ts +++ b/packages/kbn-esql-ast/src/antlr/esql_parser.ts @@ -47,106 +47,115 @@ export default class esql_parser extends parser_config { public static readonly DEV_INLINESTATS = 17; public static readonly DEV_LOOKUP = 18; public static readonly DEV_METRICS = 19; - public static readonly UNKNOWN_CMD = 20; - public static readonly LINE_COMMENT = 21; - public static readonly MULTILINE_COMMENT = 22; - public static readonly WS = 23; - public static readonly COLON = 24; - public static readonly PIPE = 25; - public static readonly QUOTED_STRING = 26; - public static readonly INTEGER_LITERAL = 27; - public static readonly DECIMAL_LITERAL = 28; - public static readonly BY = 29; - public static readonly AND = 30; - public static readonly ASC = 31; - public static readonly ASSIGN = 32; - public static readonly CAST_OP = 33; - public static readonly COMMA = 34; - public static readonly DESC = 35; - public static readonly DOT = 36; - public static readonly FALSE = 37; - public static readonly FIRST = 38; - public static readonly IN = 39; - public static readonly IS = 40; - public static readonly LAST = 41; - public static readonly LIKE = 42; - public static readonly LP = 43; - public static readonly NOT = 44; - public static readonly NULL = 45; - public static readonly NULLS = 46; - public static readonly OR = 47; - public static readonly PARAM = 48; - public static readonly RLIKE = 49; - public static readonly RP = 50; - public static readonly TRUE = 51; - public static readonly EQ = 52; - public static readonly CIEQ = 53; - public static readonly NEQ = 54; - public static readonly LT = 55; - public static readonly LTE = 56; - public static readonly GT = 57; - public static readonly GTE = 58; - public static readonly PLUS = 59; - public static readonly MINUS = 60; - public static readonly ASTERISK = 61; - public static readonly SLASH = 62; - public static readonly PERCENT = 63; - public static readonly NAMED_OR_POSITIONAL_PARAM = 64; - public static readonly OPENING_BRACKET = 65; - public static readonly CLOSING_BRACKET = 66; - public static readonly UNQUOTED_IDENTIFIER = 67; - public static readonly QUOTED_IDENTIFIER = 68; - public static readonly EXPR_LINE_COMMENT = 69; - public static readonly EXPR_MULTILINE_COMMENT = 70; - public static readonly EXPR_WS = 71; - public static readonly EXPLAIN_WS = 72; - public static readonly EXPLAIN_LINE_COMMENT = 73; - public static readonly EXPLAIN_MULTILINE_COMMENT = 74; - public static readonly METADATA = 75; - public static readonly UNQUOTED_SOURCE = 76; - public static readonly FROM_LINE_COMMENT = 77; - public static readonly FROM_MULTILINE_COMMENT = 78; - public static readonly FROM_WS = 79; - public static readonly ID_PATTERN = 80; - public static readonly PROJECT_LINE_COMMENT = 81; - public static readonly PROJECT_MULTILINE_COMMENT = 82; - public static readonly PROJECT_WS = 83; - public static readonly AS = 84; - public static readonly RENAME_LINE_COMMENT = 85; - public static readonly RENAME_MULTILINE_COMMENT = 86; - public static readonly RENAME_WS = 87; - public static readonly ON = 88; - public static readonly WITH = 89; - public static readonly ENRICH_POLICY_NAME = 90; - public static readonly ENRICH_LINE_COMMENT = 91; - public static readonly ENRICH_MULTILINE_COMMENT = 92; - public static readonly ENRICH_WS = 93; - public static readonly ENRICH_FIELD_LINE_COMMENT = 94; - public static readonly ENRICH_FIELD_MULTILINE_COMMENT = 95; - public static readonly ENRICH_FIELD_WS = 96; - public static readonly MVEXPAND_LINE_COMMENT = 97; - public static readonly MVEXPAND_MULTILINE_COMMENT = 98; - public static readonly MVEXPAND_WS = 99; - public static readonly INFO = 100; - public static readonly SHOW_LINE_COMMENT = 101; - public static readonly SHOW_MULTILINE_COMMENT = 102; - public static readonly SHOW_WS = 103; - public static readonly SETTING = 104; - public static readonly SETTING_LINE_COMMENT = 105; - public static readonly SETTTING_MULTILINE_COMMENT = 106; - public static readonly SETTING_WS = 107; - public static readonly LOOKUP_LINE_COMMENT = 108; - public static readonly LOOKUP_MULTILINE_COMMENT = 109; - public static readonly LOOKUP_WS = 110; - public static readonly LOOKUP_FIELD_LINE_COMMENT = 111; - public static readonly LOOKUP_FIELD_MULTILINE_COMMENT = 112; - public static readonly LOOKUP_FIELD_WS = 113; - public static readonly METRICS_LINE_COMMENT = 114; - public static readonly METRICS_MULTILINE_COMMENT = 115; - public static readonly METRICS_WS = 116; - public static readonly CLOSING_METRICS_LINE_COMMENT = 117; - public static readonly CLOSING_METRICS_MULTILINE_COMMENT = 118; - public static readonly CLOSING_METRICS_WS = 119; + public static readonly DEV_JOIN = 20; + public static readonly DEV_JOIN_FULL = 21; + public static readonly DEV_JOIN_LEFT = 22; + public static readonly DEV_JOIN_RIGHT = 23; + public static readonly DEV_JOIN_LOOKUP = 24; + public static readonly UNKNOWN_CMD = 25; + public static readonly LINE_COMMENT = 26; + public static readonly MULTILINE_COMMENT = 27; + public static readonly WS = 28; + public static readonly PIPE = 29; + public static readonly QUOTED_STRING = 30; + public static readonly INTEGER_LITERAL = 31; + public static readonly DECIMAL_LITERAL = 32; + public static readonly BY = 33; + public static readonly AND = 34; + public static readonly ASC = 35; + public static readonly ASSIGN = 36; + public static readonly CAST_OP = 37; + public static readonly COLON = 38; + public static readonly COMMA = 39; + public static readonly DESC = 40; + public static readonly DOT = 41; + public static readonly FALSE = 42; + public static readonly FIRST = 43; + public static readonly IN = 44; + public static readonly IS = 45; + public static readonly LAST = 46; + public static readonly LIKE = 47; + public static readonly LP = 48; + public static readonly NOT = 49; + public static readonly NULL = 50; + public static readonly NULLS = 51; + public static readonly OR = 52; + public static readonly PARAM = 53; + public static readonly RLIKE = 54; + public static readonly RP = 55; + public static readonly TRUE = 56; + public static readonly EQ = 57; + public static readonly CIEQ = 58; + public static readonly NEQ = 59; + public static readonly LT = 60; + public static readonly LTE = 61; + public static readonly GT = 62; + public static readonly GTE = 63; + public static readonly PLUS = 64; + public static readonly MINUS = 65; + public static readonly ASTERISK = 66; + public static readonly SLASH = 67; + public static readonly PERCENT = 68; + public static readonly NAMED_OR_POSITIONAL_PARAM = 69; + public static readonly OPENING_BRACKET = 70; + public static readonly CLOSING_BRACKET = 71; + public static readonly UNQUOTED_IDENTIFIER = 72; + public static readonly QUOTED_IDENTIFIER = 73; + public static readonly EXPR_LINE_COMMENT = 74; + public static readonly EXPR_MULTILINE_COMMENT = 75; + public static readonly EXPR_WS = 76; + public static readonly EXPLAIN_WS = 77; + public static readonly EXPLAIN_LINE_COMMENT = 78; + public static readonly EXPLAIN_MULTILINE_COMMENT = 79; + public static readonly METADATA = 80; + public static readonly UNQUOTED_SOURCE = 81; + public static readonly FROM_LINE_COMMENT = 82; + public static readonly FROM_MULTILINE_COMMENT = 83; + public static readonly FROM_WS = 84; + public static readonly ID_PATTERN = 85; + public static readonly PROJECT_LINE_COMMENT = 86; + public static readonly PROJECT_MULTILINE_COMMENT = 87; + public static readonly PROJECT_WS = 88; + public static readonly AS = 89; + public static readonly RENAME_LINE_COMMENT = 90; + public static readonly RENAME_MULTILINE_COMMENT = 91; + public static readonly RENAME_WS = 92; + public static readonly ON = 93; + public static readonly WITH = 94; + public static readonly ENRICH_POLICY_NAME = 95; + public static readonly ENRICH_LINE_COMMENT = 96; + public static readonly ENRICH_MULTILINE_COMMENT = 97; + public static readonly ENRICH_WS = 98; + public static readonly ENRICH_FIELD_LINE_COMMENT = 99; + public static readonly ENRICH_FIELD_MULTILINE_COMMENT = 100; + public static readonly ENRICH_FIELD_WS = 101; + public static readonly MVEXPAND_LINE_COMMENT = 102; + public static readonly MVEXPAND_MULTILINE_COMMENT = 103; + public static readonly MVEXPAND_WS = 104; + public static readonly INFO = 105; + public static readonly SHOW_LINE_COMMENT = 106; + public static readonly SHOW_MULTILINE_COMMENT = 107; + public static readonly SHOW_WS = 108; + public static readonly SETTING = 109; + public static readonly SETTING_LINE_COMMENT = 110; + public static readonly SETTTING_MULTILINE_COMMENT = 111; + public static readonly SETTING_WS = 112; + public static readonly LOOKUP_LINE_COMMENT = 113; + public static readonly LOOKUP_MULTILINE_COMMENT = 114; + public static readonly LOOKUP_WS = 115; + public static readonly LOOKUP_FIELD_LINE_COMMENT = 116; + public static readonly LOOKUP_FIELD_MULTILINE_COMMENT = 117; + public static readonly LOOKUP_FIELD_WS = 118; + public static readonly USING = 119; + public static readonly JOIN_LINE_COMMENT = 120; + public static readonly JOIN_MULTILINE_COMMENT = 121; + public static readonly JOIN_WS = 122; + public static readonly METRICS_LINE_COMMENT = 123; + public static readonly METRICS_MULTILINE_COMMENT = 124; + public static readonly METRICS_WS = 125; + public static readonly CLOSING_METRICS_LINE_COMMENT = 126; + public static readonly CLOSING_METRICS_MULTILINE_COMMENT = 127; + public static readonly CLOSING_METRICS_WS = 128; public static override readonly EOF = Token.EOF; public static readonly RULE_singleStatement = 0; public static readonly RULE_query = 1; @@ -210,6 +219,10 @@ export default class esql_parser extends parser_config { public static readonly RULE_enrichWithClause = 59; public static readonly RULE_lookupCommand = 60; public static readonly RULE_inlinestatsCommand = 61; + public static readonly RULE_joinCommand = 62; + public static readonly RULE_joinTarget = 63; + public static readonly RULE_joinCondition = 64; + public static readonly RULE_joinPredicate = 65; public static readonly literalNames: (string | null)[] = [ null, "'dissect'", "'drop'", "'enrich'", "'eval'", "'explain'", @@ -223,32 +236,35 @@ export default class esql_parser extends parser_config { null, null, null, null, null, null, - "':'", "'|'", + null, null, + null, null, + null, "'|'", null, null, null, "'by'", "'and'", "'asc'", "'='", "'::'", - "','", "'desc'", - "'.'", "'false'", - "'first'", "'in'", - "'is'", "'last'", - "'like'", "'('", - "'not'", "'null'", - "'nulls'", "'or'", - "'?'", "'rlike'", - "')'", "'true'", - "'=='", "'=~'", - "'!='", "'<'", - "'<='", "'>'", - "'>='", "'+'", - "'-'", "'*'", - "'/'", "'%'", + "':'", "','", + "'desc'", "'.'", + "'false'", "'first'", + "'in'", "'is'", + "'last'", "'like'", + "'('", "'not'", + "'null'", "'nulls'", + "'or'", "'?'", + "'rlike'", "')'", + "'true'", "'=='", + "'=~'", "'!='", + "'<'", "'<='", + "'>'", "'>='", + "'+'", "'-'", + "'*'", "'/'", + "'%'", null, + null, "']'", null, null, - "']'", null, null, null, null, null, null, null, - null, "'metadata'", + "'metadata'", null, null, null, null, null, null, @@ -261,7 +277,14 @@ export default class esql_parser extends parser_config { null, null, null, null, null, null, - "'info'" ]; + "'info'", null, + null, null, + null, null, + null, null, + null, null, + null, null, + null, null, + "'USING'" ]; public static readonly symbolicNames: (string | null)[] = [ null, "DISSECT", "DROP", "ENRICH", "EVAL", "EXPLAIN", @@ -274,30 +297,36 @@ export default class esql_parser extends parser_config { "DEV_INLINESTATS", "DEV_LOOKUP", "DEV_METRICS", + "DEV_JOIN", + "DEV_JOIN_FULL", + "DEV_JOIN_LEFT", + "DEV_JOIN_RIGHT", + "DEV_JOIN_LOOKUP", "UNKNOWN_CMD", "LINE_COMMENT", "MULTILINE_COMMENT", - "WS", "COLON", - "PIPE", "QUOTED_STRING", + "WS", "PIPE", + "QUOTED_STRING", "INTEGER_LITERAL", "DECIMAL_LITERAL", "BY", "AND", "ASC", "ASSIGN", "CAST_OP", - "COMMA", "DESC", - "DOT", "FALSE", - "FIRST", "IN", - "IS", "LAST", - "LIKE", "LP", - "NOT", "NULL", - "NULLS", "OR", - "PARAM", "RLIKE", - "RP", "TRUE", - "EQ", "CIEQ", - "NEQ", "LT", - "LTE", "GT", - "GTE", "PLUS", - "MINUS", "ASTERISK", + "COLON", "COMMA", + "DESC", "DOT", + "FALSE", "FIRST", + "IN", "IS", + "LAST", "LIKE", + "LP", "NOT", + "NULL", "NULLS", + "OR", "PARAM", + "RLIKE", "RP", + "TRUE", "EQ", + "CIEQ", "NEQ", + "LT", "LTE", + "GT", "GTE", + "PLUS", "MINUS", + "ASTERISK", "SLASH", "PERCENT", "NAMED_OR_POSITIONAL_PARAM", "OPENING_BRACKET", @@ -346,6 +375,9 @@ export default class esql_parser extends parser_config { "LOOKUP_FIELD_LINE_COMMENT", "LOOKUP_FIELD_MULTILINE_COMMENT", "LOOKUP_FIELD_WS", + "USING", "JOIN_LINE_COMMENT", + "JOIN_MULTILINE_COMMENT", + "JOIN_WS", "METRICS_LINE_COMMENT", "METRICS_MULTILINE_COMMENT", "METRICS_WS", @@ -366,7 +398,8 @@ export default class esql_parser extends parser_config { "renameCommand", "renameClause", "dissectCommand", "grokCommand", "mvExpandCommand", "commandOptions", "commandOption", "booleanValue", "numericValue", "decimalValue", "integerValue", "string", "comparisonOperator", "explainCommand", "subqueryExpression", - "showCommand", "enrichCommand", "enrichWithClause", "lookupCommand", "inlinestatsCommand", + "showCommand", "enrichCommand", "enrichWithClause", "lookupCommand", "inlinestatsCommand", + "joinCommand", "joinTarget", "joinCondition", "joinPredicate", ]; public get grammarFileName(): string { return "esql_parser.g4"; } public get literalNames(): (string | null)[] { return esql_parser.literalNames; } @@ -389,9 +422,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 124; + this.state = 132; this.query(0); - this.state = 125; + this.state = 133; this.match(esql_parser.EOF); } } @@ -433,11 +466,11 @@ export default class esql_parser extends parser_config { this._ctx = localctx; _prevctx = localctx; - this.state = 128; + this.state = 136; this.sourceCommand(); } this._ctx.stop = this._input.LT(-1); - this.state = 135; + this.state = 143; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 0, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { @@ -450,18 +483,18 @@ export default class esql_parser extends parser_config { { localctx = new CompositeQueryContext(this, new QueryContext(this, _parentctx, _parentState)); this.pushNewRecursionContext(localctx, _startState, esql_parser.RULE_query); - this.state = 130; + this.state = 138; if (!(this.precpred(this._ctx, 1))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 1)"); } - this.state = 131; + this.state = 139; this.match(esql_parser.PIPE); - this.state = 132; + this.state = 140; this.processingCommand(); } } } - this.state = 137; + this.state = 145; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 0, this._ctx); } @@ -486,45 +519,45 @@ export default class esql_parser extends parser_config { let localctx: SourceCommandContext = new SourceCommandContext(this, this._ctx, this.state); this.enterRule(localctx, 4, esql_parser.RULE_sourceCommand); try { - this.state = 144; + this.state = 152; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 1, this._ctx) ) { case 1: this.enterOuterAlt(localctx, 1); { - this.state = 138; + this.state = 146; this.explainCommand(); } break; case 2: this.enterOuterAlt(localctx, 2); { - this.state = 139; + this.state = 147; this.fromCommand(); } break; case 3: this.enterOuterAlt(localctx, 3); { - this.state = 140; + this.state = 148; this.rowCommand(); } break; case 4: this.enterOuterAlt(localctx, 4); { - this.state = 141; + this.state = 149; this.showCommand(); } break; case 5: this.enterOuterAlt(localctx, 5); { - this.state = 142; + this.state = 150; if (!(this.isDevVersion())) { throw this.createFailedPredicateException("this.isDevVersion()"); } - this.state = 143; + this.state = 151; this.metricsCommand(); } break; @@ -549,115 +582,126 @@ export default class esql_parser extends parser_config { let localctx: ProcessingCommandContext = new ProcessingCommandContext(this, this._ctx, this.state); this.enterRule(localctx, 6, esql_parser.RULE_processingCommand); try { - this.state = 162; + this.state = 172; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 2, this._ctx) ) { case 1: this.enterOuterAlt(localctx, 1); { - this.state = 146; + this.state = 154; this.evalCommand(); } break; case 2: this.enterOuterAlt(localctx, 2); { - this.state = 147; + this.state = 155; this.whereCommand(); } break; case 3: this.enterOuterAlt(localctx, 3); { - this.state = 148; + this.state = 156; this.keepCommand(); } break; case 4: this.enterOuterAlt(localctx, 4); { - this.state = 149; + this.state = 157; this.limitCommand(); } break; case 5: this.enterOuterAlt(localctx, 5); { - this.state = 150; + this.state = 158; this.statsCommand(); } break; case 6: this.enterOuterAlt(localctx, 6); { - this.state = 151; + this.state = 159; this.sortCommand(); } break; case 7: this.enterOuterAlt(localctx, 7); { - this.state = 152; + this.state = 160; this.dropCommand(); } break; case 8: this.enterOuterAlt(localctx, 8); { - this.state = 153; + this.state = 161; this.renameCommand(); } break; case 9: this.enterOuterAlt(localctx, 9); { - this.state = 154; + this.state = 162; this.dissectCommand(); } break; case 10: this.enterOuterAlt(localctx, 10); { - this.state = 155; + this.state = 163; this.grokCommand(); } break; case 11: this.enterOuterAlt(localctx, 11); { - this.state = 156; + this.state = 164; this.enrichCommand(); } break; case 12: this.enterOuterAlt(localctx, 12); { - this.state = 157; + this.state = 165; this.mvExpandCommand(); } break; case 13: this.enterOuterAlt(localctx, 13); { - this.state = 158; + this.state = 166; if (!(this.isDevVersion())) { throw this.createFailedPredicateException("this.isDevVersion()"); } - this.state = 159; + this.state = 167; this.inlinestatsCommand(); } break; case 14: this.enterOuterAlt(localctx, 14); { - this.state = 160; + this.state = 168; if (!(this.isDevVersion())) { throw this.createFailedPredicateException("this.isDevVersion()"); } - this.state = 161; + this.state = 169; this.lookupCommand(); } break; + case 15: + this.enterOuterAlt(localctx, 15); + { + this.state = 170; + if (!(this.isDevVersion())) { + throw this.createFailedPredicateException("this.isDevVersion()"); + } + this.state = 171; + this.joinCommand(); + } + break; } } catch (re) { @@ -681,9 +725,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 164; + this.state = 174; this.match(esql_parser.WHERE); - this.state = 165; + this.state = 175; this.booleanExpression(0); } } @@ -721,7 +765,7 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 197; + this.state = 206; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 6, this._ctx) ) { case 1: @@ -730,9 +774,9 @@ export default class esql_parser extends parser_config { this._ctx = localctx; _prevctx = localctx; - this.state = 168; + this.state = 178; this.match(esql_parser.NOT); - this.state = 169; + this.state = 179; this.booleanExpression(8); } break; @@ -741,7 +785,7 @@ export default class esql_parser extends parser_config { localctx = new BooleanDefaultContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 170; + this.state = 180; this.valueExpression(); } break; @@ -750,7 +794,7 @@ export default class esql_parser extends parser_config { localctx = new RegexExpressionContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 171; + this.state = 181; this.regexBooleanExpression(); } break; @@ -759,41 +803,41 @@ export default class esql_parser extends parser_config { localctx = new LogicalInContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 172; + this.state = 182; this.valueExpression(); - this.state = 174; + this.state = 184; this._errHandler.sync(this); _la = this._input.LA(1); - if (_la===44) { + if (_la===49) { { - this.state = 173; + this.state = 183; this.match(esql_parser.NOT); } } - this.state = 176; + this.state = 186; this.match(esql_parser.IN); - this.state = 177; + this.state = 187; this.match(esql_parser.LP); - this.state = 178; + this.state = 188; this.valueExpression(); - this.state = 183; + this.state = 193; this._errHandler.sync(this); _la = this._input.LA(1); - while (_la===34) { + while (_la===39) { { { - this.state = 179; + this.state = 189; this.match(esql_parser.COMMA); - this.state = 180; + this.state = 190; this.valueExpression(); } } - this.state = 185; + this.state = 195; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 186; + this.state = 196; this.match(esql_parser.RP); } break; @@ -802,21 +846,21 @@ export default class esql_parser extends parser_config { localctx = new IsNullContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 188; + this.state = 198; this.valueExpression(); - this.state = 189; + this.state = 199; this.match(esql_parser.IS); - this.state = 191; + this.state = 201; this._errHandler.sync(this); _la = this._input.LA(1); - if (_la===44) { + if (_la===49) { { - this.state = 190; + this.state = 200; this.match(esql_parser.NOT); } } - this.state = 193; + this.state = 203; this.match(esql_parser.NULL); } break; @@ -825,17 +869,13 @@ export default class esql_parser extends parser_config { localctx = new MatchExpressionContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 195; - if (!(this.isDevVersion())) { - throw this.createFailedPredicateException("this.isDevVersion()"); - } - this.state = 196; + this.state = 205; this.matchBooleanExpression(); } break; } this._ctx.stop = this._input.LT(-1); - this.state = 207; + this.state = 216; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 8, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { @@ -845,7 +885,7 @@ export default class esql_parser extends parser_config { } _prevctx = localctx; { - this.state = 205; + this.state = 214; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 7, this._ctx) ) { case 1: @@ -853,13 +893,13 @@ export default class esql_parser extends parser_config { localctx = new LogicalBinaryContext(this, new BooleanExpressionContext(this, _parentctx, _parentState)); (localctx as LogicalBinaryContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, esql_parser.RULE_booleanExpression); - this.state = 199; + this.state = 208; if (!(this.precpred(this._ctx, 5))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 5)"); } - this.state = 200; + this.state = 209; (localctx as LogicalBinaryContext)._operator = this.match(esql_parser.AND); - this.state = 201; + this.state = 210; (localctx as LogicalBinaryContext)._right = this.booleanExpression(6); } break; @@ -868,20 +908,20 @@ export default class esql_parser extends parser_config { localctx = new LogicalBinaryContext(this, new BooleanExpressionContext(this, _parentctx, _parentState)); (localctx as LogicalBinaryContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, esql_parser.RULE_booleanExpression); - this.state = 202; + this.state = 211; if (!(this.precpred(this._ctx, 4))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 4)"); } - this.state = 203; + this.state = 212; (localctx as LogicalBinaryContext)._operator = this.match(esql_parser.OR); - this.state = 204; + this.state = 213; (localctx as LogicalBinaryContext)._right = this.booleanExpression(5); } break; } } } - this.state = 209; + this.state = 218; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 8, this._ctx); } @@ -907,48 +947,48 @@ export default class esql_parser extends parser_config { this.enterRule(localctx, 12, esql_parser.RULE_regexBooleanExpression); let _la: number; try { - this.state = 224; + this.state = 233; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 11, this._ctx) ) { case 1: this.enterOuterAlt(localctx, 1); { - this.state = 210; + this.state = 219; this.valueExpression(); - this.state = 212; + this.state = 221; this._errHandler.sync(this); _la = this._input.LA(1); - if (_la===44) { + if (_la===49) { { - this.state = 211; + this.state = 220; this.match(esql_parser.NOT); } } - this.state = 214; + this.state = 223; localctx._kind = this.match(esql_parser.LIKE); - this.state = 215; + this.state = 224; localctx._pattern = this.string_(); } break; case 2: this.enterOuterAlt(localctx, 2); { - this.state = 217; + this.state = 226; this.valueExpression(); - this.state = 219; + this.state = 228; this._errHandler.sync(this); _la = this._input.LA(1); - if (_la===44) { + if (_la===49) { { - this.state = 218; + this.state = 227; this.match(esql_parser.NOT); } } - this.state = 221; + this.state = 230; localctx._kind = this.match(esql_parser.RLIKE); - this.state = 222; + this.state = 231; localctx._pattern = this.string_(); } break; @@ -975,11 +1015,11 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 226; + this.state = 235; localctx._fieldExp = this.qualifiedName(); - this.state = 227; + this.state = 236; this.match(esql_parser.COLON); - this.state = 228; + this.state = 237; localctx._queryString = this.constant(); } } @@ -1002,14 +1042,14 @@ export default class esql_parser extends parser_config { let localctx: ValueExpressionContext = new ValueExpressionContext(this, this._ctx, this.state); this.enterRule(localctx, 16, esql_parser.RULE_valueExpression); try { - this.state = 235; + this.state = 244; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 12, this._ctx) ) { case 1: localctx = new ValueExpressionDefaultContext(this, localctx); this.enterOuterAlt(localctx, 1); { - this.state = 230; + this.state = 239; this.operatorExpression(0); } break; @@ -1017,11 +1057,11 @@ export default class esql_parser extends parser_config { localctx = new ComparisonContext(this, localctx); this.enterOuterAlt(localctx, 2); { - this.state = 231; + this.state = 240; (localctx as ComparisonContext)._left = this.operatorExpression(0); - this.state = 232; + this.state = 241; this.comparisonOperator(); - this.state = 233; + this.state = 242; (localctx as ComparisonContext)._right = this.operatorExpression(0); } break; @@ -1061,7 +1101,7 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 241; + this.state = 250; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 13, this._ctx) ) { case 1: @@ -1070,7 +1110,7 @@ export default class esql_parser extends parser_config { this._ctx = localctx; _prevctx = localctx; - this.state = 238; + this.state = 247; this.primaryExpression(0); } break; @@ -1079,23 +1119,23 @@ export default class esql_parser extends parser_config { localctx = new ArithmeticUnaryContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 239; + this.state = 248; (localctx as ArithmeticUnaryContext)._operator = this._input.LT(1); _la = this._input.LA(1); - if(!(_la===59 || _la===60)) { + if(!(_la===64 || _la===65)) { (localctx as ArithmeticUnaryContext)._operator = this._errHandler.recoverInline(this); } else { this._errHandler.reportMatch(this); this.consume(); } - this.state = 240; + this.state = 249; this.operatorExpression(3); } break; } this._ctx.stop = this._input.LT(-1); - this.state = 251; + this.state = 260; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 15, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { @@ -1105,7 +1145,7 @@ export default class esql_parser extends parser_config { } _prevctx = localctx; { - this.state = 249; + this.state = 258; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 14, this._ctx) ) { case 1: @@ -1113,21 +1153,21 @@ export default class esql_parser extends parser_config { localctx = new ArithmeticBinaryContext(this, new OperatorExpressionContext(this, _parentctx, _parentState)); (localctx as ArithmeticBinaryContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, esql_parser.RULE_operatorExpression); - this.state = 243; + this.state = 252; if (!(this.precpred(this._ctx, 2))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 2)"); } - this.state = 244; + this.state = 253; (localctx as ArithmeticBinaryContext)._operator = this._input.LT(1); _la = this._input.LA(1); - if(!(((((_la - 61)) & ~0x1F) === 0 && ((1 << (_la - 61)) & 7) !== 0))) { + if(!(((((_la - 66)) & ~0x1F) === 0 && ((1 << (_la - 66)) & 7) !== 0))) { (localctx as ArithmeticBinaryContext)._operator = this._errHandler.recoverInline(this); } else { this._errHandler.reportMatch(this); this.consume(); } - this.state = 245; + this.state = 254; (localctx as ArithmeticBinaryContext)._right = this.operatorExpression(3); } break; @@ -1136,28 +1176,28 @@ export default class esql_parser extends parser_config { localctx = new ArithmeticBinaryContext(this, new OperatorExpressionContext(this, _parentctx, _parentState)); (localctx as ArithmeticBinaryContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, esql_parser.RULE_operatorExpression); - this.state = 246; + this.state = 255; if (!(this.precpred(this._ctx, 1))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 1)"); } - this.state = 247; + this.state = 256; (localctx as ArithmeticBinaryContext)._operator = this._input.LT(1); _la = this._input.LA(1); - if(!(_la===59 || _la===60)) { + if(!(_la===64 || _la===65)) { (localctx as ArithmeticBinaryContext)._operator = this._errHandler.recoverInline(this); } else { this._errHandler.reportMatch(this); this.consume(); } - this.state = 248; + this.state = 257; (localctx as ArithmeticBinaryContext)._right = this.operatorExpression(2); } break; } } } - this.state = 253; + this.state = 262; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 15, this._ctx); } @@ -1196,7 +1236,7 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 262; + this.state = 271; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 16, this._ctx) ) { case 1: @@ -1205,7 +1245,7 @@ export default class esql_parser extends parser_config { this._ctx = localctx; _prevctx = localctx; - this.state = 255; + this.state = 264; this.constant(); } break; @@ -1214,7 +1254,7 @@ export default class esql_parser extends parser_config { localctx = new DereferenceContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 256; + this.state = 265; this.qualifiedName(); } break; @@ -1223,7 +1263,7 @@ export default class esql_parser extends parser_config { localctx = new FunctionContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 257; + this.state = 266; this.functionExpression(); } break; @@ -1232,17 +1272,17 @@ export default class esql_parser extends parser_config { localctx = new ParenthesizedExpressionContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 258; + this.state = 267; this.match(esql_parser.LP); - this.state = 259; + this.state = 268; this.booleanExpression(0); - this.state = 260; + this.state = 269; this.match(esql_parser.RP); } break; } this._ctx.stop = this._input.LT(-1); - this.state = 269; + this.state = 278; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 17, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { @@ -1255,18 +1295,18 @@ export default class esql_parser extends parser_config { { localctx = new InlineCastContext(this, new PrimaryExpressionContext(this, _parentctx, _parentState)); this.pushNewRecursionContext(localctx, _startState, esql_parser.RULE_primaryExpression); - this.state = 264; + this.state = 273; if (!(this.precpred(this._ctx, 1))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 1)"); } - this.state = 265; + this.state = 274; this.match(esql_parser.CAST_OP); - this.state = 266; + this.state = 275; this.dataType(); } } } - this.state = 271; + this.state = 280; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 17, this._ctx); } @@ -1294,37 +1334,37 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 272; + this.state = 281; this.functionName(); - this.state = 273; + this.state = 282; this.match(esql_parser.LP); - this.state = 283; + this.state = 292; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 19, this._ctx) ) { case 1: { - this.state = 274; + this.state = 283; this.match(esql_parser.ASTERISK); } break; case 2: { { - this.state = 275; + this.state = 284; this.booleanExpression(0); - this.state = 280; + this.state = 289; this._errHandler.sync(this); _la = this._input.LA(1); - while (_la===34) { + while (_la===39) { { { - this.state = 276; + this.state = 285; this.match(esql_parser.COMMA); - this.state = 277; + this.state = 286; this.booleanExpression(0); } } - this.state = 282; + this.state = 291; this._errHandler.sync(this); _la = this._input.LA(1); } @@ -1332,7 +1372,7 @@ export default class esql_parser extends parser_config { } break; } - this.state = 285; + this.state = 294; this.match(esql_parser.RP); } } @@ -1357,7 +1397,7 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 287; + this.state = 296; this.identifierOrParameter(); } } @@ -1383,7 +1423,7 @@ export default class esql_parser extends parser_config { localctx = new ToDataTypeContext(this, localctx); this.enterOuterAlt(localctx, 1); { - this.state = 289; + this.state = 298; this.identifier(); } } @@ -1408,9 +1448,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 291; + this.state = 300; this.match(esql_parser.ROW); - this.state = 292; + this.state = 301; this.fields(); } } @@ -1436,23 +1476,23 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 294; + this.state = 303; this.field(); - this.state = 299; + this.state = 308; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 20, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 295; + this.state = 304; this.match(esql_parser.COMMA); - this.state = 296; + this.state = 305; this.field(); } } } - this.state = 301; + this.state = 310; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 20, this._ctx); } @@ -1479,19 +1519,19 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 305; + this.state = 314; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 21, this._ctx) ) { case 1: { - this.state = 302; + this.state = 311; this.qualifiedName(); - this.state = 303; + this.state = 312; this.match(esql_parser.ASSIGN); } break; } - this.state = 307; + this.state = 316; this.booleanExpression(0); } } @@ -1517,34 +1557,34 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 309; + this.state = 318; this.match(esql_parser.FROM); - this.state = 310; + this.state = 319; this.indexPattern(); - this.state = 315; + this.state = 324; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 22, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 311; + this.state = 320; this.match(esql_parser.COMMA); - this.state = 312; + this.state = 321; this.indexPattern(); } } } - this.state = 317; + this.state = 326; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 22, this._ctx); } - this.state = 319; + this.state = 328; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 23, this._ctx) ) { case 1: { - this.state = 318; + this.state = 327; this.metadata(); } break; @@ -1572,19 +1612,19 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 324; + this.state = 333; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 24, this._ctx) ) { case 1: { - this.state = 321; + this.state = 330; this.clusterString(); - this.state = 322; + this.state = 331; this.match(esql_parser.COLON); } break; } - this.state = 326; + this.state = 335; this.indexString(); } } @@ -1609,7 +1649,7 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 328; + this.state = 337; this.match(esql_parser.UNQUOTED_SOURCE); } } @@ -1635,9 +1675,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 330; + this.state = 339; _la = this._input.LA(1); - if(!(_la===26 || _la===76)) { + if(!(_la===30 || _la===81)) { this._errHandler.recoverInline(this); } else { @@ -1665,20 +1705,20 @@ export default class esql_parser extends parser_config { let localctx: MetadataContext = new MetadataContext(this, this._ctx, this.state); this.enterRule(localctx, 42, esql_parser.RULE_metadata); try { - this.state = 334; + this.state = 343; this._errHandler.sync(this); switch (this._input.LA(1)) { - case 75: + case 80: this.enterOuterAlt(localctx, 1); { - this.state = 332; + this.state = 341; this.metadataOption(); } break; - case 65: + case 70: this.enterOuterAlt(localctx, 2); { - this.state = 333; + this.state = 342; this.deprecated_metadata(); } break; @@ -1708,25 +1748,25 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 336; + this.state = 345; this.match(esql_parser.METADATA); - this.state = 337; + this.state = 346; this.match(esql_parser.UNQUOTED_SOURCE); - this.state = 342; + this.state = 351; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 26, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 338; + this.state = 347; this.match(esql_parser.COMMA); - this.state = 339; + this.state = 348; this.match(esql_parser.UNQUOTED_SOURCE); } } } - this.state = 344; + this.state = 353; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 26, this._ctx); } @@ -1753,11 +1793,11 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 345; + this.state = 354; this.match(esql_parser.OPENING_BRACKET); - this.state = 346; + this.state = 355; this.metadataOption(); - this.state = 347; + this.state = 356; this.match(esql_parser.CLOSING_BRACKET); } } @@ -1783,46 +1823,46 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 349; + this.state = 358; this.match(esql_parser.DEV_METRICS); - this.state = 350; + this.state = 359; this.indexPattern(); - this.state = 355; + this.state = 364; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 27, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 351; + this.state = 360; this.match(esql_parser.COMMA); - this.state = 352; + this.state = 361; this.indexPattern(); } } } - this.state = 357; + this.state = 366; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 27, this._ctx); } - this.state = 359; + this.state = 368; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 28, this._ctx) ) { case 1: { - this.state = 358; + this.state = 367; localctx._aggregates = this.aggFields(); } break; } - this.state = 363; + this.state = 372; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 29, this._ctx) ) { case 1: { - this.state = 361; + this.state = 370; this.match(esql_parser.BY); - this.state = 362; + this.state = 371; localctx._grouping = this.fields(); } break; @@ -1850,9 +1890,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 365; + this.state = 374; this.match(esql_parser.EVAL); - this.state = 366; + this.state = 375; this.fields(); } } @@ -1877,26 +1917,26 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 368; + this.state = 377; this.match(esql_parser.STATS); - this.state = 370; + this.state = 379; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 30, this._ctx) ) { case 1: { - this.state = 369; + this.state = 378; localctx._stats = this.aggFields(); } break; } - this.state = 374; + this.state = 383; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 31, this._ctx) ) { case 1: { - this.state = 372; + this.state = 381; this.match(esql_parser.BY); - this.state = 373; + this.state = 382; localctx._grouping = this.fields(); } break; @@ -1925,23 +1965,23 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 376; + this.state = 385; this.aggField(); - this.state = 381; + this.state = 390; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 32, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 377; + this.state = 386; this.match(esql_parser.COMMA); - this.state = 378; + this.state = 387; this.aggField(); } } } - this.state = 383; + this.state = 392; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 32, this._ctx); } @@ -1968,16 +2008,16 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 384; + this.state = 393; this.field(); - this.state = 387; + this.state = 396; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 33, this._ctx) ) { case 1: { - this.state = 385; + this.state = 394; this.match(esql_parser.WHERE); - this.state = 386; + this.state = 395; this.booleanExpression(0); } break; @@ -2006,23 +2046,23 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 389; + this.state = 398; this.identifierOrParameter(); - this.state = 394; + this.state = 403; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 34, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 390; + this.state = 399; this.match(esql_parser.DOT); - this.state = 391; + this.state = 400; this.identifierOrParameter(); } } } - this.state = 396; + this.state = 405; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 34, this._ctx); } @@ -2050,23 +2090,23 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 397; + this.state = 406; this.identifierPattern(); - this.state = 402; + this.state = 411; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 35, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 398; + this.state = 407; this.match(esql_parser.DOT); - this.state = 399; + this.state = 408; this.identifierPattern(); } } } - this.state = 404; + this.state = 413; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 35, this._ctx); } @@ -2094,23 +2134,23 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 405; + this.state = 414; this.qualifiedNamePattern(); - this.state = 410; + this.state = 419; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 36, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 406; + this.state = 415; this.match(esql_parser.COMMA); - this.state = 407; + this.state = 416; this.qualifiedNamePattern(); } } } - this.state = 412; + this.state = 421; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 36, this._ctx); } @@ -2138,9 +2178,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 413; + this.state = 422; _la = this._input.LA(1); - if(!(_la===67 || _la===68)) { + if(!(_la===72 || _la===73)) { this._errHandler.recoverInline(this); } else { @@ -2168,24 +2208,24 @@ export default class esql_parser extends parser_config { let localctx: IdentifierPatternContext = new IdentifierPatternContext(this, this._ctx, this.state); this.enterRule(localctx, 66, esql_parser.RULE_identifierPattern); try { - this.state = 418; + this.state = 427; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 37, this._ctx) ) { case 1: this.enterOuterAlt(localctx, 1); { - this.state = 415; + this.state = 424; this.match(esql_parser.ID_PATTERN); } break; case 2: this.enterOuterAlt(localctx, 2); { - this.state = 416; + this.state = 425; if (!(this.isDevVersion())) { throw this.createFailedPredicateException("this.isDevVersion()"); } - this.state = 417; + this.state = 426; this.parameter(); } break; @@ -2211,14 +2251,14 @@ export default class esql_parser extends parser_config { this.enterRule(localctx, 68, esql_parser.RULE_constant); let _la: number; try { - this.state = 462; + this.state = 471; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 41, this._ctx) ) { case 1: localctx = new NullLiteralContext(this, localctx); this.enterOuterAlt(localctx, 1); { - this.state = 420; + this.state = 429; this.match(esql_parser.NULL); } break; @@ -2226,9 +2266,9 @@ export default class esql_parser extends parser_config { localctx = new QualifiedIntegerLiteralContext(this, localctx); this.enterOuterAlt(localctx, 2); { - this.state = 421; + this.state = 430; this.integerValue(); - this.state = 422; + this.state = 431; this.match(esql_parser.UNQUOTED_IDENTIFIER); } break; @@ -2236,7 +2276,7 @@ export default class esql_parser extends parser_config { localctx = new DecimalLiteralContext(this, localctx); this.enterOuterAlt(localctx, 3); { - this.state = 424; + this.state = 433; this.decimalValue(); } break; @@ -2244,7 +2284,7 @@ export default class esql_parser extends parser_config { localctx = new IntegerLiteralContext(this, localctx); this.enterOuterAlt(localctx, 4); { - this.state = 425; + this.state = 434; this.integerValue(); } break; @@ -2252,7 +2292,7 @@ export default class esql_parser extends parser_config { localctx = new BooleanLiteralContext(this, localctx); this.enterOuterAlt(localctx, 5); { - this.state = 426; + this.state = 435; this.booleanValue(); } break; @@ -2260,7 +2300,7 @@ export default class esql_parser extends parser_config { localctx = new InputParameterContext(this, localctx); this.enterOuterAlt(localctx, 6); { - this.state = 427; + this.state = 436; this.parameter(); } break; @@ -2268,7 +2308,7 @@ export default class esql_parser extends parser_config { localctx = new StringLiteralContext(this, localctx); this.enterOuterAlt(localctx, 7); { - this.state = 428; + this.state = 437; this.string_(); } break; @@ -2276,27 +2316,27 @@ export default class esql_parser extends parser_config { localctx = new NumericArrayLiteralContext(this, localctx); this.enterOuterAlt(localctx, 8); { - this.state = 429; + this.state = 438; this.match(esql_parser.OPENING_BRACKET); - this.state = 430; + this.state = 439; this.numericValue(); - this.state = 435; + this.state = 444; this._errHandler.sync(this); _la = this._input.LA(1); - while (_la===34) { + while (_la===39) { { { - this.state = 431; + this.state = 440; this.match(esql_parser.COMMA); - this.state = 432; + this.state = 441; this.numericValue(); } } - this.state = 437; + this.state = 446; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 438; + this.state = 447; this.match(esql_parser.CLOSING_BRACKET); } break; @@ -2304,27 +2344,27 @@ export default class esql_parser extends parser_config { localctx = new BooleanArrayLiteralContext(this, localctx); this.enterOuterAlt(localctx, 9); { - this.state = 440; + this.state = 449; this.match(esql_parser.OPENING_BRACKET); - this.state = 441; + this.state = 450; this.booleanValue(); - this.state = 446; + this.state = 455; this._errHandler.sync(this); _la = this._input.LA(1); - while (_la===34) { + while (_la===39) { { { - this.state = 442; + this.state = 451; this.match(esql_parser.COMMA); - this.state = 443; + this.state = 452; this.booleanValue(); } } - this.state = 448; + this.state = 457; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 449; + this.state = 458; this.match(esql_parser.CLOSING_BRACKET); } break; @@ -2332,27 +2372,27 @@ export default class esql_parser extends parser_config { localctx = new StringArrayLiteralContext(this, localctx); this.enterOuterAlt(localctx, 10); { - this.state = 451; + this.state = 460; this.match(esql_parser.OPENING_BRACKET); - this.state = 452; + this.state = 461; this.string_(); - this.state = 457; + this.state = 466; this._errHandler.sync(this); _la = this._input.LA(1); - while (_la===34) { + while (_la===39) { { { - this.state = 453; + this.state = 462; this.match(esql_parser.COMMA); - this.state = 454; + this.state = 463; this.string_(); } } - this.state = 459; + this.state = 468; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 460; + this.state = 469; this.match(esql_parser.CLOSING_BRACKET); } break; @@ -2377,22 +2417,22 @@ export default class esql_parser extends parser_config { let localctx: ParameterContext = new ParameterContext(this, this._ctx, this.state); this.enterRule(localctx, 70, esql_parser.RULE_parameter); try { - this.state = 466; + this.state = 475; this._errHandler.sync(this); switch (this._input.LA(1)) { - case 48: + case 53: localctx = new InputParamContext(this, localctx); this.enterOuterAlt(localctx, 1); { - this.state = 464; + this.state = 473; this.match(esql_parser.PARAM); } break; - case 64: + case 69: localctx = new InputNamedOrPositionalParamContext(this, localctx); this.enterOuterAlt(localctx, 2); { - this.state = 465; + this.state = 474; this.match(esql_parser.NAMED_OR_POSITIONAL_PARAM); } break; @@ -2419,24 +2459,24 @@ export default class esql_parser extends parser_config { let localctx: IdentifierOrParameterContext = new IdentifierOrParameterContext(this, this._ctx, this.state); this.enterRule(localctx, 72, esql_parser.RULE_identifierOrParameter); try { - this.state = 471; + this.state = 480; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 43, this._ctx) ) { case 1: this.enterOuterAlt(localctx, 1); { - this.state = 468; + this.state = 477; this.identifier(); } break; case 2: this.enterOuterAlt(localctx, 2); { - this.state = 469; + this.state = 478; if (!(this.isDevVersion())) { throw this.createFailedPredicateException("this.isDevVersion()"); } - this.state = 470; + this.state = 479; this.parameter(); } break; @@ -2463,9 +2503,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 473; + this.state = 482; this.match(esql_parser.LIMIT); - this.state = 474; + this.state = 483; this.match(esql_parser.INTEGER_LITERAL); } } @@ -2491,25 +2531,25 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 476; + this.state = 485; this.match(esql_parser.SORT); - this.state = 477; + this.state = 486; this.orderExpression(); - this.state = 482; + this.state = 491; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 44, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 478; + this.state = 487; this.match(esql_parser.COMMA); - this.state = 479; + this.state = 488; this.orderExpression(); } } } - this.state = 484; + this.state = 493; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 44, this._ctx); } @@ -2537,17 +2577,17 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 485; + this.state = 494; this.booleanExpression(0); - this.state = 487; + this.state = 496; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 45, this._ctx) ) { case 1: { - this.state = 486; + this.state = 495; localctx._ordering = this._input.LT(1); _la = this._input.LA(1); - if(!(_la===31 || _la===35)) { + if(!(_la===35 || _la===40)) { localctx._ordering = this._errHandler.recoverInline(this); } else { @@ -2557,17 +2597,17 @@ export default class esql_parser extends parser_config { } break; } - this.state = 491; + this.state = 500; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 46, this._ctx) ) { case 1: { - this.state = 489; + this.state = 498; this.match(esql_parser.NULLS); - this.state = 490; + this.state = 499; localctx._nullOrdering = this._input.LT(1); _la = this._input.LA(1); - if(!(_la===38 || _la===41)) { + if(!(_la===43 || _la===46)) { localctx._nullOrdering = this._errHandler.recoverInline(this); } else { @@ -2600,9 +2640,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 493; + this.state = 502; this.match(esql_parser.KEEP); - this.state = 494; + this.state = 503; this.qualifiedNamePatterns(); } } @@ -2627,9 +2667,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 496; + this.state = 505; this.match(esql_parser.DROP); - this.state = 497; + this.state = 506; this.qualifiedNamePatterns(); } } @@ -2655,25 +2695,25 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 499; + this.state = 508; this.match(esql_parser.RENAME); - this.state = 500; + this.state = 509; this.renameClause(); - this.state = 505; + this.state = 514; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 47, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 501; + this.state = 510; this.match(esql_parser.COMMA); - this.state = 502; + this.state = 511; this.renameClause(); } } } - this.state = 507; + this.state = 516; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 47, this._ctx); } @@ -2700,11 +2740,11 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 508; + this.state = 517; localctx._oldName = this.qualifiedNamePattern(); - this.state = 509; + this.state = 518; this.match(esql_parser.AS); - this.state = 510; + this.state = 519; localctx._newName = this.qualifiedNamePattern(); } } @@ -2729,18 +2769,18 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 512; + this.state = 521; this.match(esql_parser.DISSECT); - this.state = 513; + this.state = 522; this.primaryExpression(0); - this.state = 514; + this.state = 523; this.string_(); - this.state = 516; + this.state = 525; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 48, this._ctx) ) { case 1: { - this.state = 515; + this.state = 524; this.commandOptions(); } break; @@ -2768,11 +2808,11 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 518; + this.state = 527; this.match(esql_parser.GROK); - this.state = 519; + this.state = 528; this.primaryExpression(0); - this.state = 520; + this.state = 529; this.string_(); } } @@ -2797,9 +2837,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 522; + this.state = 531; this.match(esql_parser.MV_EXPAND); - this.state = 523; + this.state = 532; this.qualifiedName(); } } @@ -2825,23 +2865,23 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 525; + this.state = 534; this.commandOption(); - this.state = 530; + this.state = 539; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 49, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 526; + this.state = 535; this.match(esql_parser.COMMA); - this.state = 527; + this.state = 536; this.commandOption(); } } } - this.state = 532; + this.state = 541; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 49, this._ctx); } @@ -2868,11 +2908,11 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 533; + this.state = 542; this.identifier(); - this.state = 534; + this.state = 543; this.match(esql_parser.ASSIGN); - this.state = 535; + this.state = 544; this.constant(); } } @@ -2898,9 +2938,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 537; + this.state = 546; _la = this._input.LA(1); - if(!(_la===37 || _la===51)) { + if(!(_la===42 || _la===56)) { this._errHandler.recoverInline(this); } else { @@ -2928,20 +2968,20 @@ export default class esql_parser extends parser_config { let localctx: NumericValueContext = new NumericValueContext(this, this._ctx, this.state); this.enterRule(localctx, 100, esql_parser.RULE_numericValue); try { - this.state = 541; + this.state = 550; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 50, this._ctx) ) { case 1: this.enterOuterAlt(localctx, 1); { - this.state = 539; + this.state = 548; this.decimalValue(); } break; case 2: this.enterOuterAlt(localctx, 2); { - this.state = 540; + this.state = 549; this.integerValue(); } break; @@ -2969,14 +3009,14 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 544; + this.state = 553; this._errHandler.sync(this); _la = this._input.LA(1); - if (_la===59 || _la===60) { + if (_la===64 || _la===65) { { - this.state = 543; + this.state = 552; _la = this._input.LA(1); - if(!(_la===59 || _la===60)) { + if(!(_la===64 || _la===65)) { this._errHandler.recoverInline(this); } else { @@ -2986,7 +3026,7 @@ export default class esql_parser extends parser_config { } } - this.state = 546; + this.state = 555; this.match(esql_parser.DECIMAL_LITERAL); } } @@ -3012,14 +3052,14 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 549; + this.state = 558; this._errHandler.sync(this); _la = this._input.LA(1); - if (_la===59 || _la===60) { + if (_la===64 || _la===65) { { - this.state = 548; + this.state = 557; _la = this._input.LA(1); - if(!(_la===59 || _la===60)) { + if(!(_la===64 || _la===65)) { this._errHandler.recoverInline(this); } else { @@ -3029,7 +3069,7 @@ export default class esql_parser extends parser_config { } } - this.state = 551; + this.state = 560; this.match(esql_parser.INTEGER_LITERAL); } } @@ -3054,7 +3094,7 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 553; + this.state = 562; this.match(esql_parser.QUOTED_STRING); } } @@ -3080,9 +3120,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 555; + this.state = 564; _la = this._input.LA(1); - if(!(((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 125) !== 0))) { + if(!(((((_la - 57)) & ~0x1F) === 0 && ((1 << (_la - 57)) & 125) !== 0))) { this._errHandler.recoverInline(this); } else { @@ -3112,9 +3152,9 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 557; + this.state = 566; this.match(esql_parser.EXPLAIN); - this.state = 558; + this.state = 567; this.subqueryExpression(); } } @@ -3139,11 +3179,11 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 560; + this.state = 569; this.match(esql_parser.OPENING_BRACKET); - this.state = 561; + this.state = 570; this.query(0); - this.state = 562; + this.state = 571; this.match(esql_parser.CLOSING_BRACKET); } } @@ -3169,9 +3209,9 @@ export default class esql_parser extends parser_config { localctx = new ShowInfoContext(this, localctx); this.enterOuterAlt(localctx, 1); { - this.state = 564; + this.state = 573; this.match(esql_parser.SHOW); - this.state = 565; + this.state = 574; this.match(esql_parser.INFO); } } @@ -3197,46 +3237,46 @@ export default class esql_parser extends parser_config { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 567; + this.state = 576; this.match(esql_parser.ENRICH); - this.state = 568; + this.state = 577; localctx._policyName = this.match(esql_parser.ENRICH_POLICY_NAME); - this.state = 571; + this.state = 580; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 53, this._ctx) ) { case 1: { - this.state = 569; + this.state = 578; this.match(esql_parser.ON); - this.state = 570; + this.state = 579; localctx._matchField = this.qualifiedNamePattern(); } break; } - this.state = 582; + this.state = 591; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 55, this._ctx) ) { case 1: { - this.state = 573; + this.state = 582; this.match(esql_parser.WITH); - this.state = 574; + this.state = 583; this.enrichWithClause(); - this.state = 579; + this.state = 588; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 54, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 575; + this.state = 584; this.match(esql_parser.COMMA); - this.state = 576; + this.state = 585; this.enrichWithClause(); } } } - this.state = 581; + this.state = 590; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 54, this._ctx); } @@ -3266,19 +3306,19 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 587; + this.state = 596; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 56, this._ctx) ) { case 1: { - this.state = 584; + this.state = 593; localctx._newName = this.qualifiedNamePattern(); - this.state = 585; + this.state = 594; this.match(esql_parser.ASSIGN); } break; } - this.state = 589; + this.state = 598; localctx._enrichField = this.qualifiedNamePattern(); } } @@ -3303,13 +3343,13 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 591; + this.state = 600; this.match(esql_parser.DEV_LOOKUP); - this.state = 592; + this.state = 601; localctx._tableName = this.indexPattern(); - this.state = 593; + this.state = 602; this.match(esql_parser.ON); - this.state = 594; + this.state = 603; localctx._matchFields = this.qualifiedNamePatterns(); } } @@ -3334,18 +3374,18 @@ export default class esql_parser extends parser_config { try { this.enterOuterAlt(localctx, 1); { - this.state = 596; + this.state = 605; this.match(esql_parser.DEV_INLINESTATS); - this.state = 597; + this.state = 606; localctx._stats = this.aggFields(); - this.state = 600; + this.state = 609; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 57, this._ctx) ) { case 1: { - this.state = 598; + this.state = 607; this.match(esql_parser.BY); - this.state = 599; + this.state = 608; localctx._grouping = this.fields(); } break; @@ -3366,6 +3406,163 @@ export default class esql_parser extends parser_config { } return localctx; } + // @RuleVersion(0) + public joinCommand(): JoinCommandContext { + let localctx: JoinCommandContext = new JoinCommandContext(this, this._ctx, this.state); + this.enterRule(localctx, 124, esql_parser.RULE_joinCommand); + let _la: number; + try { + this.enterOuterAlt(localctx, 1); + { + this.state = 612; + this._errHandler.sync(this); + _la = this._input.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 29360128) !== 0)) { + { + this.state = 611; + localctx._type_ = this._input.LT(1); + _la = this._input.LA(1); + if(!((((_la) & ~0x1F) === 0 && ((1 << _la) & 29360128) !== 0))) { + localctx._type_ = this._errHandler.recoverInline(this); + } + else { + this._errHandler.reportMatch(this); + this.consume(); + } + } + } + + this.state = 614; + this.match(esql_parser.DEV_JOIN); + this.state = 615; + this.joinTarget(); + this.state = 616; + this.joinCondition(); + } + } + catch (re) { + if (re instanceof RecognitionException) { + localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return localctx; + } + // @RuleVersion(0) + public joinTarget(): JoinTargetContext { + let localctx: JoinTargetContext = new JoinTargetContext(this, this._ctx, this.state); + this.enterRule(localctx, 126, esql_parser.RULE_joinTarget); + let _la: number; + try { + this.enterOuterAlt(localctx, 1); + { + this.state = 618; + localctx._index = this.identifier(); + this.state = 621; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (_la===89) { + { + this.state = 619; + this.match(esql_parser.AS); + this.state = 620; + localctx._alias = this.identifier(); + } + } + + } + } + catch (re) { + if (re instanceof RecognitionException) { + localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return localctx; + } + // @RuleVersion(0) + public joinCondition(): JoinConditionContext { + let localctx: JoinConditionContext = new JoinConditionContext(this, this._ctx, this.state); + this.enterRule(localctx, 128, esql_parser.RULE_joinCondition); + try { + let _alt: number; + this.enterOuterAlt(localctx, 1); + { + this.state = 623; + this.match(esql_parser.ON); + this.state = 624; + this.joinPredicate(); + this.state = 629; + this._errHandler.sync(this); + _alt = this._interp.adaptivePredict(this._input, 60, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 625; + this.match(esql_parser.COMMA); + this.state = 626; + this.joinPredicate(); + } + } + } + this.state = 631; + this._errHandler.sync(this); + _alt = this._interp.adaptivePredict(this._input, 60, this._ctx); + } + } + } + catch (re) { + if (re instanceof RecognitionException) { + localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return localctx; + } + // @RuleVersion(0) + public joinPredicate(): JoinPredicateContext { + let localctx: JoinPredicateContext = new JoinPredicateContext(this, this._ctx, this.state); + this.enterRule(localctx, 130, esql_parser.RULE_joinPredicate); + try { + this.enterOuterAlt(localctx, 1); + { + this.state = 632; + this.valueExpression(); + } + } + catch (re) { + if (re instanceof RecognitionException) { + localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return localctx; + } public sempred(localctx: RuleContext, ruleIndex: number, predIndex: number): boolean { switch (ruleIndex) { @@ -3408,13 +3605,13 @@ export default class esql_parser extends parser_config { return this.isDevVersion(); case 3: return this.isDevVersion(); + case 4: + return this.isDevVersion(); } return true; } private booleanExpression_sempred(localctx: BooleanExpressionContext, predIndex: number): boolean { switch (predIndex) { - case 4: - return this.isDevVersion(); case 5: return this.precpred(this._ctx, 5); case 6: @@ -3453,7 +3650,7 @@ export default class esql_parser extends parser_config { return true; } - public static readonly _serializedATN: number[] = [4,1,119,603,2,0,7,0, + public static readonly _serializedATN: number[] = [4,1,128,635,2,0,7,0, 2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9, 2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2, 17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24, @@ -3462,194 +3659,204 @@ export default class esql_parser extends parser_config { 2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2, 46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53, 7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7, - 60,2,61,7,61,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,5,1,134,8,1,10,1,12,1, - 137,9,1,1,2,1,2,1,2,1,2,1,2,1,2,3,2,145,8,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3, - 1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,163,8,3,1,4,1,4,1,4,1,5,1,5,1,5, - 1,5,1,5,1,5,1,5,3,5,175,8,5,1,5,1,5,1,5,1,5,1,5,5,5,182,8,5,10,5,12,5,185, - 9,5,1,5,1,5,1,5,1,5,1,5,3,5,192,8,5,1,5,1,5,1,5,1,5,3,5,198,8,5,1,5,1,5, - 1,5,1,5,1,5,1,5,5,5,206,8,5,10,5,12,5,209,9,5,1,6,1,6,3,6,213,8,6,1,6,1, - 6,1,6,1,6,1,6,3,6,220,8,6,1,6,1,6,1,6,3,6,225,8,6,1,7,1,7,1,7,1,7,1,8,1, - 8,1,8,1,8,1,8,3,8,236,8,8,1,9,1,9,1,9,1,9,3,9,242,8,9,1,9,1,9,1,9,1,9,1, - 9,1,9,5,9,250,8,9,10,9,12,9,253,9,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10, - 1,10,3,10,263,8,10,1,10,1,10,1,10,5,10,268,8,10,10,10,12,10,271,9,10,1, - 11,1,11,1,11,1,11,1,11,1,11,5,11,279,8,11,10,11,12,11,282,9,11,3,11,284, - 8,11,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,14,1,15,1,15,1,15,5,15,298, - 8,15,10,15,12,15,301,9,15,1,16,1,16,1,16,3,16,306,8,16,1,16,1,16,1,17,1, - 17,1,17,1,17,5,17,314,8,17,10,17,12,17,317,9,17,1,17,3,17,320,8,17,1,18, - 1,18,1,18,3,18,325,8,18,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,3,21,335, - 8,21,1,22,1,22,1,22,1,22,5,22,341,8,22,10,22,12,22,344,9,22,1,23,1,23,1, - 23,1,23,1,24,1,24,1,24,1,24,5,24,354,8,24,10,24,12,24,357,9,24,1,24,3,24, - 360,8,24,1,24,1,24,3,24,364,8,24,1,25,1,25,1,25,1,26,1,26,3,26,371,8,26, - 1,26,1,26,3,26,375,8,26,1,27,1,27,1,27,5,27,380,8,27,10,27,12,27,383,9, - 27,1,28,1,28,1,28,3,28,388,8,28,1,29,1,29,1,29,5,29,393,8,29,10,29,12,29, - 396,9,29,1,30,1,30,1,30,5,30,401,8,30,10,30,12,30,404,9,30,1,31,1,31,1, - 31,5,31,409,8,31,10,31,12,31,412,9,31,1,32,1,32,1,33,1,33,1,33,3,33,419, - 8,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,5, - 34,434,8,34,10,34,12,34,437,9,34,1,34,1,34,1,34,1,34,1,34,1,34,5,34,445, - 8,34,10,34,12,34,448,9,34,1,34,1,34,1,34,1,34,1,34,1,34,5,34,456,8,34,10, - 34,12,34,459,9,34,1,34,1,34,3,34,463,8,34,1,35,1,35,3,35,467,8,35,1,36, - 1,36,1,36,3,36,472,8,36,1,37,1,37,1,37,1,38,1,38,1,38,1,38,5,38,481,8,38, - 10,38,12,38,484,9,38,1,39,1,39,3,39,488,8,39,1,39,1,39,3,39,492,8,39,1, - 40,1,40,1,40,1,41,1,41,1,41,1,42,1,42,1,42,1,42,5,42,504,8,42,10,42,12, - 42,507,9,42,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1,44,3,44,517,8,44,1,45, - 1,45,1,45,1,45,1,46,1,46,1,46,1,47,1,47,1,47,5,47,529,8,47,10,47,12,47, - 532,9,47,1,48,1,48,1,48,1,48,1,49,1,49,1,50,1,50,3,50,542,8,50,1,51,3,51, - 545,8,51,1,51,1,51,1,52,3,52,550,8,52,1,52,1,52,1,53,1,53,1,54,1,54,1,55, - 1,55,1,55,1,56,1,56,1,56,1,56,1,57,1,57,1,57,1,58,1,58,1,58,1,58,3,58,572, - 8,58,1,58,1,58,1,58,1,58,5,58,578,8,58,10,58,12,58,581,9,58,3,58,583,8, - 58,1,59,1,59,1,59,3,59,588,8,59,1,59,1,59,1,60,1,60,1,60,1,60,1,60,1,61, - 1,61,1,61,1,61,3,61,601,8,61,1,61,0,4,2,10,18,20,62,0,2,4,6,8,10,12,14, - 16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62, - 64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108, - 110,112,114,116,118,120,122,0,8,1,0,59,60,1,0,61,63,2,0,26,26,76,76,1,0, - 67,68,2,0,31,31,35,35,2,0,38,38,41,41,2,0,37,37,51,51,2,0,52,52,54,58,628, - 0,124,1,0,0,0,2,127,1,0,0,0,4,144,1,0,0,0,6,162,1,0,0,0,8,164,1,0,0,0,10, - 197,1,0,0,0,12,224,1,0,0,0,14,226,1,0,0,0,16,235,1,0,0,0,18,241,1,0,0,0, - 20,262,1,0,0,0,22,272,1,0,0,0,24,287,1,0,0,0,26,289,1,0,0,0,28,291,1,0, - 0,0,30,294,1,0,0,0,32,305,1,0,0,0,34,309,1,0,0,0,36,324,1,0,0,0,38,328, - 1,0,0,0,40,330,1,0,0,0,42,334,1,0,0,0,44,336,1,0,0,0,46,345,1,0,0,0,48, - 349,1,0,0,0,50,365,1,0,0,0,52,368,1,0,0,0,54,376,1,0,0,0,56,384,1,0,0,0, - 58,389,1,0,0,0,60,397,1,0,0,0,62,405,1,0,0,0,64,413,1,0,0,0,66,418,1,0, - 0,0,68,462,1,0,0,0,70,466,1,0,0,0,72,471,1,0,0,0,74,473,1,0,0,0,76,476, - 1,0,0,0,78,485,1,0,0,0,80,493,1,0,0,0,82,496,1,0,0,0,84,499,1,0,0,0,86, - 508,1,0,0,0,88,512,1,0,0,0,90,518,1,0,0,0,92,522,1,0,0,0,94,525,1,0,0,0, - 96,533,1,0,0,0,98,537,1,0,0,0,100,541,1,0,0,0,102,544,1,0,0,0,104,549,1, - 0,0,0,106,553,1,0,0,0,108,555,1,0,0,0,110,557,1,0,0,0,112,560,1,0,0,0,114, - 564,1,0,0,0,116,567,1,0,0,0,118,587,1,0,0,0,120,591,1,0,0,0,122,596,1,0, - 0,0,124,125,3,2,1,0,125,126,5,0,0,1,126,1,1,0,0,0,127,128,6,1,-1,0,128, - 129,3,4,2,0,129,135,1,0,0,0,130,131,10,1,0,0,131,132,5,25,0,0,132,134,3, - 6,3,0,133,130,1,0,0,0,134,137,1,0,0,0,135,133,1,0,0,0,135,136,1,0,0,0,136, - 3,1,0,0,0,137,135,1,0,0,0,138,145,3,110,55,0,139,145,3,34,17,0,140,145, - 3,28,14,0,141,145,3,114,57,0,142,143,4,2,1,0,143,145,3,48,24,0,144,138, - 1,0,0,0,144,139,1,0,0,0,144,140,1,0,0,0,144,141,1,0,0,0,144,142,1,0,0,0, - 145,5,1,0,0,0,146,163,3,50,25,0,147,163,3,8,4,0,148,163,3,80,40,0,149,163, - 3,74,37,0,150,163,3,52,26,0,151,163,3,76,38,0,152,163,3,82,41,0,153,163, - 3,84,42,0,154,163,3,88,44,0,155,163,3,90,45,0,156,163,3,116,58,0,157,163, - 3,92,46,0,158,159,4,3,2,0,159,163,3,122,61,0,160,161,4,3,3,0,161,163,3, - 120,60,0,162,146,1,0,0,0,162,147,1,0,0,0,162,148,1,0,0,0,162,149,1,0,0, - 0,162,150,1,0,0,0,162,151,1,0,0,0,162,152,1,0,0,0,162,153,1,0,0,0,162,154, - 1,0,0,0,162,155,1,0,0,0,162,156,1,0,0,0,162,157,1,0,0,0,162,158,1,0,0,0, - 162,160,1,0,0,0,163,7,1,0,0,0,164,165,5,16,0,0,165,166,3,10,5,0,166,9,1, - 0,0,0,167,168,6,5,-1,0,168,169,5,44,0,0,169,198,3,10,5,8,170,198,3,16,8, - 0,171,198,3,12,6,0,172,174,3,16,8,0,173,175,5,44,0,0,174,173,1,0,0,0,174, - 175,1,0,0,0,175,176,1,0,0,0,176,177,5,39,0,0,177,178,5,43,0,0,178,183,3, - 16,8,0,179,180,5,34,0,0,180,182,3,16,8,0,181,179,1,0,0,0,182,185,1,0,0, - 0,183,181,1,0,0,0,183,184,1,0,0,0,184,186,1,0,0,0,185,183,1,0,0,0,186,187, - 5,50,0,0,187,198,1,0,0,0,188,189,3,16,8,0,189,191,5,40,0,0,190,192,5,44, - 0,0,191,190,1,0,0,0,191,192,1,0,0,0,192,193,1,0,0,0,193,194,5,45,0,0,194, - 198,1,0,0,0,195,196,4,5,4,0,196,198,3,14,7,0,197,167,1,0,0,0,197,170,1, - 0,0,0,197,171,1,0,0,0,197,172,1,0,0,0,197,188,1,0,0,0,197,195,1,0,0,0,198, - 207,1,0,0,0,199,200,10,5,0,0,200,201,5,30,0,0,201,206,3,10,5,6,202,203, - 10,4,0,0,203,204,5,47,0,0,204,206,3,10,5,5,205,199,1,0,0,0,205,202,1,0, - 0,0,206,209,1,0,0,0,207,205,1,0,0,0,207,208,1,0,0,0,208,11,1,0,0,0,209, - 207,1,0,0,0,210,212,3,16,8,0,211,213,5,44,0,0,212,211,1,0,0,0,212,213,1, - 0,0,0,213,214,1,0,0,0,214,215,5,42,0,0,215,216,3,106,53,0,216,225,1,0,0, - 0,217,219,3,16,8,0,218,220,5,44,0,0,219,218,1,0,0,0,219,220,1,0,0,0,220, - 221,1,0,0,0,221,222,5,49,0,0,222,223,3,106,53,0,223,225,1,0,0,0,224,210, - 1,0,0,0,224,217,1,0,0,0,225,13,1,0,0,0,226,227,3,58,29,0,227,228,5,24,0, - 0,228,229,3,68,34,0,229,15,1,0,0,0,230,236,3,18,9,0,231,232,3,18,9,0,232, - 233,3,108,54,0,233,234,3,18,9,0,234,236,1,0,0,0,235,230,1,0,0,0,235,231, - 1,0,0,0,236,17,1,0,0,0,237,238,6,9,-1,0,238,242,3,20,10,0,239,240,7,0,0, - 0,240,242,3,18,9,3,241,237,1,0,0,0,241,239,1,0,0,0,242,251,1,0,0,0,243, - 244,10,2,0,0,244,245,7,1,0,0,245,250,3,18,9,3,246,247,10,1,0,0,247,248, - 7,0,0,0,248,250,3,18,9,2,249,243,1,0,0,0,249,246,1,0,0,0,250,253,1,0,0, - 0,251,249,1,0,0,0,251,252,1,0,0,0,252,19,1,0,0,0,253,251,1,0,0,0,254,255, - 6,10,-1,0,255,263,3,68,34,0,256,263,3,58,29,0,257,263,3,22,11,0,258,259, - 5,43,0,0,259,260,3,10,5,0,260,261,5,50,0,0,261,263,1,0,0,0,262,254,1,0, - 0,0,262,256,1,0,0,0,262,257,1,0,0,0,262,258,1,0,0,0,263,269,1,0,0,0,264, - 265,10,1,0,0,265,266,5,33,0,0,266,268,3,26,13,0,267,264,1,0,0,0,268,271, - 1,0,0,0,269,267,1,0,0,0,269,270,1,0,0,0,270,21,1,0,0,0,271,269,1,0,0,0, - 272,273,3,24,12,0,273,283,5,43,0,0,274,284,5,61,0,0,275,280,3,10,5,0,276, - 277,5,34,0,0,277,279,3,10,5,0,278,276,1,0,0,0,279,282,1,0,0,0,280,278,1, - 0,0,0,280,281,1,0,0,0,281,284,1,0,0,0,282,280,1,0,0,0,283,274,1,0,0,0,283, - 275,1,0,0,0,283,284,1,0,0,0,284,285,1,0,0,0,285,286,5,50,0,0,286,23,1,0, - 0,0,287,288,3,72,36,0,288,25,1,0,0,0,289,290,3,64,32,0,290,27,1,0,0,0,291, - 292,5,12,0,0,292,293,3,30,15,0,293,29,1,0,0,0,294,299,3,32,16,0,295,296, - 5,34,0,0,296,298,3,32,16,0,297,295,1,0,0,0,298,301,1,0,0,0,299,297,1,0, - 0,0,299,300,1,0,0,0,300,31,1,0,0,0,301,299,1,0,0,0,302,303,3,58,29,0,303, - 304,5,32,0,0,304,306,1,0,0,0,305,302,1,0,0,0,305,306,1,0,0,0,306,307,1, - 0,0,0,307,308,3,10,5,0,308,33,1,0,0,0,309,310,5,6,0,0,310,315,3,36,18,0, - 311,312,5,34,0,0,312,314,3,36,18,0,313,311,1,0,0,0,314,317,1,0,0,0,315, - 313,1,0,0,0,315,316,1,0,0,0,316,319,1,0,0,0,317,315,1,0,0,0,318,320,3,42, - 21,0,319,318,1,0,0,0,319,320,1,0,0,0,320,35,1,0,0,0,321,322,3,38,19,0,322, - 323,5,24,0,0,323,325,1,0,0,0,324,321,1,0,0,0,324,325,1,0,0,0,325,326,1, - 0,0,0,326,327,3,40,20,0,327,37,1,0,0,0,328,329,5,76,0,0,329,39,1,0,0,0, - 330,331,7,2,0,0,331,41,1,0,0,0,332,335,3,44,22,0,333,335,3,46,23,0,334, - 332,1,0,0,0,334,333,1,0,0,0,335,43,1,0,0,0,336,337,5,75,0,0,337,342,5,76, - 0,0,338,339,5,34,0,0,339,341,5,76,0,0,340,338,1,0,0,0,341,344,1,0,0,0,342, - 340,1,0,0,0,342,343,1,0,0,0,343,45,1,0,0,0,344,342,1,0,0,0,345,346,5,65, - 0,0,346,347,3,44,22,0,347,348,5,66,0,0,348,47,1,0,0,0,349,350,5,19,0,0, - 350,355,3,36,18,0,351,352,5,34,0,0,352,354,3,36,18,0,353,351,1,0,0,0,354, - 357,1,0,0,0,355,353,1,0,0,0,355,356,1,0,0,0,356,359,1,0,0,0,357,355,1,0, - 0,0,358,360,3,54,27,0,359,358,1,0,0,0,359,360,1,0,0,0,360,363,1,0,0,0,361, - 362,5,29,0,0,362,364,3,30,15,0,363,361,1,0,0,0,363,364,1,0,0,0,364,49,1, - 0,0,0,365,366,5,4,0,0,366,367,3,30,15,0,367,51,1,0,0,0,368,370,5,15,0,0, - 369,371,3,54,27,0,370,369,1,0,0,0,370,371,1,0,0,0,371,374,1,0,0,0,372,373, - 5,29,0,0,373,375,3,30,15,0,374,372,1,0,0,0,374,375,1,0,0,0,375,53,1,0,0, - 0,376,381,3,56,28,0,377,378,5,34,0,0,378,380,3,56,28,0,379,377,1,0,0,0, - 380,383,1,0,0,0,381,379,1,0,0,0,381,382,1,0,0,0,382,55,1,0,0,0,383,381, - 1,0,0,0,384,387,3,32,16,0,385,386,5,16,0,0,386,388,3,10,5,0,387,385,1,0, - 0,0,387,388,1,0,0,0,388,57,1,0,0,0,389,394,3,72,36,0,390,391,5,36,0,0,391, - 393,3,72,36,0,392,390,1,0,0,0,393,396,1,0,0,0,394,392,1,0,0,0,394,395,1, - 0,0,0,395,59,1,0,0,0,396,394,1,0,0,0,397,402,3,66,33,0,398,399,5,36,0,0, - 399,401,3,66,33,0,400,398,1,0,0,0,401,404,1,0,0,0,402,400,1,0,0,0,402,403, - 1,0,0,0,403,61,1,0,0,0,404,402,1,0,0,0,405,410,3,60,30,0,406,407,5,34,0, - 0,407,409,3,60,30,0,408,406,1,0,0,0,409,412,1,0,0,0,410,408,1,0,0,0,410, - 411,1,0,0,0,411,63,1,0,0,0,412,410,1,0,0,0,413,414,7,3,0,0,414,65,1,0,0, - 0,415,419,5,80,0,0,416,417,4,33,10,0,417,419,3,70,35,0,418,415,1,0,0,0, - 418,416,1,0,0,0,419,67,1,0,0,0,420,463,5,45,0,0,421,422,3,104,52,0,422, - 423,5,67,0,0,423,463,1,0,0,0,424,463,3,102,51,0,425,463,3,104,52,0,426, - 463,3,98,49,0,427,463,3,70,35,0,428,463,3,106,53,0,429,430,5,65,0,0,430, - 435,3,100,50,0,431,432,5,34,0,0,432,434,3,100,50,0,433,431,1,0,0,0,434, - 437,1,0,0,0,435,433,1,0,0,0,435,436,1,0,0,0,436,438,1,0,0,0,437,435,1,0, - 0,0,438,439,5,66,0,0,439,463,1,0,0,0,440,441,5,65,0,0,441,446,3,98,49,0, - 442,443,5,34,0,0,443,445,3,98,49,0,444,442,1,0,0,0,445,448,1,0,0,0,446, - 444,1,0,0,0,446,447,1,0,0,0,447,449,1,0,0,0,448,446,1,0,0,0,449,450,5,66, - 0,0,450,463,1,0,0,0,451,452,5,65,0,0,452,457,3,106,53,0,453,454,5,34,0, - 0,454,456,3,106,53,0,455,453,1,0,0,0,456,459,1,0,0,0,457,455,1,0,0,0,457, - 458,1,0,0,0,458,460,1,0,0,0,459,457,1,0,0,0,460,461,5,66,0,0,461,463,1, - 0,0,0,462,420,1,0,0,0,462,421,1,0,0,0,462,424,1,0,0,0,462,425,1,0,0,0,462, - 426,1,0,0,0,462,427,1,0,0,0,462,428,1,0,0,0,462,429,1,0,0,0,462,440,1,0, - 0,0,462,451,1,0,0,0,463,69,1,0,0,0,464,467,5,48,0,0,465,467,5,64,0,0,466, - 464,1,0,0,0,466,465,1,0,0,0,467,71,1,0,0,0,468,472,3,64,32,0,469,470,4, - 36,11,0,470,472,3,70,35,0,471,468,1,0,0,0,471,469,1,0,0,0,472,73,1,0,0, - 0,473,474,5,9,0,0,474,475,5,27,0,0,475,75,1,0,0,0,476,477,5,14,0,0,477, - 482,3,78,39,0,478,479,5,34,0,0,479,481,3,78,39,0,480,478,1,0,0,0,481,484, - 1,0,0,0,482,480,1,0,0,0,482,483,1,0,0,0,483,77,1,0,0,0,484,482,1,0,0,0, - 485,487,3,10,5,0,486,488,7,4,0,0,487,486,1,0,0,0,487,488,1,0,0,0,488,491, - 1,0,0,0,489,490,5,46,0,0,490,492,7,5,0,0,491,489,1,0,0,0,491,492,1,0,0, - 0,492,79,1,0,0,0,493,494,5,8,0,0,494,495,3,62,31,0,495,81,1,0,0,0,496,497, - 5,2,0,0,497,498,3,62,31,0,498,83,1,0,0,0,499,500,5,11,0,0,500,505,3,86, - 43,0,501,502,5,34,0,0,502,504,3,86,43,0,503,501,1,0,0,0,504,507,1,0,0,0, - 505,503,1,0,0,0,505,506,1,0,0,0,506,85,1,0,0,0,507,505,1,0,0,0,508,509, - 3,60,30,0,509,510,5,84,0,0,510,511,3,60,30,0,511,87,1,0,0,0,512,513,5,1, - 0,0,513,514,3,20,10,0,514,516,3,106,53,0,515,517,3,94,47,0,516,515,1,0, - 0,0,516,517,1,0,0,0,517,89,1,0,0,0,518,519,5,7,0,0,519,520,3,20,10,0,520, - 521,3,106,53,0,521,91,1,0,0,0,522,523,5,10,0,0,523,524,3,58,29,0,524,93, - 1,0,0,0,525,530,3,96,48,0,526,527,5,34,0,0,527,529,3,96,48,0,528,526,1, - 0,0,0,529,532,1,0,0,0,530,528,1,0,0,0,530,531,1,0,0,0,531,95,1,0,0,0,532, - 530,1,0,0,0,533,534,3,64,32,0,534,535,5,32,0,0,535,536,3,68,34,0,536,97, - 1,0,0,0,537,538,7,6,0,0,538,99,1,0,0,0,539,542,3,102,51,0,540,542,3,104, - 52,0,541,539,1,0,0,0,541,540,1,0,0,0,542,101,1,0,0,0,543,545,7,0,0,0,544, - 543,1,0,0,0,544,545,1,0,0,0,545,546,1,0,0,0,546,547,5,28,0,0,547,103,1, - 0,0,0,548,550,7,0,0,0,549,548,1,0,0,0,549,550,1,0,0,0,550,551,1,0,0,0,551, - 552,5,27,0,0,552,105,1,0,0,0,553,554,5,26,0,0,554,107,1,0,0,0,555,556,7, - 7,0,0,556,109,1,0,0,0,557,558,5,5,0,0,558,559,3,112,56,0,559,111,1,0,0, - 0,560,561,5,65,0,0,561,562,3,2,1,0,562,563,5,66,0,0,563,113,1,0,0,0,564, - 565,5,13,0,0,565,566,5,100,0,0,566,115,1,0,0,0,567,568,5,3,0,0,568,571, - 5,90,0,0,569,570,5,88,0,0,570,572,3,60,30,0,571,569,1,0,0,0,571,572,1,0, - 0,0,572,582,1,0,0,0,573,574,5,89,0,0,574,579,3,118,59,0,575,576,5,34,0, - 0,576,578,3,118,59,0,577,575,1,0,0,0,578,581,1,0,0,0,579,577,1,0,0,0,579, - 580,1,0,0,0,580,583,1,0,0,0,581,579,1,0,0,0,582,573,1,0,0,0,582,583,1,0, - 0,0,583,117,1,0,0,0,584,585,3,60,30,0,585,586,5,32,0,0,586,588,1,0,0,0, - 587,584,1,0,0,0,587,588,1,0,0,0,588,589,1,0,0,0,589,590,3,60,30,0,590,119, - 1,0,0,0,591,592,5,18,0,0,592,593,3,36,18,0,593,594,5,88,0,0,594,595,3,62, - 31,0,595,121,1,0,0,0,596,597,5,17,0,0,597,600,3,54,27,0,598,599,5,29,0, - 0,599,601,3,30,15,0,600,598,1,0,0,0,600,601,1,0,0,0,601,123,1,0,0,0,58, - 135,144,162,174,183,191,197,205,207,212,219,224,235,241,249,251,262,269, - 280,283,299,305,315,319,324,334,342,355,359,363,370,374,381,387,394,402, - 410,418,435,446,457,462,466,471,482,487,491,505,516,530,541,544,549,571, - 579,582,587,600]; + 60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2,65,7,65,1,0,1,0,1,0,1,1,1, + 1,1,1,1,1,1,1,1,1,5,1,142,8,1,10,1,12,1,145,9,1,1,2,1,2,1,2,1,2,1,2,1,2, + 3,2,153,8,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, + 1,3,1,3,1,3,3,3,173,8,3,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,185, + 8,5,1,5,1,5,1,5,1,5,1,5,5,5,192,8,5,10,5,12,5,195,9,5,1,5,1,5,1,5,1,5,1, + 5,3,5,202,8,5,1,5,1,5,1,5,3,5,207,8,5,1,5,1,5,1,5,1,5,1,5,1,5,5,5,215,8, + 5,10,5,12,5,218,9,5,1,6,1,6,3,6,222,8,6,1,6,1,6,1,6,1,6,1,6,3,6,229,8,6, + 1,6,1,6,1,6,3,6,234,8,6,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,3,8,245,8,8, + 1,9,1,9,1,9,1,9,3,9,251,8,9,1,9,1,9,1,9,1,9,1,9,1,9,5,9,259,8,9,10,9,12, + 9,262,9,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,3,10,272,8,10,1,10,1, + 10,1,10,5,10,277,8,10,10,10,12,10,280,9,10,1,11,1,11,1,11,1,11,1,11,1,11, + 5,11,288,8,11,10,11,12,11,291,9,11,3,11,293,8,11,1,11,1,11,1,12,1,12,1, + 13,1,13,1,14,1,14,1,14,1,15,1,15,1,15,5,15,307,8,15,10,15,12,15,310,9,15, + 1,16,1,16,1,16,3,16,315,8,16,1,16,1,16,1,17,1,17,1,17,1,17,5,17,323,8,17, + 10,17,12,17,326,9,17,1,17,3,17,329,8,17,1,18,1,18,1,18,3,18,334,8,18,1, + 18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,3,21,344,8,21,1,22,1,22,1,22,1,22, + 5,22,350,8,22,10,22,12,22,353,9,22,1,23,1,23,1,23,1,23,1,24,1,24,1,24,1, + 24,5,24,363,8,24,10,24,12,24,366,9,24,1,24,3,24,369,8,24,1,24,1,24,3,24, + 373,8,24,1,25,1,25,1,25,1,26,1,26,3,26,380,8,26,1,26,1,26,3,26,384,8,26, + 1,27,1,27,1,27,5,27,389,8,27,10,27,12,27,392,9,27,1,28,1,28,1,28,3,28,397, + 8,28,1,29,1,29,1,29,5,29,402,8,29,10,29,12,29,405,9,29,1,30,1,30,1,30,5, + 30,410,8,30,10,30,12,30,413,9,30,1,31,1,31,1,31,5,31,418,8,31,10,31,12, + 31,421,9,31,1,32,1,32,1,33,1,33,1,33,3,33,428,8,33,1,34,1,34,1,34,1,34, + 1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,5,34,443,8,34,10,34,12,34, + 446,9,34,1,34,1,34,1,34,1,34,1,34,1,34,5,34,454,8,34,10,34,12,34,457,9, + 34,1,34,1,34,1,34,1,34,1,34,1,34,5,34,465,8,34,10,34,12,34,468,9,34,1,34, + 1,34,3,34,472,8,34,1,35,1,35,3,35,476,8,35,1,36,1,36,1,36,3,36,481,8,36, + 1,37,1,37,1,37,1,38,1,38,1,38,1,38,5,38,490,8,38,10,38,12,38,493,9,38,1, + 39,1,39,3,39,497,8,39,1,39,1,39,3,39,501,8,39,1,40,1,40,1,40,1,41,1,41, + 1,41,1,42,1,42,1,42,1,42,5,42,513,8,42,10,42,12,42,516,9,42,1,43,1,43,1, + 43,1,43,1,44,1,44,1,44,1,44,3,44,526,8,44,1,45,1,45,1,45,1,45,1,46,1,46, + 1,46,1,47,1,47,1,47,5,47,538,8,47,10,47,12,47,541,9,47,1,48,1,48,1,48,1, + 48,1,49,1,49,1,50,1,50,3,50,551,8,50,1,51,3,51,554,8,51,1,51,1,51,1,52, + 3,52,559,8,52,1,52,1,52,1,53,1,53,1,54,1,54,1,55,1,55,1,55,1,56,1,56,1, + 56,1,56,1,57,1,57,1,57,1,58,1,58,1,58,1,58,3,58,581,8,58,1,58,1,58,1,58, + 1,58,5,58,587,8,58,10,58,12,58,590,9,58,3,58,592,8,58,1,59,1,59,1,59,3, + 59,597,8,59,1,59,1,59,1,60,1,60,1,60,1,60,1,60,1,61,1,61,1,61,1,61,3,61, + 610,8,61,1,62,3,62,613,8,62,1,62,1,62,1,62,1,62,1,63,1,63,1,63,3,63,622, + 8,63,1,64,1,64,1,64,1,64,5,64,628,8,64,10,64,12,64,631,9,64,1,65,1,65,1, + 65,0,4,2,10,18,20,66,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36, + 38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84, + 86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124, + 126,128,130,0,9,1,0,64,65,1,0,66,68,2,0,30,30,81,81,1,0,72,73,2,0,35,35, + 40,40,2,0,43,43,46,46,2,0,42,42,56,56,2,0,57,57,59,63,1,0,22,24,660,0,132, + 1,0,0,0,2,135,1,0,0,0,4,152,1,0,0,0,6,172,1,0,0,0,8,174,1,0,0,0,10,206, + 1,0,0,0,12,233,1,0,0,0,14,235,1,0,0,0,16,244,1,0,0,0,18,250,1,0,0,0,20, + 271,1,0,0,0,22,281,1,0,0,0,24,296,1,0,0,0,26,298,1,0,0,0,28,300,1,0,0,0, + 30,303,1,0,0,0,32,314,1,0,0,0,34,318,1,0,0,0,36,333,1,0,0,0,38,337,1,0, + 0,0,40,339,1,0,0,0,42,343,1,0,0,0,44,345,1,0,0,0,46,354,1,0,0,0,48,358, + 1,0,0,0,50,374,1,0,0,0,52,377,1,0,0,0,54,385,1,0,0,0,56,393,1,0,0,0,58, + 398,1,0,0,0,60,406,1,0,0,0,62,414,1,0,0,0,64,422,1,0,0,0,66,427,1,0,0,0, + 68,471,1,0,0,0,70,475,1,0,0,0,72,480,1,0,0,0,74,482,1,0,0,0,76,485,1,0, + 0,0,78,494,1,0,0,0,80,502,1,0,0,0,82,505,1,0,0,0,84,508,1,0,0,0,86,517, + 1,0,0,0,88,521,1,0,0,0,90,527,1,0,0,0,92,531,1,0,0,0,94,534,1,0,0,0,96, + 542,1,0,0,0,98,546,1,0,0,0,100,550,1,0,0,0,102,553,1,0,0,0,104,558,1,0, + 0,0,106,562,1,0,0,0,108,564,1,0,0,0,110,566,1,0,0,0,112,569,1,0,0,0,114, + 573,1,0,0,0,116,576,1,0,0,0,118,596,1,0,0,0,120,600,1,0,0,0,122,605,1,0, + 0,0,124,612,1,0,0,0,126,618,1,0,0,0,128,623,1,0,0,0,130,632,1,0,0,0,132, + 133,3,2,1,0,133,134,5,0,0,1,134,1,1,0,0,0,135,136,6,1,-1,0,136,137,3,4, + 2,0,137,143,1,0,0,0,138,139,10,1,0,0,139,140,5,29,0,0,140,142,3,6,3,0,141, + 138,1,0,0,0,142,145,1,0,0,0,143,141,1,0,0,0,143,144,1,0,0,0,144,3,1,0,0, + 0,145,143,1,0,0,0,146,153,3,110,55,0,147,153,3,34,17,0,148,153,3,28,14, + 0,149,153,3,114,57,0,150,151,4,2,1,0,151,153,3,48,24,0,152,146,1,0,0,0, + 152,147,1,0,0,0,152,148,1,0,0,0,152,149,1,0,0,0,152,150,1,0,0,0,153,5,1, + 0,0,0,154,173,3,50,25,0,155,173,3,8,4,0,156,173,3,80,40,0,157,173,3,74, + 37,0,158,173,3,52,26,0,159,173,3,76,38,0,160,173,3,82,41,0,161,173,3,84, + 42,0,162,173,3,88,44,0,163,173,3,90,45,0,164,173,3,116,58,0,165,173,3,92, + 46,0,166,167,4,3,2,0,167,173,3,122,61,0,168,169,4,3,3,0,169,173,3,120,60, + 0,170,171,4,3,4,0,171,173,3,124,62,0,172,154,1,0,0,0,172,155,1,0,0,0,172, + 156,1,0,0,0,172,157,1,0,0,0,172,158,1,0,0,0,172,159,1,0,0,0,172,160,1,0, + 0,0,172,161,1,0,0,0,172,162,1,0,0,0,172,163,1,0,0,0,172,164,1,0,0,0,172, + 165,1,0,0,0,172,166,1,0,0,0,172,168,1,0,0,0,172,170,1,0,0,0,173,7,1,0,0, + 0,174,175,5,16,0,0,175,176,3,10,5,0,176,9,1,0,0,0,177,178,6,5,-1,0,178, + 179,5,49,0,0,179,207,3,10,5,8,180,207,3,16,8,0,181,207,3,12,6,0,182,184, + 3,16,8,0,183,185,5,49,0,0,184,183,1,0,0,0,184,185,1,0,0,0,185,186,1,0,0, + 0,186,187,5,44,0,0,187,188,5,48,0,0,188,193,3,16,8,0,189,190,5,39,0,0,190, + 192,3,16,8,0,191,189,1,0,0,0,192,195,1,0,0,0,193,191,1,0,0,0,193,194,1, + 0,0,0,194,196,1,0,0,0,195,193,1,0,0,0,196,197,5,55,0,0,197,207,1,0,0,0, + 198,199,3,16,8,0,199,201,5,45,0,0,200,202,5,49,0,0,201,200,1,0,0,0,201, + 202,1,0,0,0,202,203,1,0,0,0,203,204,5,50,0,0,204,207,1,0,0,0,205,207,3, + 14,7,0,206,177,1,0,0,0,206,180,1,0,0,0,206,181,1,0,0,0,206,182,1,0,0,0, + 206,198,1,0,0,0,206,205,1,0,0,0,207,216,1,0,0,0,208,209,10,5,0,0,209,210, + 5,34,0,0,210,215,3,10,5,6,211,212,10,4,0,0,212,213,5,52,0,0,213,215,3,10, + 5,5,214,208,1,0,0,0,214,211,1,0,0,0,215,218,1,0,0,0,216,214,1,0,0,0,216, + 217,1,0,0,0,217,11,1,0,0,0,218,216,1,0,0,0,219,221,3,16,8,0,220,222,5,49, + 0,0,221,220,1,0,0,0,221,222,1,0,0,0,222,223,1,0,0,0,223,224,5,47,0,0,224, + 225,3,106,53,0,225,234,1,0,0,0,226,228,3,16,8,0,227,229,5,49,0,0,228,227, + 1,0,0,0,228,229,1,0,0,0,229,230,1,0,0,0,230,231,5,54,0,0,231,232,3,106, + 53,0,232,234,1,0,0,0,233,219,1,0,0,0,233,226,1,0,0,0,234,13,1,0,0,0,235, + 236,3,58,29,0,236,237,5,38,0,0,237,238,3,68,34,0,238,15,1,0,0,0,239,245, + 3,18,9,0,240,241,3,18,9,0,241,242,3,108,54,0,242,243,3,18,9,0,243,245,1, + 0,0,0,244,239,1,0,0,0,244,240,1,0,0,0,245,17,1,0,0,0,246,247,6,9,-1,0,247, + 251,3,20,10,0,248,249,7,0,0,0,249,251,3,18,9,3,250,246,1,0,0,0,250,248, + 1,0,0,0,251,260,1,0,0,0,252,253,10,2,0,0,253,254,7,1,0,0,254,259,3,18,9, + 3,255,256,10,1,0,0,256,257,7,0,0,0,257,259,3,18,9,2,258,252,1,0,0,0,258, + 255,1,0,0,0,259,262,1,0,0,0,260,258,1,0,0,0,260,261,1,0,0,0,261,19,1,0, + 0,0,262,260,1,0,0,0,263,264,6,10,-1,0,264,272,3,68,34,0,265,272,3,58,29, + 0,266,272,3,22,11,0,267,268,5,48,0,0,268,269,3,10,5,0,269,270,5,55,0,0, + 270,272,1,0,0,0,271,263,1,0,0,0,271,265,1,0,0,0,271,266,1,0,0,0,271,267, + 1,0,0,0,272,278,1,0,0,0,273,274,10,1,0,0,274,275,5,37,0,0,275,277,3,26, + 13,0,276,273,1,0,0,0,277,280,1,0,0,0,278,276,1,0,0,0,278,279,1,0,0,0,279, + 21,1,0,0,0,280,278,1,0,0,0,281,282,3,24,12,0,282,292,5,48,0,0,283,293,5, + 66,0,0,284,289,3,10,5,0,285,286,5,39,0,0,286,288,3,10,5,0,287,285,1,0,0, + 0,288,291,1,0,0,0,289,287,1,0,0,0,289,290,1,0,0,0,290,293,1,0,0,0,291,289, + 1,0,0,0,292,283,1,0,0,0,292,284,1,0,0,0,292,293,1,0,0,0,293,294,1,0,0,0, + 294,295,5,55,0,0,295,23,1,0,0,0,296,297,3,72,36,0,297,25,1,0,0,0,298,299, + 3,64,32,0,299,27,1,0,0,0,300,301,5,12,0,0,301,302,3,30,15,0,302,29,1,0, + 0,0,303,308,3,32,16,0,304,305,5,39,0,0,305,307,3,32,16,0,306,304,1,0,0, + 0,307,310,1,0,0,0,308,306,1,0,0,0,308,309,1,0,0,0,309,31,1,0,0,0,310,308, + 1,0,0,0,311,312,3,58,29,0,312,313,5,36,0,0,313,315,1,0,0,0,314,311,1,0, + 0,0,314,315,1,0,0,0,315,316,1,0,0,0,316,317,3,10,5,0,317,33,1,0,0,0,318, + 319,5,6,0,0,319,324,3,36,18,0,320,321,5,39,0,0,321,323,3,36,18,0,322,320, + 1,0,0,0,323,326,1,0,0,0,324,322,1,0,0,0,324,325,1,0,0,0,325,328,1,0,0,0, + 326,324,1,0,0,0,327,329,3,42,21,0,328,327,1,0,0,0,328,329,1,0,0,0,329,35, + 1,0,0,0,330,331,3,38,19,0,331,332,5,38,0,0,332,334,1,0,0,0,333,330,1,0, + 0,0,333,334,1,0,0,0,334,335,1,0,0,0,335,336,3,40,20,0,336,37,1,0,0,0,337, + 338,5,81,0,0,338,39,1,0,0,0,339,340,7,2,0,0,340,41,1,0,0,0,341,344,3,44, + 22,0,342,344,3,46,23,0,343,341,1,0,0,0,343,342,1,0,0,0,344,43,1,0,0,0,345, + 346,5,80,0,0,346,351,5,81,0,0,347,348,5,39,0,0,348,350,5,81,0,0,349,347, + 1,0,0,0,350,353,1,0,0,0,351,349,1,0,0,0,351,352,1,0,0,0,352,45,1,0,0,0, + 353,351,1,0,0,0,354,355,5,70,0,0,355,356,3,44,22,0,356,357,5,71,0,0,357, + 47,1,0,0,0,358,359,5,19,0,0,359,364,3,36,18,0,360,361,5,39,0,0,361,363, + 3,36,18,0,362,360,1,0,0,0,363,366,1,0,0,0,364,362,1,0,0,0,364,365,1,0,0, + 0,365,368,1,0,0,0,366,364,1,0,0,0,367,369,3,54,27,0,368,367,1,0,0,0,368, + 369,1,0,0,0,369,372,1,0,0,0,370,371,5,33,0,0,371,373,3,30,15,0,372,370, + 1,0,0,0,372,373,1,0,0,0,373,49,1,0,0,0,374,375,5,4,0,0,375,376,3,30,15, + 0,376,51,1,0,0,0,377,379,5,15,0,0,378,380,3,54,27,0,379,378,1,0,0,0,379, + 380,1,0,0,0,380,383,1,0,0,0,381,382,5,33,0,0,382,384,3,30,15,0,383,381, + 1,0,0,0,383,384,1,0,0,0,384,53,1,0,0,0,385,390,3,56,28,0,386,387,5,39,0, + 0,387,389,3,56,28,0,388,386,1,0,0,0,389,392,1,0,0,0,390,388,1,0,0,0,390, + 391,1,0,0,0,391,55,1,0,0,0,392,390,1,0,0,0,393,396,3,32,16,0,394,395,5, + 16,0,0,395,397,3,10,5,0,396,394,1,0,0,0,396,397,1,0,0,0,397,57,1,0,0,0, + 398,403,3,72,36,0,399,400,5,41,0,0,400,402,3,72,36,0,401,399,1,0,0,0,402, + 405,1,0,0,0,403,401,1,0,0,0,403,404,1,0,0,0,404,59,1,0,0,0,405,403,1,0, + 0,0,406,411,3,66,33,0,407,408,5,41,0,0,408,410,3,66,33,0,409,407,1,0,0, + 0,410,413,1,0,0,0,411,409,1,0,0,0,411,412,1,0,0,0,412,61,1,0,0,0,413,411, + 1,0,0,0,414,419,3,60,30,0,415,416,5,39,0,0,416,418,3,60,30,0,417,415,1, + 0,0,0,418,421,1,0,0,0,419,417,1,0,0,0,419,420,1,0,0,0,420,63,1,0,0,0,421, + 419,1,0,0,0,422,423,7,3,0,0,423,65,1,0,0,0,424,428,5,85,0,0,425,426,4,33, + 10,0,426,428,3,70,35,0,427,424,1,0,0,0,427,425,1,0,0,0,428,67,1,0,0,0,429, + 472,5,50,0,0,430,431,3,104,52,0,431,432,5,72,0,0,432,472,1,0,0,0,433,472, + 3,102,51,0,434,472,3,104,52,0,435,472,3,98,49,0,436,472,3,70,35,0,437,472, + 3,106,53,0,438,439,5,70,0,0,439,444,3,100,50,0,440,441,5,39,0,0,441,443, + 3,100,50,0,442,440,1,0,0,0,443,446,1,0,0,0,444,442,1,0,0,0,444,445,1,0, + 0,0,445,447,1,0,0,0,446,444,1,0,0,0,447,448,5,71,0,0,448,472,1,0,0,0,449, + 450,5,70,0,0,450,455,3,98,49,0,451,452,5,39,0,0,452,454,3,98,49,0,453,451, + 1,0,0,0,454,457,1,0,0,0,455,453,1,0,0,0,455,456,1,0,0,0,456,458,1,0,0,0, + 457,455,1,0,0,0,458,459,5,71,0,0,459,472,1,0,0,0,460,461,5,70,0,0,461,466, + 3,106,53,0,462,463,5,39,0,0,463,465,3,106,53,0,464,462,1,0,0,0,465,468, + 1,0,0,0,466,464,1,0,0,0,466,467,1,0,0,0,467,469,1,0,0,0,468,466,1,0,0,0, + 469,470,5,71,0,0,470,472,1,0,0,0,471,429,1,0,0,0,471,430,1,0,0,0,471,433, + 1,0,0,0,471,434,1,0,0,0,471,435,1,0,0,0,471,436,1,0,0,0,471,437,1,0,0,0, + 471,438,1,0,0,0,471,449,1,0,0,0,471,460,1,0,0,0,472,69,1,0,0,0,473,476, + 5,53,0,0,474,476,5,69,0,0,475,473,1,0,0,0,475,474,1,0,0,0,476,71,1,0,0, + 0,477,481,3,64,32,0,478,479,4,36,11,0,479,481,3,70,35,0,480,477,1,0,0,0, + 480,478,1,0,0,0,481,73,1,0,0,0,482,483,5,9,0,0,483,484,5,31,0,0,484,75, + 1,0,0,0,485,486,5,14,0,0,486,491,3,78,39,0,487,488,5,39,0,0,488,490,3,78, + 39,0,489,487,1,0,0,0,490,493,1,0,0,0,491,489,1,0,0,0,491,492,1,0,0,0,492, + 77,1,0,0,0,493,491,1,0,0,0,494,496,3,10,5,0,495,497,7,4,0,0,496,495,1,0, + 0,0,496,497,1,0,0,0,497,500,1,0,0,0,498,499,5,51,0,0,499,501,7,5,0,0,500, + 498,1,0,0,0,500,501,1,0,0,0,501,79,1,0,0,0,502,503,5,8,0,0,503,504,3,62, + 31,0,504,81,1,0,0,0,505,506,5,2,0,0,506,507,3,62,31,0,507,83,1,0,0,0,508, + 509,5,11,0,0,509,514,3,86,43,0,510,511,5,39,0,0,511,513,3,86,43,0,512,510, + 1,0,0,0,513,516,1,0,0,0,514,512,1,0,0,0,514,515,1,0,0,0,515,85,1,0,0,0, + 516,514,1,0,0,0,517,518,3,60,30,0,518,519,5,89,0,0,519,520,3,60,30,0,520, + 87,1,0,0,0,521,522,5,1,0,0,522,523,3,20,10,0,523,525,3,106,53,0,524,526, + 3,94,47,0,525,524,1,0,0,0,525,526,1,0,0,0,526,89,1,0,0,0,527,528,5,7,0, + 0,528,529,3,20,10,0,529,530,3,106,53,0,530,91,1,0,0,0,531,532,5,10,0,0, + 532,533,3,58,29,0,533,93,1,0,0,0,534,539,3,96,48,0,535,536,5,39,0,0,536, + 538,3,96,48,0,537,535,1,0,0,0,538,541,1,0,0,0,539,537,1,0,0,0,539,540,1, + 0,0,0,540,95,1,0,0,0,541,539,1,0,0,0,542,543,3,64,32,0,543,544,5,36,0,0, + 544,545,3,68,34,0,545,97,1,0,0,0,546,547,7,6,0,0,547,99,1,0,0,0,548,551, + 3,102,51,0,549,551,3,104,52,0,550,548,1,0,0,0,550,549,1,0,0,0,551,101,1, + 0,0,0,552,554,7,0,0,0,553,552,1,0,0,0,553,554,1,0,0,0,554,555,1,0,0,0,555, + 556,5,32,0,0,556,103,1,0,0,0,557,559,7,0,0,0,558,557,1,0,0,0,558,559,1, + 0,0,0,559,560,1,0,0,0,560,561,5,31,0,0,561,105,1,0,0,0,562,563,5,30,0,0, + 563,107,1,0,0,0,564,565,7,7,0,0,565,109,1,0,0,0,566,567,5,5,0,0,567,568, + 3,112,56,0,568,111,1,0,0,0,569,570,5,70,0,0,570,571,3,2,1,0,571,572,5,71, + 0,0,572,113,1,0,0,0,573,574,5,13,0,0,574,575,5,105,0,0,575,115,1,0,0,0, + 576,577,5,3,0,0,577,580,5,95,0,0,578,579,5,93,0,0,579,581,3,60,30,0,580, + 578,1,0,0,0,580,581,1,0,0,0,581,591,1,0,0,0,582,583,5,94,0,0,583,588,3, + 118,59,0,584,585,5,39,0,0,585,587,3,118,59,0,586,584,1,0,0,0,587,590,1, + 0,0,0,588,586,1,0,0,0,588,589,1,0,0,0,589,592,1,0,0,0,590,588,1,0,0,0,591, + 582,1,0,0,0,591,592,1,0,0,0,592,117,1,0,0,0,593,594,3,60,30,0,594,595,5, + 36,0,0,595,597,1,0,0,0,596,593,1,0,0,0,596,597,1,0,0,0,597,598,1,0,0,0, + 598,599,3,60,30,0,599,119,1,0,0,0,600,601,5,18,0,0,601,602,3,36,18,0,602, + 603,5,93,0,0,603,604,3,62,31,0,604,121,1,0,0,0,605,606,5,17,0,0,606,609, + 3,54,27,0,607,608,5,33,0,0,608,610,3,30,15,0,609,607,1,0,0,0,609,610,1, + 0,0,0,610,123,1,0,0,0,611,613,7,8,0,0,612,611,1,0,0,0,612,613,1,0,0,0,613, + 614,1,0,0,0,614,615,5,20,0,0,615,616,3,126,63,0,616,617,3,128,64,0,617, + 125,1,0,0,0,618,621,3,64,32,0,619,620,5,89,0,0,620,622,3,64,32,0,621,619, + 1,0,0,0,621,622,1,0,0,0,622,127,1,0,0,0,623,624,5,93,0,0,624,629,3,130, + 65,0,625,626,5,39,0,0,626,628,3,130,65,0,627,625,1,0,0,0,628,631,1,0,0, + 0,629,627,1,0,0,0,629,630,1,0,0,0,630,129,1,0,0,0,631,629,1,0,0,0,632,633, + 3,16,8,0,633,131,1,0,0,0,61,143,152,172,184,193,201,206,214,216,221,228, + 233,244,250,258,260,271,278,289,292,308,314,324,328,333,343,351,364,368, + 372,379,383,390,396,403,411,419,427,444,455,466,471,475,480,491,496,500, + 514,525,539,550,553,558,580,588,591,596,609,612,621,629]; private static __ATN: ATN; public static get _ATN(): ATN { @@ -3833,6 +4040,9 @@ export class ProcessingCommandContext extends ParserRuleContext { public lookupCommand(): LookupCommandContext { return this.getTypedRuleContext(LookupCommandContext, 0) as LookupCommandContext; } + public joinCommand(): JoinCommandContext { + return this.getTypedRuleContext(JoinCommandContext, 0) as JoinCommandContext; + } public get ruleIndex(): number { return esql_parser.RULE_processingCommand; } @@ -6278,3 +6488,135 @@ export class InlinestatsCommandContext extends ParserRuleContext { } } } + + +export class JoinCommandContext extends ParserRuleContext { + public _type_!: Token; + constructor(parser?: esql_parser, parent?: ParserRuleContext, invokingState?: number) { + super(parent, invokingState); + this.parser = parser; + } + public DEV_JOIN(): TerminalNode { + return this.getToken(esql_parser.DEV_JOIN, 0); + } + public joinTarget(): JoinTargetContext { + return this.getTypedRuleContext(JoinTargetContext, 0) as JoinTargetContext; + } + public joinCondition(): JoinConditionContext { + return this.getTypedRuleContext(JoinConditionContext, 0) as JoinConditionContext; + } + public DEV_JOIN_LOOKUP(): TerminalNode { + return this.getToken(esql_parser.DEV_JOIN_LOOKUP, 0); + } + public DEV_JOIN_LEFT(): TerminalNode { + return this.getToken(esql_parser.DEV_JOIN_LEFT, 0); + } + public DEV_JOIN_RIGHT(): TerminalNode { + return this.getToken(esql_parser.DEV_JOIN_RIGHT, 0); + } + public get ruleIndex(): number { + return esql_parser.RULE_joinCommand; + } + public enterRule(listener: esql_parserListener): void { + if(listener.enterJoinCommand) { + listener.enterJoinCommand(this); + } + } + public exitRule(listener: esql_parserListener): void { + if(listener.exitJoinCommand) { + listener.exitJoinCommand(this); + } + } +} + + +export class JoinTargetContext extends ParserRuleContext { + public _index!: IdentifierContext; + public _alias!: IdentifierContext; + constructor(parser?: esql_parser, parent?: ParserRuleContext, invokingState?: number) { + super(parent, invokingState); + this.parser = parser; + } + public identifier_list(): IdentifierContext[] { + return this.getTypedRuleContexts(IdentifierContext) as IdentifierContext[]; + } + public identifier(i: number): IdentifierContext { + return this.getTypedRuleContext(IdentifierContext, i) as IdentifierContext; + } + public AS(): TerminalNode { + return this.getToken(esql_parser.AS, 0); + } + public get ruleIndex(): number { + return esql_parser.RULE_joinTarget; + } + public enterRule(listener: esql_parserListener): void { + if(listener.enterJoinTarget) { + listener.enterJoinTarget(this); + } + } + public exitRule(listener: esql_parserListener): void { + if(listener.exitJoinTarget) { + listener.exitJoinTarget(this); + } + } +} + + +export class JoinConditionContext extends ParserRuleContext { + constructor(parser?: esql_parser, parent?: ParserRuleContext, invokingState?: number) { + super(parent, invokingState); + this.parser = parser; + } + public ON(): TerminalNode { + return this.getToken(esql_parser.ON, 0); + } + public joinPredicate_list(): JoinPredicateContext[] { + return this.getTypedRuleContexts(JoinPredicateContext) as JoinPredicateContext[]; + } + public joinPredicate(i: number): JoinPredicateContext { + return this.getTypedRuleContext(JoinPredicateContext, i) as JoinPredicateContext; + } + public COMMA_list(): TerminalNode[] { + return this.getTokens(esql_parser.COMMA); + } + public COMMA(i: number): TerminalNode { + return this.getToken(esql_parser.COMMA, i); + } + public get ruleIndex(): number { + return esql_parser.RULE_joinCondition; + } + public enterRule(listener: esql_parserListener): void { + if(listener.enterJoinCondition) { + listener.enterJoinCondition(this); + } + } + public exitRule(listener: esql_parserListener): void { + if(listener.exitJoinCondition) { + listener.exitJoinCondition(this); + } + } +} + + +export class JoinPredicateContext extends ParserRuleContext { + constructor(parser?: esql_parser, parent?: ParserRuleContext, invokingState?: number) { + super(parent, invokingState); + this.parser = parser; + } + public valueExpression(): ValueExpressionContext { + return this.getTypedRuleContext(ValueExpressionContext, 0) as ValueExpressionContext; + } + public get ruleIndex(): number { + return esql_parser.RULE_joinPredicate; + } + public enterRule(listener: esql_parserListener): void { + if(listener.enterJoinPredicate) { + listener.enterJoinPredicate(this); + } + } + public exitRule(listener: esql_parserListener): void { + if(listener.exitJoinPredicate) { + listener.exitJoinPredicate(this); + } + } +} diff --git a/packages/kbn-esql-ast/src/antlr/esql_parser_listener.ts b/packages/kbn-esql-ast/src/antlr/esql_parser_listener.ts index 576418862be01..d206b099dd588 100644 --- a/packages/kbn-esql-ast/src/antlr/esql_parser_listener.ts +++ b/packages/kbn-esql-ast/src/antlr/esql_parser_listener.ts @@ -98,6 +98,10 @@ import { EnrichCommandContext } from "./esql_parser.js"; import { EnrichWithClauseContext } from "./esql_parser.js"; import { LookupCommandContext } from "./esql_parser.js"; import { InlinestatsCommandContext } from "./esql_parser.js"; +import { JoinCommandContext } from "./esql_parser.js"; +import { JoinTargetContext } from "./esql_parser.js"; +import { JoinConditionContext } from "./esql_parser.js"; +import { JoinPredicateContext } from "./esql_parser.js"; /** @@ -1031,5 +1035,45 @@ export default class esql_parserListener extends ParseTreeListener { * @param ctx the parse tree */ exitInlinestatsCommand?: (ctx: InlinestatsCommandContext) => void; + /** + * Enter a parse tree produced by `esql_parser.joinCommand`. + * @param ctx the parse tree + */ + enterJoinCommand?: (ctx: JoinCommandContext) => void; + /** + * Exit a parse tree produced by `esql_parser.joinCommand`. + * @param ctx the parse tree + */ + exitJoinCommand?: (ctx: JoinCommandContext) => void; + /** + * Enter a parse tree produced by `esql_parser.joinTarget`. + * @param ctx the parse tree + */ + enterJoinTarget?: (ctx: JoinTargetContext) => void; + /** + * Exit a parse tree produced by `esql_parser.joinTarget`. + * @param ctx the parse tree + */ + exitJoinTarget?: (ctx: JoinTargetContext) => void; + /** + * Enter a parse tree produced by `esql_parser.joinCondition`. + * @param ctx the parse tree + */ + enterJoinCondition?: (ctx: JoinConditionContext) => void; + /** + * Exit a parse tree produced by `esql_parser.joinCondition`. + * @param ctx the parse tree + */ + exitJoinCondition?: (ctx: JoinConditionContext) => void; + /** + * Enter a parse tree produced by `esql_parser.joinPredicate`. + * @param ctx the parse tree + */ + enterJoinPredicate?: (ctx: JoinPredicateContext) => void; + /** + * Exit a parse tree produced by `esql_parser.joinPredicate`. + * @param ctx the parse tree + */ + exitJoinPredicate?: (ctx: JoinPredicateContext) => void; } diff --git a/packages/kbn-esql-validation-autocomplete/src/validation/esql_validation_meta_tests.json b/packages/kbn-esql-validation-autocomplete/src/validation/esql_validation_meta_tests.json index fee9f90f38c93..2e6b4a085656f 100644 --- a/packages/kbn-esql-validation-autocomplete/src/validation/esql_validation_meta_tests.json +++ b/packages/kbn-esql-validation-autocomplete/src/validation/esql_validation_meta_tests.json @@ -2203,7 +2203,7 @@ "warning": [] }, { - "query": "ROW a=1::LONG | LOOKUP t ON a", + "query": "ROW a=1::LONG | LOOKUP JOIN t ON a", "error": [], "warning": [] }, diff --git a/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts b/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts index 03102474f6314..442a2299d8abe 100644 --- a/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts +++ b/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts @@ -506,7 +506,7 @@ describe('validation logic', () => { }); describe('lookup', () => { - testErrorsAndWarnings('ROW a=1::LONG | LOOKUP t ON a', []); + testErrorsAndWarnings('ROW a=1::LONG | LOOKUP JOIN t ON a', []); }); describe('keep', () => { diff --git a/packages/kbn-monaco/src/esql/lib/esql_theme.test.ts b/packages/kbn-monaco/src/esql/lib/esql_theme.test.ts index c2a200e650804..ba70ee4c2f061 100644 --- a/packages/kbn-monaco/src/esql/lib/esql_theme.test.ts +++ b/packages/kbn-monaco/src/esql/lib/esql_theme.test.ts @@ -95,6 +95,7 @@ describe('ESQL Theme', () => { 'setting_ws', 'metrics_ws', 'closing_metrics_ws', + 'join_ws', ]; // First, check that every valid exception is actually valid diff --git a/packages/kbn-monaco/src/esql/lib/esql_theme.ts b/packages/kbn-monaco/src/esql/lib/esql_theme.ts index 07a4d723b63e8..d8223df99bbd1 100644 --- a/packages/kbn-monaco/src/esql/lib/esql_theme.ts +++ b/packages/kbn-monaco/src/esql/lib/esql_theme.ts @@ -74,9 +74,15 @@ export const buildESQLTheme = ({ 'as', 'limit', 'dev_lookup', + 'dev_join_lookup', + 'dev_join', + 'dev_join_full', + 'dev_join_left', + 'dev_join_right', 'null', 'enrich', 'on', + 'using', 'with', 'asc', 'desc', @@ -138,6 +144,8 @@ export const buildESQLTheme = ({ 'lookup_multiline_comment', 'lookup_field_line_comment', 'lookup_field_multiline_comment', + 'join_line_comment', + 'join_multiline_comment', 'show_line_comment', 'show_multiline_comment', 'setting', From 973c69533b46014a5ec1fac7e2811c3a0105d81b Mon Sep 17 00:00:00 2001 From: Julia Bardi <90178898+juliaElastic@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:59:18 +0100 Subject: [PATCH 03/71] [Fleet] flag package policy SO to trigger agent policy bump (#200536) ## Summary Closes https://github.com/elastic/kibana/issues/193352 Update: Using a new SO field `bump_agent_policy_revision` in package policy type to mark package policies for update, this will trigger an agent policy revision bump. The feature supports both legacy and new package policy SO types, and queries policies from all spaces. To test, add a model version change to the package policy type and save. After Fleet setup is run, the agent policies using the package policies should be bumped and deployed. The same effect can be achieved by manually updating a package policy SO and loading Fleet UI to trigger setup. ``` '2': { changes: [ { type: 'data_backfill', backfillFn: (doc) => { return { attributes: { ...doc.attributes, bump_agent_policy_revision: true } }; }, }, ], }, curl -sk -XPOST --user fleet_superuser:password -H 'content-type:application/json' \ -H'x-elastic-product-origin:fleet' \ http://localhost:9200/.kibana_ingest/_update_by_query -d ' { "query": { "match": { "type": "fleet-package-policies" } },"script": { "source": "ctx._source[\"fleet-package-policies\"].bump_agent_policy_revision = true", "lang": "painless" } }' ``` ``` [2024-11-20T14:40:30.064+01:00][INFO ][plugins.fleet] Found 1 package policies that need agent policy revision bump [2024-11-20T14:40:31.933+01:00][DEBUG][plugins.fleet] Updated 1 package policies in space space1 in 1869ms, bump 1 agent policies [2024-11-20T14:40:35.056+01:00][DEBUG][plugins.fleet] Deploying 1 policies [2024-11-20T14:40:35.493+01:00][DEBUG][plugins.fleet] Deploying policies: 7f108cf2-4cf0-4a11-8df4-fc69d00a3484:10 ``` TODO: - the same flag has to be added on agent policy and output types, and the task extended to update them - I plan to do this in another pr, so that this doesn't become too big - add integration test if possible ### Scale testing Tested with 500 agent policies split to 2 spaces, 1 integration per policy and bumping the flag in a new saved object model version, the bump task took about 6s. The deploy policies step is async, took about 30s. ``` [2024-11-20T15:53:55.628+01:00][INFO ][plugins.fleet] Found 501 package policies that need agent policy revision bump [2024-11-20T15:53:57.881+01:00][DEBUG][plugins.fleet] Updated 250 package policies in space space1 in 2253ms, bump 250 agent policies [2024-11-20T15:53:59.926+01:00][DEBUG][plugins.fleet] Updated 251 package policies in space default in 4298ms, bump 251 agent policies [2024-11-20T15:54:01.186+01:00][DEBUG][plugins.fleet] Deploying 250 policies [2024-11-20T15:54:29.989+01:00][DEBUG][plugins.fleet] Deploying policies: test-policy-space1-1:4, ... [2024-11-20T15:54:33.538+01:00][DEBUG][plugins.fleet] Deploying policies: policy-elastic-agent-on-cloud:4, test-policy-default-1:4, ... ``` ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- oas_docs/bundle.json | 2 + oas_docs/bundle.serverless.json | 2 + oas_docs/output/kibana.serverless.yaml | 2 + oas_docs/output/kibana.yaml | 2 + .../current_fields.json | 2 + .../current_mappings.json | 6 + .../check_registered_types.test.ts | 4 +- .../plugins/fleet/dev_docs/space_awareness.md | 2 +- .../create_agent_policies.ts | 33 ++--- .../scripts/create_agent_policies/fixtures.ts | 9 +- .../scripts/create_agent_policies/index.js | 2 +- x-pack/plugins/fleet/server/plugin.ts | 2 + .../fleet/server/saved_objects/index.ts | 24 +++ .../bump_agent_policies_task.test.ts | 115 +++++++++++++++ .../bump_agent_policies_task.ts | 139 ++++++++++++++++++ .../fleet/server/services/agent_policy.ts | 21 +++ .../server/services/package_policies/utils.ts | 15 +- .../fleet/server/services/package_policy.ts | 56 +++---- ...et_server_policies_enrollment_keys.test.ts | 1 + .../fleet_server_policies_enrollment_keys.ts | 36 ++--- .../fleet/server/types/rest_spec/settings.ts | 4 +- .../fleet/server/types/so_attributes.ts | 1 + .../check_registered_task_types.ts | 1 + 23 files changed, 392 insertions(+), 89 deletions(-) create mode 100644 x-pack/plugins/fleet/server/services/agent_policies/bump_agent_policies_task.test.ts create mode 100644 x-pack/plugins/fleet/server/services/agent_policies/bump_agent_policies_task.ts diff --git a/oas_docs/bundle.json b/oas_docs/bundle.json index 9b446eacf7bb9..1d03129d262c2 100644 --- a/oas_docs/bundle.json +++ b/oas_docs/bundle.json @@ -36623,6 +36623,7 @@ "type": "boolean" }, "use_space_awareness_migration_started_at": { + "nullable": true, "type": "string" }, "use_space_awareness_migration_status": { @@ -36824,6 +36825,7 @@ "type": "boolean" }, "use_space_awareness_migration_started_at": { + "nullable": true, "type": "string" }, "use_space_awareness_migration_status": { diff --git a/oas_docs/bundle.serverless.json b/oas_docs/bundle.serverless.json index 7adb2e8140491..5a1e2b69438e1 100644 --- a/oas_docs/bundle.serverless.json +++ b/oas_docs/bundle.serverless.json @@ -36623,6 +36623,7 @@ "type": "boolean" }, "use_space_awareness_migration_started_at": { + "nullable": true, "type": "string" }, "use_space_awareness_migration_status": { @@ -36824,6 +36825,7 @@ "type": "boolean" }, "use_space_awareness_migration_started_at": { + "nullable": true, "type": "string" }, "use_space_awareness_migration_status": { diff --git a/oas_docs/output/kibana.serverless.yaml b/oas_docs/output/kibana.serverless.yaml index c858823e2ae0a..33378690b6500 100644 --- a/oas_docs/output/kibana.serverless.yaml +++ b/oas_docs/output/kibana.serverless.yaml @@ -29839,6 +29839,7 @@ paths: secret_storage_requirements_met: type: boolean use_space_awareness_migration_started_at: + nullable: true type: string use_space_awareness_migration_status: enum: @@ -29972,6 +29973,7 @@ paths: secret_storage_requirements_met: type: boolean use_space_awareness_migration_started_at: + nullable: true type: string use_space_awareness_migration_status: enum: diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index 6780ef4926c73..6eb1e4c23f065 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -32607,6 +32607,7 @@ paths: secret_storage_requirements_met: type: boolean use_space_awareness_migration_started_at: + nullable: true type: string use_space_awareness_migration_status: enum: @@ -32739,6 +32740,7 @@ paths: secret_storage_requirements_met: type: boolean use_space_awareness_migration_started_at: + nullable: true type: string use_space_awareness_migration_status: enum: diff --git a/packages/kbn-check-mappings-update-cli/current_fields.json b/packages/kbn-check-mappings-update-cli/current_fields.json index 619bdd6c29321..1b1b847bb2747 100644 --- a/packages/kbn-check-mappings-update-cli/current_fields.json +++ b/packages/kbn-check-mappings-update-cli/current_fields.json @@ -511,6 +511,7 @@ ], "fleet-message-signing-keys": [], "fleet-package-policies": [ + "bump_agent_policy_revision", "created_at", "created_by", "description", @@ -692,6 +693,7 @@ "version" ], "ingest-package-policies": [ + "bump_agent_policy_revision", "created_at", "created_by", "description", diff --git a/packages/kbn-check-mappings-update-cli/current_mappings.json b/packages/kbn-check-mappings-update-cli/current_mappings.json index d6ec30393e099..80739b3412e9b 100644 --- a/packages/kbn-check-mappings-update-cli/current_mappings.json +++ b/packages/kbn-check-mappings-update-cli/current_mappings.json @@ -1715,6 +1715,9 @@ }, "fleet-package-policies": { "properties": { + "bump_agent_policy_revision": { + "type": "boolean" + }, "created_at": { "type": "date" }, @@ -2300,6 +2303,9 @@ }, "ingest-package-policies": { "properties": { + "bump_agent_policy_revision": { + "type": "boolean" + }, "created_at": { "type": "date" }, diff --git a/src/core/server/integration_tests/ci_checks/saved_objects/check_registered_types.test.ts b/src/core/server/integration_tests/ci_checks/saved_objects/check_registered_types.test.ts index f16c956107c7b..61b92f4ccda64 100644 --- a/src/core/server/integration_tests/ci_checks/saved_objects/check_registered_types.test.ts +++ b/src/core/server/integration_tests/ci_checks/saved_objects/check_registered_types.test.ts @@ -108,7 +108,7 @@ describe('checking migration metadata changes on all registered SO types', () => "fleet-agent-policies": "f57d3b70e4175a19a18f18ee72a379ceec82e1fc", "fleet-fleet-server-host": "69be15f6b6f2a2875ad3c7050ddea7a87f505417", "fleet-message-signing-keys": "93421f43fed2526b59092a4e3c65d64bc2266c0f", - "fleet-package-policies": "2f4d524adb49a5281d3af0b66bb3003ba0ff2e44", + "fleet-package-policies": "8be2cabfed89e103e0d413f2900e9cf6cd31bc68", "fleet-preconfiguration-deletion-record": "c52ea1e13c919afe8a5e8e3adbb7080980ecc08e", "fleet-proxy": "6cb688f0d2dd856400c1dbc998b28704ff70363d", "fleet-setup-lock": "0dc784792c79b5af5a6e6b5dcac06b0dbaa90bde", @@ -124,7 +124,7 @@ describe('checking migration metadata changes on all registered SO types', () => "ingest-agent-policies": "5e95e539826a40ad08fd0c1d161da0a4d86ffc6d", "ingest-download-sources": "279a68147e62e4d8858c09ad1cf03bd5551ce58d", "ingest-outputs": "55988d5f778bbe0e76caa7e6468707a0a056bdd8", - "ingest-package-policies": "53a94064674835fdb35e5186233bcd7052eabd22", + "ingest-package-policies": "dfa7b1045a2667a822181f40f012786724492439", "ingest_manager_settings": "111a616eb72627c002029c19feb9e6c439a10505", "inventory-view": "b8683c8e352a286b4aca1ab21003115a4800af83", "kql-telemetry": "93c1d16c1a0dfca9c8842062cf5ef8f62ae401ad", diff --git a/x-pack/plugins/fleet/dev_docs/space_awareness.md b/x-pack/plugins/fleet/dev_docs/space_awareness.md index fc4ce3a0acd06..90371d1f8bb08 100644 --- a/x-pack/plugins/fleet/dev_docs/space_awareness.md +++ b/x-pack/plugins/fleet/dev_docs/space_awareness.md @@ -15,7 +15,7 @@ xpack.fleet.enableExperimental: ['useSpaceAwareness', 'subfeaturePrivileges'] After the feature flag is enabled you will have to do another step to opt-in for the feature, that call will migrate the current space agnostic saved objects to new space aware saved objects. ```shell -curl -u elastic:changeme -XPOST "http://localhost:5601/internal/fleet/enable_space_awareness" -H "kbn-xsrf: reporting" -H 'elastic-api-version: 1' +curl -u elastic:changeme -XPOST "http://localhost:5601/internal/fleet/enable_space_awareness" -H "kbn-xsrf: reporting" -H 'elastic-api-version: 1' -H 'x-elastic-internal-origin: 1' ``` ## Space aware entities in Fleet diff --git a/x-pack/plugins/fleet/scripts/create_agent_policies/create_agent_policies.ts b/x-pack/plugins/fleet/scripts/create_agent_policies/create_agent_policies.ts index db47c056ce12d..e000640a477e3 100644 --- a/x-pack/plugins/fleet/scripts/create_agent_policies/create_agent_policies.ts +++ b/x-pack/plugins/fleet/scripts/create_agent_policies/create_agent_policies.ts @@ -9,8 +9,7 @@ import { ToolingLog } from '@kbn/tooling-log'; import yargs from 'yargs'; import { chunk } from 'lodash'; -import { LEGACY_PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../common/constants'; -import { LEGACY_AGENT_POLICY_SAVED_OBJECT_TYPE } from '../../common'; +import { AGENT_POLICY_SAVED_OBJECT_TYPE } from '../../common/constants'; import { packagePolicyFixture } from './fixtures'; @@ -30,20 +29,18 @@ const printUsage = () => const INDEX_BULK_OP = '{ "index":{ "_id": "{{id}}" } }\n'; +const space = 'default'; function getPolicyId(idx: number | string) { - return `test-policy-${idx}`; + return `test-policy-${space}-${idx}`; } async function createAgentPoliciesDocsBulk(range: number[]) { const auth = 'Basic ' + Buffer.from(ES_SUPERUSER + ':' + ES_PASSWORD).toString('base64'); const body = range .flatMap((idx) => [ - INDEX_BULK_OP.replace( - /{{id}}/, - `${LEGACY_AGENT_POLICY_SAVED_OBJECT_TYPE}:${getPolicyId(idx)}` - ), + INDEX_BULK_OP.replace(/{{id}}/, `${AGENT_POLICY_SAVED_OBJECT_TYPE}:${getPolicyId(idx)}`), JSON.stringify({ - [LEGACY_AGENT_POLICY_SAVED_OBJECT_TYPE]: { + [AGENT_POLICY_SAVED_OBJECT_TYPE]: { namespace: 'default', monitoring_enabled: ['logs', 'metrics', 'traces'], name: `Test Policy ${idx}`, @@ -60,11 +57,11 @@ async function createAgentPoliciesDocsBulk(range: number[]) { schema_version: '1.1.1', is_protected: false, }, - type: LEGACY_AGENT_POLICY_SAVED_OBJECT_TYPE, + namespaces: [space], + type: AGENT_POLICY_SAVED_OBJECT_TYPE, references: [], managed: false, coreMigrationVersion: '8.8.0', - typeMigrationVersion: '10.3.0', created_at: new Date().toISOString(), updated_at: new Date().toISOString(), }) + '\n', @@ -81,7 +78,7 @@ async function createAgentPoliciesDocsBulk(range: number[]) { const data = await res.json(); if (!data.items) { - logger.error('Error creating agent policies docs: ' + JSON.stringify(data)); + logger.error('Error creating agent policy docs: ' + JSON.stringify(data)); process.exit(1); } return data; @@ -91,14 +88,14 @@ async function createEnrollmentToken(range: number[]) { const auth = 'Basic ' + Buffer.from(ES_SUPERUSER + ':' + ES_PASSWORD).toString('base64'); const body = range .flatMap((idx) => [ - INDEX_BULK_OP.replace(/{{id}}/, `test-enrollment-token-${idx}`), + INDEX_BULK_OP.replace(/{{id}}/, `test-enrollment-token-${space}-${idx}`), JSON.stringify({ active: true, api_key_id: 'faketest123', api_key: 'test==', name: `Test Policy ${idx}`, policy_id: `${getPolicyId(idx)}`, - namespaces: [], + namespaces: [space], created_at: new Date().toISOString(), }) + '\n', ]) @@ -115,7 +112,7 @@ async function createEnrollmentToken(range: number[]) { const data = await res.json(); if (!data.items) { - logger.error('Error creating agent policies docs: ' + JSON.stringify(data)); + logger.error('Error creating enrollment key docs: ' + JSON.stringify(data)); process.exit(1); } return data; @@ -125,14 +122,12 @@ async function createPackagePolicies(range: number[]) { const auth = 'Basic ' + Buffer.from(ES_SUPERUSER + ':' + ES_PASSWORD).toString('base64'); const body = range .flatMap((idx) => [ - INDEX_BULK_OP.replace( - /{{id}}/, - `${LEGACY_PACKAGE_POLICY_SAVED_OBJECT_TYPE}:test-policy-${idx}` - ), + INDEX_BULK_OP.replace(/{{id}}/, `fleet-package-policies:test-policy-${space}-${idx}`), JSON.stringify( packagePolicyFixture({ idx, agentPolicyId: getPolicyId(idx), + space, }) ) + '\n', ]) @@ -150,7 +145,7 @@ async function createPackagePolicies(range: number[]) { const data = await res.json(); if (!data.items) { - logger.error('Error creating agent policies docs: ' + JSON.stringify(data)); + logger.error('Error creating package policy docs: ' + JSON.stringify(data)); process.exit(1); } return data; diff --git a/x-pack/plugins/fleet/scripts/create_agent_policies/fixtures.ts b/x-pack/plugins/fleet/scripts/create_agent_policies/fixtures.ts index b10f412ac43fe..ddaa226c0729e 100644 --- a/x-pack/plugins/fleet/scripts/create_agent_policies/fixtures.ts +++ b/x-pack/plugins/fleet/scripts/create_agent_policies/fixtures.ts @@ -8,11 +8,13 @@ export const packagePolicyFixture = ({ agentPolicyId, idx, + space, }: { idx: number; agentPolicyId: string; + space: string; }) => ({ - 'ingest-package-policies': { + 'fleet-package-policies': { name: `system-test-${idx}`, namespace: '', description: '', @@ -790,11 +792,12 @@ export const packagePolicyFixture = ({ updated_at: '2024-08-30T13:45:51.197Z', updated_by: 'system', }, - type: 'ingest-package-policies', + namespaces: [space], + type: 'fleet-package-policies', references: [], managed: false, coreMigrationVersion: '8.8.0', - typeMigrationVersion: '10.14.0', + typeMigrationVersion: '10.1.0', updated_at: '2024-08-30T13:45:51.197Z', created_at: '2024-08-30T13:45:51.197Z', }); diff --git a/x-pack/plugins/fleet/scripts/create_agent_policies/index.js b/x-pack/plugins/fleet/scripts/create_agent_policies/index.js index a51859ee684c6..a61ed0e7e54d4 100644 --- a/x-pack/plugins/fleet/scripts/create_agent_policies/index.js +++ b/x-pack/plugins/fleet/scripts/create_agent_policies/index.js @@ -12,6 +12,6 @@ require('./create_agent_policies').run(); Usage: cd x-pack/plugins/fleet -node scripts/create_agents/index.js +node scripts/create_agent_policies/index.js */ diff --git a/x-pack/plugins/fleet/server/plugin.ts b/x-pack/plugins/fleet/server/plugin.ts index 4c5cdf7070530..7716d6b21d9e3 100644 --- a/x-pack/plugins/fleet/server/plugin.ts +++ b/x-pack/plugins/fleet/server/plugin.ts @@ -143,6 +143,7 @@ import { registerFieldsMetadataExtractors } from './services/register_fields_met import { registerUpgradeManagedPackagePoliciesTask } from './services/setup/managed_package_policies'; import { registerDeployAgentPoliciesTask } from './services/agent_policies/deploy_agent_policies_task'; import { DeleteUnenrolledAgentsTask } from './tasks/delete_unenrolled_agents_task'; +import { registerBumpAgentPoliciesTask } from './services/agent_policies/bump_agent_policies_task'; export interface FleetSetupDeps { security: SecurityPluginSetup; @@ -619,6 +620,7 @@ export class FleetPlugin // Register task registerUpgradeManagedPackagePoliciesTask(deps.taskManager); registerDeployAgentPoliciesTask(deps.taskManager); + registerBumpAgentPoliciesTask(deps.taskManager); this.bulkActionsResolver = new BulkActionsResolver(deps.taskManager, core); this.checkDeletedFilesTask = new CheckDeletedFilesTask({ diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index 706d0686b9845..5173ada3f5418 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -619,6 +619,7 @@ export const getSavedObjectTypes = ( updated_by: { type: 'keyword' }, created_at: { type: 'date' }, created_by: { type: 'keyword' }, + bump_agent_policy_revision: { type: 'boolean' }, }, }, modelVersions: { @@ -763,6 +764,16 @@ export const getSavedObjectTypes = ( }, ], }, + '15': { + changes: [ + { + type: 'mappings_addition', + addedMappings: { + bump_agent_policy_revision: { type: 'boolean' }, + }, + }, + ], + }, }, migrations: { '7.10.0': migratePackagePolicyToV7100, @@ -823,6 +834,19 @@ export const getSavedObjectTypes = ( updated_by: { type: 'keyword' }, created_at: { type: 'date' }, created_by: { type: 'keyword' }, + bump_agent_policy_revision: { type: 'boolean' }, + }, + }, + modelVersions: { + '1': { + changes: [ + { + type: 'mappings_addition', + addedMappings: { + bump_agent_policy_revision: { type: 'boolean' }, + }, + }, + ], }, }, }, diff --git a/x-pack/plugins/fleet/server/services/agent_policies/bump_agent_policies_task.test.ts b/x-pack/plugins/fleet/server/services/agent_policies/bump_agent_policies_task.test.ts new file mode 100644 index 0000000000000..2e7305c5c5717 --- /dev/null +++ b/x-pack/plugins/fleet/server/services/agent_policies/bump_agent_policies_task.test.ts @@ -0,0 +1,115 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { loggingSystemMock } from '@kbn/core/server/mocks'; + +import { agentPolicyService } from '../agent_policy'; + +import { appContextService } from '..'; +import { getPackagePolicySavedObjectType } from '../package_policy'; + +import { _updatePackagePoliciesThatNeedBump } from './bump_agent_policies_task'; + +jest.mock('../app_context'); +jest.mock('../agent_policy'); +jest.mock('../package_policy'); + +const mockedAgentPolicyService = jest.mocked(agentPolicyService); +const mockedAppContextService = jest.mocked(appContextService); +const mockSoClient = { + find: jest.fn(), + bulkUpdate: jest.fn(), +} as any; +const mockGetPackagePolicySavedObjectType = jest.mocked(getPackagePolicySavedObjectType); + +describe('_updatePackagePoliciesThatNeedBump', () => { + beforeEach(() => { + jest.clearAllMocks(); + mockSoClient.find.mockResolvedValue({ + total: 3, + saved_objects: [ + { + id: 'packagePolicy1', + namespaces: ['default'], + attributes: { + policy_ids: ['policy1'], + }, + }, + { + id: 'packagePolicy12', + namespaces: ['default'], + attributes: { + policy_ids: ['policy1'], + }, + }, + { + id: 'packagePolicy2', + namespaces: ['space'], + attributes: { + policy_ids: ['policy2'], + }, + }, + { + id: 'packagePolicy3', + namespaces: ['space'], + attributes: { + policy_ids: ['policy3'], + }, + }, + ], + page: 1, + perPage: 100, + }); + mockedAppContextService.getInternalUserSOClientWithoutSpaceExtension.mockReturnValue( + mockSoClient + ); + mockedAppContextService.getInternalUserSOClientForSpaceId.mockReturnValue(mockSoClient); + mockGetPackagePolicySavedObjectType.mockResolvedValue('fleet-package-policies'); + }); + + it('should update package policy if bump agent policy revision needed', async () => { + const logger = loggingSystemMock.createLogger(); + + await _updatePackagePoliciesThatNeedBump(logger, () => false); + + expect(mockSoClient.bulkUpdate).toHaveBeenCalledWith([ + { + attributes: { bump_agent_policy_revision: false }, + id: 'packagePolicy1', + type: 'fleet-package-policies', + }, + { + attributes: { bump_agent_policy_revision: false }, + id: 'packagePolicy12', + type: 'fleet-package-policies', + }, + ]); + expect(mockSoClient.bulkUpdate).toHaveBeenCalledWith([ + { + attributes: { bump_agent_policy_revision: false }, + id: 'packagePolicy2', + type: 'fleet-package-policies', + }, + { + attributes: { bump_agent_policy_revision: false }, + id: 'packagePolicy3', + type: 'fleet-package-policies', + }, + ]); + + expect(mockedAgentPolicyService.bumpAgentPoliciesByIds).toHaveBeenCalledWith( + expect.anything(), + undefined, + ['policy1'] + ); + expect(mockedAgentPolicyService.bumpAgentPoliciesByIds).toHaveBeenCalledWith( + expect.anything(), + undefined, + ['policy2', 'policy3'] + ); + }); +}); diff --git a/x-pack/plugins/fleet/server/services/agent_policies/bump_agent_policies_task.ts b/x-pack/plugins/fleet/server/services/agent_policies/bump_agent_policies_task.ts new file mode 100644 index 0000000000000..d134fdbfae04f --- /dev/null +++ b/x-pack/plugins/fleet/server/services/agent_policies/bump_agent_policies_task.ts @@ -0,0 +1,139 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import type { Logger } from '@kbn/core/server'; +import type { + ConcreteTaskInstance, + TaskManagerSetupContract, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; +import { v4 as uuidv4 } from 'uuid'; +import { uniq } from 'lodash'; + +import { DEFAULT_SPACE_ID } from '@kbn/spaces-plugin/common'; + +import { agentPolicyService, appContextService } from '..'; +import { runWithCache } from '../epm/packages/cache'; +import { getPackagePolicySavedObjectType } from '../package_policy'; +import { mapPackagePolicySavedObjectToPackagePolicy } from '../package_policies'; +import type { PackagePolicy, PackagePolicySOAttributes } from '../../types'; +import { normalizeKuery } from '../saved_object'; +import { SO_SEARCH_LIMIT } from '../../constants'; + +const TASK_TYPE = 'fleet:bump_agent_policies'; + +export function registerBumpAgentPoliciesTask(taskManagerSetup: TaskManagerSetupContract) { + taskManagerSetup.registerTaskDefinitions({ + [TASK_TYPE]: { + title: 'Fleet Bump policies', + timeout: '5m', + maxAttempts: 3, + createTaskRunner: ({ taskInstance }: { taskInstance: ConcreteTaskInstance }) => { + let cancelled = false; + const isCancelled = () => cancelled; + return { + async run() { + if (isCancelled()) { + throw new Error('Task has been cancelled'); + } + + await runWithCache(async () => { + await _updatePackagePoliciesThatNeedBump(appContextService.getLogger(), isCancelled); + }); + }, + async cancel() { + cancelled = true; + }, + }; + }, + }, + }); +} + +async function getPackagePoliciesToBump(savedObjectType: string) { + const result = await appContextService + .getInternalUserSOClientWithoutSpaceExtension() + .find({ + type: savedObjectType, + filter: normalizeKuery(savedObjectType, `${savedObjectType}.bump_agent_policy_revision:true`), + perPage: SO_SEARCH_LIMIT, + namespaces: ['*'], + fields: ['id', 'namespaces', 'policy_ids'], + }); + return { + total: result.total, + items: result.saved_objects.map((so) => + mapPackagePolicySavedObjectToPackagePolicy(so, so.namespaces) + ), + }; +} + +export async function _updatePackagePoliciesThatNeedBump( + logger: Logger, + isCancelled: () => boolean +) { + const savedObjectType = await getPackagePolicySavedObjectType(); + const packagePoliciesToBump = await getPackagePoliciesToBump(savedObjectType); + + logger.info( + `Found ${packagePoliciesToBump.total} package policies that need agent policy revision bump` + ); + + const packagePoliciesIndexedBySpace = packagePoliciesToBump.items.reduce((acc, policy) => { + const spaceId = policy.spaceIds?.[0] ?? DEFAULT_SPACE_ID; + if (!acc[spaceId]) { + acc[spaceId] = []; + } + + acc[spaceId].push(policy); + + return acc; + }, {} as { [k: string]: PackagePolicy[] }); + + const start = Date.now(); + + for (const [spaceId, packagePolicies] of Object.entries(packagePoliciesIndexedBySpace)) { + if (isCancelled()) { + throw new Error('Task has been cancelled'); + } + + const soClient = appContextService.getInternalUserSOClientForSpaceId(spaceId); + const esClient = appContextService.getInternalUserESClient(); + + await soClient.bulkUpdate( + packagePolicies.map((item) => ({ + type: savedObjectType, + id: item.id, + attributes: { + bump_agent_policy_revision: false, + }, + })) + ); + + const updatedCount = packagePolicies.length; + + const agentPoliciesToBump = uniq(packagePolicies.map((item) => item.policy_ids).flat()); + + await agentPolicyService.bumpAgentPoliciesByIds(soClient, esClient, agentPoliciesToBump); + + logger.debug( + `Updated ${updatedCount} package policies in space ${spaceId} in ${ + Date.now() - start + }ms, bump ${agentPoliciesToBump.length} agent policies` + ); + } +} + +export async function scheduleBumpAgentPoliciesTask(taskManagerStart: TaskManagerStartContract) { + await taskManagerStart.ensureScheduled({ + id: `${TASK_TYPE}:${uuidv4()}`, + scope: ['fleet'], + params: {}, + taskType: TASK_TYPE, + runAt: new Date(Date.now() + 3 * 1000), + state: {}, + }); +} diff --git a/x-pack/plugins/fleet/server/services/agent_policy.ts b/x-pack/plugins/fleet/server/services/agent_policy.ts index cada1c8e64452..21614d2a97481 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.ts @@ -1646,6 +1646,27 @@ class AgentPolicyService { ); } + public async bumpAgentPoliciesByIds( + soClient: SavedObjectsClientContract, + esClient: ElasticsearchClient, + agentPolicyIds: string[], + options?: { user?: AuthenticatedUser } + ): Promise> { + const internalSoClientWithoutSpaceExtension = + appContextService.getInternalUserSOClientWithoutSpaceExtension(); + const savedObjectType = await getAgentPolicySavedObjectType(); + + const objects = agentPolicyIds.map((id: string) => ({ id, type: savedObjectType })); + const bulkGetResponse = await soClient.bulkGet(objects); + + return this._bumpPolicies( + internalSoClientWithoutSpaceExtension, + esClient, + bulkGetResponse.saved_objects, + options + ); + } + public async getInactivityTimeouts(): Promise< Array<{ policyIds: string[]; inactivityTimeout: number }> > { diff --git a/x-pack/plugins/fleet/server/services/package_policies/utils.ts b/x-pack/plugins/fleet/server/services/package_policies/utils.ts index ef59c643a8b35..a27ac5943f80f 100644 --- a/x-pack/plugins/fleet/server/services/package_policies/utils.ts +++ b/x-pack/plugins/fleet/server/services/package_policies/utils.ts @@ -28,17 +28,16 @@ import { licenseService } from '../license'; import { outputService } from '../output'; import { appContextService } from '../app_context'; -export const mapPackagePolicySavedObjectToPackagePolicy = ({ - id, - version, - attributes, - namespaces, -}: SavedObject): PackagePolicy => { +export const mapPackagePolicySavedObjectToPackagePolicy = ( + { id, version, attributes }: SavedObject, + namespaces?: string[] +): PackagePolicy => { + const { bump_agent_policy_revision: bumpAgentPolicyRevision, ...restAttributes } = attributes; return { id, version, - spaceIds: namespaces, - ...attributes, + ...(namespaces ? { spaceIds: namespaces } : {}), + ...restAttributes, }; }; diff --git a/x-pack/plugins/fleet/server/services/package_policy.ts b/x-pack/plugins/fleet/server/services/package_policy.ts index 48dc3956d6984..31747952173ce 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.ts @@ -20,6 +20,7 @@ import type { RequestHandlerContext, SavedObjectsBulkCreateObject, SavedObjectsBulkUpdateObject, + SavedObject, } from '@kbn/core/server'; import { SavedObjectsUtils } from '@kbn/core/server'; import { v4 as uuidv4 } from 'uuid'; @@ -446,7 +447,7 @@ class PackagePolicyClientImpl implements PackagePolicyClient { } } - const createdPackagePolicy = { id: newSo.id, version: newSo.version, ...newSo.attributes }; + const createdPackagePolicy = mapPackagePolicySavedObjectToPackagePolicy(newSo); logger.debug(`Created new package policy with id ${newSo.id} and version ${newSo.version}`); return packagePolicyService.runExternalCallbacks( @@ -668,11 +669,7 @@ class PackagePolicyClientImpl implements PackagePolicyClient { } logger.debug(`Created new package policies`); return { - created: newSos.map((newSo) => ({ - id: newSo.id, - version: newSo.version, - ...newSo.attributes, - })), + created: newSos.map((newSo) => mapPackagePolicySavedObjectToPackagePolicy(newSo)), failed: failedPolicies, }; } @@ -754,11 +751,7 @@ class PackagePolicyClientImpl implements PackagePolicyClient { } } - const response = { - id: packagePolicySO.id, - version: packagePolicySO.version, - ...packagePolicySO.attributes, - }; + const response = mapPackagePolicySavedObjectToPackagePolicy(packagePolicySO); // If possible, return the experimental features map for the package policy's `package` field if (experimentalFeatures && response.package) { @@ -788,11 +781,9 @@ class PackagePolicyClientImpl implements PackagePolicyClient { return []; } - const packagePolicies = packagePolicySO.saved_objects.map((so) => ({ - id: so.id, - version: so.version, - ...so.attributes, - })); + const packagePolicies = packagePolicySO.saved_objects.map((so) => + mapPackagePolicySavedObjectToPackagePolicy(so) + ); for (const packagePolicy of packagePolicies) { auditLoggingService.writeCustomSoAuditLog({ @@ -835,11 +826,7 @@ class PackagePolicyClientImpl implements PackagePolicyClient { } } - return { - id: so.id, - version: so.version, - ...so.attributes, - }; + return mapPackagePolicySavedObjectToPackagePolicy(so); }) .filter((packagePolicy): packagePolicy is PackagePolicy => packagePolicy !== null); @@ -889,12 +876,9 @@ class PackagePolicyClientImpl implements PackagePolicyClient { } return { - items: packagePolicies?.saved_objects.map((packagePolicySO) => ({ - id: packagePolicySO.id, - version: packagePolicySO.version, - ...packagePolicySO.attributes, - spaceIds: packagePolicySO.namespaces, - })), + items: packagePolicies?.saved_objects.map((so) => + mapPackagePolicySavedObjectToPackagePolicy(so, so.namespaces) + ), total: packagePolicies?.total, page, perPage, @@ -1392,13 +1376,10 @@ class PackagePolicyClientImpl implements PackagePolicyClient { const updatedPoliciesSuccess = updatedPolicies .filter((policy) => !policy.error && policy.attributes) - .map( - (soPolicy) => - ({ - id: soPolicy.id, - version: soPolicy.version, - ...soPolicy.attributes, - } as PackagePolicy) + .map((soPolicy) => + mapPackagePolicySavedObjectToPackagePolicy( + soPolicy as SavedObject + ) ); return { updatedPolicies: updatedPoliciesSuccess, failedPolicies }; @@ -2189,7 +2170,7 @@ class PackagePolicyClientImpl implements PackagePolicyClient { perPage: SO_SEARCH_LIMIT, namespaces: ['*'], }) - ).saved_objects.map(mapPackagePolicySavedObjectToPackagePolicy); + ).saved_objects.map((so) => mapPackagePolicySavedObjectToPackagePolicy(so, so.namespaces)); if (packagePolicies.length > 0) { const getPackagePolicyUpdate = (packagePolicy: PackagePolicy) => ({ @@ -2306,7 +2287,10 @@ class PackagePolicyClientImpl implements PackagePolicyClient { savedObjectType, }); - return mapPackagePolicySavedObjectToPackagePolicy(packagePolicySO); + return mapPackagePolicySavedObjectToPackagePolicy( + packagePolicySO, + packagePolicySO.namespaces + ); }); }, }); diff --git a/x-pack/plugins/fleet/server/services/setup/fleet_server_policies_enrollment_keys.test.ts b/x-pack/plugins/fleet/server/services/setup/fleet_server_policies_enrollment_keys.test.ts index 07ec6593ec9e5..9fb30ad75ab7e 100644 --- a/x-pack/plugins/fleet/server/services/setup/fleet_server_policies_enrollment_keys.test.ts +++ b/x-pack/plugins/fleet/server/services/setup/fleet_server_policies_enrollment_keys.test.ts @@ -17,6 +17,7 @@ import { ensureAgentPoliciesFleetServerKeysAndPolicies } from './fleet_server_po jest.mock('../app_context'); jest.mock('../agent_policy'); jest.mock('../api_keys'); +jest.mock('../agent_policies/bump_agent_policies_task'); const mockedEnsureDefaultEnrollmentAPIKeyForAgentPolicy = jest.mocked( ensureDefaultEnrollmentAPIKeyForAgentPolicy diff --git a/x-pack/plugins/fleet/server/services/setup/fleet_server_policies_enrollment_keys.ts b/x-pack/plugins/fleet/server/services/setup/fleet_server_policies_enrollment_keys.ts index f5ed816d96e61..cd7e91fb81ac4 100644 --- a/x-pack/plugins/fleet/server/services/setup/fleet_server_policies_enrollment_keys.ts +++ b/x-pack/plugins/fleet/server/services/setup/fleet_server_policies_enrollment_keys.ts @@ -13,6 +13,7 @@ import { ensureDefaultEnrollmentAPIKeyForAgentPolicy } from '../api_keys'; import { SO_SEARCH_LIMIT } from '../../constants'; import { appContextService } from '../app_context'; import { scheduleDeployAgentPoliciesTask } from '../agent_policies/deploy_agent_policies_task'; +import { scheduleBumpAgentPoliciesTask } from '../agent_policies/bump_agent_policies_task'; export async function ensureAgentPoliciesFleetServerKeysAndPolicies({ logger, @@ -37,7 +38,6 @@ export async function ensureAgentPoliciesFleetServerKeysAndPolicies({ }); const outdatedAgentPolicyIds: Array<{ id: string; spaceId?: string }> = []; - await pMap( agentPolicies, async (agentPolicy) => { @@ -55,23 +55,23 @@ export async function ensureAgentPoliciesFleetServerKeysAndPolicies({ } ); - if (!outdatedAgentPolicyIds.length) { - return; - } + await scheduleBumpAgentPoliciesTask(appContextService.getTaskManagerStart()!); - if (appContextService.getExperimentalFeatures().asyncDeployPolicies) { - return scheduleDeployAgentPoliciesTask( - appContextService.getTaskManagerStart()!, - outdatedAgentPolicyIds - ); - } else { - return agentPolicyService - .deployPolicies( - soClient, - outdatedAgentPolicyIds.map(({ id }) => id) - ) - .catch((error) => { - logger.warn(`Error deploying policies: ${error.message}`, { error }); - }); + if (outdatedAgentPolicyIds.length) { + if (appContextService.getExperimentalFeatures().asyncDeployPolicies) { + return scheduleDeployAgentPoliciesTask( + appContextService.getTaskManagerStart()!, + outdatedAgentPolicyIds + ); + } else { + return agentPolicyService + .deployPolicies( + soClient, + outdatedAgentPolicyIds.map(({ id }) => id) + ) + .catch((error) => { + logger.warn(`Error deploying policies: ${error.message}`, { error }); + }); + } } } diff --git a/x-pack/plugins/fleet/server/types/rest_spec/settings.ts b/x-pack/plugins/fleet/server/types/rest_spec/settings.ts index c40dcc0b63596..64684e51350d4 100644 --- a/x-pack/plugins/fleet/server/types/rest_spec/settings.ts +++ b/x-pack/plugins/fleet/server/types/rest_spec/settings.ts @@ -61,7 +61,9 @@ export const SettingsResponseSchema = schema.object({ use_space_awareness_migration_status: schema.maybe( schema.oneOf([schema.literal('pending'), schema.literal('success'), schema.literal('error')]) ), - use_space_awareness_migration_started_at: schema.maybe(schema.string()), + use_space_awareness_migration_started_at: schema.maybe( + schema.oneOf([schema.literal(null), schema.string()]) + ), delete_unenrolled_agents: schema.maybe( schema.object({ enabled: schema.boolean(), diff --git a/x-pack/plugins/fleet/server/types/so_attributes.ts b/x-pack/plugins/fleet/server/types/so_attributes.ts index 31207dda64bc8..6f415eea9eb61 100644 --- a/x-pack/plugins/fleet/server/types/so_attributes.ts +++ b/x-pack/plugins/fleet/server/types/so_attributes.ts @@ -137,6 +137,7 @@ export interface PackagePolicySOAttributes { }; agents?: number; overrides?: any | null; + bump_agent_policy_revision?: boolean; } interface OutputSoBaseAttributes { diff --git a/x-pack/test/plugin_api_integration/test_suites/task_manager/check_registered_task_types.ts b/x-pack/test/plugin_api_integration/test_suites/task_manager/check_registered_task_types.ts index a6bf7e7e9d5f2..e8e24f53551e8 100644 --- a/x-pack/test/plugin_api_integration/test_suites/task_manager/check_registered_task_types.ts +++ b/x-pack/test/plugin_api_integration/test_suites/task_manager/check_registered_task_types.ts @@ -143,6 +143,7 @@ export default function ({ getService }: FtrProviderContext) { 'endpoint:metadata-check-transforms-task', 'endpoint:user-artifact-packager', 'entity_store:field_retention:enrichment', + 'fleet:bump_agent_policies', 'fleet:check-deleted-files-task', 'fleet:delete-unenrolled-agents-task', 'fleet:deploy_agent_policies', From 4891c7d7f99097de649667ad0c1f48515120edbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Rica=20Pais=20da=20Silva?= Date: Mon, 25 Nov 2024 11:13:16 +0100 Subject: [PATCH 04/71] [ObsUX][APM] Migrate Service Overview archiver test cases to synthtrace (#201407) Part of #193245 Related #200226 Closes #200743 ## Summary This PR completes the migration of remaining Service Overview tests to the Deployment Agnostic test framework. In this PR, one test was deduplicated (the Dependencies test), and the Instances Detailed Statistics cases dealing with archiver data was migrated to make use of synthtrace instead. Snapshots included were redone to match the data generated by synthtrace, but no other cases were changed to ensure the new migrated tests were passing the same assumptions as before. ## How to Test ### Serverless ``` node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt/apm.serverless.config.ts node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts ``` It's recommended to be run against [MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki) ### Stateful ``` node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts ``` --------- Co-authored-by: jennypavlova Co-authored-by: Elastic Machine --- .../observability/apm/dependencies/index.ts | 1 - .../dependencies/service_dependencies.spec.ts | 72 --- .../instances_detailed_statistics.spec.snap | 568 +++++++++--------- .../dependencies/index.spec.ts | 523 ++++++++-------- .../apm/service_overview/generate_data.ts | 110 ++++ .../instances_detailed_statistics.spec.ts | 174 +++++- .../dependencies/index.spec.ts | 253 -------- .../service_overview/get_service_node_ids.ts | 42 -- .../instances_detailed_statistics.spec.ts | 179 ------ 9 files changed, 841 insertions(+), 1081 deletions(-) delete mode 100644 x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/dependencies/service_dependencies.spec.ts rename x-pack/test/{apm_api_integration/tests => api_integration/deployment_agnostic/apis/observability/apm}/service_overview/__snapshots__/instances_detailed_statistics.spec.snap (71%) create mode 100644 x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/generate_data.ts delete mode 100644 x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.spec.ts delete mode 100644 x-pack/test/apm_api_integration/tests/service_overview/get_service_node_ids.ts delete mode 100644 x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.spec.ts diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/dependencies/index.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/dependencies/index.ts index 46ad399380550..617f9bcae89b1 100644 --- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/dependencies/index.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/dependencies/index.ts @@ -11,7 +11,6 @@ export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext) describe('custom_dashboards', () => { loadTestFile(require.resolve('./dependency_metrics.spec.ts')); loadTestFile(require.resolve('./metadata.spec.ts')); - loadTestFile(require.resolve('./service_dependencies.spec.ts')); loadTestFile(require.resolve('./top_dependencies.spec.ts')); loadTestFile(require.resolve('./top_operations.spec.ts')); loadTestFile(require.resolve('./top_spans.spec.ts')); diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/dependencies/service_dependencies.spec.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/dependencies/service_dependencies.spec.ts deleted file mode 100644 index 4105989e5509b..0000000000000 --- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/dependencies/service_dependencies.spec.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import expect from '@kbn/expect'; -import { DependencyNode } from '@kbn/apm-plugin/common/connections'; -import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace'; -import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context'; -import { generateData } from './generate_data'; - -export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) { - const apmApiClient = getService('apmApi'); - const synthtrace = getService('synthtrace'); - const start = new Date('2021-01-01T00:00:00.000Z').getTime(); - const end = new Date('2021-01-01T00:15:00.000Z').getTime() - 1; - const dependencyName = 'elasticsearch'; - const serviceName = 'synth-go'; - - async function callApi() { - return await apmApiClient.readUser({ - endpoint: 'GET /internal/apm/services/{serviceName}/dependencies', - params: { - path: { serviceName }, - query: { - environment: 'production', - numBuckets: 20, - offset: '1d', - start: new Date(start).toISOString(), - end: new Date(end).toISOString(), - }, - }, - }); - } - - describe('Dependency for service', () => { - describe('when data is not loaded', () => { - it('handles empty state #1', async () => { - const { status, body } = await callApi(); - - expect(status).to.be(200); - expect(body.serviceDependencies).to.empty(); - }); - }); - - describe('when data is loaded', () => { - let apmSynthtraceEsClient: ApmSynthtraceEsClient; - - before(async () => { - apmSynthtraceEsClient = await synthtrace.createApmSynthtraceEsClient(); - await generateData({ apmSynthtraceEsClient, start, end }); - }); - after(() => apmSynthtraceEsClient.clean()); - - it('returns a list of dependencies for a service', async () => { - const { status, body } = await callApi(); - - expect(status).to.be(200); - expect( - body.serviceDependencies.map( - ({ location }) => (location as DependencyNode).dependencyName - ) - ).to.eql([dependencyName]); - - const currentStatsLatencyValues = - body.serviceDependencies[0].currentStats.latency.timeseries; - expect(currentStatsLatencyValues.every(({ y }) => y === 1000000)).to.be(true); - }); - }); - }); -} diff --git a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.spec.snap b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/__snapshots__/instances_detailed_statistics.spec.snap similarity index 71% rename from x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.spec.snap rename to x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/__snapshots__/instances_detailed_statistics.spec.snap index a5444cc6a6e32..dfea3c44472a8 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.spec.snap +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/__snapshots__/instances_detailed_statistics.spec.snap @@ -1,69 +1,69 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`APM API tests service_overview/instances_detailed_statistics.spec.ts basic apm_8.0.0 Service overview instances detailed statistics when data is loaded fetching data with comparison returns the right data for current and previous periods 5`] = ` +exports[`Deployment-agnostic APM API integration tests APM service_overview Service Overview Instances detailed statistics when data is loaded fetching data with comparison returns the right data for current and previous periods 5`] = ` Object { "currentPeriod": Object { - "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad": Object { + "instance-a": Object { "cpuUsage": Array [ Object { "x": 1627974300000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974360000, - "y": 0.001, + "y": 0.5, }, Object { "x": 1627974420000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627974480000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974540000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974600000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974660000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974720000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974780000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974840000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974900000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627974960000, - "y": 0.001, + "y": 0.5, }, Object { "x": 1627975020000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627975080000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627975140000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627975200000, @@ -73,11 +73,11 @@ Object { "errorRate": Array [ Object { "x": 1627974300000, - "y": 0, + "y": null, }, Object { "x": 1627974360000, - "y": null, + "y": 0, }, Object { "x": 1627974420000, @@ -93,15 +93,15 @@ Object { }, Object { "x": 1627974600000, - "y": 0.125, + "y": 0, }, Object { "x": 1627974660000, - "y": 0.6, + "y": 0, }, Object { "x": 1627974720000, - "y": 0.2, + "y": 0, }, Object { "x": 1627974780000, @@ -113,7 +113,7 @@ Object { }, Object { "x": 1627974900000, - "y": 0.0666666666666667, + "y": 0, }, Object { "x": 1627974960000, @@ -129,7 +129,7 @@ Object { }, Object { "x": 1627975140000, - "y": 0.181818181818182, + "y": 0, }, Object { "x": 1627975200000, @@ -139,63 +139,63 @@ Object { "latency": Array [ Object { "x": 1627974300000, - "y": 34887.8888888889, + "y": null, }, Object { "x": 1627974360000, - "y": null, + "y": 1000000, }, Object { "x": 1627974420000, - "y": 4983, + "y": 1000000, }, Object { "x": 1627974480000, - "y": 41285.4, + "y": 1000000, }, Object { "x": 1627974540000, - "y": 13820.3333333333, + "y": 1000000, }, Object { "x": 1627974600000, - "y": 13782, + "y": 1000000, }, Object { "x": 1627974660000, - "y": 13392.6, + "y": 1000000, }, Object { "x": 1627974720000, - "y": 6991, + "y": 1000000, }, Object { "x": 1627974780000, - "y": 6885.85714285714, + "y": 1000000, }, Object { "x": 1627974840000, - "y": 7935, + "y": 1000000, }, Object { "x": 1627974900000, - "y": 10828.3333333333, + "y": 1000000, }, Object { "x": 1627974960000, - "y": 6079, + "y": 1000000, }, Object { "x": 1627975020000, - "y": 5217, + "y": 1000000, }, Object { "x": 1627975080000, - "y": 8477.76923076923, + "y": 1000000, }, Object { "x": 1627975140000, - "y": 5937.18181818182, + "y": 1000000, }, Object { "x": 1627975200000, @@ -205,130 +205,130 @@ Object { "memoryUsage": Array [ Object { "x": 1627974300000, - "y": 0.786640167236328, + "y": 0.416666666666667, }, Object { "x": 1627974360000, - "y": 0.786666870117188, + "y": 0.416666666666667, }, Object { "x": 1627974420000, - "y": 0.786960601806641, + "y": 0.416666666666667, }, Object { "x": 1627974480000, - "y": 0.787132263183594, + "y": 0.416666666666667, }, Object { "x": 1627974540000, - "y": 0.787441253662109, + "y": 0.416666666666667, }, Object { "x": 1627974600000, - "y": 0.787555694580078, + "y": 0.416666666666667, }, Object { "x": 1627974660000, - "y": 0.788524627685547, + "y": 0.416666666666667, }, Object { "x": 1627974720000, - "y": 0.788822174072266, + "y": 0.416666666666667, }, Object { "x": 1627974780000, - "y": 0.789054870605469, + "y": 0.416666666666667, }, Object { "x": 1627974840000, - "y": 0.78936767578125, + "y": 0.416666666666667, }, Object { "x": 1627974900000, - "y": 0.789985656738281, + "y": 0.416666666666667, }, Object { "x": 1627974960000, - "y": 0.790130615234375, + "y": 0.416666666666667, }, Object { "x": 1627975020000, - "y": 0.790508270263672, + "y": 0.416666666666667, }, Object { "x": 1627975080000, - "y": 0.791069030761719, + "y": 0.416666666666667, }, Object { "x": 1627975140000, - "y": 0.791587829589844, + "y": 0.416666666666667, }, Object { "x": 1627975200000, "y": null, }, ], - "serviceNodeName": "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", + "serviceNodeName": "instance-a", "throughput": Array [ Object { "x": 1627974300000, - "y": 9, + "y": 0, }, Object { "x": 1627974360000, - "y": 0, + "y": 20, }, Object { "x": 1627974420000, - "y": 4, + "y": 20, }, Object { "x": 1627974480000, - "y": 5, + "y": 20, }, Object { "x": 1627974540000, - "y": 6, + "y": 20, }, Object { "x": 1627974600000, - "y": 8, + "y": 20, }, Object { "x": 1627974660000, - "y": 5, + "y": 20, }, Object { "x": 1627974720000, - "y": 5, + "y": 20, }, Object { "x": 1627974780000, - "y": 7, + "y": 20, }, Object { "x": 1627974840000, - "y": 2, + "y": 20, }, Object { "x": 1627974900000, - "y": 15, + "y": 20, }, Object { "x": 1627974960000, - "y": 3, + "y": 20, }, Object { "x": 1627975020000, - "y": 8, + "y": 20, }, Object { "x": 1627975080000, - "y": 13, + "y": 20, }, Object { "x": 1627975140000, - "y": 11, + "y": 20, }, Object { "x": 1627975200000, @@ -338,77 +338,77 @@ Object { }, }, "previousPeriod": Object { - "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad": Object { + "instance-a": Object { "cpuUsage": Array [ Object { "x": 1627974300000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974360000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974420000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627974480000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974540000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974600000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974660000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974720000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974780000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974840000, - "y": 0.0045, + "y": 0.5, }, Object { "x": 1627974900000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627974960000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627975020000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627975080000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627975140000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627975200000, - "y": null, + "y": 0.5, }, ], "errorRate": Array [ Object { "x": 1627974300000, - "y": 0, + "y": null, }, Object { "x": 1627974360000, @@ -416,11 +416,11 @@ Object { }, Object { "x": 1627974420000, - "y": 0.333333333333333, + "y": 0, }, Object { "x": 1627974480000, - "y": 0.181818181818182, + "y": 0, }, Object { "x": 1627974540000, @@ -432,11 +432,11 @@ Object { }, Object { "x": 1627974660000, - "y": 0.166666666666667, + "y": 0, }, Object { "x": 1627974720000, - "y": 0.181818181818182, + "y": 0, }, Object { "x": 1627974780000, @@ -448,11 +448,11 @@ Object { }, Object { "x": 1627974900000, - "y": 0.0833333333333333, + "y": 0, }, Object { "x": 1627974960000, - "y": 0.0769230769230769, + "y": 0, }, Object { "x": 1627975020000, @@ -460,214 +460,214 @@ Object { }, Object { "x": 1627975080000, - "y": 0.1, + "y": 0, }, Object { "x": 1627975140000, - "y": 0.153846153846154, + "y": 0, }, Object { "x": 1627975200000, - "y": null, + "y": 0, }, ], "latency": Array [ Object { "x": 1627974300000, - "y": 11839, + "y": null, }, Object { "x": 1627974360000, - "y": 7407, + "y": 1000000, }, Object { "x": 1627974420000, - "y": 1925569.66666667, + "y": 1000000, }, Object { "x": 1627974480000, - "y": 9017.18181818182, + "y": 1000000, }, Object { "x": 1627974540000, - "y": 63575, + "y": 1000000, }, Object { "x": 1627974600000, - "y": 7577.66666666667, + "y": 1000000, }, Object { "x": 1627974660000, - "y": 6844.33333333333, + "y": 1000000, }, Object { "x": 1627974720000, - "y": 503471, + "y": 1000000, }, Object { "x": 1627974780000, - "y": 6247.8, + "y": 1000000, }, Object { "x": 1627974840000, - "y": 1137247, + "y": 1000000, }, Object { "x": 1627974900000, - "y": 27951.6666666667, + "y": 1000000, }, Object { "x": 1627974960000, - "y": 10248.8461538462, + "y": 1000000, }, Object { "x": 1627975020000, - "y": 13529, + "y": 1000000, }, Object { "x": 1627975080000, - "y": 6691247.8, + "y": 1000000, }, Object { "x": 1627975140000, - "y": 12098.6923076923, + "y": 1000000, }, Object { "x": 1627975200000, - "y": null, + "y": 1000000, }, ], "memoryUsage": Array [ Object { "x": 1627974300000, - "y": 0.780715942382813, + "y": 0.416666666666667, }, Object { "x": 1627974360000, - "y": 0.780921936035156, + "y": 0.416666666666667, }, Object { "x": 1627974420000, - "y": 0.781166076660156, + "y": 0.416666666666667, }, Object { "x": 1627974480000, - "y": 0.781524658203125, + "y": 0.416666666666667, }, Object { "x": 1627974540000, - "y": 0.781723022460938, + "y": 0.416666666666667, }, Object { "x": 1627974600000, - "y": 0.782463073730469, + "y": 0.416666666666667, }, Object { "x": 1627974660000, - "y": 0.782634735107422, + "y": 0.416666666666667, }, Object { "x": 1627974720000, - "y": 0.782939910888672, + "y": 0.416666666666667, }, Object { "x": 1627974780000, - "y": 0.783458709716797, + "y": 0.416666666666667, }, Object { "x": 1627974840000, - "y": 0.783935546875, + "y": 0.416666666666667, }, Object { "x": 1627974900000, - "y": 0.784690856933594, + "y": 0.416666666666667, }, Object { "x": 1627974960000, - "y": 0.785182952880859, + "y": 0.416666666666667, }, Object { "x": 1627975020000, - "y": 0.785446166992188, + "y": 0.416666666666667, }, Object { "x": 1627975080000, - "y": 0.786224365234375, + "y": 0.416666666666667, }, Object { "x": 1627975140000, - "y": 0.786415100097656, + "y": 0.416666666666667, }, Object { "x": 1627975200000, - "y": null, + "y": 0.416666666666667, }, ], - "serviceNodeName": "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", + "serviceNodeName": "instance-a", "throughput": Array [ Object { "x": 1627974300000, - "y": 4, + "y": 0, }, Object { "x": 1627974360000, - "y": 2, + "y": 20, }, Object { "x": 1627974420000, - "y": 3, + "y": 20, }, Object { "x": 1627974480000, - "y": 11, + "y": 20, }, Object { "x": 1627974540000, - "y": 4, + "y": 20, }, Object { "x": 1627974600000, - "y": 6, + "y": 20, }, Object { "x": 1627974660000, - "y": 6, + "y": 20, }, Object { "x": 1627974720000, - "y": 11, + "y": 20, }, Object { "x": 1627974780000, - "y": 10, + "y": 20, }, Object { "x": 1627974840000, - "y": 10, + "y": 20, }, Object { "x": 1627974900000, - "y": 12, + "y": 20, }, Object { "x": 1627974960000, - "y": 13, + "y": 20, }, Object { "x": 1627975020000, - "y": 8, + "y": 20, }, Object { "x": 1627975080000, - "y": 10, + "y": 20, }, Object { "x": 1627975140000, - "y": 13, + "y": 20, }, Object { "x": 1627975200000, - "y": 0, + "y": 20, }, ], }, @@ -675,130 +675,130 @@ Object { } `; -exports[`APM API tests service_overview/instances_detailed_statistics.spec.ts basic apm_8.0.0 Service overview instances detailed statistics when data is loaded fetching data without comparison returns the right data 3`] = ` +exports[`Deployment-agnostic APM API integration tests APM service_overview Service Overview Instances detailed statistics when data is loaded fetching data without comparison returns the right data 3`] = ` Object { "currentPeriod": Object { - "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad": Object { + "instance-a": Object { "cpuUsage": Array [ Object { "x": 1627973400000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627973460000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627973520000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627973580000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627973640000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627973700000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627973760000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627973820000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627973880000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627973940000, - "y": 0.0045, + "y": 0.5, }, Object { "x": 1627974000000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627974060000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627974120000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974180000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974240000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627974300000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974360000, - "y": 0.001, + "y": 0.5, }, Object { "x": 1627974420000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627974480000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974540000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974600000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974660000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974720000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974780000, - "y": 0.0015, + "y": 0.5, }, Object { "x": 1627974840000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627974900000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627974960000, - "y": 0.001, + "y": 0.5, }, Object { "x": 1627975020000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627975080000, - "y": 0.002, + "y": 0.5, }, Object { "x": 1627975140000, - "y": 0.0025, + "y": 0.5, }, Object { "x": 1627975200000, @@ -808,7 +808,7 @@ Object { "errorRate": Array [ Object { "x": 1627973400000, - "y": 0, + "y": null, }, Object { "x": 1627973460000, @@ -816,11 +816,11 @@ Object { }, Object { "x": 1627973520000, - "y": 0.333333333333333, + "y": 0, }, Object { "x": 1627973580000, - "y": 0.181818181818182, + "y": 0, }, Object { "x": 1627973640000, @@ -832,11 +832,11 @@ Object { }, Object { "x": 1627973760000, - "y": 0.166666666666667, + "y": 0, }, Object { "x": 1627973820000, - "y": 0.181818181818182, + "y": 0, }, Object { "x": 1627973880000, @@ -848,11 +848,11 @@ Object { }, Object { "x": 1627974000000, - "y": 0.0833333333333333, + "y": 0, }, Object { "x": 1627974060000, - "y": 0.0769230769230769, + "y": 0, }, Object { "x": 1627974120000, @@ -860,11 +860,11 @@ Object { }, Object { "x": 1627974180000, - "y": 0.1, + "y": 0, }, Object { "x": 1627974240000, - "y": 0.153846153846154, + "y": 0, }, Object { "x": 1627974300000, @@ -872,7 +872,7 @@ Object { }, Object { "x": 1627974360000, - "y": null, + "y": 0, }, Object { "x": 1627974420000, @@ -888,15 +888,15 @@ Object { }, Object { "x": 1627974600000, - "y": 0.125, + "y": 0, }, Object { "x": 1627974660000, - "y": 0.6, + "y": 0, }, Object { "x": 1627974720000, - "y": 0.2, + "y": 0, }, Object { "x": 1627974780000, @@ -908,7 +908,7 @@ Object { }, Object { "x": 1627974900000, - "y": 0.0666666666666667, + "y": 0, }, Object { "x": 1627974960000, @@ -924,7 +924,7 @@ Object { }, Object { "x": 1627975140000, - "y": 0.181818181818182, + "y": 0, }, Object { "x": 1627975200000, @@ -934,123 +934,123 @@ Object { "latency": Array [ Object { "x": 1627973400000, - "y": 11839, + "y": null, }, Object { "x": 1627973460000, - "y": 7407, + "y": 1000000, }, Object { "x": 1627973520000, - "y": 1925569.66666667, + "y": 1000000, }, Object { "x": 1627973580000, - "y": 9017.18181818182, + "y": 1000000, }, Object { "x": 1627973640000, - "y": 63575, + "y": 1000000, }, Object { "x": 1627973700000, - "y": 7577.66666666667, + "y": 1000000, }, Object { "x": 1627973760000, - "y": 6844.33333333333, + "y": 1000000, }, Object { "x": 1627973820000, - "y": 503471, + "y": 1000000, }, Object { "x": 1627973880000, - "y": 6247.8, + "y": 1000000, }, Object { "x": 1627973940000, - "y": 1137247, + "y": 1000000, }, Object { "x": 1627974000000, - "y": 27951.6666666667, + "y": 1000000, }, Object { "x": 1627974060000, - "y": 10248.8461538462, + "y": 1000000, }, Object { "x": 1627974120000, - "y": 13529, + "y": 1000000, }, Object { "x": 1627974180000, - "y": 6691247.8, + "y": 1000000, }, Object { "x": 1627974240000, - "y": 12098.6923076923, + "y": 1000000, }, Object { "x": 1627974300000, - "y": 34887.8888888889, + "y": 1000000, }, Object { "x": 1627974360000, - "y": null, + "y": 1000000, }, Object { "x": 1627974420000, - "y": 4983, + "y": 1000000, }, Object { "x": 1627974480000, - "y": 41285.4, + "y": 1000000, }, Object { "x": 1627974540000, - "y": 13820.3333333333, + "y": 1000000, }, Object { "x": 1627974600000, - "y": 13782, + "y": 1000000, }, Object { "x": 1627974660000, - "y": 13392.6, + "y": 1000000, }, Object { "x": 1627974720000, - "y": 6991, + "y": 1000000, }, Object { "x": 1627974780000, - "y": 6885.85714285714, + "y": 1000000, }, Object { "x": 1627974840000, - "y": 7935, + "y": 1000000, }, Object { "x": 1627974900000, - "y": 10828.3333333333, + "y": 1000000, }, Object { "x": 1627974960000, - "y": 6079, + "y": 1000000, }, Object { "x": 1627975020000, - "y": 5217, + "y": 1000000, }, Object { "x": 1627975080000, - "y": 8477.76923076923, + "y": 1000000, }, Object { "x": 1627975140000, - "y": 5937.18181818182, + "y": 1000000, }, Object { "x": 1627975200000, @@ -1060,250 +1060,250 @@ Object { "memoryUsage": Array [ Object { "x": 1627973400000, - "y": 0.780715942382813, + "y": 0.416666666666667, }, Object { "x": 1627973460000, - "y": 0.780921936035156, + "y": 0.416666666666667, }, Object { "x": 1627973520000, - "y": 0.781166076660156, + "y": 0.416666666666667, }, Object { "x": 1627973580000, - "y": 0.781524658203125, + "y": 0.416666666666667, }, Object { "x": 1627973640000, - "y": 0.781723022460938, + "y": 0.416666666666667, }, Object { "x": 1627973700000, - "y": 0.782463073730469, + "y": 0.416666666666667, }, Object { "x": 1627973760000, - "y": 0.782634735107422, + "y": 0.416666666666667, }, Object { "x": 1627973820000, - "y": 0.782939910888672, + "y": 0.416666666666667, }, Object { "x": 1627973880000, - "y": 0.783458709716797, + "y": 0.416666666666667, }, Object { "x": 1627973940000, - "y": 0.783935546875, + "y": 0.416666666666667, }, Object { "x": 1627974000000, - "y": 0.784690856933594, + "y": 0.416666666666667, }, Object { "x": 1627974060000, - "y": 0.785182952880859, + "y": 0.416666666666667, }, Object { "x": 1627974120000, - "y": 0.785446166992188, + "y": 0.416666666666667, }, Object { "x": 1627974180000, - "y": 0.786224365234375, + "y": 0.416666666666667, }, Object { "x": 1627974240000, - "y": 0.786415100097656, + "y": 0.416666666666667, }, Object { "x": 1627974300000, - "y": 0.786640167236328, + "y": 0.416666666666667, }, Object { "x": 1627974360000, - "y": 0.786666870117188, + "y": 0.416666666666667, }, Object { "x": 1627974420000, - "y": 0.786960601806641, + "y": 0.416666666666667, }, Object { "x": 1627974480000, - "y": 0.787132263183594, + "y": 0.416666666666667, }, Object { "x": 1627974540000, - "y": 0.787441253662109, + "y": 0.416666666666667, }, Object { "x": 1627974600000, - "y": 0.787555694580078, + "y": 0.416666666666667, }, Object { "x": 1627974660000, - "y": 0.788524627685547, + "y": 0.416666666666667, }, Object { "x": 1627974720000, - "y": 0.788822174072266, + "y": 0.416666666666667, }, Object { "x": 1627974780000, - "y": 0.789054870605469, + "y": 0.416666666666667, }, Object { "x": 1627974840000, - "y": 0.78936767578125, + "y": 0.416666666666667, }, Object { "x": 1627974900000, - "y": 0.789985656738281, + "y": 0.416666666666667, }, Object { "x": 1627974960000, - "y": 0.790130615234375, + "y": 0.416666666666667, }, Object { "x": 1627975020000, - "y": 0.790508270263672, + "y": 0.416666666666667, }, Object { "x": 1627975080000, - "y": 0.791069030761719, + "y": 0.416666666666667, }, Object { "x": 1627975140000, - "y": 0.791587829589844, + "y": 0.416666666666667, }, Object { "x": 1627975200000, "y": null, }, ], - "serviceNodeName": "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", + "serviceNodeName": "instance-a", "throughput": Array [ Object { "x": 1627973400000, - "y": 4, + "y": 0, }, Object { "x": 1627973460000, - "y": 2, + "y": 20, }, Object { "x": 1627973520000, - "y": 3, + "y": 20, }, Object { "x": 1627973580000, - "y": 11, + "y": 20, }, Object { "x": 1627973640000, - "y": 4, + "y": 20, }, Object { "x": 1627973700000, - "y": 6, + "y": 20, }, Object { "x": 1627973760000, - "y": 6, + "y": 20, }, Object { "x": 1627973820000, - "y": 11, + "y": 20, }, Object { "x": 1627973880000, - "y": 10, + "y": 20, }, Object { "x": 1627973940000, - "y": 10, + "y": 20, }, Object { "x": 1627974000000, - "y": 12, + "y": 20, }, Object { "x": 1627974060000, - "y": 13, + "y": 20, }, Object { "x": 1627974120000, - "y": 8, + "y": 20, }, Object { "x": 1627974180000, - "y": 10, + "y": 20, }, Object { "x": 1627974240000, - "y": 13, + "y": 20, }, Object { "x": 1627974300000, - "y": 9, + "y": 20, }, Object { "x": 1627974360000, - "y": 0, + "y": 20, }, Object { "x": 1627974420000, - "y": 4, + "y": 20, }, Object { "x": 1627974480000, - "y": 5, + "y": 20, }, Object { "x": 1627974540000, - "y": 6, + "y": 20, }, Object { "x": 1627974600000, - "y": 8, + "y": 20, }, Object { "x": 1627974660000, - "y": 5, + "y": 20, }, Object { "x": 1627974720000, - "y": 5, + "y": 20, }, Object { "x": 1627974780000, - "y": 7, + "y": 20, }, Object { "x": 1627974840000, - "y": 2, + "y": 20, }, Object { "x": 1627974900000, - "y": 15, + "y": 20, }, Object { "x": 1627974960000, - "y": 3, + "y": 20, }, Object { "x": 1627975020000, - "y": 8, + "y": 20, }, Object { "x": 1627975080000, - "y": 13, + "y": 20, }, Object { "x": 1627975140000, - "y": 11, + "y": 20, }, Object { "x": 1627975200000, diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/dependencies/index.spec.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/dependencies/index.spec.ts index cb7f81304c3b0..a579e196e7aa4 100644 --- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/dependencies/index.spec.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/dependencies/index.spec.ts @@ -4,301 +4,328 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - import expect from '@kbn/expect'; import { last, pick } from 'lodash'; +import { DependencyNode } from '@kbn/apm-plugin/common/connections'; import type { ValuesType } from 'utility-types'; +import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace'; +import type { APIReturnType } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; import { type Node, NodeType } from '@kbn/apm-plugin/common/connections'; import { ENVIRONMENT_ALL, ENVIRONMENT_NOT_DEFINED, } from '@kbn/apm-plugin/common/environment_filter_values'; -import type { APIReturnType } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; -import { roundNumber } from '../../utils/common'; import type { DeploymentAgnosticFtrProviderContext } from '../../../../../ftr_provider_context'; +import { roundNumber } from '../../utils/common'; +import { generateDependencyData } from '../generate_data'; import { apmDependenciesMapping, createServiceDependencyDocs } from './es_utils'; export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) { const apmApiClient = getService('apmApi'); + const synthtrace = getService('synthtrace'); const es = getService('es'); - - const { start, end } = { - start: '2021-08-03T06:50:15.910Z', - end: '2021-08-03T07:20:15.910Z', - }; + const start = new Date('2021-01-01T00:00:00.000Z').getTime(); + const end = new Date('2021-01-01T00:15:00.000Z').getTime() - 1; + const dependencyName = 'elasticsearch'; + const serviceName = 'synth-go'; function getName(node: Node) { return node.type === NodeType.service ? node.serviceName : node.dependencyName; } - describe('Service Overview', () => { - describe('Dependencies', () => { - describe('when data is not loaded', () => { - it('handles the empty state', async () => { - const response = await apmApiClient.readUser({ - endpoint: `GET /internal/apm/services/{serviceName}/dependencies`, - params: { - path: { serviceName: 'opbeans-java' }, - query: { - start, - end, - numBuckets: 20, - environment: ENVIRONMENT_ALL.value, - }, - }, - }); + async function callApi() { + return await apmApiClient.readUser({ + endpoint: 'GET /internal/apm/services/{serviceName}/dependencies', + params: { + path: { serviceName }, + query: { + environment: 'production', + numBuckets: 20, + offset: '1d', + start: new Date(start).toISOString(), + end: new Date(end).toISOString(), + }, + }, + }); + } - expect(response.status).to.be(200); - expect(response.body.serviceDependencies).to.eql([]); - }); + describe('Dependency for service', () => { + describe('when data is not loaded', () => { + it('handles empty state #1', async () => { + const { status, body } = await callApi(); + + expect(status).to.be(200); + expect(body.serviceDependencies).to.be.empty(); }); + }); - describe('when specific data is loaded', () => { - let response: { - status: number; - body: APIReturnType<'GET /internal/apm/services/{serviceName}/dependencies'>; - }; + describe('when specific data is loaded', () => { + let response: { + status: number; + body: APIReturnType<'GET /internal/apm/services/{serviceName}/dependencies'>; + }; + + const indices = { + metric: 'apm-dependencies-metric', + transaction: 'apm-dependencies-transaction', + span: 'apm-dependencies-span', + }; + + const startTime = new Date(start).getTime(); + const endTime = new Date(end).getTime(); + + after(async () => { + const allIndices = Object.values(indices).join(','); + const indexExists = await es.indices.exists({ index: allIndices }); + if (indexExists) { + await es.indices.delete({ + index: allIndices, + }); + } + }); - const indices = { - metric: 'apm-dependencies-metric', - transaction: 'apm-dependencies-transaction', - span: 'apm-dependencies-span', - }; + before(async () => { + await es.indices.create({ + index: indices.metric, + body: { + mappings: apmDependenciesMapping, + }, + }); - const startTime = new Date(start).getTime(); - const endTime = new Date(end).getTime(); - - after(async () => { - const allIndices = Object.values(indices).join(','); - const indexExists = await es.indices.exists({ index: allIndices }); - if (indexExists) { - await es.indices.delete({ - index: allIndices, - }); - } + await es.indices.create({ + index: indices.transaction, + body: { + mappings: apmDependenciesMapping, + }, }); - before(async () => { - await es.indices.create({ - index: indices.metric, - body: { - mappings: apmDependenciesMapping, - }, - }); + await es.indices.create({ + index: indices.span, + body: { + mappings: apmDependenciesMapping, + }, + }); - await es.indices.create({ - index: indices.transaction, - body: { - mappings: apmDependenciesMapping, + const docs = [ + ...createServiceDependencyDocs({ + service: { + name: 'opbeans-java', + environment: 'production', }, - }); - - await es.indices.create({ - index: indices.span, - body: { - mappings: apmDependenciesMapping, + agentName: 'java', + span: { + type: 'external', + subtype: 'http', }, - }); - - const docs = [ - ...createServiceDependencyDocs({ - service: { - name: 'opbeans-java', - environment: 'production', - }, - agentName: 'java', - span: { - type: 'external', - subtype: 'http', - }, - resource: 'opbeans-node:3000', - outcome: 'success', - responseTime: { - count: 2, - sum: 10, - }, - time: startTime, - to: { - service: { - name: 'opbeans-node', - }, - agentName: 'nodejs', - }, - }), - ...createServiceDependencyDocs({ - service: { - name: 'opbeans-java', - environment: 'production', - }, - agentName: 'java', - span: { - type: 'external', - subtype: 'http', - }, - resource: 'opbeans-node:3000', - outcome: 'failure', - responseTime: { - count: 1, - sum: 10, - }, - time: startTime, - }), - ...createServiceDependencyDocs({ + resource: 'opbeans-node:3000', + outcome: 'success', + responseTime: { + count: 2, + sum: 10, + }, + time: startTime, + to: { service: { - name: 'opbeans-java', - environment: 'production', - }, - agentName: 'java', - span: { - type: 'external', - subtype: 'http', - }, - resource: 'postgres', - outcome: 'success', - responseTime: { - count: 1, - sum: 3, + name: 'opbeans-node', }, - time: startTime, - }), - ...createServiceDependencyDocs({ + agentName: 'nodejs', + }, + }), + ...createServiceDependencyDocs({ + service: { + name: 'opbeans-java', + environment: 'production', + }, + agentName: 'java', + span: { + type: 'external', + subtype: 'http', + }, + resource: 'opbeans-node:3000', + outcome: 'failure', + responseTime: { + count: 1, + sum: 10, + }, + time: startTime, + }), + ...createServiceDependencyDocs({ + service: { + name: 'opbeans-java', + environment: 'production', + }, + agentName: 'java', + span: { + type: 'external', + subtype: 'http', + }, + resource: 'postgres', + outcome: 'success', + responseTime: { + count: 1, + sum: 3, + }, + time: startTime, + }), + ...createServiceDependencyDocs({ + service: { + name: 'opbeans-java', + environment: 'production', + }, + agentName: 'java', + span: { + type: 'external', + subtype: 'http', + }, + resource: 'opbeans-node-via-proxy', + outcome: 'success', + responseTime: { + count: 1, + sum: 1, + }, + time: endTime - 1, + to: { service: { - name: 'opbeans-java', - environment: 'production', - }, - agentName: 'java', - span: { - type: 'external', - subtype: 'http', - }, - resource: 'opbeans-node-via-proxy', - outcome: 'success', - responseTime: { - count: 1, - sum: 1, + name: 'opbeans-node', }, - time: endTime - 1, - to: { - service: { - name: 'opbeans-node', - }, - agentName: 'nodejs', - }, - }), - ]; - - const bulkActions = docs.reduce( - (prev, doc) => { - return [...prev, { index: { _index: indices[doc.processor.event] } }, doc]; + agentName: 'nodejs', }, - [] as Array< - | { - index: { - _index: string; - }; - } - | ValuesType - > - ); - - await es.bulk({ - body: bulkActions, - refresh: 'wait_for', - }); + }), + ]; + + const bulkActions = docs.reduce( + (prev, doc) => { + return [...prev, { index: { _index: indices[doc.processor.event] } }, doc]; + }, + [] as Array< + | { + index: { + _index: string; + }; + } + | ValuesType + > + ); + + await es.bulk({ + body: bulkActions, + refresh: 'wait_for', + }); - response = await apmApiClient.readUser({ - endpoint: `GET /internal/apm/services/{serviceName}/dependencies`, - params: { - path: { serviceName: 'opbeans-java' }, - query: { - start, - end, - numBuckets: 20, - environment: ENVIRONMENT_ALL.value, - }, + response = await apmApiClient.readUser({ + endpoint: `GET /internal/apm/services/{serviceName}/dependencies`, + params: { + path: { serviceName: 'opbeans-java' }, + query: { + start: new Date(start).toISOString(), + end: new Date(end).toISOString(), + numBuckets: 20, + environment: ENVIRONMENT_ALL.value, }, - }); + }, }); + }); - it('returns a 200', () => { - expect(response.status).to.be(200); - }); + it('returns a 200', () => { + expect(response.status).to.be(200); + }); - it('returns two dependencies', () => { - expect(response.body.serviceDependencies.length).to.be(2); - }); + it('returns two dependencies', () => { + expect(response.body.serviceDependencies.length).to.be(2); + }); - it('returns opbeans-node as a dependency', () => { - const opbeansNode = response.body.serviceDependencies.find( - (item) => getName(item.location) === 'opbeans-node' - ); - - expect(opbeansNode !== undefined).to.be(true); - - const values = { - latency: roundNumber(opbeansNode?.currentStats.latency.value), - throughput: roundNumber(opbeansNode?.currentStats.throughput.value), - errorRate: roundNumber(opbeansNode?.currentStats.errorRate.value), - impact: opbeansNode?.currentStats.impact, - ...pick(opbeansNode?.location, 'serviceName', 'type', 'agentName', 'environment'), - }; - - const count = 4; - const sum = 21; - const errors = 1; - - expect(values).to.eql({ - agentName: 'nodejs', - environment: ENVIRONMENT_NOT_DEFINED.value, - serviceName: 'opbeans-node', - type: 'service', - errorRate: roundNumber(errors / count), - latency: roundNumber(sum / count), - throughput: roundNumber(count / ((endTime - startTime) / 1000 / 60)), - impact: 100, - }); + it('returns opbeans-node as a dependency', () => { + const opbeansNode = response.body.serviceDependencies.find( + (item) => getName(item.location) === 'opbeans-node' + ); - const firstValue = roundNumber(opbeansNode?.currentStats.latency.timeseries[0].y); - const lastValue = roundNumber(last(opbeansNode?.currentStats.latency.timeseries)?.y); + expect(opbeansNode !== undefined).to.be(true); - expect(firstValue).to.be(roundNumber(20 / 3)); - expect(lastValue).to.be(1); + const values = { + latency: roundNumber(opbeansNode?.currentStats.latency.value), + throughput: roundNumber(opbeansNode?.currentStats.throughput.value), + errorRate: roundNumber(opbeansNode?.currentStats.errorRate.value), + impact: opbeansNode?.currentStats.impact, + ...pick(opbeansNode?.location, 'serviceName', 'type', 'agentName', 'environment'), + }; + + const count = 4; + const sum = 21; + const errors = 1; + + expect(values).to.eql({ + agentName: 'nodejs', + environment: ENVIRONMENT_NOT_DEFINED.value, + serviceName: 'opbeans-node', + type: 'service', + errorRate: roundNumber(errors / count), + latency: roundNumber(sum / count), + throughput: roundNumber(count / ((endTime - startTime) / 1000 / 60)), + impact: 100, }); - it('returns postgres as an external dependency', () => { - const postgres = response.body.serviceDependencies.find( - (item) => getName(item.location) === 'postgres' - ); - - expect(postgres !== undefined).to.be(true); - - const values = { - latency: roundNumber(postgres?.currentStats.latency.value), - throughput: roundNumber(postgres?.currentStats.throughput.value), - errorRate: roundNumber(postgres?.currentStats.errorRate.value), - impact: postgres?.currentStats.impact, - ...pick(postgres?.location, 'spanType', 'spanSubtype', 'dependencyName', 'type'), - }; - - const count = 1; - const sum = 3; - const errors = 0; - - expect(values).to.eql({ - spanType: 'external', - spanSubtype: 'http', - dependencyName: 'postgres', - type: 'dependency', - errorRate: roundNumber(errors / count), - latency: roundNumber(sum / count), - throughput: roundNumber(count / ((endTime - startTime) / 1000 / 60)), - impact: 0, - }); + const firstValue = roundNumber(opbeansNode?.currentStats.latency.timeseries[0].y); + const lastValue = roundNumber(last(opbeansNode?.currentStats.latency.timeseries)?.y); + + expect(firstValue).to.be(roundNumber(20 / 3)); + expect(lastValue).to.be(1); + }); + + it('returns postgres as an external dependency', () => { + const postgres = response.body.serviceDependencies.find( + (item) => getName(item.location) === 'postgres' + ); + + expect(postgres !== undefined).to.be(true); + + const values = { + latency: roundNumber(postgres?.currentStats.latency.value), + throughput: roundNumber(postgres?.currentStats.throughput.value), + errorRate: roundNumber(postgres?.currentStats.errorRate.value), + impact: postgres?.currentStats.impact, + ...pick(postgres?.location, 'spanType', 'spanSubtype', 'dependencyName', 'type'), + }; + + const count = 1; + const sum = 3; + const errors = 0; + + expect(values).to.eql({ + spanType: 'external', + spanSubtype: 'http', + dependencyName: 'postgres', + type: 'dependency', + errorRate: roundNumber(errors / count), + latency: roundNumber(sum / count), + throughput: roundNumber(count / ((endTime - startTime) / 1000 / 60)), + impact: 0, }); }); + }); - // UNSUPPORTED TEST CASES - when data is loaded - // TODO: These tests should be migrated to use synthtrace: https://github.com/elastic/kibana/issues/200743 + describe('when data is loaded', () => { + let apmSynthtraceEsClient: ApmSynthtraceEsClient; + + before(async () => { + apmSynthtraceEsClient = await synthtrace.createApmSynthtraceEsClient(); + await generateDependencyData({ apmSynthtraceEsClient, start, end }); + }); + after(() => apmSynthtraceEsClient.clean()); + + it('returns a list of dependencies for a service', async () => { + const { status, body } = await callApi(); + + expect(status).to.be(200); + expect( + body.serviceDependencies.map( + ({ location }) => (location as DependencyNode).dependencyName + ) + ).to.eql([dependencyName]); + + const currentStatsLatencyValues = + body.serviceDependencies[0].currentStats.latency.timeseries; + expect(currentStatsLatencyValues.every(({ y }) => y === 1000000)).to.be(true); + }); }); }); } diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/generate_data.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/generate_data.ts new file mode 100644 index 0000000000000..150a3ff00fde3 --- /dev/null +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/generate_data.ts @@ -0,0 +1,110 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { apm, timerange } from '@kbn/apm-synthtrace-client'; +import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace'; + +export const dataConfig = { + rate: 20, + transaction: { + name: 'GET /api/product/list', + duration: 1000, + }, + span: { + name: 'GET apm-*/_search', + type: 'db', + subType: 'elasticsearch', + destination: 'elasticsearch', + }, +} as const; + +export async function generateServiceData({ + apmSynthtraceEsClient, + start, + end, + name, + environment, + agentName, +}: { + apmSynthtraceEsClient: ApmSynthtraceEsClient; + start: number; + end: number; + name: string; + environment: string; + agentName: string; +}) { + const instance = apm.service({ name, environment, agentName }).instance('instance-a'); + const { rate, transaction, span } = dataConfig; + + await apmSynthtraceEsClient.index([ + timerange(start, end) + .interval('1m') + .rate(rate) + .generator((timestamp) => + instance + .transaction({ transactionName: transaction.name }) + .timestamp(timestamp) + .duration(transaction.duration) + .success() + .children( + instance + .span({ spanName: span.name, spanType: span.type, spanSubtype: span.subType }) + .duration(transaction.duration) + .success() + .destination(span.destination) + .timestamp(timestamp) + ) + ), + timerange(start, end) + .interval('1m') + .rate(rate) + .generator((timestamp) => + instance + .appMetrics({ + 'system.process.cpu.total.norm.pct': 0.5, + 'system.memory.total': 120000, + 'system.process.cgroup.memory.mem.usage.bytes': 50000, + }) + .timestamp(timestamp) + ), + ]); +} + +export async function generateDependencyData({ + apmSynthtraceEsClient, + start, + end, +}: { + apmSynthtraceEsClient: ApmSynthtraceEsClient; + start: number; + end: number; +}) { + const instance = apm + .service({ name: 'synth-go', environment: 'production', agentName: 'go' }) + .instance('instance-a'); + const { rate, transaction, span } = dataConfig; + + await apmSynthtraceEsClient.index( + timerange(start, end) + .interval('1m') + .rate(rate) + .generator((timestamp) => + instance + .transaction({ transactionName: transaction.name }) + .timestamp(timestamp) + .duration(transaction.duration) + .success() + .children( + instance + .span({ spanName: span.name, spanType: span.type, spanSubtype: span.subType }) + .duration(transaction.duration) + .success() + .destination(span.destination) + .timestamp(timestamp) + ) + ) + ); +} diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/instances_detailed_statistics.spec.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/instances_detailed_statistics.spec.ts index b2596ae43c956..7fd39b650b716 100644 --- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/instances_detailed_statistics.spec.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/service_overview/instances_detailed_statistics.spec.ts @@ -6,12 +6,19 @@ */ import expect from '@kbn/expect'; +import moment from 'moment'; +import type { Coordinate } from '@kbn/apm-plugin/typings/timeseries'; import { LatencyAggregationType } from '@kbn/apm-plugin/common/latency_aggregation_types'; +import { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace'; +import type { APIReturnType } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; +import { isFiniteNumber } from '@kbn/apm-plugin/common/utils/is_finite_number'; import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context'; import { getServiceNodeIds } from './get_service_node_ids'; +import { generateServiceData } from './generate_data'; export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) { const apmApiClient = getService('apmApi'); + const synthtrace = getService('synthtrace'); const serviceName = 'opbeans-java'; @@ -20,6 +27,11 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon end: '2021-08-03T07:20:15.910Z', }; + interface Response { + status: number; + body: APIReturnType<'GET /internal/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>; + } + describe('Service Overview', () => { describe('Instances detailed statistics', () => { describe('when data is not loaded', () => { @@ -49,8 +61,166 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon }); }); - // UNSUPPORTED TEST CASES - when data is loaded - // TODO: These tests should be migrated to use synthtrace: https://github.com/elastic/kibana/issues/200743 + describe('when data is loaded', () => { + let apmSynthtraceEsClient: ApmSynthtraceEsClient; + + before(async () => { + apmSynthtraceEsClient = await synthtrace.createApmSynthtraceEsClient(); + await generateServiceData({ + apmSynthtraceEsClient, + start: new Date(start).getTime(), + end: new Date(end).getTime(), + name: serviceName, + environment: 'ENVIRONMENT_ALL', + agentName: 'java', + }); + }); + + after(() => apmSynthtraceEsClient.clean()); + + describe('fetching data without comparison', () => { + let response: Response; + let serviceNodeIds: string[]; + + beforeEach(async () => { + serviceNodeIds = await getServiceNodeIds({ + apmApiClient, + start, + end, + }); + + response = await apmApiClient.readUser({ + endpoint: + 'GET /internal/apm/services/{serviceName}/service_overview_instances/detailed_statistics', + params: { + path: { serviceName }, + query: { + latencyAggregationType: LatencyAggregationType.avg, + start, + end, + numBuckets: 20, + transactionType: 'request', + serviceNodeIds: JSON.stringify(serviceNodeIds), + environment: 'ENVIRONMENT_ALL', + kuery: '', + }, + }, + }); + }); + + it('returns a service node item', () => { + expect(Object.values(response.body.currentPeriod).length).to.be.greaterThan(0); + expect(Object.values(response.body.previousPeriod)).to.eql(0); + }); + + it('returns statistics for each service node', () => { + const item = response.body.currentPeriod[serviceNodeIds[0]]; + + expect(item?.cpuUsage?.some((point) => isFiniteNumber(point.y))).to.be(true); + expect(item?.memoryUsage?.some((point) => isFiniteNumber(point.y))).to.be(true); + expect(item?.errorRate?.some((point) => isFiniteNumber(point.y))).to.be(true); + expect(item?.throughput?.some((point) => isFiniteNumber(point.y))).to.be(true); + expect(item?.latency?.some((point) => isFiniteNumber(point.y))).to.be(true); + }); + + it('returns the right data', () => { + expectSnapshot(Object.values(response.body.currentPeriod).length).toMatchInline(`1`); + + expectSnapshot(Object.keys(response.body.currentPeriod)).toMatchInline(` + Array [ + "instance-a", + ] + `); + + expectSnapshot(response.body).toMatch(); + }); + }); + + describe('fetching data with comparison', () => { + let response: Response; + let serviceNodeIds: string[]; + + beforeEach(async () => { + serviceNodeIds = await getServiceNodeIds({ + apmApiClient, + start, + end, + }); + response = await apmApiClient.readUser({ + endpoint: + 'GET /internal/apm/services/{serviceName}/service_overview_instances/detailed_statistics', + params: { + path: { serviceName }, + query: { + latencyAggregationType: LatencyAggregationType.avg, + numBuckets: 20, + transactionType: 'request', + serviceNodeIds: JSON.stringify(serviceNodeIds), + start: moment(end).subtract(15, 'minutes').toISOString(), + end, + offset: '15m', + environment: 'ENVIRONMENT_ALL', + kuery: '', + }, + }, + }); + }); + + it('returns a service node item for current and previous periods', () => { + expect(Object.values(response.body.currentPeriod).length).to.be.greaterThan(0); + expect(Object.values(response.body.previousPeriod).length).to.be.greaterThan(0); + }); + + it('returns statistics for current and previous periods', () => { + const currentPeriodItem = response.body.currentPeriod[serviceNodeIds[0]]; + + function hasValidYCoordinate(point: Coordinate) { + return isFiniteNumber(point.y); + } + + expect(currentPeriodItem?.cpuUsage?.some(hasValidYCoordinate)).to.be(true); + expect(currentPeriodItem?.memoryUsage?.some(hasValidYCoordinate)).to.be(true); + expect(currentPeriodItem?.errorRate?.some(hasValidYCoordinate)).to.be(true); + expect(currentPeriodItem?.throughput?.some(hasValidYCoordinate)).to.be(true); + expect(currentPeriodItem?.latency?.some(hasValidYCoordinate)).to.be(true); + + const previousPeriodItem = response.body.previousPeriod[serviceNodeIds[0]]; + + expect(previousPeriodItem?.cpuUsage?.some(hasValidYCoordinate)).to.be(true); + expect(previousPeriodItem?.memoryUsage?.some(hasValidYCoordinate)).to.be(true); + expect(previousPeriodItem?.errorRate?.some(hasValidYCoordinate)).to.be(true); + expect(previousPeriodItem?.throughput?.some(hasValidYCoordinate)).to.be(true); + expect(previousPeriodItem?.latency?.some(hasValidYCoordinate)).to.be(true); + }); + + it('returns the right data for current and previous periods', () => { + expectSnapshot(Object.values(response.body.currentPeriod).length).toMatchInline(`1`); + expectSnapshot(Object.values(response.body.previousPeriod).length).toMatchInline(`1`); + + expectSnapshot(Object.keys(response.body.currentPeriod)).toMatchInline(` + Array [ + "instance-a", + ] + `); + expectSnapshot(Object.keys(response.body.previousPeriod)).toMatchInline(` + Array [ + "instance-a", + ] + `); + + expectSnapshot(response.body).toMatch(); + }); + + it('matches x-axis on current period and previous period', () => { + const currentLatencyItems = response.body.currentPeriod[serviceNodeIds[0]]?.latency; + const previousLatencyItems = response.body.previousPeriod[serviceNodeIds[0]]?.latency; + + expect(currentLatencyItems?.map(({ x }) => x)).to.be.eql( + previousLatencyItems?.map(({ x }) => x) + ); + }); + }); + }); }); }); } diff --git a/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.spec.ts b/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.spec.ts deleted file mode 100644 index fd06ee9f95266..0000000000000 --- a/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.spec.ts +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; -import { omit, sortBy } from 'lodash'; -import { type Node, NodeType } from '@kbn/apm-plugin/common/connections'; -import { ENVIRONMENT_ALL } from '@kbn/apm-plugin/common/environment_filter_values'; -import type { APIReturnType } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; -import archives from '../../../common/fixtures/es_archiver/archives_metadata'; -import type { FtrProviderContext } from '../../../common/ftr_provider_context'; - -export default function ApiTest({ getService }: FtrProviderContext) { - const registry = getService('registry'); - const apmApiClient = getService('apmApiClient'); - - const archiveName = 'apm_8.0.0'; - const { start, end } = archives[archiveName]; - - function getName(node: Node) { - return node.type === NodeType.service ? node.serviceName : node.dependencyName; - } - - registry.when( - 'Service overview dependencies when data is loaded', - { config: 'basic', archives: [archiveName] }, - () => { - let response: { - status: number; - body: APIReturnType<'GET /internal/apm/services/{serviceName}/dependencies'>; - }; - - before(async () => { - response = await apmApiClient.readUser({ - endpoint: `GET /internal/apm/services/{serviceName}/dependencies`, - params: { - path: { serviceName: 'opbeans-python' }, - query: { - start, - end, - numBuckets: 20, - environment: ENVIRONMENT_ALL.value, - }, - }, - }); - }); - - it('returns a successful response', () => { - expect(response.status).to.be(200); - }); - - it('returns at least one item', () => { - expect(response.body.serviceDependencies.length).to.be.greaterThan(0); - - expectSnapshot(response.body.serviceDependencies.length).toMatchInline(`4`); - - const { currentStats, ...firstItem } = sortBy( - response.body.serviceDependencies, - 'currentStats.impact' - ).reverse()[0]; - - expectSnapshot(firstItem.location).toMatchInline(` - Object { - "agentName": "dotnet", - "dependencyName": "opbeans:3000", - "environment": "production", - "id": "5948c153c2d8989f92a9c75ef45bb845f53e200d", - "serviceName": "opbeans-dotnet", - "type": "service", - } - `); - - expectSnapshot( - omit(currentStats, [ - 'errorRate.timeseries', - 'throughput.timeseries', - 'latency.timeseries', - 'totalTime.timeseries', - ]) - ).toMatchInline(` - Object { - "errorRate": Object { - "value": 0.163636363636364, - }, - "impact": 100, - "latency": Object { - "value": 1117085.74545455, - }, - "throughput": Object { - "value": 1.83333333333333, - }, - "totalTime": Object { - "value": 61439716, - }, - } - `); - }); - - it('returns the right names', () => { - const names = response.body.serviceDependencies.map((item) => getName(item.location)); - expectSnapshot(names.sort()).toMatchInline(` - Array [ - "elasticsearch", - "opbeans-dotnet", - "postgresql", - "redis", - ] - `); - }); - - it('returns the right service names', () => { - const serviceNames = response.body.serviceDependencies - .map((item) => - item.location.type === NodeType.service ? getName(item.location) : undefined - ) - .filter(Boolean); - - expectSnapshot(serviceNames.sort()).toMatchInline(` - Array [ - "opbeans-dotnet", - ] - `); - }); - - it('returns the right latency values', () => { - const latencyValues = sortBy( - response.body.serviceDependencies.map((item) => ({ - name: getName(item.location), - latency: item.currentStats.latency.value, - })), - 'name' - ); - - expectSnapshot(latencyValues).toMatchInline(` - Array [ - Object { - "latency": 9496.32291666667, - "name": "elasticsearch", - }, - Object { - "latency": 1117085.74545455, - "name": "opbeans-dotnet", - }, - Object { - "latency": 27826.9968314322, - "name": "postgresql", - }, - Object { - "latency": 1468.27242524917, - "name": "redis", - }, - ] - `); - }); - - it('returns the right throughput values', () => { - const throughputValues = sortBy( - response.body.serviceDependencies.map((item) => ({ - name: getName(item.location), - throughput: item.currentStats.throughput.value, - })), - 'name' - ); - - expectSnapshot(throughputValues).toMatchInline(` - Array [ - Object { - "name": "elasticsearch", - "throughput": 3.2, - }, - Object { - "name": "opbeans-dotnet", - "throughput": 1.83333333333333, - }, - Object { - "name": "postgresql", - "throughput": 52.6, - }, - Object { - "name": "redis", - "throughput": 40.1333333333333, - }, - ] - `); - }); - - it('returns the right impact values', () => { - const impactValues = sortBy( - response.body.serviceDependencies.map((item) => ({ - name: getName(item.location), - impact: item.currentStats.impact, - })), - 'name' - ); - - expectSnapshot(impactValues).toMatchInline(` - Array [ - Object { - "impact": 0, - "name": "elasticsearch", - }, - Object { - "impact": 100, - "name": "opbeans-dotnet", - }, - Object { - "impact": 71.0403531954737, - "name": "postgresql", - }, - Object { - "impact": 1.41447268043525, - "name": "redis", - }, - ] - `); - }); - - it('returns the right totalTime values', () => { - const totalTimeValues = sortBy( - response.body.serviceDependencies.map((item) => ({ - name: getName(item.location), - totalTime: item.currentStats.totalTime.value, - })), - 'name' - ); - - expectSnapshot(totalTimeValues).toMatchInline(` - Array [ - Object { - "name": "elasticsearch", - "totalTime": 911647, - }, - Object { - "name": "opbeans-dotnet", - "totalTime": 61439716, - }, - Object { - "name": "postgresql", - "totalTime": 43911001, - }, - Object { - "name": "redis", - "totalTime": 1767800, - }, - ] - `); - }); - } - ); -} diff --git a/x-pack/test/apm_api_integration/tests/service_overview/get_service_node_ids.ts b/x-pack/test/apm_api_integration/tests/service_overview/get_service_node_ids.ts deleted file mode 100644 index 751f772fb7507..0000000000000 --- a/x-pack/test/apm_api_integration/tests/service_overview/get_service_node_ids.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { take } from 'lodash'; -import { LatencyAggregationType } from '@kbn/apm-plugin/common/latency_aggregation_types'; -import type { ApmServices } from '../../common/config'; - -export async function getServiceNodeIds({ - apmApiClient, - start, - end, - serviceName = 'opbeans-java', - count = 1, -}: { - apmApiClient: Awaited>; - start: string; - end: string; - serviceName?: string; - count?: number; -}) { - const { body } = await apmApiClient.readUser({ - endpoint: `GET /internal/apm/services/{serviceName}/service_overview_instances/main_statistics`, - params: { - path: { serviceName }, - query: { - latencyAggregationType: LatencyAggregationType.avg, - start, - end, - transactionType: 'request', - environment: 'ENVIRONMENT_ALL', - kuery: '', - sortField: 'throughput', - sortDirection: 'desc', - }, - }, - }); - - return take(body.currentPeriod.map((item) => item.serviceNodeName).sort(), count); -} diff --git a/x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.spec.ts b/x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.spec.ts deleted file mode 100644 index af28697a254c2..0000000000000 --- a/x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.spec.ts +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; -import moment from 'moment'; -import type { Coordinate } from '@kbn/apm-plugin/typings/timeseries'; -import { LatencyAggregationType } from '@kbn/apm-plugin/common/latency_aggregation_types'; -import { isFiniteNumber } from '@kbn/apm-plugin/common/utils/is_finite_number'; -import type { APIReturnType } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; -import type { FtrProviderContext } from '../../common/ftr_provider_context'; -import archives from '../../common/fixtures/es_archiver/archives_metadata'; -import { getServiceNodeIds } from './get_service_node_ids'; - -export default function ApiTest({ getService }: FtrProviderContext) { - const registry = getService('registry'); - const apmApiClient = getService('apmApiClient'); - - const serviceName = 'opbeans-java'; - const archiveName = 'apm_8.0.0'; - const { start, end } = archives[archiveName]; - - interface Response { - status: number; - body: APIReturnType<'GET /internal/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>; - } - - registry.when( - 'Service overview instances detailed statistics when data is loaded', - { config: 'basic', archives: [archiveName] }, - () => { - describe('fetching data without comparison', () => { - let response: Response; - let serviceNodeIds: string[]; - - beforeEach(async () => { - serviceNodeIds = await getServiceNodeIds({ - apmApiClient, - start, - end, - }); - - response = await apmApiClient.readUser({ - endpoint: - 'GET /internal/apm/services/{serviceName}/service_overview_instances/detailed_statistics', - params: { - path: { serviceName }, - query: { - latencyAggregationType: LatencyAggregationType.avg, - start, - end, - numBuckets: 20, - transactionType: 'request', - serviceNodeIds: JSON.stringify(serviceNodeIds), - environment: 'ENVIRONMENT_ALL', - kuery: '', - }, - }, - }); - }); - - it('returns a service node item', () => { - expect(Object.values(response.body.currentPeriod).length).to.be.greaterThan(0); - expect(Object.values(response.body.previousPeriod)).to.eql(0); - }); - - it('returns statistics for each service node', async () => { - const item = response.body.currentPeriod[serviceNodeIds[0]]; - - expect(item?.cpuUsage?.some((point) => isFiniteNumber(point.y))).to.be(true); - expect(item?.memoryUsage?.some((point) => isFiniteNumber(point.y))).to.be(true); - expect(item?.errorRate?.some((point) => isFiniteNumber(point.y))).to.be(true); - expect(item?.throughput?.some((point) => isFiniteNumber(point.y))).to.be(true); - expect(item?.latency?.some((point) => isFiniteNumber(point.y))).to.be(true); - }); - - it('returns the right data', () => { - expectSnapshot(Object.values(response.body.currentPeriod).length).toMatchInline(`1`); - - expectSnapshot(Object.keys(response.body.currentPeriod)).toMatchInline(` - Array [ - "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", - ] - `); - - expectSnapshot(response.body).toMatch(); - }); - }); - - describe('fetching data with comparison', () => { - let response: Response; - let serviceNodeIds: string[]; - - beforeEach(async () => { - serviceNodeIds = await getServiceNodeIds({ - apmApiClient, - start, - end, - }); - response = await apmApiClient.readUser({ - endpoint: - 'GET /internal/apm/services/{serviceName}/service_overview_instances/detailed_statistics', - params: { - path: { serviceName }, - query: { - latencyAggregationType: LatencyAggregationType.avg, - numBuckets: 20, - transactionType: 'request', - serviceNodeIds: JSON.stringify(serviceNodeIds), - start: moment(end).subtract(15, 'minutes').toISOString(), - end, - offset: '15m', - environment: 'ENVIRONMENT_ALL', - kuery: '', - }, - }, - }); - }); - - it('returns a service node item for current and previous periods', () => { - expect(Object.values(response.body.currentPeriod).length).to.be.greaterThan(0); - expect(Object.values(response.body.previousPeriod).length).to.be.greaterThan(0); - }); - - it('returns statistics for current and previous periods', () => { - const currentPeriodItem = response.body.currentPeriod[serviceNodeIds[0]]; - - function hasValidYCoordinate(point: Coordinate) { - return isFiniteNumber(point.y); - } - - expect(currentPeriodItem?.cpuUsage?.some(hasValidYCoordinate)).to.be(true); - expect(currentPeriodItem?.memoryUsage?.some(hasValidYCoordinate)).to.be(true); - expect(currentPeriodItem?.errorRate?.some(hasValidYCoordinate)).to.be(true); - expect(currentPeriodItem?.throughput?.some(hasValidYCoordinate)).to.be(true); - expect(currentPeriodItem?.latency?.some(hasValidYCoordinate)).to.be(true); - - const previousPeriodItem = response.body.previousPeriod[serviceNodeIds[0]]; - - expect(previousPeriodItem?.cpuUsage?.some(hasValidYCoordinate)).to.be(true); - expect(previousPeriodItem?.memoryUsage?.some(hasValidYCoordinate)).to.be(true); - expect(previousPeriodItem?.errorRate?.some(hasValidYCoordinate)).to.be(true); - expect(previousPeriodItem?.throughput?.some(hasValidYCoordinate)).to.be(true); - expect(previousPeriodItem?.latency?.some(hasValidYCoordinate)).to.be(true); - }); - - it('returns the right data for current and previous periods', () => { - expectSnapshot(Object.values(response.body.currentPeriod).length).toMatchInline(`1`); - expectSnapshot(Object.values(response.body.previousPeriod).length).toMatchInline(`1`); - - expectSnapshot(Object.keys(response.body.currentPeriod)).toMatchInline(` - Array [ - "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", - ] - `); - expectSnapshot(Object.keys(response.body.previousPeriod)).toMatchInline(` - Array [ - "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", - ] - `); - - expectSnapshot(response.body).toMatch(); - }); - - it('matches x-axis on current period and previous period', () => { - const currentLatencyItems = response.body.currentPeriod[serviceNodeIds[0]]?.latency; - const previousLatencyItems = response.body.previousPeriod[serviceNodeIds[0]]?.latency; - - expect(currentLatencyItems?.map(({ x }) => x)).to.be.eql( - previousLatencyItems?.map(({ x }) => x) - ); - }); - }); - } - ); -} From 083dc2d09595d26782aad0230dee5ff1ce058667 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 25 Nov 2024 11:37:47 +0100 Subject: [PATCH 05/71] ironbank: leftover for updating ironbank to `9.5` (#201325) --- .../templates/ironbank/hardening_manifest.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dev/build/tasks/os_packages/docker_generator/templates/ironbank/hardening_manifest.yaml b/src/dev/build/tasks/os_packages/docker_generator/templates/ironbank/hardening_manifest.yaml index d1d76367b4ec3..7d063b49151bd 100644 --- a/src/dev/build/tasks/os_packages/docker_generator/templates/ironbank/hardening_manifest.yaml +++ b/src/dev/build/tasks/os_packages/docker_generator/templates/ironbank/hardening_manifest.yaml @@ -11,7 +11,7 @@ tags: # Build args passed to Dockerfile ARGs args: BASE_IMAGE: 'redhat/ubi/ubi9' - BASE_TAG: "9.4" + BASE_TAG: "9.5" # Docker image labels labels: org.opencontainers.image.title: 'kibana' @@ -85,4 +85,4 @@ maintainers: - email: 'klepal_alexander@bah.com' name: 'Alexander Klepal' username: 'alexander.klepal' - cht_member: true \ No newline at end of file + cht_member: true From 1f0f8d2c529e7b4ed9803b51bcb58e3809c418dc Mon Sep 17 00:00:00 2001 From: "Eyo O. Eyo" <7893459+eokoneyo@users.noreply.github.com> Date: Mon, 25 Nov 2024 11:49:51 +0100 Subject: [PATCH 06/71] [React18] Migrate test suites to account for testing library upgrades obs-ux-logs-team (#201148) This PR migrates test suites that use `renderHook` from the library `@testing-library/react-hooks` to adopt the equivalent and replacement of `renderHook` from the export that is now available from `@testing-library/react`. This work is required for the planned migration to react18. ## Context In this PR, usages of `waitForNextUpdate` that previously could have been destructured from `renderHook` are now been replaced with `waitFor` exported from `@testing-library/react`, furthermore `waitFor` that would also have been destructured from the same renderHook result is now been replaced with `waitFor` from the export of `@testing-library/react`. ***Why is `waitFor` a sufficient enough replacement for `waitForNextUpdate`, and better for testing values subject to async computations?*** WaitFor will retry the provided callback if an error is returned, till the configured timeout elapses. By default the retry interval is `50ms` with a timeout value of `1000ms` that effectively translates to at least 20 retries for assertions placed within waitFor. See https://testing-library.com/docs/dom-testing-library/api-async/#waitfor for more information. This however means that for person's writing tests, said person has to be explicit about expectations that describe the internal state of the hook being tested. This implies checking for instance when a react query hook is being rendered, there's an assertion that said hook isn't loading anymore. In this PR you'd notice that this pattern has been adopted, with most existing assertions following an invocation of `waitForNextUpdate` being placed within a `waitFor` invocation. In some cases the replacement is simply a `waitFor(() => new Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for point out exactly why this works), where this suffices the assertions that follow aren't placed within a waitFor so this PR doesn't get larger than it needs to be. It's also worth pointing out this PR might also contain changes to test and application code to improve said existing test. ### What to do next? 1. Review the changes in this PR. 2. If you think the changes are correct, approve the PR. ## Any questions? If you have any questions or need help with this PR, please leave comments in this PR. Co-authored-by: Elastic Machine --- .../src/use_boolean/use_boolean.test.ts | 2 +- .../use_fields_metadata.test.ts | 18 ++++++-------- .../logs/log_summary/log_summary.test.tsx | 24 +++++++++---------- .../use_data_search_request.test.tsx | 2 +- ...test_partial_data_search_response.test.tsx | 2 +- 5 files changed, 22 insertions(+), 26 deletions(-) diff --git a/packages/kbn-react-hooks/src/use_boolean/use_boolean.test.ts b/packages/kbn-react-hooks/src/use_boolean/use_boolean.test.ts index 8d5583e926bac..9711d54823d35 100644 --- a/packages/kbn-react-hooks/src/use_boolean/use_boolean.test.ts +++ b/packages/kbn-react-hooks/src/use_boolean/use_boolean.test.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { act, cleanup, renderHook } from '@testing-library/react-hooks'; +import { renderHook, act, cleanup } from '@testing-library/react'; import { useBoolean } from './use_boolean'; diff --git a/x-pack/plugins/fields_metadata/public/hooks/use_fields_metadata/use_fields_metadata.test.ts b/x-pack/plugins/fields_metadata/public/hooks/use_fields_metadata/use_fields_metadata.test.ts index eaae7c5542c0b..8f69c11a10432 100644 --- a/x-pack/plugins/fields_metadata/public/hooks/use_fields_metadata/use_fields_metadata.test.ts +++ b/x-pack/plugins/fields_metadata/public/hooks/use_fields_metadata/use_fields_metadata.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { waitFor, renderHook } from '@testing-library/react'; import { createUseFieldsMetadataHook, UseFieldsMetadataParams } from './use_fields_metadata'; import { FindFieldsMetadataResponsePayload } from '../../../common/latest'; @@ -46,12 +46,12 @@ describe('useFieldsMetadata', () => { it('should return the fieldsMetadata value from the API', async () => { fieldsMetadataClient.find.mockResolvedValue(mockedFieldsMetadataResponse); - const { result, waitForNextUpdate } = renderHook(() => useFieldsMetadata()); + const { result } = renderHook(() => useFieldsMetadata()); expect(result.current.loading).toBe(true); expect(result.current.fieldsMetadata).toEqual(undefined); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); const { fieldsMetadata, loading, error } = result.current; expect(fieldsMetadata).toEqual(fields); @@ -68,21 +68,17 @@ describe('useFieldsMetadata', () => { dataset: 'dataset_name', }; - const { waitForNextUpdate } = renderHook(() => useFieldsMetadata(params)); + renderHook(() => useFieldsMetadata(params)); - await waitForNextUpdate(); - - expect(fieldsMetadataClient.find).toHaveBeenCalledWith(params); + await waitFor(() => expect(fieldsMetadataClient.find).toHaveBeenCalledWith(params)); }); it('should return an error if the API call fails', async () => { const error = new Error('Fetch fields metadata Failed'); fieldsMetadataClient.find.mockRejectedValueOnce(error); - const { result, waitForNextUpdate } = renderHook(() => useFieldsMetadata()); - - await waitForNextUpdate(); + const { result } = renderHook(() => useFieldsMetadata()); - expect(result.current.error?.message).toMatch(error.message); + await waitFor(() => expect(result.current.error?.message).toMatch(error.message)); }); }); diff --git a/x-pack/plugins/observability_solution/logs_shared/public/containers/logs/log_summary/log_summary.test.tsx b/x-pack/plugins/observability_solution/logs_shared/public/containers/logs/log_summary/log_summary.test.tsx index 183950edf9777..8635df14731a5 100644 --- a/x-pack/plugins/observability_solution/logs_shared/public/containers/logs/log_summary/log_summary.test.tsx +++ b/x-pack/plugins/observability_solution/logs_shared/public/containers/logs/log_summary/log_summary.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { waitFor, renderHook } from '@testing-library/react'; // We are using this inside a `jest.mock` call. Jest requires dynamic dependencies to be prefixed with `mock` import { coreMock as mockCoreMock } from '@kbn/core/public/mocks'; @@ -56,14 +56,14 @@ describe('useLogSummary hook', () => { .mockResolvedValueOnce(firstMockResponse) .mockResolvedValueOnce(secondMockResponse); - const { result, waitForNextUpdate, rerender } = renderHook( + const { result, rerender } = renderHook( ({ logViewReference }) => useLogSummary(logViewReference, startTimestamp, endTimestamp, null), { initialProps: { logViewReference: LOG_VIEW_REFERENCE }, } ); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(fetchLogSummaryMock).toHaveBeenCalledTimes(1); expect(fetchLogSummaryMock).toHaveBeenLastCalledWith( @@ -75,7 +75,7 @@ describe('useLogSummary hook', () => { expect(result.current.buckets).toEqual(firstMockResponse.data.buckets); rerender({ logViewReference: CHANGED_LOG_VIEW_REFERENCE }); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(fetchLogSummaryMock).toHaveBeenCalledTimes(2); expect(fetchLogSummaryMock).toHaveBeenLastCalledWith( @@ -101,7 +101,7 @@ describe('useLogSummary hook', () => { .mockResolvedValueOnce(firstMockResponse) .mockResolvedValueOnce(secondMockResponse); - const { result, waitForNextUpdate, rerender } = renderHook( + const { result, rerender } = renderHook( ({ filterQuery }) => useLogSummary(LOG_VIEW_REFERENCE, startTimestamp, endTimestamp, filterQuery), { @@ -109,7 +109,7 @@ describe('useLogSummary hook', () => { } ); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(fetchLogSummaryMock).toHaveBeenCalledTimes(1); expect(fetchLogSummaryMock).toHaveBeenLastCalledWith( @@ -121,7 +121,7 @@ describe('useLogSummary hook', () => { expect(result.current.buckets).toEqual(firstMockResponse.data.buckets); rerender({ filterQuery: 'CHANGED_FILTER_QUERY' }); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(fetchLogSummaryMock).toHaveBeenCalledTimes(2); expect(fetchLogSummaryMock).toHaveBeenLastCalledWith( @@ -139,7 +139,7 @@ describe('useLogSummary hook', () => { .mockResolvedValueOnce(createMockResponse([])); const firstRange = createMockDateRange(); - const { waitForNextUpdate, rerender } = renderHook( + const { rerender } = renderHook( ({ startTimestamp, endTimestamp }) => useLogSummary(LOG_VIEW_REFERENCE, startTimestamp, endTimestamp, null), { @@ -147,7 +147,7 @@ describe('useLogSummary hook', () => { } ); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(fetchLogSummaryMock).toHaveBeenCalledTimes(1); expect(fetchLogSummaryMock).toHaveBeenLastCalledWith( expect.objectContaining({ @@ -160,7 +160,7 @@ describe('useLogSummary hook', () => { const secondRange = createMockDateRange('now-20s', 'now'); rerender(secondRange); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(fetchLogSummaryMock).toHaveBeenCalledTimes(2); expect(fetchLogSummaryMock).toHaveBeenLastCalledWith( @@ -176,7 +176,7 @@ describe('useLogSummary hook', () => { fetchLogSummaryMock.mockResolvedValueOnce(createMockResponse([])); const firstRange = createMockDateRange(); - const { waitForNextUpdate, rerender } = renderHook( + const { rerender } = renderHook( ({ startTimestamp, endTimestamp }) => useLogSummary(LOG_VIEW_REFERENCE, startTimestamp, endTimestamp, null), { @@ -188,7 +188,7 @@ describe('useLogSummary hook', () => { // intentionally don't wait for an update to test the throttling rerender(secondRange); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(fetchLogSummaryMock).toHaveBeenCalledTimes(1); expect(fetchLogSummaryMock).toHaveBeenLastCalledWith( diff --git a/x-pack/plugins/observability_solution/logs_shared/public/utils/data_search/use_data_search_request.test.tsx b/x-pack/plugins/observability_solution/logs_shared/public/utils/data_search/use_data_search_request.test.tsx index 33369c1125e15..08907b1627086 100644 --- a/x-pack/plugins/observability_solution/logs_shared/public/utils/data_search/use_data_search_request.test.tsx +++ b/x-pack/plugins/observability_solution/logs_shared/public/utils/data_search/use_data_search_request.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { act, renderHook } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import React from 'react'; import { firstValueFrom, Observable, of, Subject } from 'rxjs'; import type { ISearchGeneric, IKibanaSearchResponse } from '@kbn/search-types'; diff --git a/x-pack/plugins/observability_solution/logs_shared/public/utils/data_search/use_latest_partial_data_search_response.test.tsx b/x-pack/plugins/observability_solution/logs_shared/public/utils/data_search/use_latest_partial_data_search_response.test.tsx index a4b01be03d80b..24433f23bc677 100644 --- a/x-pack/plugins/observability_solution/logs_shared/public/utils/data_search/use_latest_partial_data_search_response.test.tsx +++ b/x-pack/plugins/observability_solution/logs_shared/public/utils/data_search/use_latest_partial_data_search_response.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { act, renderHook } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { BehaviorSubject, Observable, of, Subject } from 'rxjs'; import { IKibanaSearchRequest } from '@kbn/search-types'; import { ParsedDataSearchRequestDescriptor, ParsedKibanaSearchResponse } from './types'; From 1c3bceacc06f5f8a01a2ffde2ec24f114717b396 Mon Sep 17 00:00:00 2001 From: Kevin Qualters <56408403+kqualters-elastic@users.noreply.github.com> Date: Mon, 25 Nov 2024 06:12:43 -0500 Subject: [PATCH 07/71] [Cases] Fix an issue with the reopen case permission, add integration tests for failing case (#201517) ## Summary Currently, the partitionPatchRequest in x-pack/plugins/cases/server/client/cases/bulk_update.ts will not check a case properly if a case is being re-opened, instead of an else if in the loop comparing cases to cases in the request, the status logic should be outside of this set of if statements. If a case is being re-opened, the final else is never run, and casesToAuthorize is 0. This results in ensureAuthorized being called with an empty array of entities, and so the check always succeeds. To fix this, reopenedCases is still populated in the same loop, just not when casesToAuthorize logic is running as well. Also adds some missing tests for this and the create comment permission as requested in https://github.com/elastic/kibana/pull/194898. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --- .../server/client/cases/bulk_update.test.ts | 91 ++++++---- .../cases/server/client/cases/bulk_update.ts | 1 + .../apis/cases/common/roles.ts | 156 ++++++++++++++++++ .../apis/cases/common/users.ts | 48 ++++++ .../api_integration/apis/cases/privileges.ts | 65 ++++++++ 5 files changed, 328 insertions(+), 33 deletions(-) diff --git a/x-pack/plugins/cases/server/client/cases/bulk_update.test.ts b/x-pack/plugins/cases/server/client/cases/bulk_update.test.ts index 755084d624b9f..5cdd4c943b944 100644 --- a/x-pack/plugins/cases/server/client/cases/bulk_update.test.ts +++ b/x-pack/plugins/cases/server/client/cases/bulk_update.test.ts @@ -1512,6 +1512,59 @@ describe('update', () => { ); }); + it('throws an error if the case is not found', async () => { + clientArgsMock.services.caseService.getCases.mockResolvedValue({ saved_objects: [] }); + + await expect( + bulkUpdate( + { + cases: [ + { + id: mockCases[0].id, + version: mockCases[0].version ?? '', + status: CaseStatuses.open, + }, + ], + }, + clientArgsMock, + casesClientMock + ) + ).rejects.toThrow( + 'Failed to update case, ids: [{"id":"mock-id-1","version":"WzAsMV0="}]: Error: These cases mock-id-1 do not exist. Please check you have the correct ids.' + ); + }); + + it('throws an error if the case is not found and the SO clients returns an SO object', async () => { + clientArgsMock.services.caseService.getCases.mockResolvedValue({ + saved_objects: [ + { + type: 'cases', + id: 'mock-id-1', + references: [], + error: { error: 'Non found', message: 'Non found', statusCode: 404 }, + }, + ], + }); + + await expect( + bulkUpdate( + { + cases: [ + { + id: mockCases[0].id, + version: mockCases[0].version ?? '', + status: CaseStatuses.open, + }, + ], + }, + clientArgsMock, + casesClientMock + ) + ).rejects.toThrow( + 'Failed to update case, ids: [{"id":"mock-id-1","version":"WzAsMV0="}]: Error: These cases mock-id-1 do not exist. Please check you have the correct ids.' + ); + }); + describe('Validate max user actions per page', () => { beforeEach(() => { jest.clearAllMocks(); @@ -1681,6 +1734,7 @@ describe('update', () => { status: CaseStatuses.closed, }, }; + clientArgs.services.caseService.getCases.mockResolvedValue({ saved_objects: [closedCase] }); clientArgs.services.caseService.patchCases.mockResolvedValue({ @@ -1701,7 +1755,10 @@ describe('update', () => { casesClientMock ); - expect(clientArgs.authorization.ensureAuthorized).not.toThrow(); + expect(clientArgs.authorization.ensureAuthorized).toHaveBeenCalledWith({ + entities: [{ id: closedCase.id, owner: closedCase.attributes.owner }], + operation: [Operations.reopenCase, Operations.updateCase], + }); }); it('throws when user is not authorized to update case', async () => { @@ -1726,38 +1783,6 @@ describe('update', () => { `"Failed to update case, ids: [{\\"id\\":\\"mock-id-1\\",\\"version\\":\\"WzAsMV0=\\"}]: Error: Unauthorized"` ); }); - - it('throws when user is not authorized to reopen case', async () => { - const closedCase = { - ...mockCases[0], - attributes: { - ...mockCases[0].attributes, - status: CaseStatuses.closed, - }, - }; - clientArgs.services.caseService.getCases.mockResolvedValue({ saved_objects: [closedCase] }); - - const error = new Error('Unauthorized to reopen case'); - clientArgs.authorization.ensureAuthorized.mockRejectedValueOnce(error); // Reject reopenCase - - await expect( - bulkUpdate( - { - cases: [ - { - id: closedCase.id, - version: closedCase.version ?? '', - status: CaseStatuses.open, - }, - ], - }, - clientArgs, - casesClientMock - ) - ).rejects.toThrowErrorMatchingInlineSnapshot( - `"Failed to update case, ids: [{\\"id\\":\\"mock-id-1\\",\\"version\\":\\"WzAsMV0=\\"}]: Error: Unauthorized to reopen case"` - ); - }); }); }); }); diff --git a/x-pack/plugins/cases/server/client/cases/bulk_update.ts b/x-pack/plugins/cases/server/client/cases/bulk_update.ts index 9a90168b858de..1f9dd5a7cb28c 100644 --- a/x-pack/plugins/cases/server/client/cases/bulk_update.ts +++ b/x-pack/plugins/cases/server/client/cases/bulk_update.ts @@ -295,6 +295,7 @@ function partitionPatchRequest( ) { // Track cases that are closed and a user is attempting to reopen reopenedCases.push(reqCase); + casesToAuthorize.set(foundCase.id, { id: foundCase.id, owner: foundCase.attributes.owner }); } else { casesToAuthorize.set(foundCase.id, { id: foundCase.id, owner: foundCase.attributes.owner }); } diff --git a/x-pack/test/api_integration/apis/cases/common/roles.ts b/x-pack/test/api_integration/apis/cases/common/roles.ts index 21ad6943ba0df..c50076b301f7c 100644 --- a/x-pack/test/api_integration/apis/cases/common/roles.ts +++ b/x-pack/test/api_integration/apis/cases/common/roles.ts @@ -136,6 +136,56 @@ export const secCasesV2All: Role = { }, }; +export const secCasesV2NoReopenWithCreateComment: Role = { + name: 'sec_cases_v2_no_reopen_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCasesV2: ['read', 'update', 'create', 'delete', 'create_comment'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secCasesV2NoCreateCommentWithReopen: Role = { + name: 'sec_cases_v2_create_comment_no_reopen_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCasesV2: ['read', 'update', 'create', 'delete', 'case_reopen'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + export const secAllSpace1: Role = { name: 'sec_all_role_space1_api_int', privileges: { @@ -434,6 +484,56 @@ export const casesV2All: Role = { }, }; +export const casesV2NoReopenWithCreateComment: Role = { + name: 'cases_v2_no_reopen_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + generalCasesV2: ['read', 'update', 'create', 'delete', 'create_comment'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const casesV2NoCreateCommentWithReopen: Role = { + name: 'cases_v2_no_create_comment_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + generalCasesV2: ['read', 'update', 'create', 'delete', 'case_reopen'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + export const casesRead: Role = { name: 'cases_read_role_api_int', privileges: { @@ -583,6 +683,56 @@ export const obsCasesV2All: Role = { }, }; +export const obsCasesV2NoReopenWithCreateComment: Role = { + name: 'obs_cases_v2_no_reopen_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + observabilityCasesV2: ['read', 'update', 'create', 'delete', 'create_comment'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const obsCasesV2NoCreateCommentWithReopen: Role = { + name: 'obs_cases_v2_no_create_comment_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + observabilityCasesV2: ['read', 'update', 'create', 'delete', 'case_reopen'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + export const obsCasesRead: Role = { name: 'obs_cases_read_role_api_int', privileges: { @@ -613,6 +763,8 @@ export const roles = [ secAllCasesNoDelete, secAll, secCasesV2All, + secCasesV2NoReopenWithCreateComment, + secCasesV2NoCreateCommentWithReopen, secAllSpace1, secAllCasesRead, secAllCasesNone, @@ -625,11 +777,15 @@ export const roles = [ casesNoDelete, casesAll, casesV2All, + casesV2NoReopenWithCreateComment, + casesV2NoCreateCommentWithReopen, casesRead, obsCasesOnlyDelete, obsCasesOnlyReadDelete, obsCasesNoDelete, obsCasesAll, obsCasesV2All, + obsCasesV2NoReopenWithCreateComment, + obsCasesV2NoCreateCommentWithReopen, obsCasesRead, ]; diff --git a/x-pack/test/api_integration/apis/cases/common/users.ts b/x-pack/test/api_integration/apis/cases/common/users.ts index a64b9767498fb..d3b05c5d3ddf6 100644 --- a/x-pack/test/api_integration/apis/cases/common/users.ts +++ b/x-pack/test/api_integration/apis/cases/common/users.ts @@ -31,6 +31,12 @@ import { secReadCasesAll, secReadCasesNone, secReadCasesRead, + casesV2NoReopenWithCreateComment, + obsCasesV2NoReopenWithCreateComment, + secCasesV2NoReopenWithCreateComment, + secCasesV2NoCreateCommentWithReopen, + casesV2NoCreateCommentWithReopen, + obsCasesV2NoCreateCommentWithReopen, } from './roles'; /** @@ -67,6 +73,18 @@ export const secCasesV2AllUser: User = { roles: [secCasesV2All.name], }; +export const secCasesV2NoReopenWithCreateCommentUser: User = { + username: 'sec_cases_v2_no_reopen_with_create_comment_user_api_int', + password: 'password', + roles: [secCasesV2NoReopenWithCreateComment.name], +}; + +export const secCasesV2NoCreateCommentWithReopenUser: User = { + username: 'sec_cases_v2_no_create_comment_with_reopen_user_api_int', + password: 'password', + roles: [secCasesV2NoCreateCommentWithReopen.name], +}; + export const secAllSpace1User: User = { username: 'sec_all_space1_user_api_int', password: 'password', @@ -143,6 +161,18 @@ export const casesV2AllUser: User = { roles: [casesV2All.name], }; +export const casesV2NoReopenWithCreateCommentUser: User = { + username: 'cases_v2_no_reopen_with_create_comment_user_api_int', + password: 'password', + roles: [casesV2NoReopenWithCreateComment.name], +}; + +export const casesV2NoCreateCommentWithReopenUser: User = { + username: 'cases_v2_no_create_comment_with_reopen_user_api_int', + password: 'password', + roles: [casesV2NoCreateCommentWithReopen.name], +}; + export const casesReadUser: User = { username: 'cases_read_user_api_int', password: 'password', @@ -183,6 +213,18 @@ export const obsCasesV2AllUser: User = { roles: [obsCasesV2All.name], }; +export const obsCasesV2NoReopenWithCreateCommentUser: User = { + username: 'obs_cases_v2_no_reopen_with_create_comment_user_api_int', + password: 'password', + roles: [obsCasesV2NoReopenWithCreateComment.name], +}; + +export const obsCasesV2NoCreateCommentWithReopenUser: User = { + username: 'obs_cases_v2_no_create_comment_with_reopen_user_api_int', + password: 'password', + roles: [obsCasesV2NoCreateCommentWithReopen.name], +}; + export const obsCasesReadUser: User = { username: 'obs_cases_read_user_api_int', password: 'password', @@ -211,6 +253,8 @@ export const users = [ secAllCasesNoDeleteUser, secAllUser, secCasesV2AllUser, + secCasesV2NoReopenWithCreateCommentUser, + secCasesV2NoCreateCommentWithReopenUser, secAllSpace1User, secAllCasesReadUser, secAllCasesNoneUser, @@ -223,12 +267,16 @@ export const users = [ casesNoDeleteUser, casesAllUser, casesV2AllUser, + casesV2NoReopenWithCreateCommentUser, + casesV2NoCreateCommentWithReopenUser, casesReadUser, obsCasesOnlyDeleteUser, obsCasesOnlyReadDeleteUser, obsCasesNoDeleteUser, obsCasesAllUser, obsCasesV2AllUser, + obsCasesV2NoReopenWithCreateCommentUser, + obsCasesV2NoCreateCommentWithReopenUser, obsCasesReadUser, obsSecCasesAllUser, obsSecCasesReadUser, diff --git a/x-pack/test/api_integration/apis/cases/privileges.ts b/x-pack/test/api_integration/apis/cases/privileges.ts index 53a1767f5c1a7..4e2baeeffa515 100644 --- a/x-pack/test/api_integration/apis/cases/privileges.ts +++ b/x-pack/test/api_integration/apis/cases/privileges.ts @@ -40,6 +40,12 @@ import { secReadCasesNoneUser, secReadCasesReadUser, secReadUser, + casesV2NoReopenWithCreateCommentUser, + casesV2NoCreateCommentWithReopenUser, + obsCasesV2NoReopenWithCreateCommentUser, + obsCasesV2NoCreateCommentWithReopenUser, + secCasesV2NoReopenWithCreateCommentUser, + secCasesV2NoCreateCommentWithReopenUser, } from './common/users'; import { getPostCaseRequest } from '../../../cases_api_integration/common/lib/mock'; @@ -183,6 +189,9 @@ export default ({ getService }: FtrProviderContext): void => { { user: obsCasesV2AllUser, owner: OBSERVABILITY_APP_ID }, { user: casesAllUser, owner: CASES_APP_ID }, { user: casesV2AllUser, owner: CASES_APP_ID }, + { user: casesV2NoCreateCommentWithReopenUser, owner: CASES_APP_ID }, + { user: obsCasesV2NoCreateCommentWithReopenUser, owner: OBSERVABILITY_APP_ID }, + { user: secCasesV2NoCreateCommentWithReopenUser, owner: SECURITY_SOLUTION_APP_ID }, ]) { it(`User ${user.username} with role(s) ${user.roles.join()} can reopen a case`, async () => { const caseInfo = await createCase(supertest, getPostCaseRequest({ owner })); @@ -206,6 +215,35 @@ export default ({ getService }: FtrProviderContext): void => { }); } + for (const { user, owner } of [ + { user: casesV2NoReopenWithCreateCommentUser, owner: CASES_APP_ID }, + { user: obsCasesV2NoReopenWithCreateCommentUser, owner: OBSERVABILITY_APP_ID }, + { user: secCasesV2NoReopenWithCreateCommentUser, owner: SECURITY_SOLUTION_APP_ID }, + ]) { + it(`User ${ + user.username + } with role(s) ${user.roles.join()} CANNOT reopen a case`, async () => { + const caseInfo = await createCase(supertest, getPostCaseRequest({ owner })); + await updateCaseStatus({ + supertest: supertestWithoutAuth, + caseId: caseInfo.id, + status: 'closed' as CaseStatuses, + version: '2', + expectedHttpCode: 200, + auth: { user, space: null }, + }); + + await updateCaseStatus({ + supertest: supertestWithoutAuth, + caseId: caseInfo.id, + status: 'open' as CaseStatuses, + version: '3', + expectedHttpCode: 403, + auth: { user, space: null }, + }); + }); + } + for (const { user, owner } of [ { user: secAllUser, owner: SECURITY_SOLUTION_APP_ID }, { user: secCasesV2AllUser, owner: SECURITY_SOLUTION_APP_ID }, @@ -213,6 +251,9 @@ export default ({ getService }: FtrProviderContext): void => { { user: obsCasesV2AllUser, owner: OBSERVABILITY_APP_ID }, { user: casesAllUser, owner: CASES_APP_ID }, { user: casesV2AllUser, owner: CASES_APP_ID }, + { user: casesV2NoReopenWithCreateCommentUser, owner: CASES_APP_ID }, + { user: obsCasesV2NoReopenWithCreateCommentUser, owner: OBSERVABILITY_APP_ID }, + { user: secCasesV2NoReopenWithCreateCommentUser, owner: SECURITY_SOLUTION_APP_ID }, ]) { it(`User ${user.username} with role(s) ${user.roles.join()} can add comments`, async () => { const caseInfo = await createCase(supertest, getPostCaseRequest({ owner })); @@ -230,5 +271,29 @@ export default ({ getService }: FtrProviderContext): void => { }); }); } + + for (const { user, owner } of [ + { user: casesV2NoCreateCommentWithReopenUser, owner: CASES_APP_ID }, + { user: obsCasesV2NoCreateCommentWithReopenUser, owner: OBSERVABILITY_APP_ID }, + { user: secCasesV2NoCreateCommentWithReopenUser, owner: SECURITY_SOLUTION_APP_ID }, + ]) { + it(`User ${ + user.username + } with role(s) ${user.roles.join()} CANNOT add comments`, async () => { + const caseInfo = await createCase(supertest, getPostCaseRequest({ owner })); + const comment: UserCommentAttachmentPayload = { + comment: 'test', + owner, + type: AttachmentType.user, + }; + await createComment({ + params: comment, + supertest: supertestWithoutAuth, + caseId: caseInfo.id, + expectedHttpCode: 403, + auth: { user, space: null }, + }); + }); + } }); }; From 27224f19b9a01379d7736357849b87069d94deb0 Mon Sep 17 00:00:00 2001 From: "Eyo O. Eyo" <7893459+eokoneyo@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:13:55 +0100 Subject: [PATCH 08/71] [React18] Migrate test suites to account for testing library upgrades kibana-management (#201146) This PR migrates test suites that use `renderHook` from the library `@testing-library/react-hooks` to adopt the equivalent and replacement of `renderHook` from the export that is now available from `@testing-library/react`. This work is required for the planned migration to react18. ## Context In this PR, usages of `waitForNextUpdate` that previously could have been destructured from `renderHook` are now been replaced with `waitFor` exported from `@testing-library/react`, furthermore `waitFor` that would also have been destructured from the same renderHook result is now been replaced with `waitFor` from the export of `@testing-library/react`. ***Why is `waitFor` a sufficient enough replacement for `waitForNextUpdate`, and better for testing values subject to async computations?*** WaitFor will retry the provided callback if an error is returned, till the configured timeout elapses. By default the retry interval is `50ms` with a timeout value of `1000ms` that effectively translates to at least 20 retries for assertions placed within waitFor. See https://testing-library.com/docs/dom-testing-library/api-async/#waitfor for more information. This however means that for person's writing tests, said person has to be explicit about expectations that describe the internal state of the hook being tested. This implies checking for instance when a react query hook is being rendered, there's an assertion that said hook isn't loading anymore. In this PR you'd notice that this pattern has been adopted, with most existing assertions following an invocation of `waitForNextUpdate` being placed within a `waitFor` invocation. In some cases the replacement is simply a `waitFor(() => new Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for point out exactly why this works), where this suffices the assertions that follow aren't placed within a waitFor so this PR doesn't get larger than it needs to be. It's also worth pointing out this PR might also contain changes to test and application code to improve said existing test. ### What to do next? 1. Review the changes in this PR. 2. If you think the changes are correct, approve the PR. ## Any questions? If you have any questions or need help with this PR, please leave comments in this PR. Co-authored-by: Elastic Machine --- .../components/field_input/input/number_input.test.tsx | 6 +++--- .../unsaved_changes_prompt/unsaved_changes_prompt.test.tsx | 5 +++-- .../containers/editor/hooks/use_set_initial_value.test.ts | 2 +- .../use_datastreams_rollover.test.tsx | 2 +- .../use_step_from_query_string.test.tsx | 2 +- .../create_field/semantic_text/use_semantic_text.test.ts | 2 +- .../public/application/hooks/redirect_path.test.tsx | 2 +- .../use_details_page_mappings_model_management.test.ts | 2 +- .../public/application/hooks/redirect_path.test.tsx | 2 +- .../collapsible_lists/use_collapsible_list.test.ts | 2 +- 10 files changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/kbn-management/settings/components/field_input/input/number_input.test.tsx b/packages/kbn-management/settings/components/field_input/input/number_input.test.tsx index 4d3b5ef9a405b..7257a5395f2fb 100644 --- a/packages/kbn-management/settings/components/field_input/input/number_input.test.tsx +++ b/packages/kbn-management/settings/components/field_input/input/number_input.test.tsx @@ -85,11 +85,11 @@ describe('NumberInput', () => { expect(input).toBeDisabled(); }); - it('recovers if value is null', () => { + it('recovers if value is null', async () => { const { getByTestId } = render( wrap() ); - const input = getByTestId(`${TEST_SUBJ_PREFIX_FIELD}-${id}`); - waitFor(() => expect(input).toHaveValue(undefined)); + + await waitFor(() => expect(getByTestId(`${TEST_SUBJ_PREFIX_FIELD}-${id}`)).toHaveValue(null)); }); }); diff --git a/packages/kbn-unsaved-changes-prompt/src/unsaved_changes_prompt/unsaved_changes_prompt.test.tsx b/packages/kbn-unsaved-changes-prompt/src/unsaved_changes_prompt/unsaved_changes_prompt.test.tsx index 3b8c38caeef5d..5b155d657c48e 100644 --- a/packages/kbn-unsaved-changes-prompt/src/unsaved_changes_prompt/unsaved_changes_prompt.test.tsx +++ b/packages/kbn-unsaved-changes-prompt/src/unsaved_changes_prompt/unsaved_changes_prompt.test.tsx @@ -8,7 +8,8 @@ */ import { createMemoryHistory } from 'history'; -import { renderHook, act, cleanup } from '@testing-library/react-hooks'; + +import { renderHook, act, cleanup, waitFor } from '@testing-library/react'; import { coreMock } from '@kbn/core/public/mocks'; import { CoreScopedHistory } from '@kbn/core/public'; @@ -73,7 +74,7 @@ describe('useUnsavedChangesPrompt', () => { act(() => history.push('/test')); // needed because we have an async useEffect - await act(() => new Promise((resolve) => resolve())); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(navigateToUrl).toBeCalledWith('/mock/test', expect.anything()); expect(coreStart.overlays.openConfirm).toBeCalled(); diff --git a/src/plugins/console/public/application/containers/editor/hooks/use_set_initial_value.test.ts b/src/plugins/console/public/application/containers/editor/hooks/use_set_initial_value.test.ts index 0605a0c903ee0..4dab86712707d 100644 --- a/src/plugins/console/public/application/containers/editor/hooks/use_set_initial_value.test.ts +++ b/src/plugins/console/public/application/containers/editor/hooks/use_set_initial_value.test.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { useSetInitialValue } from './use_set_initial_value'; import { IToasts } from '@kbn/core-notifications-browser'; import { decompressFromEncodedURIComponent } from 'lz-string'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/component_template_datastreams_rollover/use_datastreams_rollover.test.tsx b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/component_template_datastreams_rollover/use_datastreams_rollover.test.tsx index 903a9187a7335..d4ac28521b31e 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/component_template_datastreams_rollover/use_datastreams_rollover.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/component_template_datastreams_rollover/use_datastreams_rollover.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useComponentTemplatesContext } from '../../component_templates_context'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/use_step_from_query_string.test.tsx b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/use_step_from_query_string.test.tsx index cb26f40c91ae3..6e04cdc37e1fe 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/use_step_from_query_string.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/use_step_from_query_string.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { createMemoryHistory } from 'history'; import { useStepFromQueryString } from './use_step_from_query_string'; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/semantic_text/use_semantic_text.test.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/semantic_text/use_semantic_text.test.ts index 65415a287d94c..15537b0335e0a 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/semantic_text/use_semantic_text.test.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/semantic_text/use_semantic_text.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { CustomInferenceEndpointConfig, SemanticTextField } from '../../../../../types'; import { useSemanticText } from './use_semantic_text'; import { act } from 'react-dom/test-utils'; diff --git a/x-pack/plugins/index_management/public/application/hooks/redirect_path.test.tsx b/x-pack/plugins/index_management/public/application/hooks/redirect_path.test.tsx index 5b189ccbc253c..83bd06a8dd491 100644 --- a/x-pack/plugins/index_management/public/application/hooks/redirect_path.test.tsx +++ b/x-pack/plugins/index_management/public/application/hooks/redirect_path.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { coreMock } from '@kbn/core/public/mocks'; import { createMemoryHistory } from 'history'; import { useRedirectPath } from './redirect_path'; diff --git a/x-pack/plugins/index_management/public/hooks/use_details_page_mappings_model_management.test.ts b/x-pack/plugins/index_management/public/hooks/use_details_page_mappings_model_management.test.ts index 62746791510c0..4de34b584aec5 100644 --- a/x-pack/plugins/index_management/public/hooks/use_details_page_mappings_model_management.test.ts +++ b/x-pack/plugins/index_management/public/hooks/use_details_page_mappings_model_management.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { NormalizedFields } from '../application/components/mappings_editor/types'; import { useDetailsPageMappingsModelManagement } from './use_details_page_mappings_model_management'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/hooks/redirect_path.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/hooks/redirect_path.test.tsx index a387661fc1b53..25729f5ba255a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/hooks/redirect_path.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/hooks/redirect_path.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { createMemoryHistory } from 'history'; import { useRedirectPath } from './redirect_path'; import { useKibana } from '../../shared_imports'; diff --git a/x-pack/plugins/snapshot_restore/public/application/components/collapsible_lists/use_collapsible_list.test.ts b/x-pack/plugins/snapshot_restore/public/application/components/collapsible_lists/use_collapsible_list.test.ts index 72bfa570df5c7..dcc9fe1932f5d 100644 --- a/x-pack/plugins/snapshot_restore/public/application/components/collapsible_lists/use_collapsible_list.test.ts +++ b/x-pack/plugins/snapshot_restore/public/application/components/collapsible_lists/use_collapsible_list.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useCollapsibleList } from './use_collapsible_list'; From 845aa8c47c858a6ccf83390bb38f332424ce2221 Mon Sep 17 00:00:00 2001 From: Thom Heymann <190132+thomheymann@users.noreply.github.com> Date: Mon, 25 Nov 2024 11:14:49 +0000 Subject: [PATCH 09/71] [Observability] Use Fleet's default data output when onboarding integrations using auto-detect flow (#201158) Resolves #199751 ## Summary Use Fleet's default data output when onboarding integrations using auto-detect flow. ## Screenshot ### Fleet output settings Screenshot 2024-11-21 at 15 10 24 ### Generated Agent config ``` $ cat /Library/Elastic/Agent/elastic-agent.yml outputs: default: type: elasticsearch hosts: - https://192.168.1.73:9200 ssl.ca_trusted_fingerprint: c48c98cdf7f85d7cc29f834704011c1002b5251d594fc0bb08e6177544fe304a api_key: b1BkR1Q1TUIyOUpfMWhaS2NCUXA6SS1Jb3dncGVReVNpcEdzOGpSVmlzQQ== preset: balanced ``` ## Testing 1. Go to Fleet > Settings > Outputs 2. Edit the default output and enter dummy data into the "Elasticsearch CA trusted fingerprint" field 3. Go through the auto-detect onboarding flow 4. Inspect the `elastic-agent.yml` file written to disk. It should contain the default output configured in Fleet including `ca_trusted_fingerprint` setting --- x-pack/plugins/fleet/server/mocks/index.ts | 2 + x-pack/plugins/fleet/server/plugin.ts | 13 ++++ .../server/services/output_client.mock.ts | 21 ++++++ .../server/services/output_client.test.ts | 71 +++++++++++++++++++ .../fleet/server/services/output_client.ts | 40 +++++++++++ .../server/routes/flow/route.ts | 34 ++++----- 6 files changed, 161 insertions(+), 20 deletions(-) create mode 100644 x-pack/plugins/fleet/server/services/output_client.mock.ts create mode 100644 x-pack/plugins/fleet/server/services/output_client.test.ts create mode 100644 x-pack/plugins/fleet/server/services/output_client.ts diff --git a/x-pack/plugins/fleet/server/mocks/index.ts b/x-pack/plugins/fleet/server/mocks/index.ts index 8d452b394dd18..db100c5fcf7ec 100644 --- a/x-pack/plugins/fleet/server/mocks/index.ts +++ b/x-pack/plugins/fleet/server/mocks/index.ts @@ -29,6 +29,7 @@ import { createFleetActionsClientMock } from '../services/actions/mocks'; import { createFleetFilesClientFactoryMock } from '../services/files/mocks'; import { createArtifactsClientMock } from '../services/artifacts/mocks'; +import { createOutputClientMock } from '../services/output_client.mock'; import type { PackagePolicyClient } from '../services/package_policy_service'; import type { AgentPolicyServiceInterface } from '../services'; @@ -303,6 +304,7 @@ export const createFleetStartContractMock = (): DeeplyMockedKeys fleetActionsClient), getPackageSpecTagId: jest.fn(getPackageSpecTagId), + createOutputClient: jest.fn(async (_) => createOutputClientMock()), }; return startContract; diff --git a/x-pack/plugins/fleet/server/plugin.ts b/x-pack/plugins/fleet/server/plugin.ts index 7716d6b21d9e3..1620df27b82c3 100644 --- a/x-pack/plugins/fleet/server/plugin.ts +++ b/x-pack/plugins/fleet/server/plugin.ts @@ -84,6 +84,8 @@ import { MessageSigningService, } from './services/security'; +import { OutputClient, type OutputClientInterface } from './services/output_client'; + import { ASSETS_SAVED_OBJECT_TYPE, DOWNLOAD_SOURCE_SAVED_OBJECT_TYPE, @@ -262,6 +264,12 @@ export interface FleetStartContract { Function exported to allow creating unique ids for saved object tags */ getPackageSpecTagId: (spaceId: string, pkgName: string, tagName: string) => string; + + /** + * Create a Fleet Output Client instance + * @param packageName + */ + createOutputClient: (request: KibanaRequest) => Promise; } export class FleetPlugin @@ -837,6 +845,11 @@ export class FleetPlugin return new FleetActionsClient(core.elasticsearch.client.asInternalUser, packageName); }, getPackageSpecTagId, + async createOutputClient(request: KibanaRequest) { + const soClient = appContextService.getSavedObjects().getScopedClient(request); + const authz = await getAuthzFromRequest(request); + return new OutputClient(soClient, authz); + }, }; } diff --git a/x-pack/plugins/fleet/server/services/output_client.mock.ts b/x-pack/plugins/fleet/server/services/output_client.mock.ts new file mode 100644 index 0000000000000..ba684a2aff615 --- /dev/null +++ b/x-pack/plugins/fleet/server/services/output_client.mock.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { OutputClientInterface } from './output_client'; + +export const createOutputClientMock = (): jest.Mocked => { + return { + getDefaultDataOutputId: jest.fn(), + get: jest.fn(), + }; +}; diff --git a/x-pack/plugins/fleet/server/services/output_client.test.ts b/x-pack/plugins/fleet/server/services/output_client.test.ts new file mode 100644 index 0000000000000..f3d4b83bea4bc --- /dev/null +++ b/x-pack/plugins/fleet/server/services/output_client.test.ts @@ -0,0 +1,71 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { savedObjectsClientMock } from '@kbn/core/server/mocks'; + +import { createFleetAuthzMock } from '../../common/mocks'; + +import { OutputClient } from './output_client'; +import { outputService } from './output'; + +jest.mock('./output'); + +const mockedOutputService = outputService as jest.Mocked; + +describe('OutputClient', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + + describe('getDefaultDataOutputId()', () => { + it('should call output service `getDefaultDataOutputId()` method', async () => { + const soClient = savedObjectsClientMock.create(); + const authz = createFleetAuthzMock(); + const outputClient = new OutputClient(soClient, authz); + await outputClient.getDefaultDataOutputId(); + + expect(mockedOutputService.getDefaultDataOutputId).toHaveBeenCalledWith(soClient); + }); + + it('should throw error when no `fleet.readSettings` and no `fleet.readAgentPolicies` privileges', async () => { + const soClient = savedObjectsClientMock.create(); + const authz = createFleetAuthzMock(); + authz.fleet.readSettings = false; + authz.fleet.readAgentPolicies = false; + const outputClient = new OutputClient(soClient, authz); + + await expect(outputClient.getDefaultDataOutputId()).rejects.toMatchInlineSnapshot( + `[OutputUnauthorizedError]` + ); + expect(mockedOutputService.getDefaultDataOutputId).not.toHaveBeenCalled(); + }); + }); + + describe('get()', () => { + it('should call output service `get()` method', async () => { + const soClient = savedObjectsClientMock.create(); + const authz = createFleetAuthzMock(); + const outputClient = new OutputClient(soClient, authz); + await outputClient.get('default'); + + expect(mockedOutputService.get).toHaveBeenCalledWith(soClient, 'default'); + }); + + it('should throw error when no `fleet.readSettings` and no `fleet.readAgentPolicies` privileges', async () => { + const soClient = savedObjectsClientMock.create(); + const authz = createFleetAuthzMock(); + authz.fleet.readSettings = false; + authz.fleet.readAgentPolicies = false; + const outputClient = new OutputClient(soClient, authz); + + await expect(outputClient.get('default')).rejects.toMatchInlineSnapshot( + `[OutputUnauthorizedError]` + ); + expect(mockedOutputService.get).not.toHaveBeenCalled(); + }); + }); +}); diff --git a/x-pack/plugins/fleet/server/services/output_client.ts b/x-pack/plugins/fleet/server/services/output_client.ts new file mode 100644 index 0000000000000..574446e1f32a7 --- /dev/null +++ b/x-pack/plugins/fleet/server/services/output_client.ts @@ -0,0 +1,40 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { SavedObjectsClientContract } from '@kbn/core/server'; + +import type { FleetAuthz } from '../../common'; + +import { OutputUnauthorizedError } from '../errors'; +import type { Output } from '../types'; + +import { outputService } from './output'; + +export { transformOutputToFullPolicyOutput } from './agent_policies/full_agent_policy'; + +export interface OutputClientInterface { + getDefaultDataOutputId(): Promise; + get(outputId: string): Promise; +} + +export class OutputClient implements OutputClientInterface { + constructor(private soClient: SavedObjectsClientContract, private authz: FleetAuthz) {} + + async getDefaultDataOutputId() { + if (!this.authz.fleet.readSettings && !this.authz.fleet.readAgentPolicies) { + throw new OutputUnauthorizedError(); + } + return outputService.getDefaultDataOutputId(this.soClient); + } + + async get(outputId: string) { + if (!this.authz.fleet.readSettings && !this.authz.fleet.readAgentPolicies) { + throw new OutputUnauthorizedError(); + } + return outputService.get(this.soClient, outputId); + } +} diff --git a/x-pack/plugins/observability_solution/observability_onboarding/server/routes/flow/route.ts b/x-pack/plugins/observability_solution/observability_onboarding/server/routes/flow/route.ts index 372eaf7972373..738c9f1fefd57 100644 --- a/x-pack/plugins/observability_solution/observability_onboarding/server/routes/flow/route.ts +++ b/x-pack/plugins/observability_solution/observability_onboarding/server/routes/flow/route.ts @@ -13,7 +13,8 @@ import { type PackageClient, } from '@kbn/fleet-plugin/server'; import { dump } from 'js-yaml'; -import { PackageDataStreamTypes } from '@kbn/fleet-plugin/common/types'; +import { PackageDataStreamTypes, Output } from '@kbn/fleet-plugin/common/types'; +import { transformOutputToFullPolicyOutput } from '@kbn/fleet-plugin/server/services/output_client'; import { getObservabilityOnboardingFlow, saveObservabilityOnboardingFlow } from '../../lib/state'; import type { SavedObservabilityOnboardingFlow } from '../../saved_objects/observability_onboarding_status'; import { ObservabilityOnboardingFlow } from '../../saved_objects/observability_onboarding_status'; @@ -21,7 +22,6 @@ import { createObservabilityOnboardingServerRoute } from '../create_observabilit import { getHasLogs } from './get_has_logs'; import { getKibanaUrl } from '../../lib/get_fallback_urls'; import { getAgentVersionInfo } from '../../lib/get_agent_version'; -import { getFallbackESUrl } from '../../lib/get_fallback_urls'; import { ElasticAgentStepPayload, InstalledIntegration, StepProgressPayloadRT } from '../types'; import { createShipperApiKey } from '../../lib/api_key/create_shipper_api_key'; import { createInstallApiKey } from '../../lib/api_key/create_install_api_key'; @@ -329,6 +329,13 @@ const integrationsInstallRoute = createObservabilityOnboardingServerRoute({ throw Boom.notFound(`Onboarding session '${params.path.onboardingId}' not found.`); } + const outputClient = await fleetStart.createOutputClient(request); + const defaultOutputId = await outputClient.getDefaultDataOutputId(); + if (!defaultOutputId) { + throw Boom.notFound('Default data output not found'); + } + const output = await outputClient.get(defaultOutputId); + const integrationsToInstall = parseIntegrationsTSV(params.body); if (!integrationsToInstall.length) { return response.badRequest({ @@ -381,15 +388,11 @@ const integrationsInstallRoute = createObservabilityOnboardingServerRoute({ }, }); - const elasticsearchUrl = plugins.cloud?.setup?.elasticsearchUrl - ? [plugins.cloud?.setup?.elasticsearchUrl] - : await getFallbackESUrl(services.esLegacyConfigService); - return response.ok({ headers: { 'content-type': 'application/x-tar', }, - body: generateAgentConfigTar({ elasticsearchUrl, installedIntegrations }), + body: generateAgentConfigTar(output, installedIntegrations), }); }, }); @@ -565,14 +568,9 @@ function parseRegistryIntegrationMetadata( } } -const generateAgentConfigTar = ({ - elasticsearchUrl, - installedIntegrations, -}: { - elasticsearchUrl: string[]; - installedIntegrations: InstalledIntegration[]; -}) => { +function generateAgentConfigTar(output: Output, installedIntegrations: InstalledIntegration[]) { const now = new Date(); + return makeTar([ { type: 'File', @@ -581,11 +579,7 @@ const generateAgentConfigTar = ({ mtime: now, data: dump({ outputs: { - default: { - type: 'elasticsearch', - hosts: elasticsearchUrl, - api_key: '${API_KEY}', // Placeholder to be replaced by bash script with the actual API key - }, + default: transformOutputToFullPolicyOutput(output, undefined, true), }, }), }, @@ -603,7 +597,7 @@ const generateAgentConfigTar = ({ data: integration.config, })), ]); -}; +} export const flowRouteRepository = { ...createFlowRoute, From 15160b8d8b16e781f110a1a0f626c930c97decaf Mon Sep 17 00:00:00 2001 From: "elastic-renovate-prod[bot]" <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 05:26:51 -0600 Subject: [PATCH 10/71] Update dependency re2js to v0.4.3 (main) (#200831) --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index fe04f6e65bbc5..38ae9a9d9d409 100644 --- a/package.json +++ b/package.json @@ -1221,7 +1221,7 @@ "query-string": "^6.13.2", "rbush": "^3.0.1", "re-resizable": "^6.9.9", - "re2js": "0.4.2", + "re2js": "0.4.3", "react": "^17.0.2", "react-diff-view": "^3.2.1", "react-dom": "^17.0.2", diff --git a/yarn.lock b/yarn.lock index f811bb6c93c20..43235430ea4e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -27142,10 +27142,10 @@ re-resizable@^6.9.9: resolved "https://registry.yarnpkg.com/re-resizable/-/re-resizable-6.9.9.tgz#99e8b31c67a62115dc9c5394b7e55892265be216" integrity sha512-l+MBlKZffv/SicxDySKEEh42hR6m5bAHfNu3Tvxks2c4Ah+ldnWjfnVRwxo/nxF27SsUsxDS0raAzFuJNKABXA== -re2js@0.4.2: - version "0.4.2" - resolved "https://registry.yarnpkg.com/re2js/-/re2js-0.4.2.tgz#e344697e64d128ea65c121d6581e67ee5bfa5feb" - integrity sha512-wuv0p0BGbrVIkobV8zh82WjDurXko0QNCgaif6DdRAljgVm2iio4PVYCwjAxGaWen1/QZXWDM67dIslmz7AIbA== +re2js@0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/re2js/-/re2js-0.4.3.tgz#1318cd0c12aa6ed3ba56d5e012311ffbfb2aef35" + integrity sha512-EuNmh7jurhHEE8Ge/lBo9JuMLb3qf866Xjjfyovw3wPc7+hlqDkZq4LwhrCQMEI+ARWfrKrHozEndzlpNT0WDg== react-clientside-effect@^1.2.6: version "1.2.6" From 99eb6823e6201adb38a4e5c938dc41941dde7878 Mon Sep 17 00:00:00 2001 From: Tre Date: Mon, 25 Nov 2024 11:38:53 +0000 Subject: [PATCH 11/71] [Ownership] Assign test files to core team (#200950) ## Summary Assign test files to core team Contributes to: #192979 --- .github/CODEOWNERS | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 350282c9af60e..29d8ac10e20cd 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1288,7 +1288,7 @@ packages/kbn-monaco/src/esql @elastic/kibana-esql /x-pack/test/functional/apps/infra/logs @elastic/obs-ux-logs-team # Observability UX management team -/x-pack/test/api_integration/services/data_view_api.ts @elastic/obs-ux-management-team +/test/api_integration/apis/suggestions @elastic/obs-ux-management-team # Assigned per https://github.com/elastic/kibana/pull/200950#discussion_r1853705079 /x-pack/test/api_integration/services/slo.ts @elastic/obs-ux-management-team /x-pack/test/functional/services/slo @elastic/obs-ux-management-team /x-pack/test/functional/apps/slo @elastic/obs-ux-management-team @@ -1664,6 +1664,16 @@ packages/kbn-monaco/src/esql @elastic/kibana-esql /x-pack/test/api_integration/deployment_agnostic/services/ @elastic/appex-qa # Core +/test/api_integration/fixtures/kbn_archiver/management/saved_objects/relationships.json @elastic/kibana-core @elastic/kibana-data-discovery +/x-pack/test/functional/es_archives/lists @elastic/kibana-core +/test/functional/fixtures/kbn_archiver/saved_search.json @elastic/kibana-core # Assigned per only use: https://github.com/elastic/kibana/blob/main/test/interpreter_functional/test_suites/run_pipeline/esaggs.ts#L100 +/test/functional/fixtures/kbn_archiver/saved_objects_management/show_relationships.json @elastic/kibana-core # Assigned per only use: https://github.com/elastic/kibana/blob/main/test/functional/apps/saved_objects_management/show_relationships.ts#L20 +/test/functional/fixtures/kbn_archiver/saved_objects_management/hidden_from_http_apis.json @elastic/kibana-core +/test/functional/fixtures/kbn_archiver/saved_objects_management/edit_saved_object.json @elastic/kibana-core # Assigned per only use: https://github.com/elastic/kibana/blob/main/test/functional/apps/saved_objects_management/inspect_saved_objects.ts#L40 +/test/functional/fixtures/es_archiver/saved_objects_management @elastic/kibana-core +/test/api_integration/fixtures/es_archiver/saved_objects @elastic/kibana-core +/test/api_integration/fixtures/kbn_archiver/saved_objects @elastic/kibana-core +/test/interpreter_functional @elastic/kibana-core # Assigned per https://github.com/elastic/kibana/blob/main/test/interpreter_functional/plugins/kbn_tp_run_pipeline/kibana.jsonc#L4 /test/api_integration/apis/general/*.js @elastic/kibana-core # Assigned per https://github.com/elastic/kibana/pull/199795/files/894a8ede3f9d0398c5af56bf5a82654a9bc0610b#r1846691639 /x-pack/test/plugin_api_integration/plugins/feature_usage_test @elastic/kibana-core /x-pack/test/functional/page_objects/navigational_search.ts @elastic/kibana-core From e4d32fd5271ec46d6ba2b9fd9f6bf3c226884c6b Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 25 Nov 2024 13:38:32 +0100 Subject: [PATCH 12/71] [ResponseOps][Cases] `SyncAlertsToggle` flaky test (#201534) ## Summary The test failed again after the last fix. I added `within` to try and improve the time of the dom traversals in the failing test. --- .../case_form_fields/sync_alerts_toggle.test.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/cases/public/components/case_form_fields/sync_alerts_toggle.test.tsx b/x-pack/plugins/cases/public/components/case_form_fields/sync_alerts_toggle.test.tsx index fbe7eca218391..238abfefeb474 100644 --- a/x-pack/plugins/cases/public/components/case_form_fields/sync_alerts_toggle.test.tsx +++ b/x-pack/plugins/cases/public/components/case_form_fields/sync_alerts_toggle.test.tsx @@ -33,9 +33,10 @@ describe('SyncAlertsToggle', () => { ); - expect(await screen.findByTestId('caseSyncAlerts')).toBeInTheDocument(); - expect(await screen.findByRole('switch')).toHaveAttribute('aria-checked', 'true'); - expect(await screen.findByText('On')).toBeInTheDocument(); + const syncAlerts = await screen.findByTestId('caseSyncAlerts'); + expect(syncAlerts).toBeInTheDocument(); + expect(within(syncAlerts).getByRole('switch')).toHaveAttribute('aria-checked', 'true'); + expect(within(syncAlerts).getByText('On')).toBeInTheDocument(); }); it('it toggles the switch', async () => { @@ -45,9 +46,9 @@ describe('SyncAlertsToggle', () => { ); - const synAlerts = await screen.findByTestId('caseSyncAlerts'); + const syncAlerts = await screen.findByTestId('caseSyncAlerts'); - await userEvent.click(within(synAlerts).getByRole('switch')); + await userEvent.click(within(syncAlerts).getByRole('switch')); expect(await screen.findByRole('switch')).toHaveAttribute('aria-checked', 'false'); expect(await screen.findByText('Off')).toBeInTheDocument(); @@ -60,9 +61,9 @@ describe('SyncAlertsToggle', () => { ); - const synAlerts = await screen.findByTestId('caseSyncAlerts'); + const syncAlerts = await screen.findByTestId('caseSyncAlerts'); - await userEvent.click(within(synAlerts).getByRole('switch')); + await userEvent.click(within(syncAlerts).getByRole('switch')); await userEvent.click(await screen.findByText('Submit')); From 762bb7f59d1d980aa34358c62ae0ef53e81f726e Mon Sep 17 00:00:00 2001 From: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:46:05 +0000 Subject: [PATCH 13/71] [Mappings editor] Add code improvements for source field (#201188) Closes https://github.com/elastic/kibana/issues/200769 ## Summary This PR is a follow-up to https://github.com/elastic/kibana/pull/199854 and it adds the following code improvements: - Replaces Mappings-editor-context-level property `hasEnterpriceLicense` with plugin-context-level `canUseSyntheticSource` property - Adds jest tests to check if the synthetic option is correctly displayed based on license - Improves readability of serializer logic for the source field **How to test:** The same test instructions from https://github.com/elastic/kibana/pull/199854 can be followed with a focus on checking that the synthetic option is only available in Enterprise license. --- .../public/application/app_context.tsx | 1 + .../configuration_form.test.tsx | 48 +++++++++++++------ .../mappings_editor.test.tsx | 22 ++------- .../configuration_form/configuration_form.tsx | 45 +++++++++-------- .../source_field_section.tsx | 6 +-- .../mappings_editor/lib/utils.test.ts | 1 - .../mappings_editor/mappings_editor.tsx | 32 +++---------- .../mappings_state_context.tsx | 1 - .../components/mappings_editor/reducer.ts | 6 --- .../components/mappings_editor/types/state.ts | 4 +- .../application/mount_management_section.ts | 6 +++ .../plugins/index_management/public/plugin.ts | 13 ++++- 12 files changed, 93 insertions(+), 92 deletions(-) diff --git a/x-pack/plugins/index_management/public/application/app_context.tsx b/x-pack/plugins/index_management/public/application/app_context.tsx index 1a8276d76b7fc..6df01a109a036 100644 --- a/x-pack/plugins/index_management/public/application/app_context.tsx +++ b/x-pack/plugins/index_management/public/application/app_context.tsx @@ -79,6 +79,7 @@ export interface AppDependencies { docLinks: DocLinksStart; kibanaVersion: SemVer; overlays: OverlayStart; + canUseSyntheticSource: boolean; } export const AppContextProvider = ({ diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/configuration_form.test.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/configuration_form.test.tsx index 4c73fd1037dda..5bc28052b73e2 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/configuration_form.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/configuration_form.test.tsx @@ -28,6 +28,14 @@ const setup = (props: any = { onUpdate() {} }, appDependencies?: any) => { return testBed; }; +const getContext = (sourceFieldEnabled: boolean = true, canUseSyntheticSource: boolean = true) => + ({ + config: { + enableMappingsSourceFieldSection: sourceFieldEnabled, + }, + canUseSyntheticSource, + } as unknown as AppDependencies); + describe('Mappings editor: configuration form', () => { let testBed: TestBed; @@ -49,14 +57,8 @@ describe('Mappings editor: configuration form', () => { describe('_source field', () => { it('renders the _source field when it is enabled', async () => { - const ctx = { - config: { - enableMappingsSourceFieldSection: true, - }, - } as unknown as AppDependencies; - await act(async () => { - testBed = setup({ esNodesPlugins: [] }, ctx); + testBed = setup({ esNodesPlugins: [] }, getContext()); }); testBed.component.update(); const { exists } = testBed; @@ -65,19 +67,37 @@ describe('Mappings editor: configuration form', () => { }); it("doesn't render the _source field when it is disabled", async () => { - const ctx = { - config: { - enableMappingsSourceFieldSection: false, - }, - } as unknown as AppDependencies; - await act(async () => { - testBed = setup({ esNodesPlugins: [] }, ctx); + testBed = setup({ esNodesPlugins: [] }, getContext(false)); }); testBed.component.update(); const { exists } = testBed; expect(exists('sourceField')).toBe(false); }); + + it('has synthetic option if `canUseSyntheticSource` is set to true', async () => { + await act(async () => { + testBed = setup({ esNodesPlugins: [] }, getContext(true, true)); + }); + testBed.component.update(); + const { exists, find } = testBed; + + // Clicking on the field to open the options dropdown + find('sourceValueField').simulate('click'); + expect(exists('syntheticSourceFieldOption')).toBe(true); + }); + + it("doesn't have synthetic option if `canUseSyntheticSource` is set to false", async () => { + await act(async () => { + testBed = setup({ esNodesPlugins: [] }, getContext(true, false)); + }); + testBed.component.update(); + const { exists, find } = testBed; + + // Clicking on the field to open the options dropdown + find('sourceValueField').simulate('click'); + expect(exists('syntheticSourceFieldOption')).toBe(false); + }); }); }); diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx index ee3b3e72e7c19..cb8a1efbf9c70 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx @@ -28,22 +28,9 @@ describe('Mappings editor: core', () => { let onChangeHandler: jest.Mock = jest.fn(); let getMappingsEditorData = getMappingsEditorDataFactory(onChangeHandler); let testBed: MappingsEditorTestBed; - let hasEnterpriseLicense = true; - const mockLicenseCheck = jest.fn((type: any) => hasEnterpriseLicense); const appDependencies = { plugins: { ml: { mlApi: {} }, - licensing: { - license$: { - subscribe: jest.fn((callback: any) => { - callback({ - isActive: true, - hasAtLeast: mockLicenseCheck, - }); - return { unsubscribe: jest.fn() }; - }), - }, - }, }, }; @@ -314,6 +301,7 @@ describe('Mappings editor: core', () => { config: { enableMappingsSourceFieldSection: true, }, + canUseSyntheticSource: true, ...appDependencies, }; @@ -512,8 +500,7 @@ describe('Mappings editor: core', () => { }); ['logsdb', 'time_series'].forEach((indexMode) => { - it(`defaults to 'synthetic' with ${indexMode} index mode prop on enterprise license`, async () => { - hasEnterpriseLicense = true; + it(`defaults to 'synthetic' with ${indexMode} index mode prop when 'canUseSyntheticSource' is set to true`, async () => { await act(async () => { testBed = setup( { @@ -537,8 +524,7 @@ describe('Mappings editor: core', () => { expect(find('sourceValueField').prop('value')).toBe('synthetic'); }); - it(`defaults to 'standard' with ${indexMode} index mode prop on basic license`, async () => { - hasEnterpriseLicense = false; + it(`defaults to 'standard' with ${indexMode} index mode prop when 'canUseSyntheticSource' is set to true`, async () => { await act(async () => { testBed = setup( { @@ -546,7 +532,7 @@ describe('Mappings editor: core', () => { onChange: onChangeHandler, indexMode, }, - ctx + { ...ctx, canUseSyntheticSource: false } ); }); testBed.component.update(); diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx index 00ce2d02a1baa..6ddaf8e48fe42 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx @@ -39,6 +39,31 @@ interface SerializedSourceField { excludes?: string[]; } +const serializeSourceField = (sourceField: any): SerializedSourceField | undefined => { + if (sourceField?.option === SYNTHETIC_SOURCE_OPTION) { + return { mode: SYNTHETIC_SOURCE_OPTION }; + } + if (sourceField?.option === DISABLED_SOURCE_OPTION) { + return { enabled: false }; + } + if (sourceField?.option === STORED_SOURCE_OPTION) { + return { + mode: 'stored', + includes: sourceField.includes, + excludes: sourceField.excludes, + }; + } + if (sourceField?.includes || sourceField?.excludes) { + // If sourceField?.option is undefined, the user hasn't explicitly selected + // this option, so don't include the `mode` property + return { + includes: sourceField.includes, + excludes: sourceField.excludes, + }; + } + return undefined; +}; + export const formSerializer = (formData: GenericObject) => { const { dynamicMapping, sourceField, metaField, _routing, _size, subobjects } = formData; @@ -48,30 +73,12 @@ export const formSerializer = (formData: GenericObject) => { ? 'strict' : dynamicMapping?.enabled; - const _source = - sourceField?.option === SYNTHETIC_SOURCE_OPTION - ? { mode: SYNTHETIC_SOURCE_OPTION } - : sourceField?.option === DISABLED_SOURCE_OPTION - ? { enabled: false } - : sourceField?.option === STORED_SOURCE_OPTION - ? { - mode: 'stored', - includes: sourceField?.includes, - excludes: sourceField?.excludes, - } - : sourceField?.includes || sourceField?.excludes - ? { - includes: sourceField?.includes, - excludes: sourceField?.excludes, - } - : undefined; - const serialized = { dynamic, numeric_detection: dynamicMapping?.numeric_detection, date_detection: dynamicMapping?.date_detection, dynamic_date_formats: dynamicMapping?.dynamic_date_formats, - _source: _source as SerializedSourceField, + _source: serializeSourceField(sourceField), _meta: metaField, _routing, _size, diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/source_field_section/source_field_section.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/source_field_section/source_field_section.tsx index 2e8f9fb88f87d..c1709fa135035 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/source_field_section/source_field_section.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/source_field_section/source_field_section.tsx @@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiLink, EuiSpacer, EuiComboBox, EuiFormRow, EuiCallOut, EuiText } from '@elastic/eui'; -import { useMappingsState } from '../../../mappings_state_context'; +import { useAppContext } from '../../../../../app_context'; import { documentationService } from '../../../../../services/documentation'; import { UseField, FormDataProvider, FormRow, SuperSelectField } from '../../../shared_imports'; import { ComboBoxOption } from '../../../types'; @@ -24,7 +24,7 @@ import { } from './constants'; export const SourceFieldSection = () => { - const state = useMappingsState(); + const { canUseSyntheticSource } = useAppContext(); const renderOptionDropdownDisplay = (option: SourceOptionKey) => ( @@ -44,7 +44,7 @@ export const SourceFieldSection = () => { }, ]; - if (state.hasEnterpriseLicense) { + if (canUseSyntheticSource) { sourceValueOptions.push({ value: SYNTHETIC_SOURCE_OPTION, inputDisplay: sourceOptionLabels[SYNTHETIC_SOURCE_OPTION], diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/lib/utils.test.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/lib/utils.test.ts index 872c62bc6f7a7..58b40293f64f2 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/lib/utils.test.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/lib/utils.test.ts @@ -421,7 +421,6 @@ describe('utils', () => { selectedDataTypes: ['Boolean'], }, inferenceToModelIdMap: {}, - hasEnterpriseLicense: true, mappingViewFields: { byId: {}, rootLevelFields: [], aliases: {}, maxNestedDepth: 0 }, }; test('returns list of matching fields with search term', () => { diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx index cc87c3cd614e3..9f59f4959bed5 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx @@ -9,7 +9,6 @@ import React, { useMemo, useState, useEffect, useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiSpacer, EuiTabs, EuiTab } from '@elastic/eui'; -import { ILicense } from '@kbn/licensing-plugin/common/types'; import { useAppContext } from '../../app_context'; import { IndexMode } from '../../../../common/types/data_streams'; import { @@ -61,9 +60,7 @@ export interface Props { export const MappingsEditor = React.memo( ({ onChange, value, docLinks, indexSettings, esNodesPlugins, indexMode }: Props) => { - const { - plugins: { licensing }, - } = useAppContext(); + const { canUseSyntheticSource } = useAppContext(); const { parsedDefaultValue, multipleMappingsDeclared } = useMemo( () => parseMappings(value), [value] @@ -128,39 +125,22 @@ export const MappingsEditor = React.memo( [dispatch] ); - const [isLicenseCheckComplete, setIsLicenseCheckComplete] = useState(false); - useEffect(() => { - const subscription = licensing?.license$.subscribe((license: ILicense) => { - dispatch({ - type: 'hasEnterpriseLicense.update', - value: license.isActive && license.hasAtLeast('enterprise'), - }); - setIsLicenseCheckComplete(true); - }); - - return () => subscription?.unsubscribe(); - }, [dispatch, licensing]); - useEffect(() => { if ( - isLicenseCheckComplete && !state.configuration.defaultValue._source && (indexMode === LOGSDB_INDEX_MODE || indexMode === TIME_SERIES_MODE) ) { - if (state.hasEnterpriseLicense) { + if (canUseSyntheticSource) { + // If the source field is undefined (hasn't been set in the form) + // and if the user has selected a `logsdb` or `time_series` index mode in the Logistics step, + // update the form data with synthetic _source dispatch({ type: 'configuration.save', value: { ...state.configuration.defaultValue, _source: { mode: 'synthetic' } } as any, }); } } - }, [ - indexMode, - dispatch, - state.configuration, - state.hasEnterpriseLicense, - isLicenseCheckComplete, - ]); + }, [indexMode, dispatch, state.configuration, canUseSyntheticSource]); const tabToContentMap = { fields: ( diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_state_context.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_state_context.tsx index 4fd89ad0e25ad..ac19c5395f974 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_state_context.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_state_context.tsx @@ -60,7 +60,6 @@ export const StateProvider: React.FC<{ children?: React.ReactNode }> = ({ childr selectedDataTypes: [], }, inferenceToModelIdMap: {}, - hasEnterpriseLicense: false, mappingViewFields: { byId: {}, rootLevelFields: [], aliases: {}, maxNestedDepth: 0 }, }; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/reducer.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/reducer.ts index ecb9648c34d00..626ee0e839a8a 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/reducer.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/reducer.ts @@ -629,11 +629,5 @@ export const reducer = (state: State, action: Action): State => { inferenceToModelIdMap: action.value.inferenceToModelIdMap, }; } - case 'hasEnterpriseLicense.update': { - return { - ...state, - hasEnterpriseLicense: action.value, - }; - } } }; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/types/state.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/types/state.ts index 43b3a7dde3b16..f40fe420eb3be 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/types/state.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/types/state.ts @@ -108,7 +108,6 @@ export interface State { }; templates: TemplatesFormState; inferenceToModelIdMap?: InferenceToModelIdMap; - hasEnterpriseLicense: boolean; mappingViewFields: NormalizedFields; // state of the incoming index mappings, separate from the editor state above } @@ -141,7 +140,6 @@ export type Action = | { type: 'fieldsJsonEditor.update'; value: { json: { [key: string]: any }; isValid: boolean } } | { type: 'search:update'; value: string } | { type: 'validity:update'; value: boolean } - | { type: 'filter:update'; value: { selectedOptions: EuiSelectableOption[] } } - | { type: 'hasEnterpriseLicense.update'; value: boolean }; + | { type: 'filter:update'; value: { selectedOptions: EuiSelectableOption[] } }; export type Dispatch = (action: Action) => void; diff --git a/x-pack/plugins/index_management/public/application/mount_management_section.ts b/x-pack/plugins/index_management/public/application/mount_management_section.ts index da17bc4706c02..48a45579a01fc 100644 --- a/x-pack/plugins/index_management/public/application/mount_management_section.ts +++ b/x-pack/plugins/index_management/public/application/mount_management_section.ts @@ -57,6 +57,7 @@ export function getIndexManagementDependencies({ cloud, startDependencies, uiMetricService, + canUseSyntheticSource, }: { core: CoreStart; usageCollection: UsageCollectionSetup; @@ -68,6 +69,7 @@ export function getIndexManagementDependencies({ cloud?: CloudSetup; startDependencies: StartDependencies; uiMetricService: UiMetricService; + canUseSyntheticSource: boolean; }): AppDependencies { const { docLinks, application, uiSettings, settings } = core; const { url } = startDependencies.share; @@ -100,6 +102,7 @@ export function getIndexManagementDependencies({ docLinks, kibanaVersion, overlays: core.overlays, + canUseSyntheticSource, }; } @@ -112,6 +115,7 @@ export async function mountManagementSection({ kibanaVersion, config, cloud, + canUseSyntheticSource, }: { coreSetup: CoreSetup; usageCollection: UsageCollectionSetup; @@ -121,6 +125,7 @@ export async function mountManagementSection({ kibanaVersion: SemVer; config: AppDependencies['config']; cloud?: CloudSetup; + canUseSyntheticSource: boolean; }) { const { element, setBreadcrumbs, history } = params; const [core, startDependencies] = await coreSetup.getStartServices(); @@ -148,6 +153,7 @@ export async function mountManagementSection({ startDependencies, uiMetricService, usageCollection, + canUseSyntheticSource, }); const unmountAppCallback = renderApp(element, { core, dependencies: appDependencies }); diff --git a/x-pack/plugins/index_management/public/plugin.ts b/x-pack/plugins/index_management/public/plugin.ts index 5d857d8d8ac9c..82ba6505696aa 100644 --- a/x-pack/plugins/index_management/public/plugin.ts +++ b/x-pack/plugins/index_management/public/plugin.ts @@ -20,6 +20,7 @@ import { IndexManagementPluginStart, } from '@kbn/index-management-shared-types'; import { IndexManagementLocator } from '@kbn/index-management-shared-types'; +import { Subscription } from 'rxjs'; import { setExtensionsService } from './application/store/selectors/extension_service'; import { ExtensionsService } from './services/extensions_service'; @@ -57,6 +58,8 @@ export class IndexMgmtUIPlugin enableProjectLevelRetentionChecks: boolean; enableSemanticText: boolean; }; + private canUseSyntheticSource: boolean = false; + private licensingSubscription?: Subscription; constructor(ctx: PluginInitializerContext) { // Temporary hack to provide the service instances in module files in order to avoid a big refactor @@ -113,6 +116,7 @@ export class IndexMgmtUIPlugin kibanaVersion: this.kibanaVersion, config: this.config, cloud, + canUseSyntheticSource: this.canUseSyntheticSource, }); }, }); @@ -133,6 +137,11 @@ export class IndexMgmtUIPlugin public start(coreStart: CoreStart, plugins: StartDependencies): IndexManagementPluginStart { const { fleet, usageCollection, cloud, share, console, ml, licensing } = plugins; + + this.licensingSubscription = licensing?.license$.subscribe((next) => { + this.canUseSyntheticSource = next.hasAtLeast('enterprise'); + }); + return { extensionsService: this.extensionsService.setup(), getIndexMappingComponent: (deps: { history: ScopedHistory }) => { @@ -213,5 +222,7 @@ export class IndexMgmtUIPlugin }, }; } - public stop() {} + public stop() { + this.licensingSubscription?.unsubscribe(); + } } From a76084f30f8bc4b59deb2efef7b653bafe13c06c Mon Sep 17 00:00:00 2001 From: Sergi Romeu Date: Mon, 25 Nov 2024 13:48:31 +0100 Subject: [PATCH 14/71] Skip Serverless Transaction groups alerts when data is loaded with avg transaction duration alerts returns the correct number of alert counts (#201533) ## Summary Related to https://github.com/elastic/kibana/issues/201531 This PR skips `Transaction groups alerts when data is loaded with avg transaction duration alerts returns the correct number of alert counts`, which is inside `x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/transactions/transactions_groups_alerts.spec.ts` file, as it's failing on MKI. --- .../apm/transactions/transactions_groups_alerts.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/transactions/transactions_groups_alerts.spec.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/transactions/transactions_groups_alerts.spec.ts index 6abefb559bc2d..07b19ecc0b2a5 100644 --- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/transactions/transactions_groups_alerts.spec.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/transactions/transactions_groups_alerts.spec.ts @@ -73,7 +73,10 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon return response.body as TransactionsGroupsMainStatistics; } - describe('Transaction groups alerts', () => { + describe('Transaction groups alerts', function () { + // fails on MKI, see https://github.com/elastic/kibana/issues/201531 + this.tags(['failsOnMKI']); + describe('when data is loaded', () => { const transactions = [ { From db494181e37a3f3477361fc1c1919fc7ed3a1329 Mon Sep 17 00:00:00 2001 From: Jill Guyonnet Date: Mon, 25 Nov 2024 12:49:23 +0000 Subject: [PATCH 15/71] [Fleet] Handle unavailable spaces in agent policy space selector (#201251) ## Summary Closes https://github.com/elastic/kibana/issues/193827 This PR improves the space selector in agent policy setting to handle the case where the user does not have access to all policy spaces. In this case: * Space selection is disabled * The "Create space" link is hidden * A tooltip is shown to inform the user why the input is disabled * The inaccessible space badges are given an `Unavailable space` badge ### Screenshots For a user with access to all policy spaces (no change): ![Screenshot 2024-11-21 at 17 11 00](https://github.com/user-attachments/assets/79c4fcc5-17d5-4273-912c-07eecfd73715) For a user with access to only a subset of policy spaces: ![Screenshot 2024-11-21 at 17 11 09](https://github.com/user-attachments/assets/19ca162a-7ed6-45fd-8ecc-98e6e085af27) ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Elastic Machine --- .../plugins/fleet/common/constants/index.ts | 1 + .../fleet/common/constants/space_awareness.ts | 11 +++++ .../index.test.tsx | 49 +++++++++++++++++++ .../agent_policy_advanced_fields/index.tsx | 31 +++++++++--- .../components/settings/index.tsx | 13 +++-- .../translations/translations/fr-FR.json | 1 - .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - 8 files changed, 96 insertions(+), 12 deletions(-) create mode 100644 x-pack/plugins/fleet/common/constants/space_awareness.ts diff --git a/x-pack/plugins/fleet/common/constants/index.ts b/x-pack/plugins/fleet/common/constants/index.ts index 8ebfe005960c4..f51e85f22c526 100644 --- a/x-pack/plugins/fleet/common/constants/index.ts +++ b/x-pack/plugins/fleet/common/constants/index.ts @@ -25,6 +25,7 @@ export * from './message_signing_keys'; export * from './locators'; export * from './secrets'; export * from './uninstall_token'; +export * from './space_awareness'; // TODO: This is the default `index.max_result_window` ES setting, which dictates // the maximum amount of results allowed to be returned from a search. It's possible diff --git a/x-pack/plugins/fleet/common/constants/space_awareness.ts b/x-pack/plugins/fleet/common/constants/space_awareness.ts new file mode 100644 index 0000000000000..c89d0f4cddb00 --- /dev/null +++ b/x-pack/plugins/fleet/common/constants/space_awareness.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/** + * The identifier in a saved object's `namespaces` array when it is shared to an unknown space (e.g., one that the end user is not authorized to see). + */ +export const UNKNOWN_SPACE = '?'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.test.tsx index e404b30a37ced..61846bdbd7e24 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.test.tsx @@ -18,6 +18,8 @@ import type { AgentPolicy, NewAgentPolicy } from '../../../../../../../common/ty import { useLicense } from '../../../../../../hooks/use_license'; +import { useFleetStatus } from '../../../../hooks'; + import type { LicenseService } from '../../../../../../../common/services'; import { generateNewAgentPolicyWithDefaults } from '../../../../../../../common/services'; @@ -26,8 +28,13 @@ import type { ValidationResults } from '../agent_policy_validation'; import { AgentPolicyAdvancedOptionsContent } from '.'; jest.mock('../../../../../../hooks/use_license'); +jest.mock('../../../../hooks', () => ({ + ...jest.requireActual('../../../../hooks'), + useFleetStatus: jest.fn(), +})); const mockedUseLicence = useLicense as jest.MockedFunction; +const mockedUseFleetStatus = useFleetStatus as jest.MockedFunction; describe('Agent policy advanced options content', () => { let testRender: TestRenderer; @@ -40,6 +47,10 @@ describe('Agent policy advanced options content', () => { hasAtLeast: () => true, isPlatinum: () => true, } as unknown as LicenseService); + const useSpaceAwareness = () => + mockedUseFleetStatus.mockReturnValue({ + isSpaceAwarenessEnabled: true, + } as any); const render = ({ isProtected = false, @@ -47,6 +58,7 @@ describe('Agent policy advanced options content', () => { policyId = 'agent-policy-1', newAgentPolicy = false, packagePolicy = [createPackagePolicyMock()], + spaceIds = ['default'], } = {}) => { if (newAgentPolicy) { mockAgentPolicy = generateNewAgentPolicyWithDefaults(); @@ -56,6 +68,7 @@ describe('Agent policy advanced options content', () => { package_policies: packagePolicy, id: policyId, is_managed: isManaged, + space_ids: spaceIds, }; } @@ -72,6 +85,7 @@ describe('Agent policy advanced options content', () => { }; beforeEach(() => { + mockedUseFleetStatus.mockReturnValue({} as any); testRender = createFleetTestRendererMock(); }); afterEach(() => { @@ -173,4 +187,39 @@ describe('Agent policy advanced options content', () => { expect(renderResult.queryByText('This policy has no custom fields')).toBeInTheDocument(); }); }); + + describe('Space selector', () => { + beforeEach(() => { + usePlatinumLicense(); + }); + + describe('when space awareness is disabled', () => { + it('should not be rendered', () => { + render(); + expect(renderResult.queryByTestId('spaceSelectorInput')).not.toBeInTheDocument(); + }); + }); + + describe('when space awareness is enabled', () => { + beforeEach(() => { + useSpaceAwareness(); + }); + + describe('when the user has access to all policy spaces', () => { + it('should render the space selection input with the Create space link', () => { + render(); + expect(renderResult.queryByTestId('spaceSelectorInput')).toBeInTheDocument(); + expect(renderResult.queryByTestId('spaceSelectorInputLink')).toBeInTheDocument(); + }); + }); + + describe('when the user does not have access to all policy spaces', () => { + it('should render the space selection input without the Create space link', () => { + render({ spaceIds: ['default', '?'] }); + expect(renderResult.queryByTestId('spaceSelectorInput')).toBeInTheDocument(); + expect(renderResult.queryByTestId('spaceSelectorInputLink')).not.toBeInTheDocument(); + }); + }); + }); + }); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx index 305148584f545..b0889f825727f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx @@ -34,6 +34,7 @@ import { LEGACY_AGENT_POLICY_SAVED_OBJECT_TYPE, dataTypes, DEFAULT_MAX_AGENT_POLICIES_WITH_INACTIVITY_TIMEOUT, + UNKNOWN_SPACE, } from '../../../../../../../common/constants'; import type { NewAgentPolicy, AgentPolicy } from '../../../../types'; import { @@ -127,7 +128,12 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent = const isManagedorAgentlessPolicy = agentPolicy.is_managed === true || agentPolicy?.supports_agentless === true; - const agentPolicyFormContect = useAgentPolicyFormContext(); + const userHasAccessToAllPolicySpaces = useMemo( + () => 'space_ids' in agentPolicy && !agentPolicy.space_ids?.includes(UNKNOWN_SPACE), + [agentPolicy] + ); + + const agentPolicyFormContext = useAgentPolicyFormContext(); const AgentTamperProtectionSectionContent = useMemo( () => ( @@ -309,13 +315,14 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent = description={ = /> ), + tooltip: !userHasAccessToAllPolicySpaces && ( + + ), }} /> } + data-test-subj="spaceSelectorInput" > id !== UNKNOWN_SPACE) : [spaceId || 'default'] } - setInvalidSpaceError={agentPolicyFormContect?.setInvalidSpaceError} + setInvalidSpaceError={agentPolicyFormContext?.setInvalidSpaceError} onChange={(newValue) => { if (newValue.length === 0) { return; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx index 9de7a3f22adff..e0ea955cf5afe 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx @@ -39,13 +39,13 @@ import { import { DevtoolsRequestFlyoutButton } from '../../../../../components'; import { ExperimentalFeaturesService } from '../../../../../services'; import { generateUpdateAgentPolicyDevToolsRequest } from '../../../services'; +import { UNKNOWN_SPACE } from '../../../../../../../../common/constants'; -const pickAgentPolicyKeysToSend = (agentPolicy: AgentPolicy) => - pick(agentPolicy, [ +const pickAgentPolicyKeysToSend = (agentPolicy: AgentPolicy) => { + const partialPolicy = pick(agentPolicy, [ 'name', 'description', 'namespace', - 'space_ids', 'monitoring_enabled', 'unenroll_timeout', 'inactivity_timeout', @@ -61,6 +61,13 @@ const pickAgentPolicyKeysToSend = (agentPolicy: AgentPolicy) => 'monitoring_http', 'monitoring_diagnostics', ]); + return { + ...partialPolicy, + ...(!agentPolicy.space_ids?.includes(UNKNOWN_SPACE) && { + space_ids: agentPolicy.space_ids, + }), + }; +}; const FormWrapper = styled.div` max-width: 1200px; diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 06506ff9d1c93..0672227df5017 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -20488,7 +20488,6 @@ "xpack.fleet.agentPolicyForm.newAgentPolicyFieldLabel": "Nouveau nom de la stratégie d'agent", "xpack.fleet.agentPolicyForm.outputOptionDisabledTypeNotSupportedText": "La sortie {outputType} pour l'intégration des agents n'est pas prise en charge pour Fleet Server, Synthetics ou APM.", "xpack.fleet.agentPolicyForm.outputOptionDisableOutputTypeText": "La sortie {outputType} pour l'intégration des agents n'est pas prise en charge pour Fleet Server, Synthetics ou APM.", - "xpack.fleet.agentPolicyForm.spaceDescription": "Sélectionnez un ou plusieurs espaces pour cette politique ou créez un nouvel espace. {link}", "xpack.fleet.agentPolicyForm.spaceFieldLabel": "Espaces", "xpack.fleet.agentPolicyForm.systemMonitoringText": "Collecte des logs et des mesures du système", "xpack.fleet.agentPolicyForm.systemMonitoringTooltipText": "Cela ajoutera également une intégration {system} pour collecter les logs et les indicateurs du système.", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index d4c397428a8e0..c8781e36fe43a 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -20457,7 +20457,6 @@ "xpack.fleet.agentPolicyForm.newAgentPolicyFieldLabel": "新しいエージェントポリシー名", "xpack.fleet.agentPolicyForm.outputOptionDisabledTypeNotSupportedText": "Fleet Server、Synthetics、APMではエージェント統合の{outputType}出力はサポートされていません。", "xpack.fleet.agentPolicyForm.outputOptionDisableOutputTypeText": "Fleet Server、Synthetics、APMではエージェント統合の{outputType}出力はサポートされていません。", - "xpack.fleet.agentPolicyForm.spaceDescription": "このポリシーに1つ以上のスペースを選択するか、新しいスペースを作成します。{link}", "xpack.fleet.agentPolicyForm.spaceFieldLabel": "スペース", "xpack.fleet.agentPolicyForm.systemMonitoringText": "システムログとメトリックの収集", "xpack.fleet.agentPolicyForm.systemMonitoringTooltipText": "これにより、{system}統合も追加され、システムログとメトリックを収集します。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index e5ee0c1ede629..c6bb9b8da3ae9 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -20112,7 +20112,6 @@ "xpack.fleet.agentPolicyForm.newAgentPolicyFieldLabel": "新代理策略名称", "xpack.fleet.agentPolicyForm.outputOptionDisabledTypeNotSupportedText": "Fleet 服务器、Synthetics 或 APM 不支持代理集成的 {outputType} 输出。", "xpack.fleet.agentPolicyForm.outputOptionDisableOutputTypeText": "Fleet 服务器、Synthetics 或 APM 不支持代理集成的 {outputType} 输出。", - "xpack.fleet.agentPolicyForm.spaceDescription": "为此策略选择一个或多个工作区,或创建新工作区。{link}", "xpack.fleet.agentPolicyForm.spaceFieldLabel": "工作区", "xpack.fleet.agentPolicyForm.systemMonitoringText": "收集系统日志和指标", "xpack.fleet.agentPolicyForm.systemMonitoringTooltipText": "这还会添加 {system} 集成以收集系统日志和指标。", From e44de689fbe7e829a076a5e37fc48092868adaf5 Mon Sep 17 00:00:00 2001 From: Mykola Harmash Date: Mon, 25 Nov 2024 13:51:13 +0100 Subject: [PATCH 16/71] [Observability Onboarding] Add different test subjects to the footer links (#201383) Closes #201103 --- .../public/application/footer/footer.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/observability_solution/observability_onboarding/public/application/footer/footer.tsx b/x-pack/plugins/observability_solution/observability_onboarding/public/application/footer/footer.tsx index dae5f70bf3db0..8f8b0ec853dc7 100644 --- a/x-pack/plugins/observability_solution/observability_onboarding/public/application/footer/footer.tsx +++ b/x-pack/plugins/observability_solution/observability_onboarding/public/application/footer/footer.tsx @@ -43,6 +43,7 @@ export const Footer: FunctionComponent = () => { { defaultMessage: 'Explore demo' } ), link: URL_DEMO_ENV, + testSubject: 'observabilityOnboardingFooterExploreDemoLink', }, { iconUrl: forumIconUrl, @@ -65,6 +66,7 @@ export const Footer: FunctionComponent = () => { { defaultMessage: 'Open Elastic Discuss forum' } ), link: URL_FORUM, + testSubject: 'observabilityOnboardingFooterDiscussForumLink', }, { iconUrl: docsIconUrl, @@ -87,6 +89,7 @@ export const Footer: FunctionComponent = () => { { defaultMessage: 'Learn more about all Elastic features' } ), link: docLinks.links.observability.guide, + testSubject: 'observabilityOnboardingFooterLearnMoreLink', }, { iconUrl: supportIconUrl, @@ -105,6 +108,7 @@ export const Footer: FunctionComponent = () => { { defaultMessage: 'Open Support Hub' } ), link: helpSupportUrl, + testSubject: 'observabilityOnboardingFooterOpenSupportHubLink', }, ]; @@ -127,7 +131,7 @@ export const Footer: FunctionComponent = () => {

Date: Mon, 25 Nov 2024 13:56:45 +0100 Subject: [PATCH 17/71] [APM] Create dev script to be able to run Deployment agnostic tests (#201351) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Closes #201346 This PR adds a `dat` dev script, which lets you easily run APM deployment-agnostic tests, as we already do with `api` tests. ## Examples Run only server with stateful config ```sh node x-pack/plugins/observability_solution/apm/scripts/test/dat --stateful --server ``` Run only runner with stateful config ```sh node x-pack/plugins/observability_solution/apm/scripts/test/dat --stateful --runner ``` Run everything with serverless config ```sh node x-pack/plugins/observability_solution/apm/scripts/test/dat --serverless ``` More information [here](https://github.com/elastic/kibana/pull/201351/files#diff-5ca943bbe3962fc31cce510407cc1563a959b0fdb9cb52619f57e1f182a9751a) --------- Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com> --- .../apm/dev_docs/testing.md | 58 +++++++- .../apm/scripts/test/dat.js | 135 ++++++++++++++++++ 2 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 x-pack/plugins/observability_solution/apm/scripts/test/dat.js diff --git a/x-pack/plugins/observability_solution/apm/dev_docs/testing.md b/x-pack/plugins/observability_solution/apm/dev_docs/testing.md index 02ff43d37bf75..aeb9435a2e113 100644 --- a/x-pack/plugins/observability_solution/apm/dev_docs/testing.md +++ b/x-pack/plugins/observability_solution/apm/dev_docs/testing.md @@ -3,7 +3,9 @@ We've got three ways of testing our code: - Unit testing with Jest -- API testing +- Integration Tests + - Deployment specific (stateful or serverless) API testing + - Deployment-agnostic (both stateful and serverless) testing - End-to-end testing (with Cypress) API tests are usually preferred. They're stable and reasonably quick, and give a good approximation of real-world usage. @@ -73,7 +75,59 @@ node x-pack/plugins/observability_solution/apm/scripts/test/api --runner --basic #### API Test tips -- For data generation in API tests have a look at the [kbn-apm-synthtrace](../../../../packages/kbn-apm-synthtrace/README.md) package +- For data generation in API tests have a look at the [kbn-apm-synthtrace](../../../../../packages/kbn-apm-synthtrace/README.md) package +- For debugging access Elasticsearch on http://localhost:9220 and Kibana on http://localhost:5620 (`elastic` / `changeme`) + +--- + +## Deployment-agnostic Tests (dat) + +| Option | Description | +| ------------ | ----------------------------------------------- | +| --serverless | Loads serverless configuration | +| --stateful | Loads stateful configuration | +| --server | Only start ES and Kibana | +| --runner | Only run tests | +| --grep | Specify the specs to run | +| --grep-files | Specify the files to run | +| --inspect | Add --inspect-brk flag to the ftr for debugging | +| --times | Repeat the test n number of times | + +Deployment-agnostic tests are located in [`x-pack/test/deployment_agnostic/apis/observability/apm/index.ts`](../../../../test/api_integration/deployment_agnostic/apis/observability/apm/index.ts). + +#### Start server and run test (single process) + +``` +node x-pack/plugins/observability_solution/apm/scripts/test/dat [--serverless/--stateful] [--help] +``` + +The above command will start an ES instance on http://localhost:9220, a Kibana instance on http://localhost:5620 and run the api tests. +Once the tests finish, the instances will be terminated. + +#### Start server and run test (separate processes) + +```sh + +# start server +node x-pack/plugins/observability_solution/apm/scripts/test/dat --server --stateful + +# run tests +node x-pack/plugins/observability_solution/apm/scripts/test/dat --runner --stateful --grep-files=error_group_list +``` + +### Update snapshots (from Kibana root) + +To update snapshots append `--updateSnapshots` to the `--runner` command: + +``` +node x-pack/plugins/observability_solution/apm/scripts/test/dat --runner --stateful --updateSnapshots +``` + +(The test server needs to be running) + +#### API Test tips + +- For data generation in Deployment-agnostic tests have a look at the [kbn-apm-synthtrace](../../../../../packages/kbn-apm-synthtrace/README.md) package - For debugging access Elasticsearch on http://localhost:9220 and Kibana on http://localhost:5620 (`elastic` / `changeme`) --- diff --git a/x-pack/plugins/observability_solution/apm/scripts/test/dat.js b/x-pack/plugins/observability_solution/apm/scripts/test/dat.js new file mode 100644 index 0000000000000..b457cd4da5e76 --- /dev/null +++ b/x-pack/plugins/observability_solution/apm/scripts/test/dat.js @@ -0,0 +1,135 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/* eslint-disable no-console */ +const { times } = require('lodash'); +const yargs = require('yargs'); +const path = require('path'); +const childProcess = require('child_process'); +const { REPO_ROOT } = require('@kbn/repo-info'); + +const { argv } = yargs(process.argv.slice(2)) + .option('serverless', { + default: false, + type: 'boolean', + description: 'Loads serverless configuration', + }) + .option('stateful', { + default: false, + type: 'boolean', + description: 'Loads stateful configuration', + }) + .option('server', { + default: false, + type: 'boolean', + description: 'Only start ES and Kibana', + }) + .option('runner', { + default: false, + type: 'boolean', + description: 'Only run tests', + }) + .option('grep', { + alias: 'spec', + type: 'string', + description: 'Specify the specs to run', + }) + .option('grep-files', { + alias: 'files', + type: 'array', + string: true, + description: 'Specify the files to run', + }) + .option('inspect', { + default: false, + type: 'boolean', + description: 'Add --inspect-brk flag to the ftr for debugging', + }) + .option('times', { + type: 'number', + description: 'Repeat the test n number of times', + }) + .option('updateSnapshots', { + default: false, + type: 'boolean', + description: 'Update snapshots', + }) + .option('bail', { + default: false, + type: 'boolean', + description: 'Stop the test run at the first failure', + }) + .check((argv) => { + const { inspect, runner } = argv; + if (inspect && !runner) { + throw new Error('--inspect can only be used with --runner'); + } else { + return true; + } + }) + .help(); + +const { serverless, stateful, bail, server, runner, grep, grepFiles, inspect, updateSnapshots } = + argv; + +if ((serverless === false && stateful === false) || (serverless && stateful)) { + throw new Error('Please specify either --stateful or --serverless'); +} + +let ftrScript = 'functional_tests'; +if (server) { + ftrScript = 'functional_tests_server'; +} else if (runner) { + ftrScript = 'functional_test_runner'; +} + +const environment = serverless ? 'serverless' : 'stateful'; + +const cmd = [ + 'node', + ...(inspect ? ['--inspect-brk'] : []), + `${REPO_ROOT}/scripts/${ftrScript}`, + ...(grep ? [`--grep "${grep}"`] : []), + ...(updateSnapshots ? [`--updateSnapshots`] : []), + ...(bail ? [`--bail`] : []), + `--config ${REPO_ROOT}/x-pack/test/api_integration/deployment_agnostic/configs/${environment}/oblt.apm.${environment}.config.ts`, +].join(' '); + +console.log(`Running: "${cmd}"`); + +function runTests() { + childProcess.execSync(cmd, { + cwd: path.join(__dirname), + stdio: 'inherit', + env: { ...process.env, APM_TEST_GREP_FILES: JSON.stringify(grepFiles) }, + }); +} + +if (argv.times) { + const runCounter = { succeeded: 0, failed: 0, remaining: argv.times }; + let exitStatus = 0; + times(argv.times, () => { + try { + runTests(); + runCounter.succeeded++; + } catch (e) { + if (bail) { + throw e; + } + + exitStatus = 1; + runCounter.failed++; + } + runCounter.remaining--; + if (argv.times > 1) { + console.log(runCounter); + } + }); + process.exit(exitStatus); +} else { + runTests(); +} From 8964dc92c774d9ac5c82a411022ece3fb91e3cfd Mon Sep 17 00:00:00 2001 From: Bharat Pasupula <123897612+bhapas@users.noreply.github.com> Date: Mon, 25 Nov 2024 14:00:14 +0100 Subject: [PATCH 18/71] [Automatic Import] Remove fields with @ from the script processor (#201548) ## Summary This PR filters the fields containing `@` in date type from `script` processor. ## Before this PR ![image](https://github.com/user-attachments/assets/a733d81f-aaaf-4787-b974-1e5d35ff4b8f) ```json { "script": { "tag": "script_convert_array_to_string", "description": "Ensures the date processor does not receive an array value.", "lang": "painless", "source": "if (ctx.varonis?.varonis_alerts?.@timestamp != null &&\n ctx.varonis.varonis_alerts.@timestamp instanceof ArrayList){\n ctx.varonis.varonis_alerts.@timestamp = ctx.varonis.varonis_alerts.@timestamp[0];\n}\n" } }, { "date": { "if": "ctx.varonis?.varonis_alerts?.@timestamp != null", "tag": "date_processor_varonis.varonis_alerts.@timestamp", "field": "varonis.varonis_alerts.@timestamp", "target_field": "event.start", "formats": [ "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "ISO8601" ] } }, ``` ## After this PR ```json "date": { "if": "ctx.varonis?.varonis_alerts?.@timestamp != null", "tag": "date_processor_varonis.varonis_alerts.@timestamp", "field": "varonis.varonis_alerts.@timestamp", "target_field": "event.start", "formats": [ "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "ISO8601" ] } }, ``` ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --- .../__jest__/fixtures/ecs_mapping.ts | 381 ++++++++++++++++++ .../server/graphs/ecs/pipeline.test.ts | 306 ++++++++++++++ .../server/graphs/ecs/pipeline.ts | 3 + .../server/templates/pipeline.yml.njk | 3 +- 4 files changed, 692 insertions(+), 1 deletion(-) create mode 100644 x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.test.ts diff --git a/x-pack/plugins/integration_assistant/__jest__/fixtures/ecs_mapping.ts b/x-pack/plugins/integration_assistant/__jest__/fixtures/ecs_mapping.ts index 67e6c7d8f6a5e..8b905ccd64f96 100644 --- a/x-pack/plugins/integration_assistant/__jest__/fixtures/ecs_mapping.ts +++ b/x-pack/plugins/integration_assistant/__jest__/fixtures/ecs_mapping.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { EcsMappingState } from '../../server/types'; import { SamplesFormatName } from '../../common'; export const ecsMappingExpectedResults = { @@ -480,3 +481,383 @@ export const ecsTestState = { combinedSamples: '{"test1": "test1"}', additionalProcessors: [], }; + +export const ecsPipelineState: EcsMappingState = { + lastExecutedChain: 'validateMappings', + rawSamples: [], + additionalProcessors: [], + prefixedSamples: [ + '{"xdfsfs":{"ds":{"ei":0,"event":"cert.create","uid":"efd326fc-dd13-4df8-erre-3102c2d717d3","code":"TC000I","time":"2024-02-24T06:56:50.648137154Z","cluster_name":"teleport.ericbeahan.com","cert_type":"user","identity":{"user":"teleport-admin","roles":["access","editor"],"logins":["root","ubuntu","ec2-user","-teleport-internal-join"],"expires":"2024-02-24T06:56:50.648137154Z","route_to_cluster":"teleport.ericbeahan.com","traits":{"aws_role_arns":null,"azure_identities":null,"db_names":null,"db_roles":null,"db_users":null,"gcp_service_accounts":null,"host_user_gid":[""],"host_user_uid":[""],"kubernetes_groups":null,"kubernetes_users":null,"logins":["root","ubuntu","ec2-user"],"windows_logins":null},"teleport_cluster":"teleport.ericbeahan.com","client_ip":"1.2.3.4","prev_identity_expires":"0001-01-01T00:00:00Z","private_key_policy":"none"}}}}', + '{"xdfsfs":{"ds":{"ei":0,"event":"session.start","uid":"fff30583-13be-49e8-b159-32952c6ea34f","code":"T2000I","time":"2024-02-23T18:56:57.648137154Z","cluster_name":"teleport.ericbeahan.com","user":"teleport-admin","login":"ec2-user","user_kind":1,"sid":"293fda2d-2266-4d4d-b9d1-bd5ea9dd9fc3","private_key_policy":"none","namespace":"default","server_id":"face0091-2bf1-54er-a16a-f1514b4119f4","server_hostname":"ip-172-31-8-163.us-east-2.compute.internal","server_labels":{"hostname":"ip-172-31-8-163.us-east-2.compute.internal","teleport.internal/resource-id":"dccb2999-9fb8-4169-aded-ec7a1c0a26de"},"addr.remote":"1.2.3.4:50339","proto":"ssh","size":"80:25","initial_command":[""],"session_recording":"node"}}}', + ], + combinedSamples: + '{\n "xdfsfs": {\n "ds": {\n "identity": {\n "client_ip": "1.2.3.4",\n "prev_identity_expires": "0001-01-01T00:00:00Z",\n "private_key_policy": "none"\n },\n "user": "teleport-admin",\n "login": "ec2-user",\n "user_kind": 1,\n "sid": "293fda2d-2266-4d4d-b9d1-bd5ea9dd9fc3",\n "private_key_policy": "none",\n "namespace": "default",\n "server_id": "face0091-2bf1-43fd-a16a-f1514b4119f4",\n "server_hostname": "ip-172-31-8-163.us-east-2.compute.internal",\n "server_labels": {\n "hostname": "ip-172-31-8-163.us-east-2.compute.internal",\n "teleport.internal/resource-id": "dccb2999-9fb8-4169-aded-ec7a1c0a26de"\n },\n "addr.remote": "1.2.3.4:50339",\n "proto": "ssh",\n "size": "80:25",\n "initial_command": [\n ""\n ],\n "session_recording": "node"\n }\n }\n}', + sampleChunks: [], + exAnswer: + '{\n "crowdstrike": {\n "falcon": {\n "metadata": {\n "customerIDString": null,\n "offset": null,\n "eventType": {\n "target": "event.code",\n "confidence": 0.94,\n "type": "string",\n "date_formats": []\n },\n "eventCreationTime": {\n "target": "event.created",\n "confidence": 0.85,\n "type": "date",\n "date_formats": [\n "UNIX"\n ]\n },\n "version": null,\n "event": {\n "DeviceId": null,\n "CustomerId": null,\n "Ipv": {\n "target": "network.type",\n "confidence": 0.99,\n "type": "string",\n "date_formats": []\n }\n }\n }\n }\n }\n}', + packageName: 'xdfsfs', + dataStreamName: 'ds', + finalized: false, + currentMapping: { + xdfsfs: { + ds: { + identity: { + client_ip: { + target: 'client.ip', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + prev_identity_expires: { + target: 'event.end', + confidence: 0.7, + type: 'date', + date_formats: ["yyyy-MM-dd'T'HH:mm:ss'Z'"], + }, + private_key_policy: null, + }, + user: { + target: 'user.name', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + login: { + target: 'user.id', + confidence: 0.8, + type: 'string', + date_formats: [], + }, + user_kind: null, + sid: { + target: 'event.id', + confidence: 0.85, + type: 'string', + date_formats: [], + }, + private_key_policy: null, + namespace: null, + server_id: { + target: 'host.id', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + server_hostname: { + target: 'host.hostname', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + server_labels: { + hostname: null, + 'teleport.internal/resource-id': null, + }, + 'addr.remote': { + target: 'source.address', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + proto: { + target: 'network.protocol', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + size: null, + initial_command: null, + session_recording: null, + }, + }, + }, + chunkMapping: { + xdfsfs: { + ds: { + ei: null, + event: { + target: 'event.action', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + uid: { + target: 'event.id', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + code: { + target: 'event.code', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + time: { + target: 'event.created', + confidence: 0.95, + type: 'date', + date_formats: ["yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'"], + }, + cluster_name: { + target: 'cloud.account.name', + confidence: 0.8, + type: 'string', + date_formats: [], + }, + cert_type: null, + identity: { + user: { + target: 'user.name', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + roles: { + target: 'user.roles', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + logins: null, + expires: { + target: 'user.changes.name', + confidence: 0.7, + type: 'date', + date_formats: ["yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'"], + }, + route_to_cluster: null, + traits: { + aws_role_arns: null, + azure_identities: null, + db_names: null, + db_roles: null, + db_users: null, + gcp_service_accounts: null, + host_user_gid: null, + host_user_uid: null, + kubernetes_groups: null, + kubernetes_users: null, + logins: null, + windows_logins: null, + }, + teleport_cluster: null, + client_ip: { + target: 'client.ip', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + prev_identity_expires: { + target: 'event.end', + confidence: 0.7, + type: 'date', + date_formats: ["yyyy-MM-dd'T'HH:mm:ss'Z'"], + }, + private_key_policy: null, + }, + user: { + target: 'user.name', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + login: { + target: 'user.id', + confidence: 0.8, + type: 'string', + date_formats: [], + }, + user_kind: null, + sid: { + target: 'event.id', + confidence: 0.85, + type: 'string', + date_formats: [], + }, + private_key_policy: null, + namespace: null, + server_id: { + target: 'host.id', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + server_hostname: { + target: 'host.hostname', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + server_labels: { + hostname: null, + 'teleport.internal/resource-id': null, + }, + 'addr.remote': { + target: 'source.address', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + proto: { + target: 'network.protocol', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + size: null, + initial_command: null, + session_recording: null, + }, + }, + }, + finalMapping: { + xdfsfs: { + ds: { + ei: null, + event: { + target: 'event.action', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + uid: { + target: 'event.id', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + code: { + target: 'event.code', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + '@timestamp': { + target: '@timestamp', + confidence: 0.95, + type: 'date', + date_formats: ["yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'"], + }, + cluster_name: { + target: 'cloud.account.name', + confidence: 0.8, + type: 'string', + date_formats: [], + }, + cert_type: null, + identity: { + user: { + target: 'user.name', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + roles: { + target: 'user.roles', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + logins: null, + expires: { + target: 'user.changes.name', + confidence: 0.7, + type: 'date', + date_formats: ["yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'"], + }, + route_to_cluster: null, + traits: { + aws_role_arns: null, + azure_identities: null, + db_names: null, + db_roles: null, + db_users: null, + gcp_service_accounts: null, + host_user_gid: null, + host_user_uid: null, + kubernetes_groups: null, + kubernetes_users: null, + logins: null, + windows_logins: null, + }, + teleport_cluster: null, + client_ip: { + target: 'client.ip', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + prev_identity_expires: { + target: 'event.end', + confidence: 0.7, + type: 'date', + date_formats: ["yyyy-MM-dd'T'HH:mm:ss'Z'"], + }, + private_key_policy: null, + }, + user: { + target: 'user.name', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + login: { + target: 'user.id', + confidence: 0.8, + type: 'string', + date_formats: [], + }, + user_kind: null, + sid: null, + private_key_policy: null, + namespace: null, + server_id: { + target: 'host.id', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + server_hostname: { + target: 'host.hostname', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + server_labels: { + hostname: null, + 'teleport.internal/resource-id': null, + }, + 'addr.remote': { + target: 'source.address', + confidence: 0.9, + type: 'string', + date_formats: [], + }, + proto: { + target: 'network.protocol', + confidence: 0.95, + type: 'string', + date_formats: [], + }, + size: null, + initial_command: null, + session_recording: null, + }, + }, + }, + useFinalMapping: true, + hasTriedOnce: true, + currentPipeline: {}, + duplicateFields: [], + missingKeys: [], + invalidEcsFields: [], + results: {}, + samplesFormat: { + name: 'json', + json_path: [], + }, + ecsVersion: '8.11.0', + ecs: '', + chunkSize: 0, +}; diff --git a/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.test.ts b/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.test.ts new file mode 100644 index 0000000000000..3dda9208c3094 --- /dev/null +++ b/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.test.ts @@ -0,0 +1,306 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ecsPipelineState } from '../../../__jest__/fixtures/ecs_mapping'; +import type { EcsMappingState } from '../../types'; +import { createPipeline } from './pipeline'; + +const state: EcsMappingState = ecsPipelineState; + +describe('Testing pipeline templates', () => { + it('handle pipeline creation', async () => { + const pipeline = createPipeline(state); + expect(pipeline.processors).toEqual([ + { + set: { field: 'ecs.version', tag: 'set_ecs_version', value: '8.11.0' }, + }, + { + set: { + field: 'originalMessage', + copy_from: 'message', + tag: 'copy_original_message', + }, + }, + { + rename: { + field: 'originalMessage', + target_field: 'event.original', + tag: 'rename_message', + ignore_missing: true, + if: 'ctx.event?.original == null', + }, + }, + { + remove: { + field: 'originalMessage', + ignore_missing: true, + tag: 'remove_copied_message', + if: 'ctx.event?.original != null', + }, + }, + { + remove: { field: 'message', ignore_missing: true, tag: 'remove_message' }, + }, + { + json: { + field: 'event.original', + tag: 'json_original', + target_field: 'xdfsfs.ds', + }, + }, + { + rename: { + field: 'xdfsfs.ds.event', + target_field: 'event.action', + ignore_missing: true, + }, + }, + { + rename: { + field: 'xdfsfs.ds.uid', + target_field: 'event.id', + ignore_missing: true, + }, + }, + { + rename: { + field: 'xdfsfs.ds.code', + target_field: 'event.code', + ignore_missing: true, + }, + }, + { + date: { + field: 'xdfsfs.ds.@timestamp', + target_field: '@timestamp', + formats: ["yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'", 'ISO8601'], + tag: 'date_processor_xdfsfs.ds.@timestamp', + if: 'ctx.xdfsfs?.ds?.@timestamp != null', + }, + }, + { + rename: { + field: 'xdfsfs.ds.cluster_name', + target_field: 'cloud.account.name', + ignore_missing: true, + }, + }, + { + rename: { + field: 'xdfsfs.ds.identity.user', + target_field: 'user.name', + ignore_missing: true, + }, + }, + { + rename: { + field: 'xdfsfs.ds.identity.roles', + target_field: 'user.roles', + ignore_missing: true, + }, + }, + { + script: { + description: 'Ensures the date processor does not receive an array value.', + tag: 'script_convert_array_to_string', + lang: 'painless', + source: + 'if (ctx.xdfsfs?.ds?.identity?.expires != null &&\n' + + ' ctx.xdfsfs.ds.identity.expires instanceof ArrayList){\n' + + ' ctx.xdfsfs.ds.identity.expires = ctx.xdfsfs.ds.identity.expires[0];\n' + + '}\n', + }, + }, + { + date: { + field: 'xdfsfs.ds.identity.expires', + target_field: 'user.changes.name', + formats: ["yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'", 'ISO8601'], + tag: 'date_processor_xdfsfs.ds.identity.expires', + if: 'ctx.xdfsfs?.ds?.identity?.expires != null', + }, + }, + { + convert: { + field: 'xdfsfs.ds.identity.client_ip', + target_field: 'client.ip', + ignore_missing: true, + ignore_failure: true, + type: 'ip', + }, + }, + { + script: { + description: 'Ensures the date processor does not receive an array value.', + tag: 'script_convert_array_to_string', + lang: 'painless', + source: + 'if (ctx.xdfsfs?.ds?.identity?.prev_identity_expires != null &&\n' + + ' ctx.xdfsfs.ds.identity.prev_identity_expires instanceof ArrayList){\n' + + ' ctx.xdfsfs.ds.identity.prev_identity_expires = ctx.xdfsfs.ds.identity.prev_identity_expires[0];\n' + + '}\n', + }, + }, + { + date: { + field: 'xdfsfs.ds.identity.prev_identity_expires', + target_field: 'event.end', + formats: ["yyyy-MM-dd'T'HH:mm:ss'Z'", 'ISO8601'], + tag: 'date_processor_xdfsfs.ds.identity.prev_identity_expires', + if: 'ctx.xdfsfs?.ds?.identity?.prev_identity_expires != null', + }, + }, + { + rename: { + field: 'xdfsfs.ds.user', + target_field: 'user.name', + ignore_missing: true, + }, + }, + { + rename: { + field: 'xdfsfs.ds.login', + target_field: 'user.id', + ignore_missing: true, + }, + }, + { + rename: { + field: 'xdfsfs.ds.server_id', + target_field: 'host.id', + ignore_missing: true, + }, + }, + { + rename: { + field: 'xdfsfs.ds.server_hostname', + target_field: 'host.hostname', + ignore_missing: true, + }, + }, + { + rename: { + field: 'xdfsfs.ds.addr.remote', + target_field: 'source.address', + ignore_missing: true, + }, + }, + { + rename: { + field: 'xdfsfs.ds.proto', + target_field: 'network.protocol', + ignore_missing: true, + }, + }, + { + script: { + description: 'Drops null/empty values recursively.', + tag: 'script_drop_null_empty_values', + lang: 'painless', + source: + 'boolean dropEmptyFields(Object object) {\n' + + ' if (object == null || object == "") {\n' + + ' return true;\n' + + ' } else if (object instanceof Map) {\n' + + ' ((Map) object).values().removeIf(value -> dropEmptyFields(value));\n' + + ' return (((Map) object).size() == 0);\n' + + ' } else if (object instanceof List) {\n' + + ' ((List) object).removeIf(value -> dropEmptyFields(value));\n' + + ' return (((List) object).length == 0);\n' + + ' }\n' + + ' return false;\n' + + '}\n' + + 'dropEmptyFields(ctx);\n', + }, + }, + { + geoip: { + field: 'source.ip', + tag: 'geoip_source_ip', + target_field: 'source.geo', + ignore_missing: true, + }, + }, + { + geoip: { + ignore_missing: true, + database_file: 'GeoLite2-ASN.mmdb', + field: 'source.ip', + tag: 'geoip_source_asn', + target_field: 'source.as', + properties: ['asn', 'organization_name'], + }, + }, + { + rename: { + field: 'source.as.asn', + tag: 'rename_source_as_asn', + target_field: 'source.as.number', + ignore_missing: true, + }, + }, + { + rename: { + field: 'source.as.organization_name', + tag: 'rename_source_as_organization_name', + target_field: 'source.as.organization.name', + ignore_missing: true, + }, + }, + { + geoip: { + field: 'destination.ip', + tag: 'geoip_destination_ip', + target_field: 'destination.geo', + ignore_missing: true, + }, + }, + { + geoip: { + database_file: 'GeoLite2-ASN.mmdb', + field: 'destination.ip', + tag: 'geoip_destination_asn', + target_field: 'destination.as', + properties: ['asn', 'organization_name'], + ignore_missing: true, + }, + }, + { + rename: { + field: 'destination.as.asn', + tag: 'rename_destination_as_asn', + target_field: 'destination.as.number', + ignore_missing: true, + }, + }, + { + rename: { + field: 'destination.as.organization_name', + tag: 'rename_destination_as_organization_name', + target_field: 'destination.as.organization.name', + ignore_missing: true, + }, + }, + { + remove: { + field: ['xdfsfs.ds.identity.client_ip'], + ignore_missing: true, + tag: 'remove_fields', + }, + }, + { + remove: { + field: 'event.original', + tag: 'remove_original_event', + if: 'ctx?.tags == null || !(ctx.tags.contains("preserve_original_event"))', + ignore_failure: true, + ignore_missing: true, + }, + }, + ]); + }); +}); diff --git a/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts b/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts index b5a6e23000d32..dda48c97bdf98 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts @@ -186,6 +186,9 @@ export function createPipeline(state: EcsMappingState): IngestPipeline { const env = new Environment(new FileSystemLoader(templatesPath), { autoescape: false, }); + env.addFilter('includes', function (str, substr) { + return str.includes(substr); + }); env.addFilter('startswith', function (str, prefix) { return str.startsWith(prefix); }); diff --git a/x-pack/plugins/integration_assistant/server/templates/pipeline.yml.njk b/x-pack/plugins/integration_assistant/server/templates/pipeline.yml.njk index ba846dc50fba9..116d5cc66719f 100644 --- a/x-pack/plugins/integration_assistant/server/templates/pipeline.yml.njk +++ b/x-pack/plugins/integration_assistant/server/templates/pipeline.yml.njk @@ -35,6 +35,7 @@ processors: target_field: {% if value.target_field | startswith('@') %}"{{ value.target_field }}"{% else %}{{ value.target_field }}{% endif %} ignore_missing: true{% endif %} {% if key == 'date' %} + {% if not value.field | includes('.@') %} {# Leaving fields of type 'test.log.@timestamp' #} - script: description: Ensures the date processor does not receive an array value. tag: script_convert_array_to_string @@ -43,7 +44,7 @@ processors: if (ctx.{% endraw %}{{ value.field.replaceAll('.', '?.') }}{% raw %} != null && ctx.{% endraw %}{{ value.field }}{% raw %} instanceof ArrayList){ ctx.{% endraw %}{{ value.field }}{% raw %} = ctx.{% endraw %}{{ value.field }}{% raw %}[0]; - }{% endraw %} + }{% endraw %}{% endif %} - {{ key }}: field: {{ value.field }} target_field: {% if value.target_field | startswith('@') %}"{{ value.target_field }}"{% else %}{{ value.target_field }}{% endif %} From 5d6d45c34176a5933725220011ed61bddbab8d18 Mon Sep 17 00:00:00 2001 From: Tre Date: Mon, 25 Nov 2024 13:03:53 +0000 Subject: [PATCH 19/71] [Ownership] Assign test files to viz team (#200934) ## Summary Assign test files to viz team Contributes to: #192979 --------- Co-authored-by: Elastic Machine --- .github/CODEOWNERS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 29d8ac10e20cd..7773d3ca95347 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1119,6 +1119,16 @@ src/plugins/discover/public/context_awareness/profile_providers/security @elasti /x-pack/test/screenshot_creation @elastic/platform-docs # Visualizations +/x-pack/test/functional/fixtures/kbn_archiver/rollup @elastic/kibana-visualizations # Assigned per the only uses are in lens and tsvb tests +/x-pack/test/functional/fixtures/kbn_archiver/hybrid_dataview.json @elastic/kibana-visualizations # Assigned per only use: https://github.com/elastic/kibana/blob/main/x-pack/test/functional/apps/visualize/hybrid_visualization.ts#L20 +/x-pack/test/functional/es_archives/pre_calculated_histogram @elastic/kibana-visualizations # Assigned per usages +/x-pack/test/functional/es_archives/hybrid/rollup @elastic/kibana-visualizations @elastic/search-kibana # Assigned per usage +/x-pack/test/functional/es_archives/hybrid/logstash @elastic/kibana-visualizations # Assigned per only use: https://github.com/elastic/kibana/blob/main/x-pack/test/functional/apps/visualize/hybrid_visualization.ts#L22 +/x-pack/test/functional/es_archives/graph @elastic/kibana-visualizations +/x-pack/test/functional/es_archives/visualize @elastic/kibana-visualizations +/test/functional/fixtures/kbn_archiver/visualize.json @elastic/kibana-visualizations +/test/functional/fixtures/kbn_archiver/managed_content.json @elastic/kibana-visualizations # Assigned per only use: https://github.com/elastic/kibana/blob/main/x-pack/test/functional/apps/managed_content/managed_content.ts#L38 +/test/api_integration/fixtures/kbn_archiver/event_annotations/event_annotations.json @elastic/kibana-visualizations /test/functional/page_objects/unified_search_page.ts @elastic/kibana-visualizations # Assigned per https://github.com/elastic/kibana/pull/200132#discussion_r1847188168 /test/functional/apps/getting_started/*.ts @elastic/kibana-visualizations # Assigned per https://github.com/elastic/kibana/pull/199767#discussion_r1840485031 /x-pack/test/upgrade/apps/graph @elastic/kibana-visualizations From 34bf83b54f6b59d8d6aee5c1d4d201ac1775014e Mon Sep 17 00:00:00 2001 From: Elena Shostak <165678770+elena-shostak@users.noreply.github.com> Date: Mon, 25 Nov 2024 14:07:40 +0100 Subject: [PATCH 20/71] Dependency usage CLI (#198920) ## Summary [dependency-cruiser](https://github.com/sverweij/dependency-cruiser/tree/main) is used for building dependency graph. ### Show all dependencies for a specific package/plugin or directory #### Run for all plugins ```bash bash scripts/dependency_usage.sh -p x-pack/plugins -o ./tmp/deps-result-all.json ``` #### Run for single plugin ```bash bash scripts/dependency_usage.sh -p x-pack/plugins/security_solution -o ./tmp/deps-result-single.json ``` #### Run for multiple plugins ```bash bash scripts/dependency_usage.sh -p x-pack/plugins/security_solution x-pack/plugins/security -o ./tmp/deps-result-multiple.json ``` #### Run for `x-pack/packages` ```bash bash scripts/dependency_usage.sh -p x-pack/packages -o ./tmp/deps-packages-1.json ``` #### Run for `packages` ```bash bash scripts/dependency_usage.sh -p packages -o ./tmp/deps-packages-2.json ``` #### Benchmark | Analysis | Real Time | User Time | Sys Time | |-----------------------|-------------|-------------|------------| | All plugins | 7m 21.126s | 7m 53.099s | 20.581s | | Single plugin | 31.360s | 45.352s | 2.208s | | Multiple plugins | 36.403s | 50.563s | 2.814s | | x-pack/packages | 6.638s | 12.646s | 0.654s | | packages | 25.744s | 39.073s | 2.191s | #### Show all packages/plugins within a directory that use a specific dependency ```sh bash scripts/dependency_usage.sh -d rxjs -p x-pack/plugins/security_solution ``` --- #### Show all packages/plugins within a directory grouped by code owner ```sh bash scripts/dependency_usage.sh -d rxjs -p x-pack/plugins -g owner ``` --- #### Group by code owner with adjustable collapse depth for fine-grained grouping **Fine-grained grouping**: ```sh bash scripts/dependency_usage.sh -p x-pack/plugins/security_solution -g owner --collapse-depth 4 ``` **Collapsed grouping**: groups the results under a higher-level owner (e.g., `security_solution` as a single group). ```bash bash scripts/dependency_usage.sh -p x-pack/plugins/security_solution -g owner --collapse-depth 1 ``` --- #### Show all dependencies matching a pattern (e.g., `react-*`) within a package ```bash bash scripts/dependency_usage.sh -p x-pack/plugins/security_solution -d 'react-*' -o ./tmp/result.json ``` ### Checklist - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios __Related: https://github.com/elastic/kibana/issues/196767__ --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine --- .eslintrc.js | 9 + .github/CODEOWNERS | 1 + .gitignore | 2 + package.json | 2 + packages/kbn-dependency-usage/README.md | 153 ++++++++ packages/kbn-dependency-usage/jest.config.js | 15 + packages/kbn-dependency-usage/kibana.jsonc | 6 + packages/kbn-dependency-usage/package.json | 11 + packages/kbn-dependency-usage/src/cli.test.ts | 97 +++++ packages/kbn-dependency-usage/src/cli.ts | 169 +++++++++ .../src/dependency_graph/common/constants.ts | 37 ++ .../src/dependency_graph/index.ts | 10 + .../providers/cruiser.test.ts | 354 ++++++++++++++++++ .../src/dependency_graph/providers/cruiser.ts | 147 ++++++++ .../src/lib/code_owners.test.ts | 99 +++++ .../src/lib/code_owners.ts | 84 +++++ .../src/lib/collapse_with_depth.test.ts | 36 ++ .../src/lib/collapse_with_depth.ts | 18 + .../src/lib/group_by_owners.test.ts | 116 ++++++ .../src/lib/group_by_owners.ts | 89 +++++ .../src/lib/group_by_source.test.ts | 86 +++++ .../src/lib/group_by_source.ts | 30 ++ .../kbn-dependency-usage/src/lib/index.ts | 11 + packages/kbn-dependency-usage/tsconfig.json | 20 + packages/kbn-repo-packages/index.js | 2 + packages/kbn-ts-projects/ts_project.ts | 4 + scripts/dependency_usage.sh | 7 + src/dev/eslint/run_eslint_with_types.ts | 4 +- ...te.js => types.eslint.config.template.cjs} | 0 tsconfig.base.json | 2 + yarn.lock | 184 +++++++-- 31 files changed, 1779 insertions(+), 26 deletions(-) create mode 100644 packages/kbn-dependency-usage/README.md create mode 100644 packages/kbn-dependency-usage/jest.config.js create mode 100644 packages/kbn-dependency-usage/kibana.jsonc create mode 100644 packages/kbn-dependency-usage/package.json create mode 100644 packages/kbn-dependency-usage/src/cli.test.ts create mode 100644 packages/kbn-dependency-usage/src/cli.ts create mode 100644 packages/kbn-dependency-usage/src/dependency_graph/common/constants.ts create mode 100644 packages/kbn-dependency-usage/src/dependency_graph/index.ts create mode 100644 packages/kbn-dependency-usage/src/dependency_graph/providers/cruiser.test.ts create mode 100644 packages/kbn-dependency-usage/src/dependency_graph/providers/cruiser.ts create mode 100644 packages/kbn-dependency-usage/src/lib/code_owners.test.ts create mode 100644 packages/kbn-dependency-usage/src/lib/code_owners.ts create mode 100644 packages/kbn-dependency-usage/src/lib/collapse_with_depth.test.ts create mode 100644 packages/kbn-dependency-usage/src/lib/collapse_with_depth.ts create mode 100644 packages/kbn-dependency-usage/src/lib/group_by_owners.test.ts create mode 100644 packages/kbn-dependency-usage/src/lib/group_by_owners.ts create mode 100644 packages/kbn-dependency-usage/src/lib/group_by_source.test.ts create mode 100644 packages/kbn-dependency-usage/src/lib/group_by_source.ts create mode 100644 packages/kbn-dependency-usage/src/lib/index.ts create mode 100644 packages/kbn-dependency-usage/tsconfig.json create mode 100755 scripts/dependency_usage.sh rename src/dev/eslint/{types.eslint.config.template.js => types.eslint.config.template.cjs} (100%) diff --git a/.eslintrc.js b/.eslintrc.js index e2d02c33288a7..097080753161d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2015,6 +2015,15 @@ module.exports = { '@kbn/imports/no_group_crossing_imports': 'warn', }, }, + { + files: ['packages/kbn-dependency-usage/**/*.{ts,tsx}'], + rules: { + // disabling it since package is a CLI tool + 'no-console': 'off', + // disabling it since package is marked as module and it requires extension for files written + '@kbn/imports/uniform_imports': 'off', + }, + }, ], }; diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7773d3ca95347..b56729efdee02 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -329,6 +329,7 @@ packages/kbn-data-service @elastic/kibana-visualizations @elastic/kibana-data-di packages/kbn-data-stream-adapter @elastic/security-threat-hunting packages/kbn-data-view-utils @elastic/kibana-data-discovery packages/kbn-datemath @elastic/kibana-data-discovery +packages/kbn-dependency-usage @elastic/kibana-security packages/kbn-dev-cli-errors @elastic/kibana-operations packages/kbn-dev-cli-runner @elastic/kibana-operations packages/kbn-dev-proc-runner @elastic/kibana-operations diff --git a/.gitignore b/.gitignore index 9bda927a92b6a..34ba130ee2981 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ target *.iml *.log types.eslint.config.js +types.eslint.config.cjs __tmp__ # Ignore example plugin builds @@ -159,3 +160,4 @@ x-pack/test/security_solution_playwright/playwright/.cache/ x-pack/test/security_solution_playwright/.auth/ x-pack/test/security_solution_playwright/.env .codeql +.dependency-graph-log.json diff --git a/package.json b/package.json index 38ae9a9d9d409..5c91eb0694911 100644 --- a/package.json +++ b/package.json @@ -1429,6 +1429,7 @@ "@kbn/core-ui-settings-server-mocks": "link:packages/core/ui-settings/core-ui-settings-server-mocks", "@kbn/core-usage-data-server-mocks": "link:packages/core/usage-data/core-usage-data-server-mocks", "@kbn/cypress-config": "link:packages/kbn-cypress-config", + "@kbn/dependency-usage": "link:packages/kbn-dependency-usage", "@kbn/dev-cli-errors": "link:packages/kbn-dev-cli-errors", "@kbn/dev-cli-runner": "link:packages/kbn-dev-cli-runner", "@kbn/dev-proc-runner": "link:packages/kbn-dev-proc-runner", @@ -1708,6 +1709,7 @@ "cypress-recurse": "^1.35.2", "date-fns": "^2.29.3", "dependency-check": "^4.1.0", + "dependency-cruiser": "^16.4.2", "ejs": "^3.1.10", "enzyme": "^3.11.0", "enzyme-to-json": "^3.6.2", diff --git a/packages/kbn-dependency-usage/README.md b/packages/kbn-dependency-usage/README.md new file mode 100644 index 0000000000000..95d0b237bb141 --- /dev/null +++ b/packages/kbn-dependency-usage/README.md @@ -0,0 +1,153 @@ + +# @kbn/dependency-usage + +A CLI tool for analyzing dependencies across packages and plugins. This tool provides commands to check dependency usage, aggregate it, debug dependency graphs, and more. + +--- + +## Table of Contents +1. [Show all packages/plugins using a dependency](#show-all-packagesplugins-using-a-dependency) +2. [Show dependencies grouped by code owner](#show-dependencies-grouped-by-code-owner) +3. [List all dependencies for a package or directory](#list-all-dependencies-for-source-directory) +4. [Group by code owner with adjustable collapse depth](#group-by-code-owner-with-adjustable-collapse-depth) +5. [Show dependencies matching a pattern](#show-dependencies-matching-a-pattern) +6. [Verbose flag to debug dependency graph issues](#verbose-flag-to-debug-dependency-graph-issues) + +--- + + +### 1. Show all packages/plugins using a specific dependency + +Use this command to list all packages or plugins within a directory that use a specified dependency. + +```sh +bash scripts/dependency_usage.sh -d -p +``` +or +```sh +bash scripts/dependency_usage.sh --dependency-name --paths +``` + +**Example**: +```sh +bash scripts/dependency_usage.sh -d rxjs -p x-pack/plugins/security_solution +``` + +- `-d rxjs`: Specifies the dependency to look for (`rxjs`). +- `-p x-pack/plugins/security_solution`: Sets the directory to search within (`x-pack/plugins/security_solution`). + +--- + +### 2. Show dependencies grouped by code owner + +Group the dependencies used within a directory by code owner. + +```sh +bash scripts/dependency_usage.sh -p -g owner +``` +or +```sh +bash scripts/dependency_usage.sh --paths --group-by owner +``` + +**Example**: +```sh +bash scripts/dependency_usage.sh -p x-pack/plugins -g owner +``` + +- `-p x-pack/plugins`: Sets the directory to scan for plugins using this dependency. +- `-g owner`: Groups results by code owner. +- **Output**: Lists all dependencies for `x-pack/plugins`, organized by code owner. + +--- + +### 3. List all dependencies for source directory + +To display all dependencies used within a specific directory. + +```sh +bash scripts/dependency_usage.sh -p +``` +or +```sh +bash scripts/dependency_usage.sh --paths +``` + +**Example**: +```sh +bash scripts/dependency_usage.sh -p x-pack/plugins/security_solution +``` + +- `-p x-pack/plugins/security_solution`: Specifies the package or directory for which to list all dependencies. +- **Output**: Lists all dependencies for `x-pack/plugins/security_solution`. + +--- + +### 4. Group by code owner with adjustable collapse depth + +When a package or plugin has multiple subteams, use the `--collapse-depth` option to control how granular the grouping by code owner should be. + +#### Detailed Subteam Grouping +Shows all subteams within `security_solution`. + +```sh +bash scripts/dependency_usage.sh -p x-pack/plugins/security_solution -g owner --collapse-depth 4 +``` + +#### Collapsed Grouping +Groups the results under a higher-level owner (e.g., `security_solution` as a single group). + +```sh +bash scripts/dependency_usage.sh -p x-pack/plugins/security_solution -g owner --collapse-depth 1 +``` + +**Explanation**: +- `-p x-pack/plugins/security_solution`: Specifies the directory to scan. +- `-g owner`: Groups results by code owner. +- `--collapse-depth`: Defines the depth for grouping, where higher numbers show more granular subteams. +- **Output**: Lists dependencies grouped by code owner at different levels of depth based on the `--collapse-depth` value. + +--- + +### 5. Show dependencies matching a pattern + +Search for dependencies that match a specific pattern (such as `react-*`) within a package and output the results to a specified file. + +```sh +bash scripts/dependency_usage.sh -p -d '' -o +``` + +**Example**: +```sh +bash scripts/dependency_usage.sh -d 'react-*' -p x-pack/plugins/security_solution -o ./tmp/results.json +``` + +- `-p x-pack/plugins/security_solution`: Specifies the directory or package to search within. +- `-d 'react-*'`: Searches for dependencies that match the pattern `react-*`. +- `-o ./tmp/results.json`: Outputs the results to a specified file (`results.json` in the `./tmp` directory). +- **Output**: Saves a list of all dependencies matching `react-*` in `x-pack/plugins/security_solution` to `./tmp/results.json`. + +--- + +### 6. Verbose flag to debug dependency graph issues + +Enable verbose mode to log additional details for debugging dependency graphs. This includes generating a non-aggregated dependency graph in `.dependency-graph-log.json`. + +```sh +bash scripts/dependency_usage.sh -p -o -v +``` + +**Example**: +```sh +bash scripts/dependency_usage.sh -p x-pack/plugins/security_solution -o ./tmp/results.json +``` +- `-p x-pack/plugins/security_solution`: Specifies the target directory or package to analyze. +- `-o ./tmp/results.json`: Saves the output to the `results.json` file in the `./tmp` directory. +- `-v`: Enables verbose mode. + +**Output**: Saves a list of all dependencies in `x-pack/plugins/security_solution` to `./tmp/results.json`. Additionally, it logs a detailed, non aggregated dependency graph to `.dependency-graph-log.json` for debugging purposes. + +--- + +For further information on additional flags and options, refer to the script's help command. + diff --git a/packages/kbn-dependency-usage/jest.config.js b/packages/kbn-dependency-usage/jest.config.js new file mode 100644 index 0000000000000..4a579a5ff94b8 --- /dev/null +++ b/packages/kbn-dependency-usage/jest.config.js @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +/* eslint-disable no-restricted-syntax */ +export default { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-dependency-usage'], +}; diff --git a/packages/kbn-dependency-usage/kibana.jsonc b/packages/kbn-dependency-usage/kibana.jsonc new file mode 100644 index 0000000000000..b5d8f6261eee8 --- /dev/null +++ b/packages/kbn-dependency-usage/kibana.jsonc @@ -0,0 +1,6 @@ +{ + "devOnly": true, + "type": "shared-common", + "id": "@kbn/dependency-usage", + "owner": "@elastic/kibana-security" +} diff --git a/packages/kbn-dependency-usage/package.json b/packages/kbn-dependency-usage/package.json new file mode 100644 index 0000000000000..631d012028587 --- /dev/null +++ b/packages/kbn-dependency-usage/package.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.json", + "name": "@kbn/dependency-usage", + "private": true, + "version": "1.0.0", + "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0", + "type": "module", + "exports": { + "./src/*": "./src/*" + } +} \ No newline at end of file diff --git a/packages/kbn-dependency-usage/src/cli.test.ts b/packages/kbn-dependency-usage/src/cli.test.ts new file mode 100644 index 0000000000000..5e40e4e39619c --- /dev/null +++ b/packages/kbn-dependency-usage/src/cli.test.ts @@ -0,0 +1,97 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { identifyDependencyUsageWithCruiser } from './dependency_graph/providers/cruiser.ts'; +import { configureYargs } from './cli'; + +jest.mock('chalk', () => ({ + green: jest.fn((str) => str), + yellow: jest.fn((str) => str), + cyan: jest.fn((str) => str), + magenta: jest.fn((str) => str), + blue: jest.fn((str) => str), + bold: { magenta: jest.fn((str) => str), blue: jest.fn((str) => str) }, +})); + +jest.mock('./dependency_graph/providers/cruiser', () => ({ + identifyDependencyUsageWithCruiser: jest.fn(), +})); + +jest.mock('./cli', () => ({ + ...jest.requireActual('./cli'), + runCLI: jest.fn(), +})); + +describe('dependency-usage CLI', () => { + const parser = configureYargs() + .fail((message: string) => { + throw new Error(message); + }) + .exitProcess(false); + + beforeEach(() => { + jest.spyOn(console, 'log').mockImplementation(() => {}); + }); + + afterEach(() => { + jest.resetAllMocks(); + }); + + it('should handle verbose option', () => { + const argv = parser.parse(['--paths', './plugins', '--verbose']); + expect(argv.verbose).toBe(true); + + expect(identifyDependencyUsageWithCruiser).toHaveBeenCalledWith( + expect.any(Array), + undefined, + expect.objectContaining({ isVerbose: true }) + ); + }); + + it('should group results by specified group-by option', () => { + const argv = parser.parse(['--paths', './src', '--group-by', 'owner']); + expect(argv['group-by']).toBe('owner'); + + expect(identifyDependencyUsageWithCruiser).toHaveBeenCalledWith( + expect.any(Array), + undefined, + expect.objectContaining({ groupBy: 'owner' }) + ); + }); + + it('should use default values when optional arguments are not provided', () => { + const argv = parser.parse([]); + expect(argv.paths).toEqual(['.']); + expect(argv['dependency-name']).toBeUndefined(); + expect(argv['collapse-depth']).toBe(1); + expect(argv.verbose).toBe(false); + }); + + it('should throw an error if summary is used without dependency-name', () => { + expect(() => { + parser.parse(['--summary', '--paths', './src']); + }).toThrow('Summary option can only be used when a dependency name is provided'); + }); + + it('should validate collapse-depth as a positive integer', () => { + expect(() => { + parser.parse(['--paths', './src', '--collapse-depth', '0']); + }).toThrow('Collapse depth must be a positive integer'); + }); + + it('should output results to specified output path', () => { + const argv = parser.parse(['--paths', './src', '--output-path', './output.json']); + expect(argv['output-path']).toBe('./output.json'); + }); + + it('should print results to console if no output path is specified', () => { + const argv = parser.parse(['--paths', './src']); + expect(argv['output-path']).toBeUndefined(); + }); +}); diff --git a/packages/kbn-dependency-usage/src/cli.ts b/packages/kbn-dependency-usage/src/cli.ts new file mode 100644 index 0000000000000..674150fa4d91e --- /dev/null +++ b/packages/kbn-dependency-usage/src/cli.ts @@ -0,0 +1,169 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import nodePath from 'path'; +import yargs from 'yargs'; +import chalk from 'chalk'; +import fs from 'fs'; + +import { identifyDependencyUsageWithCruiser } from './dependency_graph/providers/cruiser.ts'; + +interface CLIArgs { + dependencyName?: string; + paths: string[]; + groupBy: string; + summary: boolean; + outputPath: string; + collapseDepth: number; + tool: string; + verbose: boolean; +} + +export const configureYargs = () => { + return yargs(process.argv.slice(2)) + .command( + '*', + chalk.green('Identify the usage of a dependency in the given paths and output as JSON'), + (y) => { + y.version(false) + .option('dependency-name', { + alias: 'd', + describe: chalk.yellow('The name of the dependency to search for'), + type: 'string', + demandOption: false, + }) + .option('paths', { + alias: 'p', + describe: chalk.cyan('The paths to search within (can be multiple)'), + type: 'string', + array: true, + default: ['.'], + }) + .option('group-by', { + alias: 'g', + describe: chalk.magenta('Group results by either owner or source (package/plugin)'), + choices: ['owner', 'source'], + }) + .option('summary', { + alias: 's', + describe: chalk.magenta( + 'Output a summary instead of full details. Applies only when a dependency name is provided' + ), + type: 'boolean', + }) + .option('collapse-depth', { + alias: 'c', + describe: chalk.blue('Specify the directory depth level for collapsing'), + type: 'number', + default: 1, + }) + .option('output-path', { + alias: 'o', + describe: chalk.blue('Specify the output file to save results as JSON'), + type: 'string', + }) + .option('verbose', { + alias: 'v', + describe: chalk.blue('Outputs verbose graph details to a file'), + type: 'boolean', + default: false, + }) + .check(({ summary, dependencyName, collapseDepth }: Partial) => { + if (summary && !dependencyName) { + throw new Error('Summary option can only be used when a dependency name is provided'); + } + + if (collapseDepth !== undefined && collapseDepth <= 0) { + throw new Error('Collapse depth must be a positive integer'); + } + + return true; + }) + .example( + '--dependency-name lodash --paths ./src ./lib', + chalk.blue( + 'Searches for "lodash" usage in the ./src and ./lib directories and outputs as JSON' + ) + ); + }, + async (argv: CLIArgs) => { + const { + dependencyName, + paths, + groupBy, + summary, + collapseDepth, + outputPath, + verbose: isVerbose, + } = argv; + if (dependencyName) { + console.log( + `Searching for dependency ${chalk.bold.magenta( + dependencyName + )} in paths: ${chalk.bold.magenta(paths.join(', '))}` + ); + } else { + console.log( + `Searching for dependencies in paths: ${chalk.bold.magenta(paths.join(', '))}` + ); + } + + if (collapseDepth > 1) { + console.log(`Dependencies will be collapsed to depth: ${chalk.bold.blue(collapseDepth)}`); + } + + try { + console.log(`${chalk.bold.magenta('cruiser')} is used for building dependency graph`); + + const result = await identifyDependencyUsageWithCruiser(paths, dependencyName, { + groupBy, + summary, + collapseDepth, + isVerbose, + }); + + if (outputPath) { + const isJsonFile = nodePath.extname(outputPath) === '.json'; + const outputFile = isJsonFile + ? outputPath + : nodePath.join(outputPath, 'dependency-usage.json'); + + const outputDir = nodePath.dirname(outputFile); + + if (!fs.existsSync(outputDir)) { + fs.mkdirSync(outputDir, { recursive: true }); + } + + fs.writeFile(outputFile, JSON.stringify(result, null, 2), (err) => { + if (err) { + console.error(chalk.red(`Failed to save results to ${outputFile}: ${err.message}`)); + } else { + console.log(chalk.green(`Results successfully saved to ${outputFile}`)); + } + }); + } else { + console.log(chalk.yellow('No output file specified, displaying results below:\n')); + console.log(JSON.stringify(result, null, 2)); + } + } catch (error) { + console.error('Error fetching dependency usage:', error.message); + } + } + ) + .help(); +}; + +export const runCLI = () => { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + configureYargs().argv; +}; + +if (!process.env.JEST_WORKER_ID) { + runCLI(); +} diff --git a/packages/kbn-dependency-usage/src/dependency_graph/common/constants.ts b/packages/kbn-dependency-usage/src/dependency_graph/common/constants.ts new file mode 100644 index 0000000000000..e13a696450328 --- /dev/null +++ b/packages/kbn-dependency-usage/src/dependency_graph/common/constants.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export const aggregationGroups = [ + 'x-pack/plugins', + 'x-pack/packages', + 'src/plugins', + 'packages', + 'src', + 'x-pack/test', + 'x-pack/test_serverless', +]; + +export const excludePaths = [ + '(^|/)target($|/)', + '^kbn', + '^@kbn', + '^.buildkite', + '^docs', + '^dev_docs', + '^examples', + '^scripts', + '^bazel', + '^x-pack/examples', + '^oas_docs', + '^api_docs', + '^kbn_pm', + '^.es', + '^.codeql', + '^.github', +]; diff --git a/packages/kbn-dependency-usage/src/dependency_graph/index.ts b/packages/kbn-dependency-usage/src/dependency_graph/index.ts new file mode 100644 index 0000000000000..c02e90eb1edeb --- /dev/null +++ b/packages/kbn-dependency-usage/src/dependency_graph/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export { identifyDependencyUsageWithCruiser } from './providers/cruiser.ts'; diff --git a/packages/kbn-dependency-usage/src/dependency_graph/providers/cruiser.test.ts b/packages/kbn-dependency-usage/src/dependency_graph/providers/cruiser.test.ts new file mode 100644 index 0000000000000..ed2004c462ab3 --- /dev/null +++ b/packages/kbn-dependency-usage/src/dependency_graph/providers/cruiser.test.ts @@ -0,0 +1,354 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { identifyDependencyUsageWithCruiser as identifyDependencyUsage } from './cruiser.ts'; +import { cruise } from 'dependency-cruiser'; + +import * as groupBy from '../../lib/group_by_owners.ts'; +import * as groupBySource from '../../lib/group_by_source.ts'; + +const codeOwners: Record = { + 'plugins/security': ['team_security'], + 'plugins/data_visualization': ['team_visualization'], + 'plugins/data_charts': ['team_visualization'], + 'plugins/analytics': ['team_analytics'], + 'plugins/notification': ['team_alerts', 'team_notifications'], + 'plugins/security_solution/public/entity_analytics/components': ['team_security_analytics'], + 'plugins/security_solution/public/entity_analytics/components/componentA.ts': [ + 'team_security_analytics', + ], + 'plugins/security_solution/public/entity_analytics/components/componentB.ts': [ + 'team_security_analytics', + ], + 'plugins/security_solution/server/lib/analytics/analytics.ts': ['team_security_analytics'], + 'plugins/security_solution/common/api/detection_engine': ['team_security_solution'], +}; + +jest.mock('dependency-cruiser', () => ({ + cruise: jest.fn(), +})); + +const mockCruiseResult = { + output: { + summary: { + violations: [ + { + from: 'plugins/security', + to: 'node_modules/rxjs', + }, + { + from: 'plugins/data_visualization', + to: 'node_modules/rxjs', + }, + { + from: 'plugins/data_charts', + to: 'node_modules/rxjs', + }, + { + from: 'plugins/analytics', + to: 'node_modules/rxjs', + }, + { + from: 'plugins/analytics', + to: 'node_modules/@hapi/boom', + }, + ], + }, + modules: [ + { + source: 'node_modules/rxjs', + dependents: [ + 'plugins/security/server/index.ts', + 'plugins/data_charts/public/charts.ts', + 'plugins/data_visualization/public/visualization.ts', + 'plugins/data_visualization/public/ingest.ts', + 'plugins/analytics/server/analytics.ts', + ], + }, + { + source: 'node_modules/@hapi/boom', + dependents: ['plugins/analytics'], + }, + ], + }, +}; + +jest.mock('../../lib/code_owners', () => ({ + getCodeOwnersForFile: jest.fn().mockImplementation((filePath: string) => codeOwners[filePath]), + getPathsWithOwnersReversed: () => ({}), +})); + +describe('identifyDependencyUsage', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + it('should respect collapseDepth param', async () => { + (cruise as jest.Mock).mockResolvedValue(mockCruiseResult); + + await identifyDependencyUsage([], 'rxjs', { + groupBy: 'owner', + collapseDepth: 2, + summary: false, + }); + + await identifyDependencyUsage([], undefined, { + groupBy: 'owner', + collapseDepth: 1, + summary: false, + }); + + const [, configWithDepth2] = (cruise as jest.Mock).mock.calls[0]; + const [, configWithDepth1] = (cruise as jest.Mock).mock.calls[1]; + + expect(configWithDepth2.collapse).toMatchInlineSnapshot( + `"^(x-pack/plugins|x-pack/packages|src/plugins|packages|src|x-pack/test|x-pack/test_serverless)/([^/]+)/([^/]+)"` + ); + + expect(configWithDepth1.collapse).toMatchInlineSnapshot( + `"^(x-pack/plugins|x-pack/packages|src/plugins|packages|src|x-pack/test|x-pack/test_serverless)/([^/]+)|^node_modules/(@[^/]+/[^/]+|[^/]+)"` + ); + }); + + it('should group dependencies by codeowners', async () => { + (cruise as jest.Mock).mockResolvedValue(mockCruiseResult); + const groupFilesByOwnersSpy = jest.spyOn(groupBy, 'groupFilesByOwners'); + + const result = await identifyDependencyUsage([], undefined, { + groupBy: 'owner', + collapseDepth: 1, + summary: false, + }); + + expect(cruise).toHaveBeenCalled(); + expect(groupFilesByOwnersSpy).toHaveBeenCalledWith(mockCruiseResult.output.summary.violations); + + expect(result).toEqual({ + team_security: { + modules: ['plugins/security'], + deps: ['rxjs'], + teams: ['team_security'], + }, + team_visualization: { + modules: ['plugins/data_visualization', 'plugins/data_charts'], + deps: ['rxjs'], + teams: ['team_visualization'], + }, + team_analytics: { + modules: ['plugins/analytics'], + deps: ['rxjs', '@hapi/boom'], + teams: ['team_analytics'], + }, + }); + }); + + it('should group dependencies by source directory', async () => { + (cruise as jest.Mock).mockResolvedValue(mockCruiseResult); + const groupFilesByOwnersSpy = jest.spyOn(groupBySource, 'groupBySource'); + + const result = await identifyDependencyUsage([], undefined, { + collapseDepth: 1, + summary: false, + }); + + expect(cruise).toHaveBeenCalled(); + expect(groupFilesByOwnersSpy).toHaveBeenCalledWith(mockCruiseResult.output.summary.violations); + + expect(result).toEqual({ + 'plugins/security': ['rxjs'], + 'plugins/data_visualization': ['rxjs'], + 'plugins/data_charts': ['rxjs'], + 'plugins/analytics': ['rxjs', '@hapi/boom'], + }); + }); + + it('should search for specific dependency and return full dependents list', async () => { + (cruise as jest.Mock).mockResolvedValue(mockCruiseResult); + const result = await identifyDependencyUsage([], 'rxjs', { + collapseDepth: 1, + summary: false, + }); + + expect(cruise).toHaveBeenCalled(); + + expect(result).toEqual({ + modules: [ + 'plugins/security', + 'plugins/data_visualization', + 'plugins/data_charts', + 'plugins/analytics', + ], + dependents: { + rxjs: [ + 'plugins/security/server/index.ts', + 'plugins/data_charts/public/charts.ts', + 'plugins/data_visualization/public/visualization.ts', + 'plugins/data_visualization/public/ingest.ts', + 'plugins/analytics/server/analytics.ts', + ], + }, + }); + }); + + it('should search for specific dependency and return only summary', async () => { + (cruise as jest.Mock).mockResolvedValue(mockCruiseResult); + const result = await identifyDependencyUsage([], 'rxjs', { + collapseDepth: 1, + summary: true, + }); + + expect(cruise).toHaveBeenCalled(); + + expect(result).toEqual({ + modules: [ + 'plugins/security', + 'plugins/data_visualization', + 'plugins/data_charts', + 'plugins/analytics', + ], + }); + }); + + it('should handle empty cruise result', async () => { + (cruise as jest.Mock).mockResolvedValue({ + output: { summary: { violations: [] }, modules: [] }, + }); + + const result = await identifyDependencyUsage([], undefined, { + collapseDepth: 1, + summary: false, + }); + + expect(cruise).toHaveBeenCalled(); + expect(result).toEqual({}); + }); + + it('should handle no violations', async () => { + (cruise as jest.Mock).mockResolvedValue({ + output: { summary: { violations: [] }, modules: mockCruiseResult.output.modules }, + }); + + const result = await identifyDependencyUsage([], undefined, { + collapseDepth: 1, + summary: false, + }); + + expect(cruise).toHaveBeenCalled(); + expect(result).toEqual({}); + }); + + it('should return empty structure if specific dependency name does not exist', async () => { + (cruise as jest.Mock).mockResolvedValue({ + output: { summary: { violations: [] }, modules: mockCruiseResult.output.modules }, + }); + + const result = await identifyDependencyUsage([], 'nonexistent_dependency', { + collapseDepth: 1, + summary: false, + }); + + expect(cruise).toHaveBeenCalled(); + expect(result).toEqual({ + modules: [], + dependents: {}, + }); + }); + + it('should handle unknown ownership when grouping by owner', async () => { + const customCruiseResult = { + output: { + summary: { + violations: [ + { from: 'plugins/unknown_plugin', to: 'node_modules/some_module' }, + { from: 'plugins/security', to: 'node_modules/rxjs' }, + ], + }, + modules: [], + }, + }; + (cruise as jest.Mock).mockResolvedValue(customCruiseResult); + + const result = await identifyDependencyUsage([], undefined, { + groupBy: 'owner', + collapseDepth: 1, + summary: false, + }); + + expect(cruise).toHaveBeenCalled(); + expect(result).toEqual({ + unknown: { + modules: ['plugins/unknown_plugin'], + deps: ['some_module'], + teams: ['unknown'], + }, + team_security: { + modules: ['plugins/security'], + deps: ['rxjs'], + teams: ['team_security'], + }, + }); + }); + + it('should search for specific dependency and group by owner', async () => { + const customCruiseResult = { + output: { + summary: { + violations: [ + { + from: 'plugins/security_solution/public/entity_analytics/components/componentA.ts', + to: 'node_modules/lodash/fp.js', + }, + { + from: 'plugins/security_solution/public/entity_analytics/components/componentB.ts', + to: 'node_modules/lodash/partition.js', + }, + { + from: 'plugins/security_solution/server/lib/analytics/analytics.ts', + to: 'node_modules/lodash/partition.js', + }, + { + from: 'plugins/security_solution/server/lib/analytics/analytics.ts', + to: 'node_modules/lodash/cloneDeep.js', + }, + { + from: 'plugins/security_solution/common/api/detection_engine', + to: 'node_modules/lodash/sortBy.js', + }, + ], + }, + modules: [], + }, + }; + (cruise as jest.Mock).mockResolvedValue(customCruiseResult); + + const result = await identifyDependencyUsage([], 'lodash', { + groupBy: 'owner', + collapseDepth: 3, + summary: false, + }); + + expect(cruise).toHaveBeenCalled(); + expect(result).toEqual({ + team_security_analytics: { + modules: [ + 'plugins/security_solution/public/entity_analytics/components/componentA.ts', + 'plugins/security_solution/public/entity_analytics/components/componentB.ts', + 'plugins/security_solution/server/lib/analytics/analytics.ts', + ], + deps: ['lodash/fp.js', 'lodash/partition.js', 'lodash/cloneDeep.js'], + teams: ['team_security_analytics'], + }, + team_security_solution: { + modules: ['plugins/security_solution/common/api/detection_engine'], + deps: ['lodash/sortBy.js'], + teams: ['team_security_solution'], + }, + }); + }); +}); diff --git a/packages/kbn-dependency-usage/src/dependency_graph/providers/cruiser.ts b/packages/kbn-dependency-usage/src/dependency_graph/providers/cruiser.ts new file mode 100644 index 0000000000000..33817605cf11b --- /dev/null +++ b/packages/kbn-dependency-usage/src/dependency_graph/providers/cruiser.ts @@ -0,0 +1,147 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import chalk from 'chalk'; +import { cruise } from 'dependency-cruiser'; +import fs from 'fs'; +import nodePath from 'path'; + +import { groupFilesByOwners } from '../../lib/group_by_owners.ts'; +import { groupBySource } from '../../lib/group_by_source.ts'; +import { createCollapseRegexWithDepth } from '../../lib/collapse_with_depth.ts'; +import { aggregationGroups, excludePaths } from '../common/constants.ts'; + +interface DependencyGraphOptions { + isVerbose?: boolean; + summary?: boolean; + collapseDepth: number; + groupBy?: string; +} + +type PathsToAnalyze = string[]; +type DependencyName = string | undefined; + +const invokeDependencyCruiser = async ( + paths: PathsToAnalyze, + dependencyName: DependencyName, + { summary, collapseDepth }: Omit +) => { + const collapseByNodeModule = !dependencyName || (dependencyName && summary); + const collapseByNodeModuleRegex = '^node_modules/(@[^/]+/[^/]+|[^/]+)'; + const collapseRules = [createCollapseRegexWithDepth(aggregationGroups, collapseDepth)]; + + if (collapseByNodeModule) { + collapseRules.push(collapseByNodeModuleRegex); + } + + const captureRule = dependencyName + ? { + name: `dependency-usage ${dependencyName}`, + severity: 'info', + from: { pathNot: '^node_modules' }, + to: { path: dependencyName }, + } + : { + name: 'external-deps', + severity: 'info', + from: { path: paths.map((path) => `^${path}`) }, + to: { path: '^node_modules' }, + }; + + const result = await cruise(paths, { + ruleSet: { + // @ts-ignore + forbidden: [captureRule], + }, + doNotFollow: { + path: 'node_modules', + }, + extensions: ['.ts', '.tsx'], + focus: '^node_modules', + exclude: { + path: excludePaths, + }, + onlyReachable: paths.map((path) => `^${path}`).join('|'), + includeOnly: ['^node_modules', ...paths.map((path) => `^${path}`)], + validate: true, + collapse: collapseRules.join('|'), + }); + + return result; +}; + +export async function identifyDependencyUsageWithCruiser( + paths: PathsToAnalyze, + dependencyName: string | undefined, + { groupBy, summary, collapseDepth, isVerbose }: DependencyGraphOptions +) { + const result = await invokeDependencyCruiser(paths, dependencyName, { + summary, + collapseDepth, + }); + + if (typeof result.output === 'string') { + throw new Error('Unexpected string output from cruise result'); + } + + console.log( + `${chalk.green(`Successfully`)} built dependency graph using ${chalk.bold.magenta( + 'cruiser' + )}. Analyzing...` + ); + + if (isVerbose) { + const verboseLogPath = nodePath.join(process.cwd(), '.dependency-graph-log.json'); + + fs.writeFile(verboseLogPath, JSON.stringify(result, null, 2), (err) => { + if (err) { + console.error( + chalk.red(`Failed to save dependency graph log to ${verboseLogPath}: ${err.message}`) + ); + } else { + console.log(chalk.yellow(`Dependency graph log saved to ${verboseLogPath}`)); + } + }); + } + + const { violations } = result.output.summary; + + if (groupBy === 'owner') { + return groupFilesByOwners(violations); + } + + if (dependencyName) { + const dependencyRegex = new RegExp(`node_modules/${dependencyName}`); + + const dependentsList = result.output.modules.reduce>( + (acc, { source, dependents }) => { + if (!dependencyRegex.test(source)) { + return acc; + } + + const transformedDependencyName = source.split('/')[1]; + if (!acc[transformedDependencyName]) { + acc[transformedDependencyName] = []; + } + + acc[transformedDependencyName].push(...dependents); + + return acc; + }, + {} + ); + + return { + modules: [...new Set(violations.map(({ from }) => from))], + ...(!summary && { dependents: dependentsList }), + }; + } + + return groupBySource(violations); +} diff --git a/packages/kbn-dependency-usage/src/lib/code_owners.test.ts b/packages/kbn-dependency-usage/src/lib/code_owners.test.ts new file mode 100644 index 0000000000000..e9c5c63ba2f98 --- /dev/null +++ b/packages/kbn-dependency-usage/src/lib/code_owners.test.ts @@ -0,0 +1,99 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { getCodeOwnersForFile, PathWithOwners } from './code_owners'; + +describe('getCodeOwnersForFile', () => { + it('should return teams for exact file match', () => { + const reversedCodeowners = [ + { + path: 'src/file1.js', + teams: ['team_a'], + ignorePattern: { + test: (filePath: string) => ({ ignored: filePath === 'src/file1.js' }), + }, + }, + ] as PathWithOwners[]; + + const result = getCodeOwnersForFile('src/file1.js', reversedCodeowners); + expect(result).toEqual(['team_a']); + }); + + it('should return "unknown" if no ownership is found', () => { + const reversedCodeowners = [ + { + path: 'src/file1.js', + teams: ['team_a'], + ignorePattern: { test: (filePath: string) => ({ ignored: filePath === 'src/file1.js' }) }, + }, + ] as PathWithOwners[]; + + const result = getCodeOwnersForFile('src/unknown_file.js', reversedCodeowners); + expect(result).toEqual(['unknown']); + }); + + it('should return teams for partial match if no exact match exists', () => { + const reversedCodeowners = [ + { + path: 'src/folder', + teams: ['team_c'], + ignorePattern: { + test: (filePath: string) => ({ ignored: filePath.startsWith('src/folder') }), + }, + }, + ] as PathWithOwners[]; + + const result = getCodeOwnersForFile('src/folder/subfolder/file.js', reversedCodeowners); + expect(result).toEqual(['team_c']); + }); + + it('should handle root directory without ownership but with subdirectory owners', () => { + const reversedCodeowners = [ + { + path: 'folder/some/test', + teams: ['team_a'], + ignorePattern: { + test: (filePath: string) => ({ ignored: filePath.startsWith('folder/some/test') }), + }, + }, + { + path: 'folder/another/test', + teams: ['team_b'], + ignorePattern: { + test: (filePath: string) => ({ ignored: filePath.startsWith('folder/another/test') }), + }, + }, + ] as PathWithOwners[]; + + const result = getCodeOwnersForFile('folder', reversedCodeowners); + expect(result).toEqual(['team_a', 'team_b']); + }); + + it('should return all unique teams if multiple subdirectories match', () => { + const reversedCodeowners = [ + { + path: 'folder/some/test', + teams: ['team_a'], + ignorePattern: { + test: (filePath: string) => ({ ignored: filePath.startsWith('folder/some/test') }), + }, + }, + { + path: 'folder/another/test', + teams: ['team_b'], + ignorePattern: { + test: (filePath: string) => ({ ignored: filePath.startsWith('folder/another/test') }), + }, + }, + ] as PathWithOwners[]; + + const result = getCodeOwnersForFile('folder/another/test/file.js', reversedCodeowners); + expect(result).toEqual(['team_b']); + }); +}); diff --git a/packages/kbn-dependency-usage/src/lib/code_owners.ts b/packages/kbn-dependency-usage/src/lib/code_owners.ts new file mode 100644 index 0000000000000..194dee7c80197 --- /dev/null +++ b/packages/kbn-dependency-usage/src/lib/code_owners.ts @@ -0,0 +1,84 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +// @ts-ignore +import { REPO_ROOT } from '@kbn/repo-info'; +import { join as joinPath } from 'path'; +import { existsSync, readFileSync } from 'fs'; + +import type { Ignore } from 'ignore'; +import ignore from 'ignore'; + +export interface PathWithOwners { + path: string; + teams: string[]; + ignorePattern: Ignore; +} + +const existOrThrow = (targetFile: string) => { + if (existsSync(targetFile) === false) + throw Error(`Unable to determine code owners: file ${targetFile} Not Found`); +}; + +/** + * Get the .github/CODEOWNERS entries, prepared for path matching. + * The last matching CODEOWNERS entry has highest precedence: + * https://help.github.com/articles/about-codeowners/ + * so entries are returned in reversed order to later search for the first match. + */ +export function getPathsWithOwnersReversed(): PathWithOwners[] { + const codeownersPath = joinPath(REPO_ROOT, '.github', 'CODEOWNERS'); + existOrThrow(codeownersPath); + const codeownersContent = readFileSync(codeownersPath, { encoding: 'utf8', flag: 'r' }); + const codeownersLines = codeownersContent.split(/\r?\n/); + const codeowners = codeownersLines + .map((line) => line.trim()) + .filter((line) => line && line[0] !== '#'); + + const pathsWithOwners: PathWithOwners[] = codeowners.map((c) => { + const [path, ...ghTeams] = c.split(/\s+/); + const cleanedPath = path.replace(/\/$/, ''); // remove trailing slash + const parsedTeams = ghTeams + .map((t) => t.replace('@', '').split(',')) + .flat() + .filter((t) => t.startsWith('elastic')); + return { + path: cleanedPath, + teams: parsedTeams, + // register CODEOWNERS entries with the `ignores` lib for later path matching + ignorePattern: ignore().add([cleanedPath]), + }; + }); + + return pathsWithOwners.reverse(); +} + +export function getCodeOwnersForFile( + filePath: string, + reversedCodeowners?: PathWithOwners[] +): string[] { + const pathsWithOwners = reversedCodeowners ?? getPathsWithOwnersReversed(); + + const match = pathsWithOwners.find((p) => p.ignorePattern.test(filePath).ignored); + + if (!match?.teams.length) { + const allTeams = pathsWithOwners + .filter((p) => p.path.includes(filePath) && p.teams.length) + .map((p) => p.teams) + .flat(); + + if (!allTeams.length) { + return ['unknown']; + } + + return [...new Set(allTeams)]; + } + + return match?.teams ?? []; +} diff --git a/packages/kbn-dependency-usage/src/lib/collapse_with_depth.test.ts b/packages/kbn-dependency-usage/src/lib/collapse_with_depth.test.ts new file mode 100644 index 0000000000000..f2f8c365fdd96 --- /dev/null +++ b/packages/kbn-dependency-usage/src/lib/collapse_with_depth.test.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { createCollapseRegexWithDepth } from './collapse_with_depth'; + +describe('createCollapseRegexWithDepth', () => { + it('should generate regex with a base path and depth of 0', () => { + const basePath = ['app/components']; + const depth = 0; + const regex = createCollapseRegexWithDepth(basePath, depth); + + expect(regex).toBe('^(app/components)'); + }); + + it('should generate regex with a base path and depth of 1', () => { + const basePath = ['src']; + const depth = 1; + const regex = createCollapseRegexWithDepth(basePath, depth); + + expect(regex).toBe('^(src)/([^/]+)'); + }); + + it('should generate regex with a base path and depth of 2', () => { + const basePath = ['src']; + const depth = 2; + const regex = createCollapseRegexWithDepth(basePath, depth); + + expect(regex).toBe('^(src)/([^/]+)/([^/]+)'); + }); +}); diff --git a/packages/kbn-dependency-usage/src/lib/collapse_with_depth.ts b/packages/kbn-dependency-usage/src/lib/collapse_with_depth.ts new file mode 100644 index 0000000000000..6f0c42df0dcfa --- /dev/null +++ b/packages/kbn-dependency-usage/src/lib/collapse_with_depth.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export function createCollapseRegexWithDepth(basePaths: string[], depth: number) { + let regex = `^(${basePaths.join('|')})`; + + for (let i = 0; i < depth; i++) { + regex += `/([^/]+)`; + } + + return regex; +} diff --git a/packages/kbn-dependency-usage/src/lib/group_by_owners.test.ts b/packages/kbn-dependency-usage/src/lib/group_by_owners.test.ts new file mode 100644 index 0000000000000..224db092db447 --- /dev/null +++ b/packages/kbn-dependency-usage/src/lib/group_by_owners.test.ts @@ -0,0 +1,116 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { groupFilesByOwners } from './group_by_owners'; + +jest.mock('./code_owners', () => ({ + getPathsWithOwnersReversed: jest.fn(), + getCodeOwnersForFile: jest.fn((file: string) => { + const owners: Record = { + '/src/file1.js': ['team_a'], + '/src/file2.js': ['team_b'], + '/src/file3.js': ['team_a', 'team_c'], + }; + return owners[file]; + }), +})); + +describe('groupFilesByOwners', () => { + it('should group files by single owners correctly', () => { + const dependencies = [ + { from: '/src/file1.js', to: 'node_modules/module1' }, + { from: '/src/file2.js', to: 'node_modules/module2' }, + ]; + + const result = groupFilesByOwners(dependencies); + + expect(result).toEqual({ + team_a: { + modules: ['/src/file1.js'], + deps: ['module1'], + teams: ['team_a'], + }, + team_b: { + modules: ['/src/file2.js'], + deps: ['module2'], + teams: ['team_b'], + }, + }); + }); + + it('should group files with multiple owners under "multiple_teams"', () => { + const dependencies = [ + { from: '/src/file3.js', to: 'node_modules/module3' }, + { from: '/src/file3.js', to: 'node_modules/module4' }, + ]; + + const result = groupFilesByOwners(dependencies); + + expect(result).toEqual({ + multiple_teams: [ + { + modules: ['/src/file3.js'], + deps: ['module3', 'module4'], + teams: ['team_a', 'team_c'], + }, + ], + }); + }); + + it('should handle files with unknown owners', () => { + const dependencies = [{ from: '/src/file_unknown.js', to: 'node_modules/module_unknown' }]; + + const result = groupFilesByOwners(dependencies); + + expect(result).toEqual({ + unknown: { + modules: ['/src/file_unknown.js'], + deps: ['module_unknown'], + teams: ['unknown'], + }, + }); + }); + + it('should correctly handle mixed ownership scenarios', () => { + const dependencies = [ + { from: '/src/file1.js', to: 'node_modules/module1' }, + { from: '/src/file2.js', to: 'node_modules/module2' }, + { from: '/src/file3.js', to: 'node_modules/module3' }, + { from: '/src/file3.js', to: 'node_modules/module4' }, + { from: '/src/file_unknown.js', to: 'node_modules/module_unknown' }, + ]; + + const result = groupFilesByOwners(dependencies); + + expect(result).toEqual({ + team_a: { + modules: ['/src/file1.js'], + deps: ['module1'], + teams: ['team_a'], + }, + team_b: { + modules: ['/src/file2.js'], + deps: ['module2'], + teams: ['team_b'], + }, + multiple_teams: [ + { + modules: ['/src/file3.js'], + deps: ['module3', 'module4'], + teams: ['team_a', 'team_c'], + }, + ], + unknown: { + modules: ['/src/file_unknown.js'], + deps: ['module_unknown'], + teams: ['unknown'], + }, + }); + }); +}); diff --git a/packages/kbn-dependency-usage/src/lib/group_by_owners.ts b/packages/kbn-dependency-usage/src/lib/group_by_owners.ts new file mode 100644 index 0000000000000..36a3a4ab5df74 --- /dev/null +++ b/packages/kbn-dependency-usage/src/lib/group_by_owners.ts @@ -0,0 +1,89 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { getCodeOwnersForFile, getPathsWithOwnersReversed } from './code_owners.ts'; + +interface DependencyByOwnerEntry { + modules: T; + deps: T; + teams: T; +} + +const UNKNOWN_OWNER = 'unknown'; +const MULTIPLE_TEAMS_OWNER = 'multiple_teams'; + +export function groupFilesByOwners(dependencies: Array<{ from: string; to: string }>) { + const ownerFilesMap = new Map(); + const reversedCodeowners = getPathsWithOwnersReversed(); + + for (const dep of dependencies) { + const { from, to } = dep; + + const owners = getCodeOwnersForFile(from, reversedCodeowners) ?? [UNKNOWN_OWNER]; + const ownerKey = owners.length > 1 ? MULTIPLE_TEAMS_OWNER : owners[0]; + + if (ownerKey === MULTIPLE_TEAMS_OWNER) { + if (!ownerFilesMap.has(ownerKey)) { + ownerFilesMap.set(ownerKey, new Map()); + } + + const modulesMap = ownerFilesMap.get(ownerKey); + + if (!modulesMap.has(from)) { + modulesMap.set(from, { deps: new Set(), modules: new Set(), teams: new Set() }); + } + + const moduleEntry = modulesMap.get(from); + + moduleEntry.deps.add(to.replace(/^node_modules\//, '')); + moduleEntry.modules.add(from); + + for (const owner of owners) { + moduleEntry.teams.add(owner); + } + + continue; + } + + if (!ownerFilesMap.has(ownerKey)) { + ownerFilesMap.set(ownerKey, { deps: new Set(), modules: new Set(), teams: new Set(owners) }); + } + + ownerFilesMap.get(ownerKey).deps.add(to.replace(/^node_modules\//, '')); + ownerFilesMap.get(ownerKey).modules.add(from); + } + + const result: Record = {}; + + const transformRecord = (entry: DependencyByOwnerEntry>) => ({ + modules: Array.from(entry.modules), + deps: Array.from(entry.deps), + teams: Array.from(entry.teams), + }); + + for (const [key, ownerRecord] of ownerFilesMap.entries()) { + const isMultiTeamRecord = key === MULTIPLE_TEAMS_OWNER; + + if (isMultiTeamRecord) { + if (!Array.isArray(result[MULTIPLE_TEAMS_OWNER])) { + result[MULTIPLE_TEAMS_OWNER] = []; + } + + for (const [, multiTeamRecord] of ownerRecord.entries()) { + (result[key] as DependencyByOwnerEntry[]).push(transformRecord(multiTeamRecord)); + } + + continue; + } + + result[key] = transformRecord(ownerRecord); + } + + return result; +} diff --git a/packages/kbn-dependency-usage/src/lib/group_by_source.test.ts b/packages/kbn-dependency-usage/src/lib/group_by_source.test.ts new file mode 100644 index 0000000000000..1ebce6936c1db --- /dev/null +++ b/packages/kbn-dependency-usage/src/lib/group_by_source.test.ts @@ -0,0 +1,86 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { groupBySource } from './group_by_source.ts'; + +describe('groupBySource', () => { + it('should group dependencies by their source files', () => { + const dependencies = [ + { from: 'src/file1.js', to: 'node_modules/module1' }, + { from: 'src/file1.js', to: 'node_modules/module2' }, + { from: 'src/file2.js', to: 'node_modules/module3' }, + ]; + + const result = groupBySource(dependencies); + + expect(result).toEqual({ + 'src/file1.js': ['module1', 'module2'], + 'src/file2.js': ['module3'], + }); + }); + + it('should handle a single dependency', () => { + const dependencies = [{ from: 'src/file1.js', to: 'node_modules/module1' }]; + + const result = groupBySource(dependencies); + + expect(result).toEqual({ + 'src/file1.js': ['module1'], + }); + }); + + it('should handle multiple dependencies from the same source', () => { + const dependencies = [ + { from: 'src/file1.js', to: 'node_modules/module1' }, + { from: 'src/file1.js', to: 'node_modules/module2' }, + { from: 'src/file1.js', to: 'node_modules/module3' }, + ]; + + const result = groupBySource(dependencies); + + expect(result).toEqual({ + 'src/file1.js': ['module1', 'module2', 'module3'], + }); + }); + + it('should handle dependencies from different sources', () => { + const dependencies = [ + { from: 'src/file1.js', to: 'node_modules/module1' }, + { from: 'src/file2.js', to: 'node_modules/module2' }, + { from: 'src/file3.js', to: 'node_modules/module3' }, + ]; + + const result = groupBySource(dependencies); + + expect(result).toEqual({ + 'src/file1.js': ['module1'], + 'src/file2.js': ['module2'], + 'src/file3.js': ['module3'], + }); + }); + + it('should remove "node_modules/" prefix from dependencies', () => { + const dependencies = [ + { from: 'src/file1.js', to: 'node_modules/module1' }, + { from: 'src/file1.js', to: 'node_modules/module2' }, + ]; + + const result = groupBySource(dependencies); + + expect(result).toEqual({ + 'src/file1.js': ['module1', 'module2'], + }); + }); + + it('should return an empty object if there are no dependencies', () => { + const result = groupBySource([]); + + expect(result).toEqual({}); + }); +}); diff --git a/packages/kbn-dependency-usage/src/lib/group_by_source.ts b/packages/kbn-dependency-usage/src/lib/group_by_source.ts new file mode 100644 index 0000000000000..9275e6fd8392e --- /dev/null +++ b/packages/kbn-dependency-usage/src/lib/group_by_source.ts @@ -0,0 +1,30 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export function groupBySource(dependencies: Array<{ from: string; to: string }>) { + const packageMap = new Map(); + + for (const dep of dependencies) { + const { from, to } = dep; + + if (!packageMap.has(from)) { + packageMap.set(from, new Set()); + } + + packageMap.get(from).add(to.replace(/^node_modules\//, '')); + } + + const result: Record = {}; + + for (const [key, value] of packageMap.entries()) { + result[key] = Array.from(value); + } + + return result; +} diff --git a/packages/kbn-dependency-usage/src/lib/index.ts b/packages/kbn-dependency-usage/src/lib/index.ts new file mode 100644 index 0000000000000..ddf97e41d0bd5 --- /dev/null +++ b/packages/kbn-dependency-usage/src/lib/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export { groupFilesByOwners } from './group_by_owners.ts'; +export { groupBySource } from './group_by_source.ts'; diff --git a/packages/kbn-dependency-usage/tsconfig.json b/packages/kbn-dependency-usage/tsconfig.json new file mode 100644 index 0000000000000..96b87da389c39 --- /dev/null +++ b/packages/kbn-dependency-usage/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "esnext", + "moduleResolution": "node", + "outDir": "target/types", + "esModuleInterop": true, + "strict": true, + "resolveJsonModule": true, + "noEmit": true, + "allowImportingTsExtensions": true, + }, + "include": ["**/*.ts"], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + "@kbn/repo-info", + ], +} diff --git a/packages/kbn-repo-packages/index.js b/packages/kbn-repo-packages/index.js index b8784b3ef4b2f..067d75b6e1697 100644 --- a/packages/kbn-repo-packages/index.js +++ b/packages/kbn-repo-packages/index.js @@ -35,6 +35,7 @@ const { parseKbnImportReq } = require('./modern/parse_kbn_import_req'); const { getRepoRels, getRepoRelsSync } = require('./modern/get_repo_rels'); const Jsonc = require('./utils/jsonc'); const { getPluginPackagesFilter, getPluginSearchPaths } = require('./modern/plugins'); +const { readPackageJson } = require('./modern/parse_package_json'); module.exports = { Package, @@ -52,4 +53,5 @@ module.exports = { parseKbnImportReq, getRepoRels, getRepoRelsSync, + readPackageJson, }; diff --git a/packages/kbn-ts-projects/ts_project.ts b/packages/kbn-ts-projects/ts_project.ts index 22c28931da144..4870bc7d0e95b 100644 --- a/packages/kbn-ts-projects/ts_project.ts +++ b/packages/kbn-ts-projects/ts_project.ts @@ -14,6 +14,7 @@ import { REPO_ROOT } from '@kbn/repo-info'; import { makeMatcher } from '@kbn/picomatcher'; import { type Package, findPackageForPath, getRepoRelsSync } from '@kbn/repo-packages'; import { createFailError } from '@kbn/dev-cli-errors'; +import { readPackageJson } from '@kbn/repo-packages'; import { readTsConfig, parseTsConfig, TsConfig } from './ts_configfile'; @@ -151,6 +152,8 @@ export class TsProject { public readonly directory: string; /** the package this tsconfig file is within, if any */ public readonly pkg?: Package; + /** the package is esm or not */ + public readonly isEsm?: boolean; /** * if this project is within a package then this will * be set to the import request that maps to the root of this project @@ -187,6 +190,7 @@ export class TsProject { : undefined; this._disableTypeCheck = !!opts?.disableTypeCheck; + this.isEsm = readPackageJson(`${this.dir}/package.json`)?.type === 'module'; } private _name: string | undefined; diff --git a/scripts/dependency_usage.sh b/scripts/dependency_usage.sh new file mode 100755 index 0000000000000..ccee69e62d348 --- /dev/null +++ b/scripts/dependency_usage.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Need to tun the script with ts-node/esm since dependency-cruiser is only available as an ESM module. +# We specify the correct tsconfig.json file to ensure compatibility, as our current setup doesn’t fully support ESM modules. +# Should be resolved after https://github.com/elastic/kibana/issues/198790 is done. +NODE_NO_WARNINGS=1 TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=packages/kbn-dependency-usage/tsconfig.json \ +node --loader ts-node/esm packages/kbn-dependency-usage/src/cli.ts "$@" diff --git a/src/dev/eslint/run_eslint_with_types.ts b/src/dev/eslint/run_eslint_with_types.ts index 8a70945688ddf..0a872a248dc5a 100644 --- a/src/dev/eslint/run_eslint_with_types.ts +++ b/src/dev/eslint/run_eslint_with_types.ts @@ -28,7 +28,7 @@ export function runEslintWithTypes() { async ({ log, flags }) => { const ignoreFilePath = Path.resolve(REPO_ROOT, '.eslintignore'); const configTemplate = Fs.readFileSync( - Path.resolve(__dirname, 'types.eslint.config.template.js'), + Path.resolve(__dirname, 'types.eslint.config.template.cjs'), 'utf8' ); @@ -65,7 +65,7 @@ export function runEslintWithTypes() { const failures = await Rx.lastValueFrom( Rx.from(projects).pipe( mergeMap(async (project) => { - const configFilePath = Path.resolve(project.directory, 'types.eslint.config.js'); + const configFilePath = Path.resolve(project.directory, 'types.eslint.config.cjs'); Fs.writeFileSync( configFilePath, diff --git a/src/dev/eslint/types.eslint.config.template.js b/src/dev/eslint/types.eslint.config.template.cjs similarity index 100% rename from src/dev/eslint/types.eslint.config.template.js rename to src/dev/eslint/types.eslint.config.template.cjs diff --git a/tsconfig.base.json b/tsconfig.base.json index 23be79df3418f..e1721840d4fb5 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -756,6 +756,8 @@ "@kbn/default-nav-management/*": ["packages/default-nav/management/*"], "@kbn/default-nav-ml": ["packages/default-nav/ml"], "@kbn/default-nav-ml/*": ["packages/default-nav/ml/*"], + "@kbn/dependency-usage": ["packages/kbn-dependency-usage"], + "@kbn/dependency-usage/*": ["packages/kbn-dependency-usage/*"], "@kbn/dev-cli-errors": ["packages/kbn-dev-cli-errors"], "@kbn/dev-cli-errors/*": ["packages/kbn-dev-cli-errors/*"], "@kbn/dev-cli-runner": ["packages/kbn-dev-cli-runner"], diff --git a/yarn.lock b/yarn.lock index 43235430ea4e8..f299e48d4bb2d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5298,6 +5298,10 @@ version "0.0.0" uid "" +"@kbn/dependency-usage@link:packages/kbn-dependency-usage": + version "0.0.0" + uid "" + "@kbn/dev-cli-errors@link:packages/kbn-dev-cli-errors": version "0.0.0" uid "" @@ -13107,11 +13111,23 @@ acorn-import-attributes@^1.9.5: resolved "https://registry.yarnpkg.com/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz#7eb1557b1ba05ef18b5ed0ec67591bfab04688ef" integrity sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ== +acorn-jsx-walk@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/acorn-jsx-walk/-/acorn-jsx-walk-2.0.0.tgz#a5ed648264e68282d7c2aead80216bfdf232573a" + integrity sha512-uuo6iJj4D4ygkdzd6jPtcxs8vZgDX9YFIkqczGImoypX2fQ4dVImmu3UzA4ynixCIMTrEOWW+95M2HuBaCEOVA== + acorn-jsx@^5.3.1, acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== +acorn-loose@^8.4.0: + version "8.4.0" + resolved "https://registry.yarnpkg.com/acorn-loose/-/acorn-loose-8.4.0.tgz#26d3e219756d1e180d006f5bcc8d261a28530f55" + integrity sha512-M0EUka6rb+QC4l9Z3T0nJEzNOO7JcoJlYMrBlyBCiFSXRyxjLKayd4TbQs2FDRWQU1h9FR7QVNHt+PEaoNL5rQ== + dependencies: + acorn "^8.11.0" + acorn-node@^1.6.1: version "1.8.2" resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.8.2.tgz#114c95d64539e53dede23de8b9d96df7c7ae2af8" @@ -13126,10 +13142,12 @@ acorn-walk@^7.0.0, acorn-walk@^7.2.0: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== -acorn-walk@^8.0.0, acorn-walk@^8.0.2, acorn-walk@^8.1.1, acorn-walk@^8.2.0: - version "8.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" - integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== +acorn-walk@^8.0.0, acorn-walk@^8.0.2, acorn-walk@^8.1.1, acorn-walk@^8.2.0, acorn-walk@^8.3.4: + version "8.3.4" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" + integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== + dependencies: + acorn "^8.11.0" acorn@^6.4.1: version "6.4.2" @@ -13141,10 +13159,10 @@ acorn@^7.0.0, acorn@^7.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.0.4, acorn@^8.1.0, acorn@^8.4.1, acorn@^8.7.1, acorn@^8.8.0, acorn@^8.8.2, acorn@^8.9.0: - version "8.10.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" - integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== +acorn@^8.0.4, acorn@^8.1.0, acorn@^8.11.0, acorn@^8.12.1, acorn@^8.4.1, acorn@^8.7.1, acorn@^8.8.0, acorn@^8.8.2, acorn@^8.9.0: + version "8.13.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.13.0.tgz#2a30d670818ad16ddd6a35d3842dacec9e5d7ca3" + integrity sha512-8zSiw54Oxrdym50NlZ9sUusyO1Z1ZchgRLWRaK6c86XJFClyCgFKetdowBg5bKxyp/u+CDBJG4Mpp0m3HLZl9w== address@^1.0.1: version "1.1.2" @@ -13269,15 +13287,15 @@ ajv@^6.1.0, ajv@^6.10.2, ajv@^6.12.2, ajv@^6.12.4, ajv@^6.12.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.0, ajv@^8.0.1, ajv@^8.12.0, ajv@^8.8.0: - version "8.12.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" - integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== +ajv@^8.0.0, ajv@^8.0.1, ajv@^8.12.0, ajv@^8.17.1, ajv@^8.8.0: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" + integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== dependencies: - fast-deep-equal "^3.1.1" + fast-deep-equal "^3.1.3" + fast-uri "^3.0.1" json-schema-traverse "^1.0.0" require-from-string "^2.0.2" - uri-js "^4.2.2" ansi-align@^3.0.0: version "3.0.1" @@ -16972,6 +16990,34 @@ dependency-check@^4.1.0: read-package-json "^2.0.10" resolve "^1.1.7" +dependency-cruiser@^16.4.2: + version "16.4.2" + resolved "https://registry.yarnpkg.com/dependency-cruiser/-/dependency-cruiser-16.4.2.tgz#586487e1ac355912a0ad2310b830b63054733e01" + integrity sha512-mQZM95WwIvKzYYdj+1RgIBuJ6qbr1cfyzTt62dDJVrWAShfhV9IEkG/Xv4S2iD5sT+Gt3oFWyZjwNufAhcbtWA== + dependencies: + acorn "^8.12.1" + acorn-jsx "^5.3.2" + acorn-jsx-walk "^2.0.0" + acorn-loose "^8.4.0" + acorn-walk "^8.3.4" + ajv "^8.17.1" + commander "^12.1.0" + enhanced-resolve "^5.17.1" + ignore "^6.0.2" + interpret "^3.1.1" + is-installed-globally "^1.0.0" + json5 "^2.2.3" + memoize "^10.0.0" + picocolors "^1.1.0" + picomatch "^4.0.2" + prompts "^2.4.2" + rechoir "^0.8.0" + safe-regex "^2.1.1" + semver "^7.6.3" + teamcity-service-messages "^0.1.14" + tsconfig-paths-webpack-plugin "^4.1.0" + watskeburt "^4.1.0" + dependency-tree@^10.0.9: version "10.0.9" resolved "https://registry.yarnpkg.com/dependency-tree/-/dependency-tree-10.0.9.tgz#0c6c0dbeb0c5ec2cf83bf755f30e9cb12e7b4ac7" @@ -17670,10 +17716,10 @@ enhanced-resolve@^4.5.0: memory-fs "^0.5.0" tapable "^1.0.0" -enhanced-resolve@^5.14.1, enhanced-resolve@^5.16.0: - version "5.16.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.16.0.tgz#65ec88778083056cb32487faa9aef82ed0864787" - integrity sha512-O+QWCviPNSSLAD9Ucn8Awv+poAkqn3T1XY5/N7kR7rQO9yfSGWkYZDwpJ+iKF7B8rxaQKWngSqACpgzeapSyoA== +enhanced-resolve@^5.14.1, enhanced-resolve@^5.16.0, enhanced-resolve@^5.17.1, enhanced-resolve@^5.7.0: + version "5.17.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" + integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -18770,6 +18816,11 @@ fast-text-encoding@^1.0.0: resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.6.tgz#0aa25f7f638222e3396d72bf936afcf1d42d6867" integrity sha512-VhXlQgj9ioXCqGstD37E/HBeqEGV/qOD/kmbVG8h5xKBYvM1L3lR1Zn4555cQ8GkYbJa8aJSipLPndE1k6zK2w== +fast-uri@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.3.tgz#892a1c91802d5d7860de728f18608a0573142241" + integrity sha512-aLrHthzCjH5He4Z2H9YZ+v6Ujb9ocRuW6ZzkJQOrTxleEijANq4v1TsaPaVG1PZcuurEzrLcWRyYBYXD5cEiaw== + fast-xml-parser@4.4.1: version "4.4.1" resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz#86dbf3f18edf8739326447bcaac31b4ae7f6514f" @@ -19779,6 +19830,13 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, gl once "^1.3.0" path-is-absolute "^1.0.0" +global-directory@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/global-directory/-/global-directory-4.0.1.tgz#4d7ac7cfd2cb73f304c53b8810891748df5e361e" + integrity sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q== + dependencies: + ini "4.1.1" + global-dirs@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.0.tgz#70a76fe84ea315ab37b1f5576cbde7d48ef72686" @@ -20789,6 +20847,11 @@ ignore@^5.0.5, ignore@^5.1.1, ignore@^5.2.0, ignore@^5.3.0: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.0.tgz#67418ae40d34d6999c95ff56016759c718c82f78" integrity sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg== +ignore@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-6.0.2.tgz#77cccb72a55796af1b6d2f9eb14fa326d24f4283" + integrity sha512-InwqeHHN2XpumIkMvpl/DCJVrAHgCsG5+cn1XlnLWGwtZBm8QJfSusItfrwx81CTp5agNZqpKU2J/ccC5nGT4A== + immediate@~3.0.5: version "3.0.6" resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" @@ -20885,6 +20948,11 @@ ini@2.0.0: resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5" integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== +ini@4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ini/-/ini-4.1.1.tgz#d95b3d843b1e906e56d6747d5447904ff50ce7a1" + integrity sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g== + ini@^1.3.5, ini@~1.3.0: version "1.3.7" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84" @@ -20972,6 +21040,11 @@ interpret@^2.2.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== +interpret@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4" + integrity sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ== + intl-messageformat@10.5.12: version "10.5.12" resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-10.5.12.tgz#a0c1a20da896b7a1f4ba1b59c8ba5d9943c29c3f" @@ -21296,6 +21369,14 @@ is-hexadecimal@^1.0.0: resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.1.tgz#6e084bbc92061fbb0971ec58b6ce6d404e24da69" integrity sha1-bghLvJIGH7sJcexYts5tQE4k2mk= +is-installed-globally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-1.0.0.tgz#08952c43758c33d815692392f7f8437b9e436d5a" + integrity sha512-K55T22lfpQ63N4KEN57jZUAaAYqYHEe8veb/TycJRk9DdSCLLcovXz/mL6mOnhQaZsQGwPhuFopdQIlqGSEjiQ== + dependencies: + global-directory "^4.0.1" + is-path-inside "^4.0.0" + is-installed-globally@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.4.0.tgz#9a0fd407949c30f86eb6959ef1b7994ed0b7b520" @@ -21412,6 +21493,11 @@ is-path-inside@^3.0.2, is-path-inside@^3.0.3: resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== +is-path-inside@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-4.0.0.tgz#805aeb62c47c1b12fc3fd13bfb3ed1e7430071db" + integrity sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA== + is-plain-obj@2.1.0, is-plain-obj@^2.0.0, is-plain-obj@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" @@ -23775,6 +23861,13 @@ memoize-one@^6.0.0: resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-6.0.0.tgz#b2591b871ed82948aee4727dc6abceeeac8c1045" integrity sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw== +memoize@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/memoize/-/memoize-10.0.0.tgz#43fa66b2022363c7c50cf5dfab732a808a3d7147" + integrity sha512-H6cBLgsi6vMWOcCpvVCdFFnl3kerEXbrYh9q+lY6VXvQSmM6CkmV08VOwT+WE2tzIEqRPFfAq3fm4v/UIW6mSA== + dependencies: + mimic-function "^5.0.0" + memoizerific@^1.11.3: version "1.11.3" resolved "https://registry.yarnpkg.com/memoizerific/-/memoizerific-1.11.3.tgz#7c87a4646444c32d75438570905f2dbd1b1a805a" @@ -25936,16 +26029,21 @@ picocolors@^0.2.1: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-0.2.1.tgz#570670f793646851d1ba135996962abad587859f" integrity sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA== -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.0.0, picocolors@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.0, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== +picomatch@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" + integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== + pidusage@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/pidusage/-/pidusage-3.0.2.tgz#6faa5402b2530b3af2cf93d13bcf202889724a53" @@ -26746,7 +26844,7 @@ promise.prototype.finally@^3.1.0: es-abstract "^1.9.0" function-bind "^1.1.1" -prompts@^2.0.1, prompts@^2.4.0, prompts@~2.4.2: +prompts@^2.0.1, prompts@^2.4.0, prompts@^2.4.2, prompts@~2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== @@ -27868,6 +27966,13 @@ rechoir@^0.7.0: dependencies: resolve "^1.9.0" +rechoir@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.8.0.tgz#49f866e0d32146142da3ad8f0eff352b3215ff22" + integrity sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ== + dependencies: + resolve "^1.20.0" + redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -28043,6 +28148,11 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" +regexp-tree@~0.1.1: + version "0.1.27" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.27.tgz#2198f0ef54518ffa743fe74d983b56ffd631b6cd" + integrity sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA== + regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.4.3, regexp.prototype.flags@^1.5.1, regexp.prototype.flags@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz#138f644a3350f981a858c44f6bb1a61ff59be334" @@ -28697,6 +28807,13 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" +safe-regex@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-2.1.1.tgz#f7128f00d056e2fe5c11e81a1324dd974aadced2" + integrity sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A== + dependencies: + regexp-tree "~0.1.1" + safe-squel@^5.12.5: version "5.12.5" resolved "https://registry.yarnpkg.com/safe-squel/-/safe-squel-5.12.5.tgz#9597cec498dc184a15fe94082b7bcc80cb4d048b" @@ -30760,6 +30877,11 @@ tcp-port-used@^1.0.2: debug "4.3.1" is2 "^2.0.6" +teamcity-service-messages@^0.1.14: + version "0.1.14" + resolved "https://registry.yarnpkg.com/teamcity-service-messages/-/teamcity-service-messages-0.1.14.tgz#193d420a5e4aef8e5e50b8c39e7865e08fbb5d8a" + integrity sha512-29aQwaHqm8RMX74u2o/h1KbMLP89FjNiMxD9wbF2BbWOnbM+q+d1sCEC+MqCc4QW3NJykn77OMpTFw/xTHIc0w== + teex@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/teex/-/teex-1.0.1.tgz#b8fa7245ef8e8effa8078281946c85ab780a0b12" @@ -31259,6 +31381,15 @@ ts-pnp@^1.1.6: resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw== +tsconfig-paths-webpack-plugin@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths-webpack-plugin/-/tsconfig-paths-webpack-plugin-4.1.0.tgz#3c6892c5e7319c146eee1e7302ed9e6f2be4f763" + integrity sha512-xWFISjviPydmtmgeUAuXp4N1fky+VCtfhOkDUFIv5ea7p4wuTomI4QTrXvFBX2S4jZsmyTSrStQl+E+4w+RzxA== + dependencies: + chalk "^4.1.0" + enhanced-resolve "^5.7.0" + tsconfig-paths "^4.1.2" + tsconfig-paths@^3.14.2: version "3.14.2" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088" @@ -31269,7 +31400,7 @@ tsconfig-paths@^3.14.2: minimist "^1.2.6" strip-bom "^3.0.0" -tsconfig-paths@^4.2.0: +tsconfig-paths@^4.1.2, tsconfig-paths@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz#ef78e19039133446d244beac0fd6a1632e2d107c" integrity sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg== @@ -32621,6 +32752,11 @@ watchpack@^2.2.0, watchpack@^2.4.1: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" +watskeburt@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/watskeburt/-/watskeburt-4.1.0.tgz#3c0227669be646a97424b631164b1afe3d4d5344" + integrity sha512-KkY5H51ajqy9HYYI+u9SIURcWnqeVVhdH0I+ab6aXPGHfZYxgRCwnR6Lm3+TYB6jJVt5jFqw4GAKmwf1zHmGQw== + wbuf@^1.1.0, wbuf@^1.7.3: version "1.7.3" resolved "https://registry.yarnpkg.com/wbuf/-/wbuf-1.7.3.tgz#c1d8d149316d3ea852848895cb6a0bfe887b87df" From 197e606bdf812438dbcfe5bb783198a0ea874b52 Mon Sep 17 00:00:00 2001 From: "Eyo O. Eyo" <7893459+eokoneyo@users.noreply.github.com> Date: Mon, 25 Nov 2024 14:35:02 +0100 Subject: [PATCH 21/71] fix issue with generating short url when copying share link (#201475) ## Summary Extracted from https://github.com/elastic/kibana/pull/197484, to make it much easier to backport this fix to other releases that require this fix. This PR fixes the issue with generating short URL for the share link. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios Co-authored-by: Elastic Machine --- .../public/components/context/index.test.tsx | 25 +++ .../share/public/components/context/index.tsx | 23 ++- .../public/components/share_tabs.test.tsx | 16 +- .../share/public/components/share_tabs.tsx | 16 +- .../tabs/link/link_content.test.tsx | 191 ++++++++++++++++++ .../components/tabs/link/link_content.tsx | 107 +++++----- 6 files changed, 300 insertions(+), 78 deletions(-) create mode 100644 src/plugins/share/public/components/context/index.test.tsx create mode 100644 src/plugins/share/public/components/tabs/link/link_content.test.tsx diff --git a/src/plugins/share/public/components/context/index.test.tsx b/src/plugins/share/public/components/context/index.test.tsx new file mode 100644 index 0000000000000..162518e505b1d --- /dev/null +++ b/src/plugins/share/public/components/context/index.test.tsx @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { renderHook } from '@testing-library/react-hooks'; +import { useShareTabsContext } from '.'; + +describe('share menu context', () => { + describe('useShareTabsContext', () => { + it('throws an error if used outside of ShareMenuProvider tree', () => { + const { result } = renderHook(() => useShareTabsContext()); + + expect(result.error?.message).toEqual( + expect.stringContaining( + 'Failed to call `useShareTabsContext` because the context from ShareMenuProvider is missing.' + ) + ); + }); + }); +}); diff --git a/src/plugins/share/public/components/context/index.tsx b/src/plugins/share/public/components/context/index.tsx index b75df40aaa41a..13d6138e42a60 100644 --- a/src/plugins/share/public/components/context/index.tsx +++ b/src/plugins/share/public/components/context/index.tsx @@ -9,7 +9,7 @@ import { ThemeServiceSetup } from '@kbn/core-theme-browser'; import { I18nStart } from '@kbn/core/public'; -import { createContext, useContext } from 'react'; +import React, { type PropsWithChildren, createContext, useContext } from 'react'; import { AnonymousAccessServiceContract } from '../../../common'; import type { @@ -35,6 +35,23 @@ export interface IShareContext extends ShareContext { anchorElement?: HTMLElement; } -export const ShareTabsContext = createContext(null); +const ShareTabsContext = createContext(null); -export const useShareTabsContext = () => useContext(ShareTabsContext); +export const ShareMenuProvider = ({ + shareContext, + children, +}: PropsWithChildren<{ shareContext: IShareContext }>) => { + return {children}; +}; + +export const useShareTabsContext = () => { + const context = useContext(ShareTabsContext); + + if (!context) { + throw new Error( + 'Failed to call `useShareTabsContext` because the context from ShareMenuProvider is missing. Ensure the component or React root is wrapped with ShareMenuProvider' + ); + } + + return context; +}; diff --git a/src/plugins/share/public/components/share_tabs.test.tsx b/src/plugins/share/public/components/share_tabs.test.tsx index b4ad92fce84f9..6b04a28304fdd 100644 --- a/src/plugins/share/public/components/share_tabs.test.tsx +++ b/src/plugins/share/public/components/share_tabs.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ShareMenuTabs } from './share_tabs'; -import { ShareTabsContext } from './context'; +import { ShareMenuProvider } from './context'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { KibanaLocation, LocatorGetUrlParams, UrlService } from '../../common/url_service'; import { @@ -77,9 +77,9 @@ describe('Share modal tabs', () => { }, ]; const wrapper = mountWithIntl( - + - + ); expect(wrapper.find('[data-test-subj="export"]').exists()).toBeTruthy(); }); @@ -92,11 +92,13 @@ describe('Share modal tabs', () => { generateExportUrl: mockGenerateExportUrl, }, ]; + const wrapper = mountWithIntl( - + - + ); + expect(wrapper.find('[data-test-subj="export"]').exists()).toBeFalsy(); }); @@ -116,9 +118,9 @@ describe('Share modal tabs', () => { }, ]; const wrapper = mountWithIntl( - + - + ); expect(wrapper.find('[data-test-subj="export"]').exists()).toBeTruthy(); }); diff --git a/src/plugins/share/public/components/share_tabs.tsx b/src/plugins/share/public/components/share_tabs.tsx index 0ed540a612009..94c4ab8655dca 100644 --- a/src/plugins/share/public/components/share_tabs.tsx +++ b/src/plugins/share/public/components/share_tabs.tsx @@ -8,16 +8,16 @@ */ import React, { type FC } from 'react'; -import { TabbedModal } from '@kbn/shared-ux-tabbed-modal'; +import { TabbedModal, type IModalTabDeclaration } from '@kbn/shared-ux-tabbed-modal'; -import { ShareTabsContext, useShareTabsContext, type IShareContext } from './context'; +import { ShareMenuProvider, useShareTabsContext, type IShareContext } from './context'; import { linkTab, embedTab, exportTab } from './tabs'; export const ShareMenu: FC<{ shareContext: IShareContext }> = ({ shareContext }) => { return ( - + - + ); }; @@ -25,15 +25,9 @@ export const ShareMenu: FC<{ shareContext: IShareContext }> = ({ shareContext }) export const ShareMenuTabs = () => { const shareContext = useShareTabsContext(); - if (!shareContext) { - return null; - } - const { allowEmbed, objectTypeMeta, onClose, shareMenuItems, anchorElement } = shareContext; - const tabs = []; - - tabs.push(linkTab); + const tabs: Array> = [linkTab]; const enabledItems = shareMenuItems.filter(({ shareMenuItem }) => !shareMenuItem?.disabled); diff --git a/src/plugins/share/public/components/tabs/link/link_content.test.tsx b/src/plugins/share/public/components/tabs/link/link_content.test.tsx new file mode 100644 index 0000000000000..77fac4afc8ce0 --- /dev/null +++ b/src/plugins/share/public/components/tabs/link/link_content.test.tsx @@ -0,0 +1,191 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import React, { type ComponentProps } from 'react'; +import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; +import userEvent from '@testing-library/user-event'; +import { render, screen, waitFor } from '@testing-library/react'; + +import { urlServiceTestSetup } from '../../../../common/url_service/__tests__/setup'; +import { MockLocatorDefinition } from '../../../../common/url_service/mocks'; +import { BrowserShortUrlClientFactory } from '../../../url_service/short_urls/short_url_client_factory'; +import { + BrowserShortUrlClientHttp, + BrowserShortUrlClient, +} from '../../../url_service/short_urls/short_url_client'; +import { BrowserUrlService } from '../../../types'; +import { LinkContent } from './link_content'; + +const renderComponent = (props: ComponentProps) => { + render( + + + + ); +}; + +describe('LinkContent', () => { + const shareableUrl = 'http://localhost:5601/app/dashboards#/view/123'; + + const http: BrowserShortUrlClientHttp = { + basePath: { + get: () => '/xyz', + }, + fetch: jest.fn(async () => { + return {} as any; + }), + }; + + let urlService: BrowserUrlService; + + // @ts-expect-error there is a type because we override the shortUrls implementation + // eslint-disable-next-line prefer-const + ({ service: urlService } = urlServiceTestSetup({ + shortUrls: ({ locators }) => + new BrowserShortUrlClientFactory({ + http, + locators, + }), + })); + + beforeAll(() => { + Object.defineProperty(document, 'execCommand', { + value: jest.fn(() => true), + }); + }); + + it('uses the delegatedShareUrlHandler to generate the shareable URL when it is provided', async () => { + const user = userEvent.setup(); + const objectType = 'dashboard'; + const objectId = '123'; + const isDirty = false; + + const delegatedShareUrlHandler = jest.fn(); + + renderComponent({ + objectType, + objectId, + isDirty, + shareableUrl, + urlService, + allowShortUrl: true, + delegatedShareUrlHandler, + }); + + await user.click(screen.getByTestId('copyShareUrlButton')); + + expect(delegatedShareUrlHandler).toHaveBeenCalled(); + }); + + it('returns the shareable URL when the delegatedShareUrlHandler is not provided and shortURLs are not allowed', async () => { + const user = userEvent.setup(); + const objectType = 'dashboard'; + const objectId = '123'; + const isDirty = false; + + renderComponent({ + objectType, + objectId, + isDirty, + shareableUrl, + urlService, + allowShortUrl: false, + }); + + const copyButton = screen.getByTestId('copyShareUrlButton'); + + await user.click(copyButton); + + waitFor(() => { + expect(copyButton.getAttribute('data-share-url')).toBe(shareableUrl); + }); + }); + + it('invokes the createWithLocator method on the shortURL service if a locator is present when the copy button is clicked', async () => { + const user = userEvent.setup(); + const objectType = 'dashboard'; + const objectId = '123'; + const isDirty = false; + const shareableUrlLocatorParams = { + locator: new MockLocatorDefinition('TEST_LOCATOR'), + params: {}, + }; + + const shortURL = 'http://localhost:5601/xyz/r/s/yellow-orange-tomato'; + + const createWithLocatorSpy = jest.spyOn(BrowserShortUrlClient.prototype, 'createWithLocator'); + + createWithLocatorSpy.mockResolvedValue({ + // @ts-expect-error we only return locator property, as that's all we need for this test + locator: { + getUrl: jest.fn(() => Promise.resolve(shortURL)), + }, + }); + + renderComponent({ + objectType, + objectId, + isDirty, + shareableUrl, + urlService, + allowShortUrl: true, + // @ts-ignore this locator is passed mainly to test the code path that invokes createWithLocator + shareableUrlLocatorParams, + }); + + const copyButton = screen.getByTestId('copyShareUrlButton'); + + const numberOfClicks = 4; + + for (const _click of Array.from({ length: numberOfClicks })) { + await user.click(copyButton); + } + + // should only invoke once no matter how many times the button is clicked + expect(createWithLocatorSpy).toHaveBeenCalledTimes(1); + expect(copyButton.getAttribute('data-share-url')).toBe(shortURL); + }); + + it('invokes the createFromLongUrl method on the shortURL service if a locator is not present when the copy button is clicked', async () => { + const user = userEvent.setup(); + const objectType = 'dashboard'; + const objectId = '123'; + const isDirty = false; + + const shortURL = 'http://localhost:5601/xyz/r/s/yellow-orange-tomato'; + + const createFromLongUrlSpy = jest.spyOn(BrowserShortUrlClient.prototype, 'createFromLongUrl'); + + // @ts-expect-error we only return url property, as that's all we need for this test + createFromLongUrlSpy.mockResolvedValue({ + url: shortURL, + }); + + renderComponent({ + objectType, + objectId, + isDirty, + shareableUrl, + urlService, + allowShortUrl: true, + }); + + const copyButton = screen.getByTestId('copyShareUrlButton'); + + const numberOfClicks = 4; + + for (const _click of Array.from({ length: numberOfClicks })) { + await user.click(copyButton); + } + + // should only invoke once no matter how many times the button is clicked + expect(createFromLongUrlSpy).toHaveBeenCalledTimes(1); + expect(copyButton.getAttribute('data-share-url')).toBe(shortURL); + }); +}); diff --git a/src/plugins/share/public/components/tabs/link/link_content.tsx b/src/plugins/share/public/components/tabs/link/link_content.tsx index 0871599a524ba..6c0d8e6e988ec 100644 --- a/src/plugins/share/public/components/tabs/link/link_content.tsx +++ b/src/plugins/share/public/components/tabs/link/link_content.tsx @@ -20,8 +20,8 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import React, { useCallback, useMemo, useState } from 'react'; -import { IShareContext } from '../../context'; +import React, { useCallback, useState, useRef, useEffect } from 'react'; +import type { IShareContext } from '../../context'; type LinkProps = Pick< IShareContext, @@ -42,87 +42,80 @@ interface UrlParams { } export const LinkContent = ({ - objectType, isDirty, + objectType, shareableUrl, urlService, shareableUrlLocatorParams, allowShortUrl, delegatedShareUrlHandler, }: LinkProps) => { - const [url, setUrl] = useState(''); - const [urlParams] = useState(undefined); + const [snapshotUrl, setSnapshotUrl] = useState(''); const [isTextCopied, setTextCopied] = useState(false); - const [shortUrlCache, setShortUrlCache] = useState(undefined); const [isLoading, setIsLoading] = useState(false); + const urlParamsRef = useRef(undefined); + const urlToCopy = useRef(undefined); + const copiedTextToolTipCleanupIdRef = useRef>(); - const getUrlWithUpdatedParams = useCallback( - (tempUrl: string): string => { - const urlWithUpdatedParams = urlParams - ? Object.keys(urlParams).reduce((urlAccumulator, key) => { - const urlParam = urlParams[key]; - return urlParam - ? Object.keys(urlParam).reduce((queryAccumulator, queryParam) => { - const isQueryParamEnabled = urlParam[queryParam]; - return isQueryParamEnabled - ? queryAccumulator + `&${queryParam}=true` - : queryAccumulator; - }, urlAccumulator) - : urlAccumulator; - }, tempUrl) - : tempUrl; + const getUrlWithUpdatedParams = useCallback((tempUrl: string): string => { + const urlWithUpdatedParams = urlParamsRef.current + ? Object.keys(urlParamsRef.current).reduce((urlAccumulator, key) => { + const urlParam = urlParamsRef.current?.[key]; + return urlParam + ? Object.keys(urlParam).reduce((queryAccumulator, queryParam) => { + const isQueryParamEnabled = urlParam[queryParam]; + return isQueryParamEnabled + ? queryAccumulator + `&${queryParam}=true` + : queryAccumulator; + }, urlAccumulator) + : urlAccumulator; + }, tempUrl) + : tempUrl; - // persist updated url to state - setUrl(urlWithUpdatedParams); - return urlWithUpdatedParams; - }, - [urlParams] - ); + return urlWithUpdatedParams; + }, []); - const getSnapshotUrl = useCallback(() => { - return getUrlWithUpdatedParams(shareableUrl || window.location.href); + useEffect(() => { + setSnapshotUrl(getUrlWithUpdatedParams(shareableUrl || window.location.href)); }, [getUrlWithUpdatedParams, shareableUrl]); const createShortUrl = useCallback(async () => { + const shortUrlService = urlService.shortUrls.get(null); + if (shareableUrlLocatorParams) { - const shortUrls = urlService.shortUrls.get(null); - const shortUrl = await shortUrls.createWithLocator(shareableUrlLocatorParams); - const urlWithLoc = await shortUrl.locator.getUrl(shortUrl.params, { absolute: true }); - setShortUrlCache(urlWithLoc); - return urlWithLoc; + const shortUrl = await shortUrlService.createWithLocator(shareableUrlLocatorParams); + return shortUrl.locator.getUrl(shortUrl.params, { absolute: true }); } else { - const snapshotUrl = getSnapshotUrl(); - const shortUrl = await urlService.shortUrls.get(null).createFromLongUrl(snapshotUrl); - setShortUrlCache(shortUrl.url); - - return shortUrl.url; + return (await shortUrlService.createFromLongUrl(snapshotUrl)).url; } - }, [shareableUrlLocatorParams, urlService.shortUrls, getSnapshotUrl, setShortUrlCache]); + }, [shareableUrlLocatorParams, urlService.shortUrls, snapshotUrl]); const copyUrlHelper = useCallback(async () => { setIsLoading(true); - let urlToCopy = url; - if (!urlToCopy || delegatedShareUrlHandler) { - urlToCopy = delegatedShareUrlHandler - ? delegatedShareUrlHandler?.() + if (!urlToCopy.current) { + urlToCopy.current = delegatedShareUrlHandler + ? delegatedShareUrlHandler() : allowShortUrl ? await createShortUrl() - : getSnapshotUrl(); + : snapshotUrl; } - copyToClipboard(urlToCopy); - setUrl(urlToCopy); - setTextCopied(true); + copyToClipboard(urlToCopy.current); + setTextCopied(() => { + if (copiedTextToolTipCleanupIdRef.current) { + clearInterval(copiedTextToolTipCleanupIdRef.current); + } + + // set up timer to revert copied state to false after specified duration + copiedTextToolTipCleanupIdRef.current = setTimeout(() => setTextCopied(false), 1000); + + // set copied state to true for now + return true; + }); setIsLoading(false); - return urlToCopy; - }, [url, delegatedShareUrlHandler, allowShortUrl, createShortUrl, getSnapshotUrl]); + }, [snapshotUrl, delegatedShareUrlHandler, allowShortUrl, createShortUrl]); - const handleTestUrl = useMemo(() => { - if (objectType !== 'search' || !allowShortUrl) return getSnapshotUrl(); - else if (objectType === 'search' && allowShortUrl) return shortUrlCache; - return copyUrlHelper(); - }, [objectType, getSnapshotUrl, allowShortUrl, shortUrlCache, copyUrlHelper]); return ( <> @@ -157,14 +150,14 @@ export const LinkContent = ({ (objectType === 'lens' && isDirty ? null : setTextCopied(false))} onClick={copyUrlHelper} color={objectType === 'lens' && isDirty ? 'warning' : 'primary'} From 63da7701e7e4d61254d31791d7856b3019bd6802 Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Mon, 25 Nov 2024 14:51:24 +0100 Subject: [PATCH 22/71] [Streams] App plugin (#200060) Creates the Streams app plugin, which renders UI for managing streams (see https://github.com/elastic/kibana/pull/198713). Additional changes in this PR: - The menus were updated to conditionally add a link to the Streams app. The Streams plugin itself returns a status$ observable which signals if Streams have been enabled. This value is used to conditionally render the link in the various flavors of menus. - There's a small change in the ES types to allow for ordered params in ES|QL (vs named params) - `@kbn/server-route-repository` was updated to be able to override `access` (instead of only inferring it from the endpoint name). Additionally, we now allow all route options by default. - `@kbn/typed-react-router-config` now also exports a `useBreadcrumbs`. This was copied over from the APM implementation. - the signature of the `esql` method in `ObservabilityElasticsearchClient` was updated to separate processing options from options that are sent over to the _query endpoint. --------- Co-authored-by: Chris Cowan Co-authored-by: Joe Reuter Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .eslintrc.js | 5 +- .github/CODEOWNERS | 1 + docs/developer/plugin-list.asciidoc | 4 + package.json | 1 + packages/deeplinks/observability/constants.ts | 2 + .../deeplinks/observability/deep_links.ts | 13 +- packages/kbn-es-types/src/search.ts | 2 +- packages/kbn-optimizer/limits.yml | 1 + .../src/create_repository_client.ts | 4 +- .../index.ts | 1 - .../src/parse_endpoint.ts | 12 +- .../src/typings.ts | 95 ++- packages/kbn-server-route-repository/index.ts | 1 - .../src/create_server_route_factory.ts | 9 +- .../src/register_routes.test.ts | 65 +- .../src/register_routes.ts | 32 +- .../src/test_types.ts | 24 +- .../kbn-typed-react-router-config/index.ts | 1 + .../kibana.jsonc | 2 +- .../src/breadcrumbs/breadcrumb.tsx | 51 ++ .../src/breadcrumbs/context.tsx | 113 +++ .../create_router_breadcrumb_component.tsx | 17 + .../src/breadcrumbs/index.tsx | 12 + .../src/breadcrumbs/use_breadcrumbs.ts | 101 +++ .../src/breadcrumbs/use_router_breadcrumb.ts | 53 ++ .../src/create_router.ts | 8 +- .../src/types/index.ts | 6 + .../src/use_router.tsx | 2 +- .../tsconfig.json | 7 +- packages/kbn-utility-types/src/dot.ts | 4 +- .../src/tsd_tests/test_d/dot.ts | 52 +- .../collectors/application_usage/schema.ts | 1 + src/plugins/telemetry/schema/oss_plugins.json | 131 +++ tsconfig.base.json | 2 + x-pack/.i18nrc.json | 7 +- .../object/unflatten_object.test.ts | 12 + .../object/unflatten_object.ts | 11 +- .../observability_utils_common/tsconfig.json | 1 + .../client/create_observability_es_client.ts | 135 +++- .../es/esql_result_to_plain_objects.test.ts | 35 +- .../es/esql_result_to_plain_objects.ts | 34 +- .../observability_utils_server/tsconfig.json | 2 + .../server/routes/enablement/check.ts | 12 +- .../server/routes/enablement/disable.ts | 12 +- .../server/routes/enablement/enable.ts | 12 +- .../server/routes/entities/create.ts | 12 +- .../server/routes/entities/delete.ts | 12 +- .../server/routes/entities/get.ts | 12 +- .../server/routes/entities/reset.ts | 12 +- .../server/routes/entities/update.ts | 12 +- .../apm_routes/register_apm_server_routes.ts | 10 +- .../apm/server/routes/typings.ts | 28 +- .../server/routes/register_routes.ts | 6 +- .../dataset_quality/server/routes/types.ts | 4 +- .../routes/entities/get_latest_entity.ts | 21 +- .../routes/entities/get_entity_groups.ts | 16 +- .../routes/entities/get_entity_types.ts | 20 +- .../routes/entities/get_latest_entities.ts | 31 +- .../server/routes/has_data/get_has_data.ts | 12 +- .../inventory/server/routes/types.ts | 8 +- .../investigate_app/server/routes/types.ts | 7 +- .../observability/kibana.jsonc | 5 +- .../observability/public/navigation_tree.ts | 15 +- .../observability/public/plugin.ts | 3 + .../observability/server/plugin.ts | 1 - .../server/routes/register_routes.ts | 99 +-- .../observability/server/routes/types.ts | 8 +- .../observability/tsconfig.json | 1 + .../server/functions/context.ts | 2 +- .../server/plugin.ts | 15 +- .../server/routes/chat/route.ts | 2 +- .../server/routes/register_routes.ts | 4 +- .../server/routes/types.ts | 71 +- .../observability_ai_assistant/tsconfig.json | 1 + .../server/plugin.ts | 19 +- .../server/rule_connector/index.test.ts | 12 +- .../server/rule_connector/index.ts | 2 +- .../observability_onboarding/server/plugin.ts | 24 +- .../server/routes/register_routes.ts | 126 --- .../server/routes/types.ts | 6 +- .../observability_shared/kibana.jsonc | 2 +- .../slo/server/routes/register_routes.ts | 3 +- .../observability_solution/slo/tsconfig.json | 1 - .../serverless_observability/kibana.jsonc | 6 +- .../public/navigation_tree.ts | 745 +++++++++--------- .../serverless_observability/public/plugin.ts | 10 +- .../serverless_observability/public/types.ts | 11 +- .../serverless_observability/tsconfig.json | 1 + x-pack/plugins/streams/common/index.ts | 8 + x-pack/plugins/streams/public/api/index.ts | 52 ++ x-pack/plugins/streams/public/index.ts | 7 +- x-pack/plugins/streams/public/plugin.ts | 38 +- x-pack/plugins/streams/public/types.ts | 15 +- x-pack/plugins/streams/server/index.ts | 2 + .../streams/server/lib/streams/stream_crud.ts | 76 +- x-pack/plugins/streams/server/plugin.ts | 7 +- .../streams/server/routes/esql/route.ts | 67 ++ x-pack/plugins/streams/server/routes/index.ts | 10 +- .../streams/server/routes/streams/delete.ts | 42 +- .../streams/server/routes/streams/disable.ts | 44 ++ .../streams/server/routes/streams/edit.ts | 28 +- .../streams/server/routes/streams/enable.ts | 33 +- .../streams/server/routes/streams/fork.ts | 35 +- .../streams/server/routes/streams/list.ts | 81 +- .../streams/server/routes/streams/read.ts | 41 +- .../streams/server/routes/streams/resync.ts | 33 +- .../streams/server/routes/streams/settings.ts | 34 + x-pack/plugins/streams/tsconfig.json | 3 + .../get_mock_streams_app_context.tsx | 36 + .../streams_app/.storybook/jest_setup.js | 11 + x-pack/plugins/streams_app/.storybook/main.js | 8 + .../plugins/streams_app/.storybook/preview.js | 13 + .../.storybook/storybook_decorator.tsx | 18 + x-pack/plugins/streams_app/README.md | 3 + .../streams_app/common/entity_source_query.ts | 14 + x-pack/plugins/streams_app/common/index.ts | 22 + x-pack/plugins/streams_app/jest.config.js | 23 + x-pack/plugins/streams_app/kibana.jsonc | 26 + .../streams_app/public/application.tsx | 49 ++ .../public/components/app_root/index.tsx | 73 ++ .../components/entity_detail_view/index.tsx | 102 +++ .../index.tsx | 30 + .../entity_overview_tab_list/index.tsx | 32 + .../esql_chart/controlled_esql_chart.tsx | 174 ++++ .../public/components/loading_panel/index.tsx | 35 + .../public/components/not_found/index.tsx | 24 + .../public/components/redirect_to/index.tsx | 27 + .../stream_detail_overview/index.tsx | 168 ++++ .../components/stream_detail_view/index.tsx | 65 ++ .../components/stream_list_view/index.tsx | 64 ++ .../streams_app_context_provider/index.tsx | 27 + .../streams_app_page_body/index.tsx | 26 + .../streams_app_page_header/index.tsx | 35 + .../streams_app_page_header_title.tsx | 16 + .../streams_app_page_template/index.tsx | 44 ++ .../streams_app_router_breadcrumb/index.tsx | 11 + .../streams_app_search_bar/index.tsx | 78 ++ .../public/components/streams_table/index.tsx | 78 ++ .../streams_app/public/hooks/use_kibana.tsx | 36 + .../hooks/use_streams_app_breadcrumbs.ts | 11 + .../public/hooks/use_streams_app_fetch.ts | 73 ++ .../public/hooks/use_streams_app_params.ts | 14 + .../hooks/use_streams_app_route_path.ts | 15 + .../public/hooks/use_streams_app_router.ts | 55 ++ x-pack/plugins/streams_app/public/index.ts | 26 + x-pack/plugins/streams_app/public/plugin.ts | 139 ++++ .../streams_app/public/routes/config.tsx | 68 ++ .../streams_app/public/services/types.ts | 9 + x-pack/plugins/streams_app/public/types.ts | 43 + .../public/util/esql_result_to_timeseries.ts | 99 +++ x-pack/plugins/streams_app/server/config.ts | 14 + x-pack/plugins/streams_app/server/index.ts | 35 + x-pack/plugins/streams_app/server/plugin.ts | 42 + x-pack/plugins/streams_app/server/types.ts | 23 + x-pack/plugins/streams_app/tsconfig.json | 37 + yarn.lock | 4 + 156 files changed, 4098 insertions(+), 1159 deletions(-) create mode 100644 packages/kbn-typed-react-router-config/src/breadcrumbs/breadcrumb.tsx create mode 100644 packages/kbn-typed-react-router-config/src/breadcrumbs/context.tsx create mode 100644 packages/kbn-typed-react-router-config/src/breadcrumbs/create_router_breadcrumb_component.tsx create mode 100644 packages/kbn-typed-react-router-config/src/breadcrumbs/index.tsx create mode 100644 packages/kbn-typed-react-router-config/src/breadcrumbs/use_breadcrumbs.ts create mode 100644 packages/kbn-typed-react-router-config/src/breadcrumbs/use_router_breadcrumb.ts delete mode 100644 x-pack/plugins/observability_solution/observability_onboarding/server/routes/register_routes.ts create mode 100644 x-pack/plugins/streams/common/index.ts create mode 100644 x-pack/plugins/streams/public/api/index.ts create mode 100644 x-pack/plugins/streams/server/routes/esql/route.ts create mode 100644 x-pack/plugins/streams/server/routes/streams/disable.ts create mode 100644 x-pack/plugins/streams/server/routes/streams/settings.ts create mode 100644 x-pack/plugins/streams_app/.storybook/get_mock_streams_app_context.tsx create mode 100644 x-pack/plugins/streams_app/.storybook/jest_setup.js create mode 100644 x-pack/plugins/streams_app/.storybook/main.js create mode 100644 x-pack/plugins/streams_app/.storybook/preview.js create mode 100644 x-pack/plugins/streams_app/.storybook/storybook_decorator.tsx create mode 100644 x-pack/plugins/streams_app/README.md create mode 100644 x-pack/plugins/streams_app/common/entity_source_query.ts create mode 100644 x-pack/plugins/streams_app/common/index.ts create mode 100644 x-pack/plugins/streams_app/jest.config.js create mode 100644 x-pack/plugins/streams_app/kibana.jsonc create mode 100644 x-pack/plugins/streams_app/public/application.tsx create mode 100644 x-pack/plugins/streams_app/public/components/app_root/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/entity_detail_view/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/entity_detail_view_header_section/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/entity_overview_tab_list/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/esql_chart/controlled_esql_chart.tsx create mode 100644 x-pack/plugins/streams_app/public/components/loading_panel/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/not_found/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/redirect_to/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/stream_detail_overview/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/stream_detail_view/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/stream_list_view/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/streams_app_context_provider/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/streams_app_page_body/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/streams_app_page_header/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/streams_app_page_header/streams_app_page_header_title.tsx create mode 100644 x-pack/plugins/streams_app/public/components/streams_app_page_template/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/streams_app_router_breadcrumb/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/streams_app_search_bar/index.tsx create mode 100644 x-pack/plugins/streams_app/public/components/streams_table/index.tsx create mode 100644 x-pack/plugins/streams_app/public/hooks/use_kibana.tsx create mode 100644 x-pack/plugins/streams_app/public/hooks/use_streams_app_breadcrumbs.ts create mode 100644 x-pack/plugins/streams_app/public/hooks/use_streams_app_fetch.ts create mode 100644 x-pack/plugins/streams_app/public/hooks/use_streams_app_params.ts create mode 100644 x-pack/plugins/streams_app/public/hooks/use_streams_app_route_path.ts create mode 100644 x-pack/plugins/streams_app/public/hooks/use_streams_app_router.ts create mode 100644 x-pack/plugins/streams_app/public/index.ts create mode 100644 x-pack/plugins/streams_app/public/plugin.ts create mode 100644 x-pack/plugins/streams_app/public/routes/config.tsx create mode 100644 x-pack/plugins/streams_app/public/services/types.ts create mode 100644 x-pack/plugins/streams_app/public/types.ts create mode 100644 x-pack/plugins/streams_app/public/util/esql_result_to_timeseries.ts create mode 100644 x-pack/plugins/streams_app/server/config.ts create mode 100644 x-pack/plugins/streams_app/server/index.ts create mode 100644 x-pack/plugins/streams_app/server/plugin.ts create mode 100644 x-pack/plugins/streams_app/server/types.ts create mode 100644 x-pack/plugins/streams_app/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index 097080753161d..7ff37b0c9fd98 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -952,6 +952,7 @@ module.exports = { { files: [ 'x-pack/plugins/observability_solution/**/*.{ts,tsx}', + 'x-pack/plugins/{streams,streams_app}/**/*.{ts,tsx}', 'x-pack/packages/observability/**/*.{ts,tsx}', ], rules: { @@ -959,7 +960,7 @@ module.exports = { 'error', { additionalHooks: - '^(useAbortableAsync|useMemoWithAbortSignal|useFetcher|useProgressiveFetcher|useBreadcrumb|useAsync|useTimeRangeAsync|useAutoAbortedHttpClient)$', + '^(useAbortableAsync|useMemoWithAbortSignal|useFetcher|useProgressiveFetcher|useBreadcrumb|useAsync|useTimeRangeAsync|useAutoAbortedHttpClient|use.*Fetch)$', }, ], }, @@ -968,6 +969,7 @@ module.exports = { files: [ 'x-pack/plugins/aiops/**/*.tsx', 'x-pack/plugins/observability_solution/**/*.tsx', + 'x-pack/plugins/{streams,streams_app}/**/*.{ts,tsx}', 'src/plugins/ai_assistant_management/**/*.tsx', 'x-pack/packages/observability/**/*.{ts,tsx}', ], @@ -984,6 +986,7 @@ module.exports = { { files: [ 'x-pack/plugins/observability_solution/**/!(*.stories.tsx|*.test.tsx|*.storybook_decorator.tsx|*.mock.tsx)', + 'x-pack/plugins/{streams,streams_app}/**/!(*.stories.tsx|*.test.tsx|*.storybook_decorator.tsx|*.mock.tsx)', 'src/plugins/ai_assistant_management/**/!(*.stories.tsx|*.test.tsx|*.storybook_decorator.tsx|*.mock.tsx)', 'x-pack/packages/observability/logs_overview/**/!(*.stories.tsx|*.test.tsx|*.storybook_decorator.tsx|*.mock.tsx)', ], diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b56729efdee02..2ef66f43460c5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -978,6 +978,7 @@ x-pack/plugins/spaces @elastic/kibana-security x-pack/plugins/stack_alerts @elastic/response-ops x-pack/plugins/stack_connectors @elastic/response-ops x-pack/plugins/streams @simianhacker @flash1293 @dgieselaar +x-pack/plugins/streams_app @simianhacker @flash1293 @dgieselaar x-pack/plugins/task_manager @elastic/response-ops x-pack/plugins/telemetry_collection_xpack @elastic/kibana-core x-pack/plugins/threat_intelligence @elastic/security-threat-hunting-investigations diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index efe65e4a99549..8e8ee80ff81be 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -917,6 +917,10 @@ routes, etc. |This plugin provides an interface to manage streams +|{kib-repo}blob/{branch}/x-pack/plugins/streams_app/README.md[streamsApp] +|Home of the Streams app plugin, which allows users to manage Streams via the UI. + + |{kib-repo}blob/{branch}/x-pack/plugins/observability_solution/synthetics/README.md[synthetics] |The purpose of this plugin is to provide users of Heartbeat more visibility of what's happening in their infrastructure. diff --git a/package.json b/package.json index 5c91eb0694911..a36f44f300866 100644 --- a/package.json +++ b/package.json @@ -937,6 +937,7 @@ "@kbn/status-plugin-a-plugin": "link:test/server_integration/plugins/status_plugin_a", "@kbn/status-plugin-b-plugin": "link:test/server_integration/plugins/status_plugin_b", "@kbn/std": "link:packages/kbn-std", + "@kbn/streams-app-plugin": "link:x-pack/plugins/streams_app", "@kbn/streams-plugin": "link:x-pack/plugins/streams", "@kbn/synthetics-plugin": "link:x-pack/plugins/observability_solution/synthetics", "@kbn/synthetics-private-location": "link:x-pack/packages/kbn-synthetics-private-location", diff --git a/packages/deeplinks/observability/constants.ts b/packages/deeplinks/observability/constants.ts index 25642ba69613a..3dcc009481d0a 100644 --- a/packages/deeplinks/observability/constants.ts +++ b/packages/deeplinks/observability/constants.ts @@ -35,3 +35,5 @@ export const OBLT_UX_APP_ID = 'ux'; export const OBLT_PROFILING_APP_ID = 'profiling'; export const INVENTORY_APP_ID = 'inventory'; + +export const STREAMS_APP_ID = 'streams'; diff --git a/packages/deeplinks/observability/deep_links.ts b/packages/deeplinks/observability/deep_links.ts index 1253b4e889fcf..256350feb2e21 100644 --- a/packages/deeplinks/observability/deep_links.ts +++ b/packages/deeplinks/observability/deep_links.ts @@ -21,6 +21,7 @@ import { OBLT_UX_APP_ID, OBLT_PROFILING_APP_ID, INVENTORY_APP_ID, + STREAMS_APP_ID, } from './constants'; type LogsApp = typeof LOGS_APP_ID; @@ -36,6 +37,7 @@ type AiAssistantApp = typeof AI_ASSISTANT_APP_ID; type ObltUxApp = typeof OBLT_UX_APP_ID; type ObltProfilingApp = typeof OBLT_PROFILING_APP_ID; type InventoryApp = typeof INVENTORY_APP_ID; +type StreamsApp = typeof STREAMS_APP_ID; export type AppId = | LogsApp @@ -50,7 +52,8 @@ export type AppId = | AiAssistantApp | ObltUxApp | ObltProfilingApp - | InventoryApp; + | InventoryApp + | StreamsApp; export type LogsLinkId = 'log-categories' | 'settings' | 'anomalies' | 'stream'; @@ -83,13 +86,16 @@ export type SyntheticsLinkId = 'certificates' | 'overview'; export type ProfilingLinkId = 'stacktraces' | 'flamegraphs' | 'functions'; +export type StreamsLinkId = 'overview'; + export type LinkId = | LogsLinkId | ObservabilityOverviewLinkId | MetricsLinkId | ApmLinkId | SyntheticsLinkId - | ProfilingLinkId; + | ProfilingLinkId + | StreamsLinkId; export type DeepLinkId = | AppId @@ -99,4 +105,5 @@ export type DeepLinkId = | `${ApmApp}:${ApmLinkId}` | `${SyntheticsApp}:${SyntheticsLinkId}` | `${ObltProfilingApp}:${ProfilingLinkId}` - | `${InventoryApp}:${InventoryLinkId}`; + | `${InventoryApp}:${InventoryLinkId}` + | `${StreamsApp}:${StreamsLinkId}`; diff --git a/packages/kbn-es-types/src/search.ts b/packages/kbn-es-types/src/search.ts index 87f9dd15517c9..d3675e04c2663 100644 --- a/packages/kbn-es-types/src/search.ts +++ b/packages/kbn-es-types/src/search.ts @@ -695,5 +695,5 @@ export interface ESQLSearchParams { locale?: string; include_ccs_metadata?: boolean; dropNullColumns?: boolean; - params?: Array>; + params?: estypesWithoutBodyKey.ScalarValue[] | Array>; } diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 34355f36541cd..caa5c3b53d193 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -163,6 +163,7 @@ pageLoadAssetSize: stackAlerts: 58316 stackConnectors: 67227 streams: 16742 + streamsApp: 20537 synthetics: 55971 telemetry: 51957 telemetryManagementSection: 38586 diff --git a/packages/kbn-server-route-repository-client/src/create_repository_client.ts b/packages/kbn-server-route-repository-client/src/create_repository_client.ts index 015db2b9948d8..325f484103d09 100644 --- a/packages/kbn-server-route-repository-client/src/create_repository_client.ts +++ b/packages/kbn-server-route-repository-client/src/create_repository_client.ts @@ -15,12 +15,12 @@ import { } from '@kbn/server-route-repository-utils'; import { httpResponseIntoObservable } from '@kbn/sse-utils-client'; import { from } from 'rxjs'; -import { HttpFetchOptions, HttpFetchQuery, HttpResponse } from '@kbn/core-http-browser'; +import { HttpFetchQuery, HttpResponse } from '@kbn/core-http-browser'; import { omit } from 'lodash'; export function createRepositoryClient< TRepository extends ServerRouteRepository, - TClientOptions extends HttpFetchOptions = {} + TClientOptions extends Record = {} >(core: CoreStart | CoreSetup): RouteRepositoryClient { const fetch = ( endpoint: string, diff --git a/packages/kbn-server-route-repository-utils/index.ts b/packages/kbn-server-route-repository-utils/index.ts index 14322f9b64c8f..a1e3ec45bd6f7 100644 --- a/packages/kbn-server-route-repository-utils/index.ts +++ b/packages/kbn-server-route-repository-utils/index.ts @@ -18,7 +18,6 @@ export type { EndpointOf, ReturnOf, RouteRepositoryClient, - RouteState, ClientRequestParamsOf, DecodedRequestParamsOf, ServerRouteRepository, diff --git a/packages/kbn-server-route-repository-utils/src/parse_endpoint.ts b/packages/kbn-server-route-repository-utils/src/parse_endpoint.ts index e16590c9a666f..b81b3285ec8f5 100644 --- a/packages/kbn-server-route-repository-utils/src/parse_endpoint.ts +++ b/packages/kbn-server-route-repository-utils/src/parse_endpoint.ts @@ -7,22 +7,20 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -type Method = 'get' | 'post' | 'put' | 'patch' | 'delete'; +import type { RouteMethod } from '@kbn/core-http-server'; + +const validMethods: RouteMethod[] = ['delete', 'get', 'patch', 'post', 'put']; export function parseEndpoint(endpoint: string) { const parts = endpoint.split(' '); - const method = parts[0].trim().toLowerCase() as Method; + const method = parts[0].trim().toLowerCase() as Exclude; const pathname = parts[1].trim(); const version = parts[2]?.trim(); - if (!['get', 'post', 'put', 'patch', 'delete'].includes(method)) { + if (!validMethods.includes(method)) { throw new Error(`Endpoint ${endpoint} was not prefixed with a valid HTTP method`); } - if (!version && pathname.startsWith('/api')) { - throw new Error(`Missing version for public endpoint ${endpoint}`); - } - return { method, pathname, version }; } diff --git a/packages/kbn-server-route-repository-utils/src/typings.ts b/packages/kbn-server-route-repository-utils/src/typings.ts index fc4fbe8ab6da6..5db4a87b8b326 100644 --- a/packages/kbn-server-route-repository-utils/src/typings.ts +++ b/packages/kbn-server-route-repository-utils/src/typings.ts @@ -8,14 +8,13 @@ */ import type { HttpFetchOptions } from '@kbn/core-http-browser'; -import type { IKibanaResponse } from '@kbn/core-http-server'; +import type { IKibanaResponse, RouteAccess, RouteSecurity } from '@kbn/core-http-server'; import type { KibanaRequest, KibanaResponseFactory, Logger, RequestHandlerContext, RouteConfigOptions, - RouteSecurity, RouteMethod, } from '@kbn/core/server'; import type { ServerSentEvent } from '@kbn/sse-utils'; @@ -23,7 +22,7 @@ import { z } from '@kbn/zod'; import * as t from 'io-ts'; import { Observable } from 'rxjs'; import { Readable } from 'stream'; -import { RequiredKeys, ValuesType } from 'utility-types'; +import { Required, RequiredKeys, ValuesType } from 'utility-types'; type MaybeOptional }> = RequiredKeys< T['params'] @@ -51,24 +50,37 @@ export type ZodParamsObject = z.ZodObject<{ export type IoTsParamsObject = WithoutIncompatibleMethods>; export type RouteParamsRT = IoTsParamsObject | ZodParamsObject; +export type ServerRouteHandlerResources = Record; -export interface RouteState { - [endpoint: string]: ServerRoute; +export interface ServerRouteCreateOptions { + [x: string]: any; } -export type ServerRouteHandlerResources = Record; -export type ServerRouteCreateOptions = Record; +type RouteMethodOf = TEndpoint extends `${infer TRouteMethod} ${string}` + ? Lowercase extends RouteMethod + ? Lowercase + : never + : never; -type ValidateEndpoint = string extends TEndpoint +type IsPublicEndpoint< + TEndpoint extends string, + TRouteAccess extends RouteAccess | undefined +> = TRouteAccess extends 'public' ? true - : TEndpoint extends `${string} ${string} ${string}` + : TRouteAccess extends 'internal' + ? false + : TEndpoint extends `${string} /api${string}` ? true - : TEndpoint extends `${string} ${infer TPathname}` - ? TPathname extends `/internal/${string}` - ? true - : false : false; +type IsVersionSpecified = + TEndpoint extends `${string} ${string} ${string}` ? true : false; + +type ValidateEndpoint< + TEndpoint extends string, + TRouteAccess extends RouteAccess | undefined +> = IsPublicEndpoint extends true ? IsVersionSpecified : true; + type IsAny = 1 | 0 extends (T extends never ? 1 : 0) ? true : false; // this ensures only plain objects can be returned, if it's not one @@ -128,17 +140,27 @@ type ServerRouteHandler< export type CreateServerRouteFactory< TRouteHandlerResources extends ServerRouteHandlerResources, - TRouteCreateOptions extends ServerRouteCreateOptions + TRouteCreateOptions extends DefaultRouteCreateOptions | undefined > = < TEndpoint extends string, TReturnType extends ServerRouteHandlerReturnType, - TRouteParamsRT extends RouteParamsRT | undefined = undefined + TRouteParamsRT extends RouteParamsRT | undefined = undefined, + TRouteAccess extends RouteAccess | undefined = undefined >( options: { - endpoint: ValidateEndpoint extends true ? TEndpoint : never; + endpoint: ValidateEndpoint extends true ? TEndpoint : never; handler: ServerRouteHandler; params?: TRouteParamsRT; - } & TRouteCreateOptions + security?: RouteSecurity; + } & Required< + { + options?: (TRouteCreateOptions extends DefaultRouteCreateOptions ? TRouteCreateOptions : {}) & + RouteConfigOptions> & { + access?: TRouteAccess; + }; + }, + RequiredKeys extends never ? never : 'options' + > ) => Record< TEndpoint, ServerRoute< @@ -155,16 +177,17 @@ export type ServerRoute< TRouteParamsRT extends RouteParamsRT | undefined, TRouteHandlerResources extends ServerRouteHandlerResources, TReturnType extends ServerRouteHandlerReturnType, - TRouteCreateOptions extends ServerRouteCreateOptions + TRouteCreateOptions extends DefaultRouteCreateOptions | undefined > = { endpoint: TEndpoint; handler: ServerRouteHandler; -} & TRouteCreateOptions & - (TRouteParamsRT extends RouteParamsRT ? { params: TRouteParamsRT } : {}); + security?: RouteSecurity; +} & (TRouteParamsRT extends RouteParamsRT ? { params: TRouteParamsRT } : {}) & + (TRouteCreateOptions extends DefaultRouteCreateOptions ? { options: TRouteCreateOptions } : {}); export type ServerRouteRepository = Record< string, - ServerRoute> + ServerRoute >; type ClientRequestParamsOfType = @@ -195,13 +218,7 @@ export type EndpointOf = export type ReturnOf< TServerRouteRepository extends ServerRouteRepository, TEndpoint extends keyof TServerRouteRepository -> = TServerRouteRepository[TEndpoint] extends ServerRoute< - any, - any, - any, - infer TReturnType, - ServerRouteCreateOptions -> +> = TServerRouteRepository[TEndpoint] extends ServerRoute ? TReturnType extends IKibanaResponse ? TWrappedResponseType : TReturnType @@ -210,13 +227,7 @@ export type ReturnOf< export type DecodedRequestParamsOf< TServerRouteRepository extends ServerRouteRepository, TEndpoint extends keyof TServerRouteRepository -> = TServerRouteRepository[TEndpoint] extends ServerRoute< - any, - infer TRouteParamsRT, - any, - any, - ServerRouteCreateOptions -> +> = TServerRouteRepository[TEndpoint] extends ServerRoute ? TRouteParamsRT extends RouteParamsRT ? DecodedRequestParamsOfType : {} @@ -230,7 +241,7 @@ export type ClientRequestParamsOf< infer TRouteParamsRT, any, any, - ServerRouteCreateOptions + ServerRouteCreateOptions | undefined > ? TRouteParamsRT extends RouteParamsRT ? ClientRequestParamsOfType @@ -250,13 +261,17 @@ export interface RouteRepositoryClient< fetch>( endpoint: TEndpoint, ...args: MaybeOptionalArgs< - ClientRequestParamsOf & TAdditionalClientOptions + ClientRequestParamsOf & + TAdditionalClientOptions & + HttpFetchOptions > ): Promise>; stream>( endpoint: TEndpoint, ...args: MaybeOptionalArgs< - ClientRequestParamsOf & TAdditionalClientOptions + ClientRequestParamsOf & + TAdditionalClientOptions & + HttpFetchOptions > ): ReturnOf extends Observable ? TReturnType extends ServerSentEvent @@ -277,6 +292,4 @@ export interface DefaultRouteHandlerResources extends CoreRouteHandlerResources logger: Logger; } -export interface DefaultRouteCreateOptions { - options?: RouteConfigOptions & { security?: RouteSecurity }; -} +export type DefaultRouteCreateOptions = RouteConfigOptions>; diff --git a/packages/kbn-server-route-repository/index.ts b/packages/kbn-server-route-repository/index.ts index a922c2ebb1e1f..16958e744417b 100644 --- a/packages/kbn-server-route-repository/index.ts +++ b/packages/kbn-server-route-repository/index.ts @@ -23,7 +23,6 @@ export type { ServerRouteRepository, ServerRoute, RouteParamsRT, - RouteState, DefaultRouteCreateOptions, DefaultRouteHandlerResources, IoTsParamsObject, diff --git a/packages/kbn-server-route-repository/src/create_server_route_factory.ts b/packages/kbn-server-route-repository/src/create_server_route_factory.ts index be375bd069480..34fc375b0d9ab 100644 --- a/packages/kbn-server-route-repository/src/create_server_route_factory.ts +++ b/packages/kbn-server-route-repository/src/create_server_route_factory.ts @@ -8,16 +8,17 @@ */ import type { - DefaultRouteCreateOptions, DefaultRouteHandlerResources, - ServerRouteCreateOptions, ServerRouteHandlerResources, } from '@kbn/server-route-repository-utils'; -import type { CreateServerRouteFactory } from '@kbn/server-route-repository-utils/src/typings'; +import type { + CreateServerRouteFactory, + DefaultRouteCreateOptions, +} from '@kbn/server-route-repository-utils/src/typings'; export function createServerRouteFactory< TRouteHandlerResources extends ServerRouteHandlerResources = DefaultRouteHandlerResources, - TRouteCreateOptions extends ServerRouteCreateOptions = DefaultRouteCreateOptions + TRouteCreateOptions extends DefaultRouteCreateOptions | undefined = undefined >(): CreateServerRouteFactory { return (route) => ({ [route.endpoint]: route } as any); } diff --git a/packages/kbn-server-route-repository/src/register_routes.test.ts b/packages/kbn-server-route-repository/src/register_routes.test.ts index 249f81df3a8a9..b13592c57ba59 100644 --- a/packages/kbn-server-route-repository/src/register_routes.test.ts +++ b/packages/kbn-server-route-repository/src/register_routes.test.ts @@ -15,6 +15,7 @@ import { NEVER } from 'rxjs'; import * as makeZodValidationObject from './make_zod_validation_object'; import { registerRoutes } from './register_routes'; import { passThroughValidationObject, noParamsValidationObject } from './validation_objects'; +import { ServerRouteRepository } from '@kbn/server-route-repository-utils'; describe('registerRoutes', () => { const post = jest.fn(); @@ -54,44 +55,82 @@ describe('registerRoutes', () => { 'POST /internal/route': { endpoint: 'POST /internal/route', handler: jest.fn(), - options: { - internal: true, - }, }, 'POST /api/public_route version': { endpoint: 'POST /api/public_route version', handler: jest.fn(), + }, + 'POST /api/internal_but_looks_like_public version': { + endpoint: 'POST /api/internal_but_looks_like_public version', options: { - public: true, + access: 'internal', }, + handler: jest.fn(), }, - }); + 'POST /internal/route_with_security': { + endpoint: `POST /internal/route_with_security`, + handler: jest.fn(), + security: { + authz: { + enabled: false, + reason: 'whatever', + }, + }, + }, + 'POST /api/route_with_security version': { + endpoint: `POST /api/route_with_security version`, + handler: jest.fn(), + security: { + authz: { + enabled: false, + reason: 'whatever', + }, + }, + }, + } satisfies ServerRouteRepository); expect(createRouter).toHaveBeenCalledTimes(1); - expect(post).toHaveBeenCalledTimes(1); - const [internalRoute] = post.mock.calls[0]; expect(internalRoute.path).toEqual('/internal/route'); expect(internalRoute.options).toEqual({ - internal: true, + access: 'internal', }); expect(internalRoute.validate).toEqual(noParamsValidationObject); - expect(postWithVersion).toHaveBeenCalledTimes(1); + const [internalRouteWithSecurity] = post.mock.calls[1]; + + expect(internalRouteWithSecurity.path).toEqual('/internal/route_with_security'); + expect(internalRouteWithSecurity.security).toEqual({ + authz: { + enabled: false, + reason: 'whatever', + }, + }); + const [publicRoute] = postWithVersion.mock.calls[0]; expect(publicRoute.path).toEqual('/api/public_route'); - expect(publicRoute.options).toEqual({ - public: true, - }); expect(publicRoute.access).toEqual('public'); - expect(postAddVersion).toHaveBeenCalledTimes(1); + const [apiInternalRoute] = postWithVersion.mock.calls[1]; + expect(apiInternalRoute.path).toEqual('/api/internal_but_looks_like_public'); + expect(apiInternalRoute.access).toEqual('internal'); + const [versionedRoute] = postAddVersion.mock.calls[0]; expect(versionedRoute.version).toEqual('version'); expect(versionedRoute.validate).toEqual({ request: noParamsValidationObject, }); + + const [publicRouteWithSecurity] = postWithVersion.mock.calls[2]; + + expect(publicRouteWithSecurity.path).toEqual('/api/route_with_security'); + expect(publicRouteWithSecurity.security).toEqual({ + authz: { + enabled: false, + reason: 'whatever', + }, + }); }); it('does not allow any params if no schema is provided', () => { diff --git a/packages/kbn-server-route-repository/src/register_routes.ts b/packages/kbn-server-route-repository/src/register_routes.ts index 6e7b0d839b2f8..6201ffcd869ea 100644 --- a/packages/kbn-server-route-repository/src/register_routes.ts +++ b/packages/kbn-server-route-repository/src/register_routes.ts @@ -15,19 +15,20 @@ import { isKibanaResponse } from '@kbn/core-http-server'; import type { CoreSetup } from '@kbn/core-lifecycle-server'; import type { Logger } from '@kbn/logging'; import { + DefaultRouteCreateOptions, + RouteParamsRT, ServerRoute, - ServerRouteCreateOptions, ZodParamsObject, parseEndpoint, } from '@kbn/server-route-repository-utils'; +import { ServerSentEvent } from '@kbn/sse-utils'; import { observableIntoEventSourceStream } from '@kbn/sse-utils-server'; import { isZod } from '@kbn/zod'; -import { merge } from 'lodash'; +import { merge, omit } from 'lodash'; import { Observable, isObservable } from 'rxjs'; -import { ServerSentEvent } from '@kbn/sse-utils'; -import { passThroughValidationObject, noParamsValidationObject } from './validation_objects'; -import { validateAndDecodeParams } from './validate_and_decode_params'; import { makeZodValidationObject } from './make_zod_validation_object'; +import { validateAndDecodeParams } from './validate_and_decode_params'; +import { noParamsValidationObject, passThroughValidationObject } from './validation_objects'; const CLIENT_CLOSED_REQUEST = { statusCode: 499, @@ -43,7 +44,7 @@ export function registerRoutes>({ dependencies, }: { core: CoreSetup; - repository: Record>; + repository: Record>; logger: Logger; dependencies: TDependencies; }) { @@ -52,7 +53,11 @@ export function registerRoutes>({ const router = core.http.createRouter(); routes.forEach((route) => { - const { params, endpoint, options, handler } = route; + const { endpoint, handler, security } = route; + + const params = 'params' in route ? route.params : undefined; + + const options: DefaultRouteCreateOptions = 'options' in route ? route.options : {}; const { method, pathname, version } = parseEndpoint(endpoint); @@ -137,14 +142,18 @@ export function registerRoutes>({ validationObject = passThroughValidationObject; } - const { security, ...restOptions } = options ?? {}; + const access = options?.access ?? (pathname.startsWith('/internal/') ? 'internal' : 'public'); if (!version) { router[method]( { path: pathname, + // @ts-expect-error we are essentially calling multiple methods at the same type so TS gets confused + options: { + ...options, + access, + }, security, - options: restOptions, validate: validationObject, }, wrappedHandler @@ -152,8 +161,9 @@ export function registerRoutes>({ } else { router.versioned[method]({ path: pathname, - access: pathname.startsWith('/internal/') ? 'internal' : 'public', - options: restOptions, + access, + // @ts-expect-error we are essentially calling multiple methods at the same type so TS gets confused + options: omit(options, 'access', 'description', 'summary', 'deprecated', 'discontinued'), security, }).addVersion( { diff --git a/packages/kbn-server-route-repository/src/test_types.ts b/packages/kbn-server-route-repository/src/test_types.ts index acef5a524eb6b..6b099c158f07f 100644 --- a/packages/kbn-server-route-repository/src/test_types.ts +++ b/packages/kbn-server-route-repository/src/test_types.ts @@ -83,32 +83,44 @@ createServerRouteFactory<{ context: { getSpaceId: () => string } }, {}>()({ }); // Create options are available when registering a route. -createServerRouteFactory<{}, { options: { tags: string[] } }>()({ +createServerRouteFactory<{}, {}>()({ endpoint: 'GET /internal/endpoint_with_params', params: t.type({ path: t.type({ serviceName: t.string, }), }), - options: { - tags: [], - }, handler: async (resources) => { assertType<{ params: { path: { serviceName: string } } }>(resources); }, }); // Public APIs should be versioned -createServerRouteFactory<{}, { options: { tags: string[] } }>()({ +createServerRouteFactory<{}, { tags: string[] }>()({ // @ts-expect-error + endpoint: 'GET /api/endpoint_with_params', + tags: [], + handler: async (resources) => {}, +}); + +// `access` is respected +createServerRouteFactory<{}, { tags: string[] }>()({ endpoint: 'GET /api/endpoint_with_params', options: { tags: [], + access: 'internal', }, handler: async (resources) => {}, }); -createServerRouteFactory<{}, { options: { tags: string[] } }>()({ +// specifying additional options makes them required +// @ts-expect-error +createServerRouteFactory<{}, { tags: string[] }>()({ + endpoint: 'GET /api/endpoint_with_params 2023-10-31', + handler: async (resources) => {}, +}); + +createServerRouteFactory<{}, { tags: string[] }>()({ endpoint: 'GET /api/endpoint_with_params 2023-10-31', options: { tags: [], diff --git a/packages/kbn-typed-react-router-config/index.ts b/packages/kbn-typed-react-router-config/index.ts index 3075cb48a951b..6aff73c55e6c3 100644 --- a/packages/kbn-typed-react-router-config/index.ts +++ b/packages/kbn-typed-react-router-config/index.ts @@ -17,3 +17,4 @@ export * from './src/use_match_routes'; export * from './src/use_params'; export * from './src/use_router'; export * from './src/use_route_path'; +export * from './src/breadcrumbs'; diff --git a/packages/kbn-typed-react-router-config/kibana.jsonc b/packages/kbn-typed-react-router-config/kibana.jsonc index 37c95108427ee..2f2bda611d6b3 100644 --- a/packages/kbn-typed-react-router-config/kibana.jsonc +++ b/packages/kbn-typed-react-router-config/kibana.jsonc @@ -1,5 +1,5 @@ { - "type": "shared-common", + "type": "shared-browser", "id": "@kbn/typed-react-router-config", "owner": [ "@elastic/obs-knowledge-team", diff --git a/packages/kbn-typed-react-router-config/src/breadcrumbs/breadcrumb.tsx b/packages/kbn-typed-react-router-config/src/breadcrumbs/breadcrumb.tsx new file mode 100644 index 0000000000000..94a32c76c21f2 --- /dev/null +++ b/packages/kbn-typed-react-router-config/src/breadcrumbs/breadcrumb.tsx @@ -0,0 +1,51 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import React from 'react'; +import { RequiredKeys } from 'utility-types'; +import { useRouterBreadcrumb } from './use_router_breadcrumb'; +import { PathsOf, RouteMap, TypeOf } from '../types'; + +type AsParamsProps> = RequiredKeys extends never + ? {} + : { params: TObject }; + +export type RouterBreadcrumb = < + TRoutePath extends PathsOf +>({}: { + title: string; + children: React.ReactNode; + path: TRoutePath; +} & AsParamsProps>) => React.ReactElement; + +export function RouterBreadcrumb< + TRouteMap extends RouteMap, + TRoutePath extends PathsOf +>({ + title, + path, + params, + children, +}: { + title: string; + path: TRoutePath; + children: React.ReactElement; + params?: Record; +}) { + useRouterBreadcrumb( + () => ({ + title, + path, + params, + }), + [] + ); + + return children; +} diff --git a/packages/kbn-typed-react-router-config/src/breadcrumbs/context.tsx b/packages/kbn-typed-react-router-config/src/breadcrumbs/context.tsx new file mode 100644 index 0000000000000..21d6a30567b18 --- /dev/null +++ b/packages/kbn-typed-react-router-config/src/breadcrumbs/context.tsx @@ -0,0 +1,113 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { ChromeBreadcrumb, ScopedHistory } from '@kbn/core/public'; +import { compact, isEqual } from 'lodash'; +import React, { createContext, useMemo, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import { useBreadcrumbs } from './use_breadcrumbs'; +import { + PathsOf, + Route, + RouteMap, + RouteMatch, + TypeAsArgs, + TypeAsParams, + TypeOf, + useMatchRoutes, + useRouter, +} from '../..'; + +export type Breadcrumb< + TRouteMap extends RouteMap = RouteMap, + TPath extends PathsOf = PathsOf +> = { + title: string; + path: TPath; +} & TypeAsParams>; + +interface BreadcrumbApi { + set>( + route: Route, + breadcrumb: Array> + ): void; + unset(route: Route): void; + getBreadcrumbs(matches: RouteMatch[]): Array>>; +} + +export const BreadcrumbsContext = createContext(undefined); + +export function BreadcrumbsContextProvider({ + children, +}: { + children: React.ReactNode; +}) { + const [, forceUpdate] = useState({}); + + const breadcrumbs = useMemo(() => { + return new Map>>(); + }, []); + + const history = useHistory() as ScopedHistory; + + const router = useRouter(); + + const matches: RouteMatch[] = useMatchRoutes(); + + const api = useMemo>( + () => ({ + set(route, breadcrumb) { + if (!isEqual(breadcrumbs.get(route), breadcrumb)) { + breadcrumbs.set(route, breadcrumb); + forceUpdate({}); + } + }, + unset(route) { + if (breadcrumbs.has(route)) { + breadcrumbs.delete(route); + forceUpdate({}); + } + }, + getBreadcrumbs(currentMatches: RouteMatch[]) { + return compact( + currentMatches.flatMap((match) => { + const breadcrumb = breadcrumbs.get(match.route); + + return breadcrumb; + }) + ); + }, + }), + [breadcrumbs] + ); + + const formattedBreadcrumbs: ChromeBreadcrumb[] = api + .getBreadcrumbs(matches) + .map((breadcrumb, index, array) => { + return { + text: breadcrumb.title, + ...(index === array.length - 1 + ? {} + : { + href: history.createHref({ + pathname: router.link( + breadcrumb.path, + ...(('params' in breadcrumb ? [breadcrumb.params] : []) as TypeAsArgs< + TypeOf, false> + >) + ), + }), + }), + }; + }); + + useBreadcrumbs(formattedBreadcrumbs); + + return {children}; +} diff --git a/packages/kbn-typed-react-router-config/src/breadcrumbs/create_router_breadcrumb_component.tsx b/packages/kbn-typed-react-router-config/src/breadcrumbs/create_router_breadcrumb_component.tsx new file mode 100644 index 0000000000000..04c8cf4e9d245 --- /dev/null +++ b/packages/kbn-typed-react-router-config/src/breadcrumbs/create_router_breadcrumb_component.tsx @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { RouteMap } from '../types'; +import { RouterBreadcrumb } from './breadcrumb'; + +export function createRouterBreadcrumbComponent< + TRouteMap extends RouteMap +>(): RouterBreadcrumb { + return RouterBreadcrumb as RouterBreadcrumb; +} diff --git a/packages/kbn-typed-react-router-config/src/breadcrumbs/index.tsx b/packages/kbn-typed-react-router-config/src/breadcrumbs/index.tsx new file mode 100644 index 0000000000000..721ba433cc01b --- /dev/null +++ b/packages/kbn-typed-react-router-config/src/breadcrumbs/index.tsx @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export { createRouterBreadcrumbComponent } from './create_router_breadcrumb_component'; +export { createUseBreadcrumbs } from './use_router_breadcrumb'; +export { BreadcrumbsContextProvider } from './context'; diff --git a/packages/kbn-typed-react-router-config/src/breadcrumbs/use_breadcrumbs.ts b/packages/kbn-typed-react-router-config/src/breadcrumbs/use_breadcrumbs.ts new file mode 100644 index 0000000000000..3d63c8a0f27d7 --- /dev/null +++ b/packages/kbn-typed-react-router-config/src/breadcrumbs/use_breadcrumbs.ts @@ -0,0 +1,101 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { i18n } from '@kbn/i18n'; +import { ApplicationStart, ChromeBreadcrumb, ChromeStart } from '@kbn/core/public'; +import { MouseEvent, useEffect, useMemo } from 'react'; +import { useKibana } from '@kbn/kibana-react-plugin/public'; +import { ChromeBreadcrumbsAppendExtension } from '@kbn/core-chrome-browser'; +import type { ServerlessPluginStart } from '@kbn/serverless/public'; + +function addClickHandlers( + breadcrumbs: ChromeBreadcrumb[], + navigateToHref?: (url: string) => Promise +) { + return breadcrumbs.map((bc) => ({ + ...bc, + ...(bc.href + ? { + onClick: (event: MouseEvent) => { + if (navigateToHref && bc.href) { + event.preventDefault(); + navigateToHref(bc.href); + } + }, + } + : {}), + })); +} + +function getTitleFromBreadCrumbs(breadcrumbs: ChromeBreadcrumb[]) { + return breadcrumbs.map(({ text }) => text?.toString() ?? '').reverse(); +} + +export const useBreadcrumbs = ( + extraCrumbs: ChromeBreadcrumb[], + options?: { + app?: { id: string; label: string }; + breadcrumbsAppendExtension?: ChromeBreadcrumbsAppendExtension; + serverless?: ServerlessPluginStart; + } +) => { + const { app, breadcrumbsAppendExtension, serverless } = options ?? {}; + + const { + services: { + chrome: { docTitle, setBreadcrumbs: chromeSetBreadcrumbs, setBreadcrumbsAppendExtension }, + application: { getUrlForApp, navigateToUrl }, + }, + } = useKibana<{ + application: ApplicationStart; + chrome: ChromeStart; + }>(); + + const setTitle = docTitle.change; + const appPath = getUrlForApp(app?.id ?? 'observability-overview') ?? ''; + + const setBreadcrumbs = useMemo( + () => serverless?.setBreadcrumbs ?? chromeSetBreadcrumbs, + [serverless, chromeSetBreadcrumbs] + ); + + useEffect(() => { + if (breadcrumbsAppendExtension) { + setBreadcrumbsAppendExtension(breadcrumbsAppendExtension); + } + return () => { + if (breadcrumbsAppendExtension) { + setBreadcrumbsAppendExtension(undefined); + } + }; + }, [breadcrumbsAppendExtension, setBreadcrumbsAppendExtension]); + + useEffect(() => { + const breadcrumbs = serverless + ? extraCrumbs + : [ + { + text: + app?.label ?? + i18n.translate('xpack.observabilityShared.breadcrumbs.observabilityLinkText', { + defaultMessage: 'Observability', + }), + href: appPath + '/overview', + }, + ...extraCrumbs, + ]; + + if (setBreadcrumbs) { + setBreadcrumbs(addClickHandlers(breadcrumbs, navigateToUrl)); + } + if (setTitle) { + setTitle(getTitleFromBreadCrumbs(breadcrumbs)); + } + }, [app?.label, appPath, extraCrumbs, navigateToUrl, serverless, setBreadcrumbs, setTitle]); +}; diff --git a/packages/kbn-typed-react-router-config/src/breadcrumbs/use_router_breadcrumb.ts b/packages/kbn-typed-react-router-config/src/breadcrumbs/use_router_breadcrumb.ts new file mode 100644 index 0000000000000..47003cbce5a26 --- /dev/null +++ b/packages/kbn-typed-react-router-config/src/breadcrumbs/use_router_breadcrumb.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { useContext, useEffect, useRef } from 'react'; +import { castArray } from 'lodash'; +import { PathsOf, RouteMap, useCurrentRoute } from '../..'; +import { Breadcrumb, BreadcrumbsContext } from './context'; + +type UseBreadcrumbs = >( + callback: () => Breadcrumb | Array>, + fnDeps: unknown[] +) => void; + +export function useRouterBreadcrumb(callback: () => Breadcrumb | Breadcrumb[], fnDeps: any[]) { + const api = useContext(BreadcrumbsContext); + + if (!api) { + throw new Error('Missing Breadcrumb API in context'); + } + + const { match } = useCurrentRoute(); + + const matchedRoute = useRef(match?.route); + + useEffect(() => { + if (matchedRoute.current && matchedRoute.current !== match?.route) { + api.unset(matchedRoute.current); + } + + matchedRoute.current = match?.route; + + if (matchedRoute.current) { + api.set(matchedRoute.current, castArray(callback())); + } + + return () => { + if (matchedRoute.current) { + api.unset(matchedRoute.current); + } + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [matchedRoute.current, match?.route, ...fnDeps]); +} + +export function createUseBreadcrumbs(): UseBreadcrumbs { + return useRouterBreadcrumb; +} diff --git a/packages/kbn-typed-react-router-config/src/create_router.ts b/packages/kbn-typed-react-router-config/src/create_router.ts index 467fe096ffece..4321f4c0744a7 100644 --- a/packages/kbn-typed-react-router-config/src/create_router.ts +++ b/packages/kbn-typed-react-router-config/src/create_router.ts @@ -11,7 +11,7 @@ import { deepExactRt, mergeRt } from '@kbn/io-ts-utils'; import { isLeft } from 'fp-ts/lib/Either'; import { Location } from 'history'; import { PathReporter } from 'io-ts/lib/PathReporter'; -import { compact, findLastIndex, merge, orderBy } from 'lodash'; +import { compact, findLastIndex, mapValues, merge, orderBy } from 'lodash'; import qs from 'query-string'; import { MatchedRoute, @@ -139,7 +139,9 @@ export function createRouter(routes: TRoutes): Router< if (route?.params) { const decoded = deepExactRt(route.params).decode( merge({}, route.defaults ?? {}, { - path: matchedRoute.match.params, + path: mapValues(matchedRoute.match.params, (value) => { + return decodeURIComponent(value); + }), query: qs.parse(location.search, { decode: true }), }) ); @@ -179,7 +181,7 @@ export function createRouter(routes: TRoutes): Router< .split('/') .map((part) => { const match = part.match(/(?:{([a-zA-Z]+)})/); - return match ? paramsWithBuiltInDefaults.path[match[1]] : part; + return match ? encodeURIComponent(paramsWithBuiltInDefaults.path[match[1]]) : part; }) .join('/'); diff --git a/packages/kbn-typed-react-router-config/src/types/index.ts b/packages/kbn-typed-react-router-config/src/types/index.ts index 3b4c36c42af53..dbab588619db7 100644 --- a/packages/kbn-typed-react-router-config/src/types/index.ts +++ b/packages/kbn-typed-react-router-config/src/types/index.ts @@ -106,6 +106,12 @@ export type TypeAsArgs = keyof TObject extends never ? [TObject] | [] : [TObject]; +export type TypeAsParams = keyof TObject extends never + ? {} + : RequiredKeys extends never + ? never + : { params: TObject }; + export type FlattenRoutesOf = Array< ValuesType<{ [key in keyof MapRoutes]: ValuesType[key]>; diff --git a/packages/kbn-typed-react-router-config/src/use_router.tsx b/packages/kbn-typed-react-router-config/src/use_router.tsx index 531bc5aea53b3..af92e33b8952a 100644 --- a/packages/kbn-typed-react-router-config/src/use_router.tsx +++ b/packages/kbn-typed-react-router-config/src/use_router.tsx @@ -20,7 +20,7 @@ export const RouterContextProvider = ({ children: React.ReactNode; }) => {children}; -export function useRouter(): Router { +export function useRouter(): Router { const router = useContext(RouterContext); if (!router) { diff --git a/packages/kbn-typed-react-router-config/tsconfig.json b/packages/kbn-typed-react-router-config/tsconfig.json index efda701736093..f9a133f48e8d5 100644 --- a/packages/kbn-typed-react-router-config/tsconfig.json +++ b/packages/kbn-typed-react-router-config/tsconfig.json @@ -14,7 +14,12 @@ ], "kbn_references": [ "@kbn/io-ts-utils", - "@kbn/shared-ux-router" + "@kbn/shared-ux-router", + "@kbn/core", + "@kbn/i18n", + "@kbn/kibana-react-plugin", + "@kbn/core-chrome-browser", + "@kbn/serverless" ], "exclude": [ "target/**/*", diff --git a/packages/kbn-utility-types/src/dot.ts b/packages/kbn-utility-types/src/dot.ts index 40af0ce14c695..54b8cb5f5ac39 100644 --- a/packages/kbn-utility-types/src/dot.ts +++ b/packages/kbn-utility-types/src/dot.ts @@ -23,7 +23,9 @@ type DedotKey< export type DedotObject> = UnionToIntersection< Exclude< ValuesType<{ - [TKey in keyof TObject]: {} extends Pick + [TKey in keyof TObject as string]: string extends TKey + ? Record + : {} extends Pick ? DeepPartial>> : DedotKey; }>, diff --git a/packages/kbn-utility-types/src/tsd_tests/test_d/dot.ts b/packages/kbn-utility-types/src/tsd_tests/test_d/dot.ts index 855b84a3cbc10..1911db2e141be 100644 --- a/packages/kbn-utility-types/src/tsd_tests/test_d/dot.ts +++ b/packages/kbn-utility-types/src/tsd_tests/test_d/dot.ts @@ -7,9 +7,10 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { expectAssignable, expectNotType, expectType } from 'tsd'; import { DedotObject, DotObject } from '../../dot'; +function isAssignable(t: T) {} + interface TestA { 'my.dotted.key': string; 'my.dotted.partial.key'?: string; @@ -60,20 +61,39 @@ const dedotted1 = {} as DedotObject; const dotted1 = {} as DotObject; -expectAssignable>({} as Dedotted); -expectAssignable>({} as Dotted); -expectAssignable({} as DedotObject); -expectAssignable({} as DotObject); - -expectType(dedotted1.ym?.dotted?.partial?.key?.toString()); -expectType(dotted1['my.undotted.key'].toString()); -expectNotType(dotted1['my.partial.key']); -expectType(dotted1['my.partial.key']?.toString()); -expectNotType<{ baz: string }>({} as DedotObject); -expectNotType<{ baz: string }>({} as DotObject); -expectNotType<{ my: { dotted: { key: string }; partial: { key: number } } }>( - {} as DedotObject -); +isAssignable>({} as Dedotted); + +isAssignable>({} as Dotted); +isAssignable({} as DedotObject); +isAssignable({} as DotObject); + +isAssignable(dedotted1.ym?.dotted?.partial?.key); + +isAssignable(dotted1['my.undotted.key'].toString()); +// @ts-expect-error +isAssignable(dotted1['my.partial.key']); + +isAssignable(dotted1['my.partial.key']?.toString()); + +// @ts-expect-error +isAssignable<{ baz: string }>({} as DedotObject); +// @ts-expect-error +isAssignable<{ baz: string }>({} as DotObject); + +// @ts-expect-error +isAssignable<{ my: { dotted: { key: string }; partial: { key: number } } }, DedotObject>(); + +type WithStringKey = { + [x: string]: string; +} & { + count: number; +}; + +type WithStringKeyDedotted = DedotObject; + +isAssignable({} as WithStringKey); + +isAssignable({} as WithStringKeyDedotted); interface ObjectWithArray { span: { @@ -88,7 +108,7 @@ interface ObjectWithArray { }; } -expectType>({ +isAssignable>({ 'span.links.span.id': [''], 'span.links.trace.id': [''], }); diff --git a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts index 0cc56676137e5..ad2dce80fb650 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts @@ -183,6 +183,7 @@ export const applicationUsageSchema = { */ siem: commonSchema, space_selector: commonSchema, + streams: commonSchema, uptime: commonSchema, synthetics: commonSchema, ux: commonSchema, diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index 44fcda4f28581..fe0f599dd6ca1 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -7731,6 +7731,137 @@ } } }, + "streams": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "Always `main`" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 90 days" + } + }, + "views": { + "type": "array", + "items": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "The application view being tracked" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application sub view since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application sub view is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 90 days" + } + } + } + } + } + } + }, "uptime": { "properties": { "appId": { diff --git a/tsconfig.base.json b/tsconfig.base.json index e1721840d4fb5..d8426dfdef123 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1848,6 +1848,8 @@ "@kbn/stdio-dev-helpers/*": ["packages/kbn-stdio-dev-helpers/*"], "@kbn/storybook": ["packages/kbn-storybook"], "@kbn/storybook/*": ["packages/kbn-storybook/*"], + "@kbn/streams-app-plugin": ["x-pack/plugins/streams_app"], + "@kbn/streams-app-plugin/*": ["x-pack/plugins/streams_app/*"], "@kbn/streams-plugin": ["x-pack/plugins/streams"], "@kbn/streams-plugin/*": ["x-pack/plugins/streams/*"], "@kbn/synthetics-e2e": ["x-pack/plugins/observability_solution/synthetics/e2e"], diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 7c97dcf1b722f..213c3f06f34aa 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -112,7 +112,9 @@ "xpack.observabilityLogsOverview": [ "packages/observability/logs_overview/src/components" ], - "xpack.osquery": ["plugins/osquery"], + "xpack.osquery": [ + "plugins/osquery" + ], "xpack.painlessLab": "plugins/painless_lab", "xpack.profiling": [ "plugins/observability_solution/profiling" @@ -148,6 +150,9 @@ "xpack.securitySolutionEss": "plugins/security_solution_ess", "xpack.securitySolutionServerless": "plugins/security_solution_serverless", "xpack.sessionView": "plugins/session_view", + "xpack.streams": [ + "plugins/streams_app" + ], "xpack.slo": "plugins/observability_solution/slo", "xpack.snapshotRestore": "plugins/snapshot_restore", "xpack.spaces": "plugins/spaces", diff --git a/x-pack/packages/observability/observability_utils/observability_utils_common/object/unflatten_object.test.ts b/x-pack/packages/observability/observability_utils/observability_utils_common/object/unflatten_object.test.ts index 22cee17bb1a64..aa25821b4ac14 100644 --- a/x-pack/packages/observability/observability_utils/observability_utils_common/object/unflatten_object.test.ts +++ b/x-pack/packages/observability/observability_utils/observability_utils_common/object/unflatten_object.test.ts @@ -37,4 +37,16 @@ describe('unflattenObject', () => { }, }); }); + + it('handles null values correctly', () => { + expect( + unflattenObject({ + 'agent.name': null, + }) + ).toEqual({ + agent: { + name: null, + }, + }); + }); }); diff --git a/x-pack/packages/observability/observability_utils/observability_utils_common/object/unflatten_object.ts b/x-pack/packages/observability/observability_utils/observability_utils_common/object/unflatten_object.ts index 83508d5d2dbf5..8a4493905f1d4 100644 --- a/x-pack/packages/observability/observability_utils/observability_utils_common/object/unflatten_object.ts +++ b/x-pack/packages/observability/observability_utils/observability_utils_common/object/unflatten_object.ts @@ -6,13 +6,17 @@ */ import { set } from '@kbn/safer-lodash-set'; +import { DedotObject } from '@kbn/utility-types'; -export function unflattenObject(source: Record, target: Record = {}) { +export function unflattenObject>( + source: T, + target: Record = {} +): DedotObject { // eslint-disable-next-line guard-for-in for (const key in source) { const val = source[key as keyof typeof source]; if (Array.isArray(val)) { - const unflattenedArray = val.map((item) => { + const unflattenedArray = val.map((item: unknown) => { if (item && typeof item === 'object' && !Array.isArray(item)) { return unflattenObject(item); } @@ -23,5 +27,6 @@ export function unflattenObject(source: Record, target: Record; } diff --git a/x-pack/packages/observability/observability_utils/observability_utils_common/tsconfig.json b/x-pack/packages/observability/observability_utils/observability_utils_common/tsconfig.json index 7954cdc946e9c..e2226268918a7 100644 --- a/x-pack/packages/observability/observability_utils/observability_utils_common/tsconfig.json +++ b/x-pack/packages/observability/observability_utils/observability_utils_common/tsconfig.json @@ -19,5 +19,6 @@ "@kbn/es-query", "@kbn/safer-lodash-set", "@kbn/inference-common", + "@kbn/utility-types", ] } diff --git a/x-pack/packages/observability/observability_utils/observability_utils_server/es/client/create_observability_es_client.ts b/x-pack/packages/observability/observability_utils/observability_utils_server/es/client/create_observability_es_client.ts index 78ed20a582bc3..92c7b8d19e531 100644 --- a/x-pack/packages/observability/observability_utils/observability_utils_server/es/client/create_observability_es_client.ts +++ b/x-pack/packages/observability/observability_utils/observability_utils_server/es/client/create_observability_es_client.ts @@ -10,12 +10,15 @@ import type { FieldCapsRequest, FieldCapsResponse, MsearchRequest, + ScalarValue, SearchResponse, } from '@elastic/elasticsearch/lib/api/types'; import { withSpan } from '@kbn/apm-utils'; import type { ElasticsearchClient, Logger } from '@kbn/core/server'; -import type { ESQLSearchResponse, ESSearchRequest, InferSearchResponseOf } from '@kbn/es-types'; -import { Required } from 'utility-types'; +import type { ESSearchRequest, InferSearchResponseOf } from '@kbn/es-types'; +import { Required, ValuesType } from 'utility-types'; +import { DedotObject } from '@kbn/utility-types'; +import { unflattenObject } from '@kbn/task-manager-plugin/server/metrics/lib'; import { esqlResultToPlainObjects } from '../esql_result_to_plain_objects'; type SearchRequest = ESSearchRequest & { @@ -24,19 +27,52 @@ type SearchRequest = ESSearchRequest & { size: number | boolean; }; -type EsqlQueryParameters = EsqlQueryRequest & { parseOutput?: boolean }; -type EsqlOutputParameters = Omit & { - parseOutput?: true; - format?: 'json'; - columnar?: false; -}; +export interface EsqlOptions { + transform?: 'none' | 'plain' | 'unflatten'; +} + +export type EsqlValue = ScalarValue | ScalarValue[]; + +export type EsqlOutput = Record; + +type MaybeUnflatten, TApply> = TApply extends true + ? DedotObject + : T; + +interface UnparsedEsqlResponseOf { + columns: Array<{ name: keyof TOutput; type: string }>; + values: Array>>; +} -type EsqlParameters = EsqlOutputParameters | EsqlQueryParameters; +interface ParsedEsqlResponseOf< + TOutput extends EsqlOutput, + TOptions extends EsqlOptions | undefined = { transform: 'none' } +> { + hits: Array< + MaybeUnflatten< + { + [key in keyof TOutput]: TOutput[key]; + }, + TOptions extends { transform: 'unflatten' } ? true : false + > + >; +} export type InferEsqlResponseOf< - TOutput = unknown, - TParameters extends EsqlParameters = EsqlParameters -> = TParameters extends EsqlOutputParameters ? TOutput[] : ESQLSearchResponse; + TOutput extends EsqlOutput, + TOptions extends EsqlOptions | undefined = { transform: 'none' } +> = TOptions extends { transform: 'plain' | 'unflatten' } + ? ParsedEsqlResponseOf + : UnparsedEsqlResponseOf; + +export type ObservabilityESSearchRequest = SearchRequest; + +export type ObservabilityEsQueryRequest = Omit; + +export type ParsedEsqlResponse = ParsedEsqlResponseOf; +export type UnparsedEsqlResponse = UnparsedEsqlResponseOf; + +export type EsqlQueryResponse = UnparsedEsqlResponse | ParsedEsqlResponse; /** * An Elasticsearch Client with a fully typed `search` method and built-in @@ -57,14 +93,18 @@ export interface ObservabilityElasticsearchClient { operationName: string, request: Required ): Promise; - esql( + esql( operationName: string, - parameters: TQueryParams - ): Promise>; - esql( + parameters: ObservabilityEsQueryRequest + ): Promise>; + esql< + TOutput extends EsqlOutput = EsqlOutput, + TEsqlOptions extends EsqlOptions = { transform: 'none' } + >( operationName: string, - parameters: TQueryParams - ): Promise>; + parameters: ObservabilityEsQueryRequest, + options: TEsqlOptions + ): Promise>; client: ElasticsearchClient; } @@ -109,32 +149,41 @@ export function createObservabilityEsClient({ }); }); }, - esql( + esql( operationName: string, - { parseOutput = true, format = 'json', columnar = false, ...parameters }: TSearchRequest - ) { - logger.trace(() => `Request (${operationName}):\n${JSON.stringify(parameters, null, 2)}`); - return withSpan({ name: operationName, labels: { plugin } }, () => { - return client.esql.query( - { ...parameters, format, columnar }, - { - querystring: { - drop_null_columns: true, - }, - } - ); - }) - .then((response) => { - logger.trace(() => `Response (${operationName}):\n${JSON.stringify(response, null, 2)}`); - - const esqlResponse = response as unknown as ESQLSearchResponse; - - const shouldParseOutput = parseOutput && !columnar && format === 'json'; - return shouldParseOutput ? esqlResultToPlainObjects(esqlResponse) : esqlResponse; - }) - .catch((error) => { - throw error; - }); + parameters: ObservabilityEsQueryRequest, + options?: EsqlOptions + ): Promise> { + return callWithLogger(operationName, parameters, () => { + return client.esql + .query( + { ...parameters }, + { + querystring: { + drop_null_columns: true, + }, + } + ) + .then((response) => { + const esqlResponse = response as unknown as UnparsedEsqlResponseOf; + + const transform = options?.transform ?? 'none'; + + if (transform === 'none') { + return esqlResponse; + } + + const parsedResponse = { hits: esqlResultToPlainObjects(esqlResponse) }; + + if (transform === 'plain') { + return parsedResponse; + } + + return { + hits: parsedResponse.hits.map((hit) => unflattenObject(hit)), + }; + }) as Promise>; + }); }, search( operationName: string, diff --git a/x-pack/packages/observability/observability_utils/observability_utils_server/es/esql_result_to_plain_objects.test.ts b/x-pack/packages/observability/observability_utils/observability_utils_server/es/esql_result_to_plain_objects.test.ts index 4557d0ba0bdd5..55d77368cfdfb 100644 --- a/x-pack/packages/observability/observability_utils/observability_utils_server/es/esql_result_to_plain_objects.test.ts +++ b/x-pack/packages/observability/observability_utils/observability_utils_server/es/esql_result_to_plain_objects.test.ts @@ -27,40 +27,15 @@ describe('esqlResultToPlainObjects', () => { expect(output).toEqual([{ name: 'Foo Bar' }]); }); - it('should return columns without "text" or "keyword" in their names', () => { + it('should not unflatten objects', () => { const result: ESQLSearchResponse = { columns: [ - { name: 'name.text', type: 'text' }, - { name: 'age', type: 'keyword' }, - ], - values: [ - ['Foo Bar', 30], - ['Foo Qux', 25], - ], - }; - const output = esqlResultToPlainObjects(result); - expect(output).toEqual([ - { name: 'Foo Bar', age: 30 }, - { name: 'Foo Qux', age: 25 }, - ]); - }); - - it('should handle mixed columns correctly', () => { - const result: ESQLSearchResponse = { - columns: [ - { name: 'name', type: 'text' }, - { name: 'name.text', type: 'text' }, - { name: 'age', type: 'keyword' }, - ], - values: [ - ['Foo Bar', 'Foo Bar', 30], - ['Foo Qux', 'Foo Qux', 25], + { name: 'name', type: 'keyword' }, + { name: 'name.nested', type: 'keyword' }, ], + values: [['Foo Bar', 'Bar Foo']], }; const output = esqlResultToPlainObjects(result); - expect(output).toEqual([ - { name: 'Foo Bar', age: 30 }, - { name: 'Foo Qux', age: 25 }, - ]); + expect(output).toEqual([{ name: 'Foo Bar', 'name.nested': 'Bar Foo' }]); }); }); diff --git a/x-pack/packages/observability/observability_utils/observability_utils_server/es/esql_result_to_plain_objects.ts b/x-pack/packages/observability/observability_utils/observability_utils_server/es/esql_result_to_plain_objects.ts index 34781153532c5..53f54b608ca35 100644 --- a/x-pack/packages/observability/observability_utils/observability_utils_server/es/esql_result_to_plain_objects.ts +++ b/x-pack/packages/observability/observability_utils/observability_utils_server/es/esql_result_to_plain_objects.ts @@ -6,28 +6,24 @@ */ import type { ESQLSearchResponse } from '@kbn/es-types'; -import { unflattenObject } from '@kbn/observability-utils-common/object/unflatten_object'; -export function esqlResultToPlainObjects( - result: ESQLSearchResponse -): TDocument[] { - return result.values.map((row) => { - return unflattenObject( - row.reduce>((acc, value, index) => { - const column = result.columns[index]; +export function esqlResultToPlainObjects< + TDocument extends Record = Record +>(result: ESQLSearchResponse): TDocument[] { + return result.values.map((row): TDocument => { + return row.reduce>((acc, value, index) => { + const column = result.columns[index]; - if (!column) { - return acc; - } + if (!column) { + return acc; + } - // Removes the type suffix from the column name - const name = column.name.replace(/\.(text|keyword)$/, ''); - if (!acc[name]) { - acc[name] = value; - } + const name = column.name; + if (!acc[name]) { + acc[name] = value; + } - return acc; - }, {}) - ) as TDocument; + return acc; + }, {}) as TDocument; }); } diff --git a/x-pack/packages/observability/observability_utils/observability_utils_server/tsconfig.json b/x-pack/packages/observability/observability_utils/observability_utils_server/tsconfig.json index f51d93089c627..f6dd781184b86 100644 --- a/x-pack/packages/observability/observability_utils/observability_utils_server/tsconfig.json +++ b/x-pack/packages/observability/observability_utils/observability_utils_server/tsconfig.json @@ -24,5 +24,7 @@ "@kbn/alerting-plugin", "@kbn/rule-registry-plugin", "@kbn/rule-data-utils", + "@kbn/utility-types", + "@kbn/task-manager-plugin", ] } diff --git a/x-pack/plugins/entity_manager/server/routes/enablement/check.ts b/x-pack/plugins/entity_manager/server/routes/enablement/check.ts index 5373ac9df50f5..100b0ac382dcf 100644 --- a/x-pack/plugins/entity_manager/server/routes/enablement/check.ts +++ b/x-pack/plugins/entity_manager/server/routes/enablement/check.ts @@ -45,13 +45,11 @@ import { createEntityManagerServerRoute } from '../create_entity_manager_server_ */ export const checkEntityDiscoveryEnabledRoute = createEntityManagerServerRoute({ endpoint: 'GET /internal/entities/managed/enablement', - options: { - security: { - authz: { - enabled: false, - reason: - 'This endpoint leverages the security plugin to evaluate the privileges needed as part of its core flow', - }, + security: { + authz: { + enabled: false, + reason: + 'This endpoint leverages the security plugin to evaluate the privileges needed as part of its core flow', }, }, handler: async ({ response, logger, server }) => { diff --git a/x-pack/plugins/entity_manager/server/routes/enablement/disable.ts b/x-pack/plugins/entity_manager/server/routes/enablement/disable.ts index a71a317045c44..1c8755c682f7f 100644 --- a/x-pack/plugins/entity_manager/server/routes/enablement/disable.ts +++ b/x-pack/plugins/entity_manager/server/routes/enablement/disable.ts @@ -44,13 +44,11 @@ import { createEntityManagerServerRoute } from '../create_entity_manager_server_ */ export const disableEntityDiscoveryRoute = createEntityManagerServerRoute({ endpoint: 'DELETE /internal/entities/managed/enablement', - options: { - security: { - authz: { - enabled: false, - reason: - 'This endpoint leverages the security plugin to evaluate the privileges needed as part of its core flow', - }, + security: { + authz: { + enabled: false, + reason: + 'This endpoint leverages the security plugin to evaluate the privileges needed as part of its core flow', }, }, params: z.object({ diff --git a/x-pack/plugins/entity_manager/server/routes/enablement/enable.ts b/x-pack/plugins/entity_manager/server/routes/enablement/enable.ts index 562b798a598a6..6ddb65804b90f 100644 --- a/x-pack/plugins/entity_manager/server/routes/enablement/enable.ts +++ b/x-pack/plugins/entity_manager/server/routes/enablement/enable.ts @@ -63,13 +63,11 @@ import { startTransforms } from '../../lib/entities/start_transforms'; */ export const enableEntityDiscoveryRoute = createEntityManagerServerRoute({ endpoint: 'PUT /internal/entities/managed/enablement', - options: { - security: { - authz: { - enabled: false, - reason: - 'This endpoint leverages the security plugin to evaluate the privileges needed as part of its core flow', - }, + security: { + authz: { + enabled: false, + reason: + 'This endpoint leverages the security plugin to evaluate the privileges needed as part of its core flow', }, }, params: z.object({ diff --git a/x-pack/plugins/entity_manager/server/routes/entities/create.ts b/x-pack/plugins/entity_manager/server/routes/entities/create.ts index a22916f3e69f7..fc0f4c6e9a1ed 100644 --- a/x-pack/plugins/entity_manager/server/routes/entities/create.ts +++ b/x-pack/plugins/entity_manager/server/routes/entities/create.ts @@ -50,13 +50,11 @@ import { canManageEntityDefinition } from '../../lib/auth'; */ export const createEntityDefinitionRoute = createEntityManagerServerRoute({ endpoint: 'POST /internal/entities/definition', - options: { - security: { - authz: { - enabled: false, - reason: - 'This endpoint mainly manages Elasticsearch resources using the requesting users credentials', - }, + security: { + authz: { + enabled: false, + reason: + 'This endpoint mainly manages Elasticsearch resources using the requesting users credentials', }, }, params: z.object({ diff --git a/x-pack/plugins/entity_manager/server/routes/entities/delete.ts b/x-pack/plugins/entity_manager/server/routes/entities/delete.ts index ff5b9624dbb3c..ec5b4ada3039f 100644 --- a/x-pack/plugins/entity_manager/server/routes/entities/delete.ts +++ b/x-pack/plugins/entity_manager/server/routes/entities/delete.ts @@ -52,13 +52,11 @@ import { canDeleteEntityDefinition } from '../../lib/auth/privileges'; */ export const deleteEntityDefinitionRoute = createEntityManagerServerRoute({ endpoint: 'DELETE /internal/entities/definition/{id}', - options: { - security: { - authz: { - enabled: false, - reason: - 'This endpoint mainly manages Elasticsearch resources using the requesting users credentials', - }, + security: { + authz: { + enabled: false, + reason: + 'This endpoint mainly manages Elasticsearch resources using the requesting users credentials', }, }, params: z.object({ diff --git a/x-pack/plugins/entity_manager/server/routes/entities/get.ts b/x-pack/plugins/entity_manager/server/routes/entities/get.ts index f22e0890e60ad..738ed0f440643 100644 --- a/x-pack/plugins/entity_manager/server/routes/entities/get.ts +++ b/x-pack/plugins/entity_manager/server/routes/entities/get.ts @@ -50,13 +50,11 @@ import { createEntityManagerServerRoute } from '../create_entity_manager_server_ */ export const getEntityDefinitionRoute = createEntityManagerServerRoute({ endpoint: 'GET /internal/entities/definition/{id?}', - options: { - security: { - authz: { - enabled: false, - reason: - 'This endpoint mainly manages Elasticsearch resources using the requesting users credentials', - }, + security: { + authz: { + enabled: false, + reason: + 'This endpoint mainly manages Elasticsearch resources using the requesting users credentials', }, }, params: z.object({ diff --git a/x-pack/plugins/entity_manager/server/routes/entities/reset.ts b/x-pack/plugins/entity_manager/server/routes/entities/reset.ts index ab4ba29fa1483..5da7a608aed84 100644 --- a/x-pack/plugins/entity_manager/server/routes/entities/reset.ts +++ b/x-pack/plugins/entity_manager/server/routes/entities/reset.ts @@ -25,13 +25,11 @@ import { stopTransforms } from '../../lib/entities/stop_transforms'; export const resetEntityDefinitionRoute = createEntityManagerServerRoute({ endpoint: 'POST /internal/entities/definition/{id}/_reset', - options: { - security: { - authz: { - enabled: false, - reason: - 'This endpoint mainly manages Elasticsearch resources using the requesting users credentials', - }, + security: { + authz: { + enabled: false, + reason: + 'This endpoint mainly manages Elasticsearch resources using the requesting users credentials', }, }, params: z.object({ diff --git a/x-pack/plugins/entity_manager/server/routes/entities/update.ts b/x-pack/plugins/entity_manager/server/routes/entities/update.ts index f1118028cda93..4f23486375f92 100644 --- a/x-pack/plugins/entity_manager/server/routes/entities/update.ts +++ b/x-pack/plugins/entity_manager/server/routes/entities/update.ts @@ -54,13 +54,11 @@ import { canManageEntityDefinition } from '../../lib/auth'; */ export const updateEntityDefinitionRoute = createEntityManagerServerRoute({ endpoint: 'PATCH /internal/entities/definition/{id}', - options: { - security: { - authz: { - enabled: false, - reason: - 'This endpoint mainly manages Elasticsearch resources using the requesting users credentials', - }, + security: { + authz: { + enabled: false, + reason: + 'This endpoint mainly manages Elasticsearch resources using the requesting users credentials', }, }, params: z.object({ diff --git a/x-pack/plugins/observability_solution/apm/server/routes/apm_routes/register_apm_server_routes.ts b/x-pack/plugins/observability_solution/apm/server/routes/apm_routes/register_apm_server_routes.ts index 4792223610bb6..59c9cdac2df83 100644 --- a/x-pack/plugins/observability_solution/apm/server/routes/apm_routes/register_apm_server_routes.ts +++ b/x-pack/plugins/observability_solution/apm/server/routes/apm_routes/register_apm_server_routes.ts @@ -11,6 +11,7 @@ import { Logger, KibanaRequest, KibanaResponseFactory, RouteRegistrar } from '@k import { errors } from '@elastic/elasticsearch'; import agent from 'elastic-apm-node'; import { + DefaultRouteCreateOptions, IoTsParamsObject, ServerRouteRepository, stripNullishRequestParameters, @@ -30,6 +31,7 @@ import type { APMIndices } from '@kbn/apm-data-access-plugin/server'; import { ApmFeatureFlags } from '../../../common/apm_feature_flags'; import type { APMCore, + APMRouteCreateOptions, MinimalApmPluginRequestHandlerContext, TelemetryUsageCounter, } from '../typings'; @@ -78,7 +80,11 @@ export function registerRoutes({ const router = core.setup.http.createRouter(); routes.forEach((route) => { - const { params, endpoint, options, handler } = route; + const { endpoint, handler, security } = route; + + const options = ('options' in route ? route.options : {}) as DefaultRouteCreateOptions & + APMRouteCreateOptions; + const params = 'params' in route ? route.params : undefined; const { method, pathname, version } = parseEndpoint(endpoint); @@ -215,6 +221,7 @@ export function registerRoutes({ path: pathname, options, validate: passThroughValidationObject, + security, }, wrappedHandler ); @@ -228,6 +235,7 @@ export function registerRoutes({ path: pathname, access: pathname.includes('/internal/apm') ? 'internal' : 'public', options, + security, }).addVersion( { version, diff --git a/x-pack/plugins/observability_solution/apm/server/routes/typings.ts b/x-pack/plugins/observability_solution/apm/server/routes/typings.ts index f9ea085a11e6b..126ae48937648 100644 --- a/x-pack/plugins/observability_solution/apm/server/routes/typings.ts +++ b/x-pack/plugins/observability_solution/apm/server/routes/typings.ts @@ -9,7 +9,6 @@ import type { CoreSetup, CustomRequestHandlerContext, CoreStart, - RouteConfigOptions, IScopedClusterClient, IUiSettingsClient, SavedObjectsClientContract, @@ -48,21 +47,18 @@ export type MinimalApmPluginRequestHandlerContext = Omit< }; export interface APMRouteCreateOptions { - options: { - tags: Array< - | 'access:apm' - | 'access:apm_write' - | 'access:apm_settings_write' - | 'access:ml:canGetJobs' - | 'access:ml:canCreateJob' - | 'access:ml:canCloseJob' - | 'access:ai_assistant' - | 'oas-tag:APM agent keys' - | 'oas-tag:APM annotations' - >; - body?: { accepts: Array<'application/json' | 'multipart/form-data'> }; - disableTelemetry?: boolean; - } & RouteConfigOptions; + tags: Array< + | 'access:apm' + | 'access:apm_write' + | 'access:apm_settings_write' + | 'access:ml:canGetJobs' + | 'access:ml:canCreateJob' + | 'access:ml:canCloseJob' + | 'access:ai_assistant' + | 'oas-tag:APM agent keys' + | 'oas-tag:APM annotations' + >; + disableTelemetry?: boolean; } export type TelemetryUsageCounter = ReturnType; diff --git a/x-pack/plugins/observability_solution/dataset_quality/server/routes/register_routes.ts b/x-pack/plugins/observability_solution/dataset_quality/server/routes/register_routes.ts index 4e1970d7fc887..db5620e0778f0 100644 --- a/x-pack/plugins/observability_solution/dataset_quality/server/routes/register_routes.ts +++ b/x-pack/plugins/observability_solution/dataset_quality/server/routes/register_routes.ts @@ -39,14 +39,18 @@ export function registerRoutes({ const router = core.http.createRouter(); routes.forEach((route) => { - const { endpoint, options, handler, params } = route; + const { endpoint, handler } = route; const { pathname, method } = parseEndpoint(endpoint); + const params = 'params' in route ? route.params : undefined; + const options = 'options' in route ? route.options : {}; + (router[method] as RouteRegistrar)( { path: pathname, validate: passThroughValidationObject, options, + security: route.security, }, async (context, request, response) => { try { diff --git a/x-pack/plugins/observability_solution/dataset_quality/server/routes/types.ts b/x-pack/plugins/observability_solution/dataset_quality/server/routes/types.ts index 86dd9e0986257..298d0c45efc45 100644 --- a/x-pack/plugins/observability_solution/dataset_quality/server/routes/types.ts +++ b/x-pack/plugins/observability_solution/dataset_quality/server/routes/types.ts @@ -29,7 +29,5 @@ export interface DatasetQualityRouteHandlerResources { } export interface DatasetQualityRouteCreateOptions { - options: { - tags: string[]; - }; + tags: string[]; } diff --git a/x-pack/plugins/observability_solution/infra/server/routes/entities/get_latest_entity.ts b/x-pack/plugins/observability_solution/infra/server/routes/entities/get_latest_entity.ts index c109f53be1f11..c7669e6f9acdd 100644 --- a/x-pack/plugins/observability_solution/infra/server/routes/entities/get_latest_entity.ts +++ b/x-pack/plugins/observability_solution/infra/server/routes/entities/get_latest_entity.ts @@ -44,18 +44,25 @@ export async function getLatestEntity({ return undefined; } - const response = await inventoryEsClient.esql<{ - source_data_stream?: { type?: string | string[] }; - }>('get_latest_entities', { - query: `FROM ${ENTITIES_LATEST_ALIAS} + const response = await inventoryEsClient.esql< + { + 'source_data_stream.type'?: string | string; + }, + { transform: 'plain' } + >( + 'get_latest_entities', + { + query: `FROM ${ENTITIES_LATEST_ALIAS} | WHERE ${ENTITY_TYPE} == ? | WHERE ${hostOrContainerIdentityField} == ? | KEEP ${SOURCE_DATA_STREAM_TYPE} `, - params: [entityType, entityId], - }); + params: [entityType, entityId], + }, + { transform: 'plain' } + ); - return { sourceDataStreamType: response[0].source_data_stream?.type }; + return { sourceDataStreamType: response.hits[0]['source_data_stream.type'] }; } catch (e) { logger.error(e); } diff --git a/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_entity_groups.ts b/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_entity_groups.ts index 87d0c375149e0..816b3c6af6ec2 100644 --- a/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_entity_groups.ts +++ b/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_entity_groups.ts @@ -22,7 +22,7 @@ export async function getEntityGroupsBy({ inventoryEsClient: ObservabilityElasticsearchClient; field: string; esQuery?: QueryDslQueryContainer; -}) { +}): Promise { const from = `FROM ${ENTITIES_LATEST_ALIAS}`; const where = [getBuiltinEntityDefinitionIdESQLWhereClause()]; @@ -31,8 +31,14 @@ export async function getEntityGroupsBy({ const limit = `LIMIT ${MAX_NUMBER_OF_ENTITIES}`; const query = [from, ...where, group, sort, limit].join(' | '); - return inventoryEsClient.esql('get_entities_groups', { - query, - filter: esQuery, - }); + const { hits } = await inventoryEsClient.esql( + 'get_entities_groups', + { + query, + filter: esQuery, + }, + { transform: 'plain' } + ); + + return hits; } diff --git a/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_entity_types.ts b/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_entity_types.ts index e944e27379ab5..c1f7894a178b1 100644 --- a/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_entity_types.ts +++ b/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_entity_types.ts @@ -7,7 +7,6 @@ import { type ObservabilityElasticsearchClient } from '@kbn/observability-utils-server/es/client/create_observability_es_client'; import { ENTITY_TYPE } from '@kbn/observability-shared-plugin/common'; -import type { EntityInstance } from '@kbn/entities-schema'; import { ENTITIES_LATEST_ALIAS } from '../../../common/entities'; import { getBuiltinEntityDefinitionIdESQLWhereClause } from './query_helper'; @@ -16,14 +15,21 @@ export async function getEntityTypes({ }: { inventoryEsClient: ObservabilityElasticsearchClient; }) { - const entityTypesEsqlResponse = await inventoryEsClient.esql<{ - entity: Pick; - }>('get_entity_types', { - query: `FROM ${ENTITIES_LATEST_ALIAS} + const entityTypesEsqlResponse = await inventoryEsClient.esql< + { + 'entity.type': string; + }, + { transform: 'plain' } + >( + 'get_entity_types', + { + query: `FROM ${ENTITIES_LATEST_ALIAS} | ${getBuiltinEntityDefinitionIdESQLWhereClause()} | STATS count = COUNT(${ENTITY_TYPE}) BY ${ENTITY_TYPE} `, - }); + }, + { transform: 'plain' } + ); - return entityTypesEsqlResponse.map((response) => response.entity.type); + return entityTypesEsqlResponse.hits.map((response) => response['entity.type']); } diff --git a/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_latest_entities.ts b/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_latest_entities.ts index c4bf13c5ec140..9dcf17250ad68 100644 --- a/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_latest_entities.ts +++ b/x-pack/plugins/observability_solution/inventory/server/routes/entities/get_latest_entities.ts @@ -6,13 +6,13 @@ */ import type { QueryDslQueryContainer, ScalarValue } from '@elastic/elasticsearch/lib/api/types'; -import type { EntityInstance } from '@kbn/entities-schema'; import { ENTITY_DISPLAY_NAME, ENTITY_LAST_SEEN, ENTITY_TYPE, } from '@kbn/observability-shared-plugin/common'; import type { ObservabilityElasticsearchClient } from '@kbn/observability-utils-server/es/client/create_observability_es_client'; +import { unflattenObject } from '@kbn/observability-utils-common/object/unflatten_object'; import { ENTITIES_LATEST_ALIAS, InventoryEntity, @@ -62,17 +62,38 @@ export async function getLatestEntities({ const query = [from, ...where, sort, limit].join(' | '); - const latestEntitiesEsqlResponse = await inventoryEsClient.esql( + const latestEntitiesEsqlResponse = await inventoryEsClient.esql< + { + 'entity.id': string; + 'entity.type': string; + 'entity.definition_id': string; + 'entity.display_name': string; + 'entity.identity_fields': string | string[]; + 'entity.last_seen_timestamp': string; + 'entity.definition_version': string; + 'entity.schema_version': string; + } & Record, + { transform: 'plain' } + >( 'get_latest_entities', { query, filter: esQuery, params, - } + }, + { transform: 'plain' } ); - return latestEntitiesEsqlResponse.map((lastestEntity) => { - const { entity, ...metadata } = lastestEntity; + return latestEntitiesEsqlResponse.hits.map((latestEntity) => { + Object.keys(latestEntity).forEach((key) => { + const keyOfObject = key as keyof typeof latestEntity; + // strip out multi-field aliases + if (keyOfObject.endsWith('.text') || keyOfObject.endsWith('.keyword')) { + delete latestEntity[keyOfObject]; + } + }); + + const { entity, ...metadata } = unflattenObject(latestEntity); return { entityId: entity.id, diff --git a/x-pack/plugins/observability_solution/inventory/server/routes/has_data/get_has_data.ts b/x-pack/plugins/observability_solution/inventory/server/routes/has_data/get_has_data.ts index 2f59478f17c02..c3fd3971f09d2 100644 --- a/x-pack/plugins/observability_solution/inventory/server/routes/has_data/get_has_data.ts +++ b/x-pack/plugins/observability_solution/inventory/server/routes/has_data/get_has_data.ts @@ -17,14 +17,18 @@ export async function getHasData({ logger: Logger; }) { try { - const esqlResults = await inventoryEsClient.esql<{ _count: number }>('get_has_data', { - query: `FROM ${ENTITIES_LATEST_ALIAS} + const esqlResults = await inventoryEsClient.esql<{ _count: number }, { transform: 'plain' }>( + 'get_has_data', + { + query: `FROM ${ENTITIES_LATEST_ALIAS} | ${getBuiltinEntityDefinitionIdESQLWhereClause()} | STATS _count = COUNT(*) | LIMIT 1`, - }); + }, + { transform: 'plain' } + ); - const totalCount = esqlResults[0]._count; + const totalCount = esqlResults.hits[0]._count; return { hasData: totalCount > 0 }; } catch (e) { diff --git a/x-pack/plugins/observability_solution/inventory/server/routes/types.ts b/x-pack/plugins/observability_solution/inventory/server/routes/types.ts index 397710509dab5..646d34888ae91 100644 --- a/x-pack/plugins/observability_solution/inventory/server/routes/types.ts +++ b/x-pack/plugins/observability_solution/inventory/server/routes/types.ts @@ -30,10 +30,8 @@ export interface InventoryRouteHandlerResources { } export interface InventoryRouteCreateOptions { - options: { - timeout?: { - idleSocket?: number; - }; - tags: Array<'access:inventory'>; + timeout?: { + idleSocket?: number; }; + tags: Array<'access:inventory'>; } diff --git a/x-pack/plugins/observability_solution/investigate_app/server/routes/types.ts b/x-pack/plugins/observability_solution/investigate_app/server/routes/types.ts index afb022cdc9b7f..0cee1b701539f 100644 --- a/x-pack/plugins/observability_solution/investigate_app/server/routes/types.ts +++ b/x-pack/plugins/observability_solution/investigate_app/server/routes/types.ts @@ -53,10 +53,7 @@ export interface InvestigateAppRouteHandlerResources { } export interface InvestigateAppRouteCreateOptions { - options: { - timeout?: { - idleSocket?: number; - }; - tags: []; + timeout?: { + idleSocket?: number; }; } diff --git a/x-pack/plugins/observability_solution/observability/kibana.jsonc b/x-pack/plugins/observability_solution/observability/kibana.jsonc index 1c09efd7dd6e1..3a888ce14e5ef 100644 --- a/x-pack/plugins/observability_solution/observability/kibana.jsonc +++ b/x-pack/plugins/observability_solution/observability/kibana.jsonc @@ -56,7 +56,8 @@ "serverless", "guidedOnboarding", "observabilityAIAssistant", - "investigate" + "investigate", + "streams" ], "requiredBundles": [ "data", @@ -70,4 +71,4 @@ "common" ] } -} \ No newline at end of file +} diff --git a/x-pack/plugins/observability_solution/observability/public/navigation_tree.ts b/x-pack/plugins/observability_solution/observability/public/navigation_tree.ts index 07bb33ebb5a98..16718648c9724 100644 --- a/x-pack/plugins/observability_solution/observability/public/navigation_tree.ts +++ b/x-pack/plugins/observability_solution/observability/public/navigation_tree.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import type { NavigationTreeDefinition } from '@kbn/core-chrome-browser'; import type { AddSolutionNavigationArg } from '@kbn/navigation-plugin/public'; -import { of } from 'rxjs'; +import { map, of } from 'rxjs'; import type { ObservabilityPublicPluginsStart } from './plugin'; const title = i18n.translate( @@ -18,7 +18,7 @@ const title = i18n.translate( ); const icon = 'logoObservability'; -export function createNavTree(pluginsStart: ObservabilityPublicPluginsStart) { +function createNavTree({ streamsAvailable }: { streamsAvailable?: boolean }) { const navTree: NavigationTreeDefinition = { body: [ { @@ -87,6 +87,13 @@ export function createNavTree(pluginsStart: ObservabilityPublicPluginsStart) { link: 'inventory', spaceBefore: 'm', }, + ...(streamsAvailable + ? [ + { + link: 'streams' as const, + }, + ] + : []), { id: 'apm', title: i18n.translate('xpack.observability.obltNav.applications', { @@ -558,6 +565,8 @@ export const createDefinition = ( title, icon: 'logoObservability', homePage: 'observabilityOnboarding', - navigationTree$: of(createNavTree(pluginsStart)), + navigationTree$: (pluginsStart.streams?.status$ || of({ status: 'disabled' as const })).pipe( + map(({ status }) => createNavTree({ streamsAvailable: status === 'enabled' })) + ), dataTestSubj: 'observabilitySideNav', }); diff --git a/x-pack/plugins/observability_solution/observability/public/plugin.ts b/x-pack/plugins/observability_solution/observability/public/plugin.ts index 5866a082556bb..c37f3cc2f624a 100644 --- a/x-pack/plugins/observability_solution/observability/public/plugin.ts +++ b/x-pack/plugins/observability_solution/observability/public/plugin.ts @@ -70,6 +70,7 @@ import type { import type { UiActionsSetup, UiActionsStart } from '@kbn/ui-actions-plugin/public'; import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; +import type { StreamsPluginStart, StreamsPluginSetup } from '@kbn/streams-plugin/public'; import { observabilityAppId, observabilityFeatureId } from '../common'; import { ALERTS_PATH, @@ -124,6 +125,7 @@ export interface ObservabilityPublicPluginsSetup { licensing: LicensingPluginSetup; serverless?: ServerlessPluginSetup; presentationUtil?: PresentationUtilPluginStart; + streams?: StreamsPluginSetup; } export interface ObservabilityPublicPluginsStart { actionTypeRegistry: ActionTypeRegistryContract; @@ -162,6 +164,7 @@ export interface ObservabilityPublicPluginsStart { dataViewFieldEditor: DataViewFieldEditorStart; toastNotifications: ToastsStart; investigate?: InvestigatePublicStart; + streams?: StreamsPluginStart; } export type ObservabilityPublicStart = ReturnType; diff --git a/x-pack/plugins/observability_solution/observability/server/plugin.ts b/x-pack/plugins/observability_solution/observability/server/plugin.ts index b98fe316c712e..4d0e809f882e7 100644 --- a/x-pack/plugins/observability_solution/observability/server/plugin.ts +++ b/x-pack/plugins/observability_solution/observability/server/plugin.ts @@ -195,7 +195,6 @@ export class ObservabilityPlugin implements Plugin { void core.getStartServices().then(([coreStart, pluginStart]) => { registerRoutes({ core, - config, dependencies: { pluginsSetup: { ...plugins, diff --git a/x-pack/plugins/observability_solution/observability/server/routes/register_routes.ts b/x-pack/plugins/observability_solution/observability/server/routes/register_routes.ts index 5599039a5ce67..9ce2d7c9f1829 100644 --- a/x-pack/plugins/observability_solution/observability/server/routes/register_routes.ts +++ b/x-pack/plugins/observability_solution/observability/server/routes/register_routes.ts @@ -4,29 +4,16 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { errors } from '@elastic/elasticsearch'; -import Boom from '@hapi/boom'; import { RulesClientApi } from '@kbn/alerting-plugin/server/types'; -import { CoreSetup, KibanaRequest, Logger, RouteRegistrar } from '@kbn/core/server'; +import { CoreSetup, KibanaRequest, Logger } from '@kbn/core/server'; import { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; import { RuleDataPluginService } from '@kbn/rule-registry-plugin/server'; -import { - IoTsParamsObject, - decodeRequestParams, - parseEndpoint, - passThroughValidationObject, - stripNullishRequestParameters, -} from '@kbn/server-route-repository'; +import { registerRoutes as registerServerRoutes } from '@kbn/server-route-repository'; import { SpacesPluginStart } from '@kbn/spaces-plugin/server'; -import axios from 'axios'; -import * as t from 'io-ts'; -import { ObservabilityConfig } from '..'; import { AlertDetailsContextualInsightsService } from '../services'; -import { ObservabilityRequestHandlerContext } from '../types'; import { AbstractObservabilityServerRouteRepository } from './types'; interface RegisterRoutes { - config: ObservabilityConfig; core: CoreSetup; repository: AbstractObservabilityServerRouteRepository; logger: Logger; @@ -46,81 +33,11 @@ export interface RegisterRoutesDependencies { getRulesClientWithRequest: (request: KibanaRequest) => RulesClientApi; } -export function registerRoutes({ config, repository, core, logger, dependencies }: RegisterRoutes) { - const routes = Object.values(repository); - - const router = core.http.createRouter(); - - routes.forEach((route) => { - const { endpoint, options, handler, params } = route; - const { pathname, method } = parseEndpoint(endpoint); - - (router[method] as RouteRegistrar)( - { - path: pathname, - validate: passThroughValidationObject, - options, - }, - async (context, request, response) => { - try { - const decodedParams = decodeRequestParams( - stripNullishRequestParameters({ - params: request.params, - body: request.body, - query: request.query, - }), - (params as IoTsParamsObject) ?? t.strict({}) - ); - - const data = await handler({ - config, - context, - request, - logger, - params: decodedParams, - dependencies, - }); - - if (data === undefined) { - return response.noContent(); - } - - return response.ok({ body: data }); - } catch (error) { - if (axios.isAxiosError(error)) { - logger.error(error); - return response.customError({ - statusCode: error.response?.status || 500, - body: { - message: error.message, - }, - }); - } - - if (Boom.isBoom(error)) { - logger.error(error.output.payload.message); - return response.customError({ - statusCode: error.output.statusCode, - body: { message: error.output.payload.message }, - }); - } - - logger.error(error); - const opts = { - statusCode: 500, - body: { - message: error.message, - }, - }; - - if (error instanceof errors.RequestAbortedError) { - opts.statusCode = 499; - opts.body.message = 'Client closed request'; - } - - return response.customError(opts); - } - } - ); +export function registerRoutes({ repository, core, logger, dependencies }: RegisterRoutes) { + registerServerRoutes({ + core, + dependencies: { dependencies }, + logger, + repository, }); } diff --git a/x-pack/plugins/observability_solution/observability/server/routes/types.ts b/x-pack/plugins/observability_solution/observability/server/routes/types.ts index 3940253137640..111bc4e714119 100644 --- a/x-pack/plugins/observability_solution/observability/server/routes/types.ts +++ b/x-pack/plugins/observability_solution/observability/server/routes/types.ts @@ -13,7 +13,6 @@ import { } from './get_global_observability_server_route_repository'; import { ObservabilityRequestHandlerContext } from '../types'; import { RegisterRoutesDependencies } from './register_routes'; -import { ObservabilityConfig } from '..'; export type { ObservabilityServerRouteRepository, APIEndpoint }; @@ -22,14 +21,11 @@ export interface ObservabilityRouteHandlerResources { dependencies: RegisterRoutesDependencies; logger: Logger; request: KibanaRequest; - config: ObservabilityConfig; } export interface ObservabilityRouteCreateOptions { - options: { - tags: string[]; - access?: 'public' | 'internal'; - }; + tags: string[]; + access?: 'public' | 'internal'; } export type AbstractObservabilityServerRouteRepository = ServerRouteRepository; diff --git a/x-pack/plugins/observability_solution/observability/tsconfig.json b/x-pack/plugins/observability_solution/observability/tsconfig.json index 84a691f1033af..b3c18dc24b8e0 100644 --- a/x-pack/plugins/observability_solution/observability/tsconfig.json +++ b/x-pack/plugins/observability_solution/observability/tsconfig.json @@ -111,6 +111,7 @@ "@kbn/core-ui-settings-server-mocks", "@kbn/es-types", "@kbn/logging-mocks", + "@kbn/streams-plugin", ], "exclude": ["target/**/*"] } diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant/server/functions/context.ts b/x-pack/plugins/observability_solution/observability_ai_assistant/server/functions/context.ts index 80ddf3cbc0a0d..1bf892c0d40ee 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant/server/functions/context.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant/server/functions/context.ts @@ -34,7 +34,7 @@ export function registerContextFunction({ visibility: FunctionVisibility.Internal, }, async ({ messages, screenContexts, chat }, signal) => { - const { analytics } = (await resources.context.core).coreStart; + const { analytics } = await resources.plugins.core.start(); async function getContext() { const screenDescription = compact( diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant/server/plugin.ts b/x-pack/plugins/observability_solution/observability_ai_assistant/server/plugin.ts index f693fa53c06cc..7949276ac6aba 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant/server/plugin.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant/server/plugin.ts @@ -111,7 +111,18 @@ export class ObservabilityAIAssistantPlugin ]; }), }; - }) as ObservabilityAIAssistantRouteHandlerResources['plugins']; + }) as Pick< + ObservabilityAIAssistantRouteHandlerResources['plugins'], + keyof ObservabilityAIAssistantPluginStartDependencies + >; + + const withCore = { + ...routeHandlerPlugins, + core: { + setup: core, + start: () => core.getStartServices().then(([coreStart]) => coreStart), + }, + }; const service = (this.service = new ObservabilityAIAssistantService({ logger: this.logger.get('service'), @@ -133,7 +144,7 @@ export class ObservabilityAIAssistantPlugin core, logger: this.logger, dependencies: { - plugins: routeHandlerPlugins, + plugins: withCore, service: this.service, }, }); diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/chat/route.ts b/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/chat/route.ts index a6fe57cb58adc..e80e6fa156b06 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/chat/route.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/chat/route.ts @@ -194,7 +194,7 @@ const chatRecallRoute = createObservabilityAIAssistantServerRoute({ const response$ = from( recallAndScore({ - analytics: (await resources.context.core).coreStart.analytics, + analytics: (await resources.plugins.core.start()).analytics, chat: (name, params) => client .chat(name, { diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/register_routes.ts b/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/register_routes.ts index 1a6140968c925..27c7361e8a7fb 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/register_routes.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/register_routes.ts @@ -6,7 +6,7 @@ */ import type { CoreSetup } from '@kbn/core/server'; import type { Logger } from '@kbn/logging'; -import { registerRoutes } from '@kbn/server-route-repository'; +import { DefaultRouteHandlerResources, registerRoutes } from '@kbn/server-route-repository'; import { getGlobalObservabilityAIAssistantServerRouteRepository } from './get_global_observability_ai_assistant_route_repository'; import type { ObservabilityAIAssistantRouteHandlerResources } from './types'; import { ObservabilityAIAssistantPluginStartDependencies } from '../types'; @@ -20,7 +20,7 @@ export function registerServerRoutes({ logger: Logger; dependencies: Omit< ObservabilityAIAssistantRouteHandlerResources, - 'request' | 'context' | 'logger' | 'params' + keyof DefaultRouteHandlerResources >; }) { registerRoutes({ diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/types.ts b/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/types.ts index b817328d22c64..62365536f3823 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/types.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant/server/routes/types.ts @@ -6,32 +6,36 @@ */ import type { + CoreSetup, CoreStart, CustomRequestHandlerContext, IScopedClusterClient, IUiSettingsClient, - KibanaRequest, SavedObjectsClientContract, } from '@kbn/core/server'; -import type { Logger } from '@kbn/logging'; import type { LicensingApiRequestHandlerContext } from '@kbn/licensing-plugin/server/types'; import type { RacApiRequestHandlerContext } from '@kbn/rule-registry-plugin/server'; import type { RulesClientApi } from '@kbn/alerting-plugin/server/types'; +import { DefaultRouteHandlerResources } from '@kbn/server-route-repository-utils'; import type { ObservabilityAIAssistantService } from '../service'; import type { ObservabilityAIAssistantPluginSetupDependencies, ObservabilityAIAssistantPluginStartDependencies, } from '../types'; +type ObservabilityAIAssistantRequestHandlerContextBase = CustomRequestHandlerContext<{ + licensing: Pick; + // these two are here for compatibility with APM functions + rac: Pick; + alerting: { + getRulesClient: () => RulesClientApi; + }; +}>; + +// this is the type used across methods, it's stripped down for compatibility +// with the context that's available when executing as an action export type ObservabilityAIAssistantRequestHandlerContext = Omit< - CustomRequestHandlerContext<{ - licensing: Pick; - // these two are here for compatibility with APM functions - rac: Pick; - alerting: { - getRulesClient: () => RulesClientApi; - }; - }>, + ObservabilityAIAssistantRequestHandlerContextBase, 'core' | 'resolve' > & { core: Promise<{ @@ -45,32 +49,41 @@ export type ObservabilityAIAssistantRequestHandlerContext = Omit< savedObjects: { client: SavedObjectsClientContract; }; - coreStart: CoreStart; }>; }; -export interface ObservabilityAIAssistantRouteHandlerResources { - request: KibanaRequest; +interface PluginContractResolveCore { + core: { + setup: CoreSetup; + start: () => Promise; + }; +} + +type PluginContractResolveDependenciesStart = { + [key in keyof ObservabilityAIAssistantPluginStartDependencies]: { + start: () => Promise[key]>; + }; +}; + +type PluginContractResolveDependenciesSetup = { + [key in keyof ObservabilityAIAssistantPluginSetupDependencies]: { + setup: Required[key]; + }; +}; + +export interface ObservabilityAIAssistantRouteHandlerResources + extends Omit { context: ObservabilityAIAssistantRequestHandlerContext; - logger: Logger; service: ObservabilityAIAssistantService; - plugins: { - [key in keyof ObservabilityAIAssistantPluginSetupDependencies]: { - setup: Required[key]; - }; - } & { - [key in keyof ObservabilityAIAssistantPluginStartDependencies]: { - start: () => Promise[key]>; - }; - }; + plugins: PluginContractResolveCore & + PluginContractResolveDependenciesSetup & + PluginContractResolveDependenciesStart; } export interface ObservabilityAIAssistantRouteCreateOptions { - options: { - timeout?: { - payload?: number; - idleSocket?: number; - }; - tags: Array<'access:ai_assistant'>; + timeout?: { + payload?: number; + idleSocket?: number; }; + tags: Array<'access:ai_assistant'>; } diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant/tsconfig.json b/x-pack/plugins/observability_solution/observability_ai_assistant/tsconfig.json index d5acd7a365b50..709b3117d575d 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant/tsconfig.json +++ b/x-pack/plugins/observability_solution/observability_ai_assistant/tsconfig.json @@ -47,6 +47,7 @@ "@kbn/ai-assistant-common", "@kbn/inference-common", "@kbn/core-lifecycle-server", + "@kbn/server-route-repository-utils", ], "exclude": ["target/**/*"] } diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/plugin.ts b/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/plugin.ts index 63e06818a2b70..97fdc01069b97 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/plugin.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/plugin.ts @@ -17,7 +17,6 @@ import { ObservabilityAIAssistantRequestHandlerContext, ObservabilityAIAssistantRouteHandlerResources, } from '@kbn/observability-ai-assistant-plugin/server/routes/types'; -import { ObservabilityAIAssistantPluginStartDependencies } from '@kbn/observability-ai-assistant-plugin/server/types'; import { mapValues } from 'lodash'; import { firstValueFrom } from 'rxjs'; import type { ObservabilityAIAssistantAppConfig } from './config'; @@ -59,13 +58,22 @@ export class ObservabilityAIAssistantAppPlugin setup: value, start: () => core.getStartServices().then((services) => { - const [, pluginsStartContracts] = services; + const [_, pluginsStartContracts] = services; + return pluginsStartContracts[ - key as keyof ObservabilityAIAssistantPluginStartDependencies + key as keyof ObservabilityAIAssistantAppPluginStartDependencies ]; }), }; - }) as ObservabilityAIAssistantRouteHandlerResources['plugins']; + }) as Omit; + + const withCore = { + ...routeHandlerPlugins, + core: { + setup: core, + start: () => core.getStartServices().then(([coreStart]) => coreStart), + }, + }; const initResources = async ( request: KibanaRequest @@ -90,7 +98,6 @@ export class ObservabilityAIAssistantAppPlugin }; }), core: Promise.resolve({ - coreStart, elasticsearch: { client: coreStart.elasticsearch.client.asScoped(request), }, @@ -110,7 +117,7 @@ export class ObservabilityAIAssistantAppPlugin context, service: plugins.observabilityAIAssistant.service, logger: this.logger.get('connector'), - plugins: routeHandlerPlugins, + plugins: withCore, }; }; diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.test.ts b/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.test.ts index de02e4cf841ce..04fd10c3e506f 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.test.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.test.ts @@ -94,12 +94,14 @@ describe('observabilityAIAssistant rule_connector', () => { getAdhocInstructions: () => [], }), }, - context: { - core: Promise.resolve({ - coreStart: { http: { basePath: { publicBaseUrl: 'http://kibana.com' } } }, - }), - }, + context: {}, plugins: { + core: { + start: () => + Promise.resolve({ + http: { basePath: { publicBaseUrl: 'http://kibana.com' } }, + }), + }, actions: { start: async () => { return { diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.ts b/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.ts index 33f3bdd2c98f8..1f5a097f8f7cd 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.ts @@ -248,7 +248,7 @@ If available, include the link of the conversation at the end of your answer.` isPublic: true, connectorId: execOptions.params.connector, signal: new AbortController().signal, - kibanaPublicUrl: (await resources.context.core).coreStart.http.basePath.publicBaseUrl, + kibanaPublicUrl: (await resources.plugins.core.start()).http.basePath.publicBaseUrl, instructions: [backgroundInstruction], messages: [ { diff --git a/x-pack/plugins/observability_solution/observability_onboarding/server/plugin.ts b/x-pack/plugins/observability_solution/observability_onboarding/server/plugin.ts index ccb260a002cf2..30aaaf2588388 100644 --- a/x-pack/plugins/observability_solution/observability_onboarding/server/plugin.ts +++ b/x-pack/plugins/observability_solution/observability_onboarding/server/plugin.ts @@ -14,8 +14,8 @@ import type { } from '@kbn/core/server'; import { mapValues } from 'lodash'; import { i18n } from '@kbn/i18n'; +import { DefaultRouteHandlerResources, registerRoutes } from '@kbn/server-route-repository'; import { getObservabilityOnboardingServerRouteRepository } from './routes'; -import { registerRoutes } from './routes/register_routes'; import { ObservabilityOnboardingRouteHandlerResources } from './routes/types'; import { ObservabilityOnboardingPluginSetup, @@ -71,16 +71,28 @@ export class ObservabilityOnboardingPlugin }) as ObservabilityOnboardingRouteHandlerResources['plugins']; const config = this.initContext.config.get(); - registerRoutes({ - core, - logger: this.logger, - repository: getObservabilityOnboardingServerRouteRepository(), - plugins: resourcePlugins, + + const dependencies: Omit< + ObservabilityOnboardingRouteHandlerResources, + keyof DefaultRouteHandlerResources + > = { config, kibanaVersion: this.initContext.env.packageInfo.version, + plugins: resourcePlugins, services: { esLegacyConfigService: this.esLegacyConfigService, }, + core: { + setup: core, + start: () => core.getStartServices().then(([coreStart]) => coreStart), + }, + }; + + registerRoutes({ + core, + logger: this.logger, + repository: getObservabilityOnboardingServerRouteRepository(), + dependencies, }); plugins.customIntegrations.registerCustomIntegration({ diff --git a/x-pack/plugins/observability_solution/observability_onboarding/server/routes/register_routes.ts b/x-pack/plugins/observability_solution/observability_onboarding/server/routes/register_routes.ts deleted file mode 100644 index 8fe51623510eb..0000000000000 --- a/x-pack/plugins/observability_solution/observability_onboarding/server/routes/register_routes.ts +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { errors } from '@elastic/elasticsearch'; -import Boom from '@hapi/boom'; -import type { IKibanaResponse } from '@kbn/core/server'; -import { CoreSetup, Logger, RouteRegistrar } from '@kbn/core/server'; -import { - IoTsParamsObject, - ServerRouteRepository, - decodeRequestParams, - stripNullishRequestParameters, - parseEndpoint, - passThroughValidationObject, -} from '@kbn/server-route-repository'; -import * as t from 'io-ts'; -import { ObservabilityOnboardingConfig } from '..'; -import { EsLegacyConfigService } from '../services/es_legacy_config_service'; -import { ObservabilityOnboardingRequestHandlerContext } from '../types'; -import { ObservabilityOnboardingRouteHandlerResources } from './types'; - -interface RegisterRoutes { - core: CoreSetup; - repository: ServerRouteRepository; - logger: Logger; - plugins: ObservabilityOnboardingRouteHandlerResources['plugins']; - config: ObservabilityOnboardingConfig; - kibanaVersion: string; - services: { - esLegacyConfigService: EsLegacyConfigService; - }; -} - -export function registerRoutes({ - repository, - core, - logger, - plugins, - config, - kibanaVersion, - services, -}: RegisterRoutes) { - const routes = Object.values(repository); - - const router = core.http.createRouter(); - - routes.forEach((route) => { - const { endpoint, options, handler, params } = route; - const { pathname, method } = parseEndpoint(endpoint); - - (router[method] as RouteRegistrar)( - { - path: pathname, - validate: passThroughValidationObject, - options, - }, - async (context, request, response) => { - try { - const decodedParams = decodeRequestParams( - stripNullishRequestParameters({ - params: request.params, - body: request.body, - query: request.query, - }), - (params as IoTsParamsObject) ?? t.strict({}) - ); - - const data = (await handler({ - context, - request, - response, - logger, - params: decodedParams, - plugins, - core: { - setup: core, - start: async () => { - const [coreStart] = await core.getStartServices(); - return coreStart; - }, - }, - config, - kibanaVersion, - services, - })) as any; - - if (data === undefined) { - return response.noContent(); - } - - if (data instanceof response.noContent().constructor) { - return data as IKibanaResponse; - } - - return response.ok({ body: data }); - } catch (error) { - if (Boom.isBoom(error)) { - logger.error(error.output.payload.message); - return response.customError({ - statusCode: error.output.statusCode, - body: { message: error.output.payload.message }, - }); - } - - logger.error(error); - const opts = { - statusCode: 500, - body: { - message: error.message, - }, - }; - - if (error instanceof errors.RequestAbortedError) { - opts.statusCode = 499; - opts.body.message = 'Client closed request'; - } - - return response.customError(opts); - } - } - ); - }); -} diff --git a/x-pack/plugins/observability_solution/observability_onboarding/server/routes/types.ts b/x-pack/plugins/observability_solution/observability_onboarding/server/routes/types.ts index 4b35272eaa330..689ab14739818 100644 --- a/x-pack/plugins/observability_solution/observability_onboarding/server/routes/types.ts +++ b/x-pack/plugins/observability_solution/observability_onboarding/server/routes/types.ts @@ -46,10 +46,8 @@ export interface ObservabilityOnboardingRouteHandlerResources { } export interface ObservabilityOnboardingRouteCreateOptions { - options: { - tags: string[]; - xsrfRequired?: boolean; - }; + tags: string[]; + xsrfRequired?: boolean; } export const IntegrationRT = t.intersection([ diff --git a/x-pack/plugins/observability_solution/observability_shared/kibana.jsonc b/x-pack/plugins/observability_solution/observability_shared/kibana.jsonc index a5cde081c7c54..8e5a4c25af48c 100644 --- a/x-pack/plugins/observability_solution/observability_shared/kibana.jsonc +++ b/x-pack/plugins/observability_solution/observability_shared/kibana.jsonc @@ -33,4 +33,4 @@ "common" ] } -} \ No newline at end of file +} diff --git a/x-pack/plugins/observability_solution/slo/server/routes/register_routes.ts b/x-pack/plugins/observability_solution/slo/server/routes/register_routes.ts index 6e3c02a5b921b..ee58618add23c 100644 --- a/x-pack/plugins/observability_solution/slo/server/routes/register_routes.ts +++ b/x-pack/plugins/observability_solution/slo/server/routes/register_routes.ts @@ -6,12 +6,11 @@ */ import { CoreSetup, Logger } from '@kbn/core/server'; import { ServerRoute, registerRoutes } from '@kbn/server-route-repository'; -import { ServerRouteCreateOptions } from '@kbn/server-route-repository-utils'; import { SLORequestHandlerContext, SLORoutesDependencies } from './types'; interface RegisterRoutes { core: CoreSetup; - repository: Record>; + repository: Record>; logger: Logger; dependencies: SLORoutesDependencies; isServerless: boolean; diff --git a/x-pack/plugins/observability_solution/slo/tsconfig.json b/x-pack/plugins/observability_solution/slo/tsconfig.json index 02a2ea06cc527..001c835fcb5cb 100644 --- a/x-pack/plugins/observability_solution/slo/tsconfig.json +++ b/x-pack/plugins/observability_solution/slo/tsconfig.json @@ -99,6 +99,5 @@ "@kbn/observability-alerting-rule-utils", "@kbn/discover-shared-plugin", "@kbn/server-route-repository-client", - "@kbn/server-route-repository-utils" ] } diff --git a/x-pack/plugins/serverless_observability/kibana.jsonc b/x-pack/plugins/serverless_observability/kibana.jsonc index fce943c44865a..ad2c1f76ce563 100644 --- a/x-pack/plugins/serverless_observability/kibana.jsonc +++ b/x-pack/plugins/serverless_observability/kibana.jsonc @@ -25,7 +25,9 @@ "discover", "security" ], - "optionalPlugins": [], + "optionalPlugins": [ + "streams" + ], "requiredBundles": [] } -} \ No newline at end of file +} diff --git a/x-pack/plugins/serverless_observability/public/navigation_tree.ts b/x-pack/plugins/serverless_observability/public/navigation_tree.ts index 7501a75abe876..e6fb3c9107306 100644 --- a/x-pack/plugins/serverless_observability/public/navigation_tree.ts +++ b/x-pack/plugins/serverless_observability/public/navigation_tree.ts @@ -8,374 +8,387 @@ import { i18n } from '@kbn/i18n'; import type { NavigationTreeDefinition } from '@kbn/core-chrome-browser'; -export const navigationTree: NavigationTreeDefinition = { - body: [ - { type: 'recentlyAccessed' }, - { - type: 'navGroup', - id: 'observability_project_nav', - title: 'Observability', - icon: 'logoObservability', - defaultIsCollapsed: false, - isCollapsible: false, - breadcrumbStatus: 'hidden', - children: [ - { - title: i18n.translate('xpack.serverlessObservability.nav.discover', { - defaultMessage: 'Discover', - }), - link: 'last-used-logs-viewer', - // avoid duplicate "Discover" breadcrumbs - breadcrumbStatus: 'hidden', - renderAs: 'item', - children: [ - { - link: 'discover', - children: [ - { - link: 'observability-logs-explorer', - }, - ], - }, - ], - }, - { - title: i18n.translate('xpack.serverlessObservability.nav.dashboards', { - defaultMessage: 'Dashboards', - }), - link: 'dashboards', - getIsActive: ({ pathNameSerialized, prepend }) => { - return pathNameSerialized.startsWith(prepend('/app/dashboards')); +export const createNavigationTree = ({ + streamsAvailable, +}: { + streamsAvailable?: boolean; +}): NavigationTreeDefinition => { + return { + body: [ + { type: 'recentlyAccessed' }, + { + type: 'navGroup', + id: 'observability_project_nav', + title: 'Observability', + icon: 'logoObservability', + defaultIsCollapsed: false, + isCollapsible: false, + breadcrumbStatus: 'hidden', + children: [ + { + title: i18n.translate('xpack.serverlessObservability.nav.discover', { + defaultMessage: 'Discover', + }), + link: 'last-used-logs-viewer', + // avoid duplicate "Discover" breadcrumbs + breadcrumbStatus: 'hidden', + renderAs: 'item', + children: [ + { + link: 'discover', + children: [ + { + link: 'observability-logs-explorer', + }, + ], + }, + ], }, - }, - { - link: 'observability-overview:alerts', - }, - { - link: 'observability-overview:cases', - renderAs: 'item', - children: [ - { - link: 'observability-overview:cases_configure', - }, - { - link: 'observability-overview:cases_create', - }, - ], - }, - { - title: i18n.translate('xpack.serverlessObservability.nav.slo', { - defaultMessage: 'SLOs', - }), - link: 'slo', - }, - { - link: 'observabilityAIAssistant', - title: i18n.translate('xpack.serverlessObservability.nav.aiAssistant', { - defaultMessage: 'AI Assistant', - }), - }, - { link: 'inventory', spaceBefore: 'm' }, - { - id: 'apm', - title: i18n.translate('xpack.serverlessObservability.nav.applications', { - defaultMessage: 'Applications', - }), - renderAs: 'panelOpener', - children: [ - { - children: [ - { - link: 'apm:services', - title: i18n.translate('xpack.serverlessObservability.nav.apm.services', { - defaultMessage: 'Service inventory', - }), - }, - { link: 'apm:traces' }, - { link: 'apm:dependencies' }, - { link: 'apm:settings' }, - { - id: 'synthetics', - title: i18n.translate('xpack.serverlessObservability.nav.synthetics', { - defaultMessage: 'Synthetics', - }), - children: [ - { - title: i18n.translate( - 'xpack.serverlessObservability.nav.synthetics.overviewItem', - { - defaultMessage: 'Overview', - } - ), - id: 'synthetics-overview', - link: 'synthetics:overview', - breadcrumbStatus: 'hidden', - }, - { - link: 'synthetics:certificates', - title: i18n.translate( - 'xpack.serverlessObservability.nav.synthetics.certificatesItem', - { - defaultMessage: 'TLS certificates', - } - ), - id: 'synthetics-certificates', - breadcrumbStatus: 'hidden', - }, - ], - }, - ], + { + title: i18n.translate('xpack.serverlessObservability.nav.dashboards', { + defaultMessage: 'Dashboards', + }), + link: 'dashboards', + getIsActive: ({ pathNameSerialized, prepend }) => { + return pathNameSerialized.startsWith(prepend('/app/dashboards')); }, - ], - }, - { - id: 'metrics', - title: i18n.translate('xpack.serverlessObservability.nav.infrastructure', { - defaultMessage: 'Infrastructure', - }), - renderAs: 'panelOpener', - children: [ - { - children: [ - { - link: 'metrics:inventory', - title: i18n.translate( - 'xpack.serverlessObservability.nav.infrastructureInventory', - { - defaultMessage: 'Infrastructure inventory', - } - ), - }, - { link: 'metrics:hosts' }, - { link: 'metrics:settings' }, - { link: 'metrics:assetDetails' }, - ], - }, - ], - }, - { - id: 'machine_learning-landing', - renderAs: 'panelOpener', - title: i18n.translate('xpack.serverlessObservability.nav.machineLearning', { - defaultMessage: 'Machine learning', - }), - children: [ - { - children: [ - { - link: 'ml:overview', - }, - { - link: 'ml:notifications', - }, - { - link: 'ml:memoryUsage', - title: i18n.translate( - 'xpack.serverlessObservability.nav.machineLearning.memoryUsage', - { - defaultMessage: 'Memory usage', - } - ), - }, - ], - }, - { - id: 'category-anomaly_detection', - title: i18n.translate('xpack.serverlessObservability.nav.ml.anomaly_detection', { - defaultMessage: 'Anomaly detection', - }), - breadcrumbStatus: 'hidden', - children: [ - { - link: 'ml:anomalyDetection', - title: i18n.translate( - 'xpack.serverlessObservability.nav.ml.anomaly_detection.jobs', - { - defaultMessage: 'Jobs', - } - ), - }, - { - link: 'ml:anomalyExplorer', - }, - { - link: 'ml:singleMetricViewer', - }, - { - link: 'ml:settings', - }, - { - link: 'ml:suppliedConfigurations', - }, - ], - }, - { - id: 'category-data_frame analytics', - title: i18n.translate('xpack.serverlessObservability.nav.ml.data_frame_analytics', { - defaultMessage: 'Data frame analytics', - }), - breadcrumbStatus: 'hidden', - children: [ - { - link: 'ml:dataFrameAnalytics', - title: i18n.translate( - 'xpack.serverlessObservability.nav.ml.data_frame_analytics.jobs', - { - defaultMessage: 'Jobs', - } - ), - }, - { - link: 'ml:resultExplorer', - }, - { - link: 'ml:analyticsMap', - }, - ], - }, - { - id: 'category-model_management', - title: i18n.translate('xpack.serverlessObservability.nav.ml.model_management', { - defaultMessage: 'Model management', - }), - breadcrumbStatus: 'hidden', - children: [ - { - link: 'ml:nodesOverview', - title: i18n.translate( - 'xpack.serverlessObservability.nav.ml.model_management.trainedModels', - { - defaultMessage: 'Trained models', - } - ), - }, - ], - }, - { - id: 'category-data_visualizer', - title: i18n.translate('xpack.serverlessObservability.nav.ml.data_visualizer', { - defaultMessage: 'Data visualizer', - }), - breadcrumbStatus: 'hidden', - children: [ - { - link: 'ml:fileUpload', - title: i18n.translate( - 'xpack.serverlessObservability.nav.ml.data_visualizer.file_data_visualizer', - { - defaultMessage: 'File data visualizer', - } - ), - }, - { - link: 'ml:indexDataVisualizer', - title: i18n.translate( - 'xpack.serverlessObservability.nav.ml.data_visualizer.data_view_data_visualizer', - { - defaultMessage: 'Data view data visualizer', - } - ), - }, - { - link: 'ml:dataDrift', - title: i18n.translate( - 'xpack.serverlessObservability.nav.ml.data_visualizer.data_drift', - { - defaultMessage: 'Data drift', - } - ), - }, - ], - }, - { - id: 'category-aiops_labs', - title: i18n.translate('xpack.serverlessObservability.nav.ml.aiops_labs', { - defaultMessage: 'Aiops labs', - }), - breadcrumbStatus: 'hidden', - children: [ - { - link: 'ml:logRateAnalysis', - title: i18n.translate( - 'xpack.serverlessObservability.nav.ml.aiops_labs.log_rate_analysis', - { - defaultMessage: 'Log rate analysis', - } - ), - }, - { - link: 'ml:logPatternAnalysis', - title: i18n.translate( - 'xpack.serverlessObservability.nav.ml.aiops_labs.log_pattern_analysis', - { - defaultMessage: 'Log pattern analysis', - } - ), - }, + }, + { + link: 'observability-overview:alerts', + }, + { + link: 'observability-overview:cases', + renderAs: 'item', + children: [ + { + link: 'observability-overview:cases_configure', + }, + { + link: 'observability-overview:cases_create', + }, + ], + }, + { + title: i18n.translate('xpack.serverlessObservability.nav.slo', { + defaultMessage: 'SLOs', + }), + link: 'slo', + }, + { + link: 'observabilityAIAssistant', + title: i18n.translate('xpack.serverlessObservability.nav.aiAssistant', { + defaultMessage: 'AI Assistant', + }), + }, + { link: 'inventory', spaceBefore: 'm' }, + ...(streamsAvailable + ? [ { - link: 'ml:changePointDetections', - title: i18n.translate( - 'xpack.serverlessObservability.nav.ml.aiops_labs.change_point_detection', - { - defaultMessage: 'Change point detection', - } - ), + link: 'streams' as const, }, - ], - }, - ], - }, - ], - }, - ], - footer: [ - { - type: 'navItem', - title: i18n.translate('xpack.serverlessObservability.nav.getStarted', { - defaultMessage: 'Add data', - }), - link: 'observabilityOnboarding', - icon: 'launch', - }, - { - type: 'navItem', - id: 'devTools', - title: i18n.translate('xpack.serverlessObservability.nav.devTools', { - defaultMessage: 'Developer tools', - }), - link: 'dev_tools', - icon: 'editorCodeBlock', - }, - { - type: 'navGroup', - id: 'project_settings_project_nav', - title: i18n.translate('xpack.serverlessObservability.nav.projectSettings', { - defaultMessage: 'Project settings', - }), - icon: 'gear', - breadcrumbStatus: 'hidden', - children: [ - { - link: 'management', - title: i18n.translate('xpack.serverlessObservability.nav.mngt', { - defaultMessage: 'Management', - }), - }, - { - link: 'integrations', - }, - { - link: 'fleet', - }, - { - id: 'cloudLinkUserAndRoles', - cloudLink: 'userAndRoles', - }, - { - id: 'cloudLinkBilling', - cloudLink: 'billingAndSub', - }, - ], - }, - ], + ] + : []), + { + id: 'apm', + title: i18n.translate('xpack.serverlessObservability.nav.applications', { + defaultMessage: 'Applications', + }), + renderAs: 'panelOpener', + children: [ + { + children: [ + { + link: 'apm:services', + title: i18n.translate('xpack.serverlessObservability.nav.apm.services', { + defaultMessage: 'Service inventory', + }), + }, + { link: 'apm:traces' }, + { link: 'apm:dependencies' }, + { link: 'apm:settings' }, + { + id: 'synthetics', + title: i18n.translate('xpack.serverlessObservability.nav.synthetics', { + defaultMessage: 'Synthetics', + }), + children: [ + { + title: i18n.translate( + 'xpack.serverlessObservability.nav.synthetics.overviewItem', + { + defaultMessage: 'Overview', + } + ), + id: 'synthetics-overview', + link: 'synthetics:overview', + breadcrumbStatus: 'hidden', + }, + { + link: 'synthetics:certificates', + title: i18n.translate( + 'xpack.serverlessObservability.nav.synthetics.certificatesItem', + { + defaultMessage: 'TLS certificates', + } + ), + id: 'synthetics-certificates', + breadcrumbStatus: 'hidden', + }, + ], + }, + ], + }, + ], + }, + { + id: 'metrics', + title: i18n.translate('xpack.serverlessObservability.nav.infrastructure', { + defaultMessage: 'Infrastructure', + }), + renderAs: 'panelOpener', + children: [ + { + children: [ + { + link: 'metrics:inventory', + title: i18n.translate( + 'xpack.serverlessObservability.nav.infrastructureInventory', + { + defaultMessage: 'Infrastructure inventory', + } + ), + }, + { link: 'metrics:hosts' }, + { link: 'metrics:settings' }, + { link: 'metrics:assetDetails' }, + ], + }, + ], + }, + { + id: 'machine_learning-landing', + renderAs: 'panelOpener', + title: i18n.translate('xpack.serverlessObservability.nav.machineLearning', { + defaultMessage: 'Machine learning', + }), + children: [ + { + children: [ + { + link: 'ml:overview', + }, + { + link: 'ml:notifications', + }, + { + link: 'ml:memoryUsage', + title: i18n.translate( + 'xpack.serverlessObservability.nav.machineLearning.memoryUsage', + { + defaultMessage: 'Memory usage', + } + ), + }, + ], + }, + { + id: 'category-anomaly_detection', + title: i18n.translate('xpack.serverlessObservability.nav.ml.anomaly_detection', { + defaultMessage: 'Anomaly detection', + }), + breadcrumbStatus: 'hidden', + children: [ + { + link: 'ml:anomalyDetection', + title: i18n.translate( + 'xpack.serverlessObservability.nav.ml.anomaly_detection.jobs', + { + defaultMessage: 'Jobs', + } + ), + }, + { + link: 'ml:anomalyExplorer', + }, + { + link: 'ml:singleMetricViewer', + }, + { + link: 'ml:settings', + }, + { + link: 'ml:suppliedConfigurations', + }, + ], + }, + { + id: 'category-data_frame analytics', + title: i18n.translate('xpack.serverlessObservability.nav.ml.data_frame_analytics', { + defaultMessage: 'Data frame analytics', + }), + breadcrumbStatus: 'hidden', + children: [ + { + link: 'ml:dataFrameAnalytics', + title: i18n.translate( + 'xpack.serverlessObservability.nav.ml.data_frame_analytics.jobs', + { + defaultMessage: 'Jobs', + } + ), + }, + { + link: 'ml:resultExplorer', + }, + { + link: 'ml:analyticsMap', + }, + ], + }, + { + id: 'category-model_management', + title: i18n.translate('xpack.serverlessObservability.nav.ml.model_management', { + defaultMessage: 'Model management', + }), + breadcrumbStatus: 'hidden', + children: [ + { + link: 'ml:nodesOverview', + title: i18n.translate( + 'xpack.serverlessObservability.nav.ml.model_management.trainedModels', + { + defaultMessage: 'Trained models', + } + ), + }, + ], + }, + { + id: 'category-data_visualizer', + title: i18n.translate('xpack.serverlessObservability.nav.ml.data_visualizer', { + defaultMessage: 'Data visualizer', + }), + breadcrumbStatus: 'hidden', + children: [ + { + link: 'ml:fileUpload', + title: i18n.translate( + 'xpack.serverlessObservability.nav.ml.data_visualizer.file_data_visualizer', + { + defaultMessage: 'File data visualizer', + } + ), + }, + { + link: 'ml:indexDataVisualizer', + title: i18n.translate( + 'xpack.serverlessObservability.nav.ml.data_visualizer.data_view_data_visualizer', + { + defaultMessage: 'Data view data visualizer', + } + ), + }, + { + link: 'ml:dataDrift', + title: i18n.translate( + 'xpack.serverlessObservability.nav.ml.data_visualizer.data_drift', + { + defaultMessage: 'Data drift', + } + ), + }, + ], + }, + { + id: 'category-aiops_labs', + title: i18n.translate('xpack.serverlessObservability.nav.ml.aiops_labs', { + defaultMessage: 'Aiops labs', + }), + breadcrumbStatus: 'hidden', + children: [ + { + link: 'ml:logRateAnalysis', + title: i18n.translate( + 'xpack.serverlessObservability.nav.ml.aiops_labs.log_rate_analysis', + { + defaultMessage: 'Log rate analysis', + } + ), + }, + { + link: 'ml:logPatternAnalysis', + title: i18n.translate( + 'xpack.serverlessObservability.nav.ml.aiops_labs.log_pattern_analysis', + { + defaultMessage: 'Log pattern analysis', + } + ), + }, + { + link: 'ml:changePointDetections', + title: i18n.translate( + 'xpack.serverlessObservability.nav.ml.aiops_labs.change_point_detection', + { + defaultMessage: 'Change point detection', + } + ), + }, + ], + }, + ], + }, + ], + }, + ], + footer: [ + { + type: 'navItem', + title: i18n.translate('xpack.serverlessObservability.nav.getStarted', { + defaultMessage: 'Add data', + }), + link: 'observabilityOnboarding', + icon: 'launch', + }, + { + type: 'navItem', + id: 'devTools', + title: i18n.translate('xpack.serverlessObservability.nav.devTools', { + defaultMessage: 'Developer tools', + }), + link: 'dev_tools', + icon: 'editorCodeBlock', + }, + { + type: 'navGroup', + id: 'project_settings_project_nav', + title: i18n.translate('xpack.serverlessObservability.nav.projectSettings', { + defaultMessage: 'Project settings', + }), + icon: 'gear', + breadcrumbStatus: 'hidden', + children: [ + { + link: 'management', + title: i18n.translate('xpack.serverlessObservability.nav.mngt', { + defaultMessage: 'Management', + }), + }, + { + link: 'integrations', + }, + { + link: 'fleet', + }, + { + id: 'cloudLinkUserAndRoles', + cloudLink: 'userAndRoles', + }, + { + id: 'cloudLinkBilling', + cloudLink: 'billingAndSub', + }, + ], + }, + ], + }; }; diff --git a/x-pack/plugins/serverless_observability/public/plugin.ts b/x-pack/plugins/serverless_observability/public/plugin.ts index 05d598b2b3a7e..774a76749f8d6 100644 --- a/x-pack/plugins/serverless_observability/public/plugin.ts +++ b/x-pack/plugins/serverless_observability/public/plugin.ts @@ -8,8 +8,8 @@ import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public'; import { i18n } from '@kbn/i18n'; import { appCategories, appIds } from '@kbn/management-cards-navigation'; -import { of } from 'rxjs'; -import { navigationTree } from './navigation_tree'; +import { map, of } from 'rxjs'; +import { createNavigationTree } from './navigation_tree'; import { createObservabilityDashboardRegistration } from './logs_signal/overview_registration'; import { ServerlessObservabilityPublicSetup, @@ -50,7 +50,11 @@ export class ServerlessObservabilityPlugin setupDeps: ServerlessObservabilityPublicStartDependencies ): ServerlessObservabilityPublicStart { const { serverless, management, security } = setupDeps; - const navigationTree$ = of(navigationTree); + const navigationTree$ = (setupDeps.streams?.status$ || of({ status: 'disabled' })).pipe( + map(({ status }) => { + return createNavigationTree({ streamsAvailable: status === 'enabled' }); + }) + ); serverless.setProjectHome('/app/observability/landing'); serverless.initNavigation('oblt', navigationTree$, { dataTestSubj: 'svlObservabilitySideNav' }); const aiAssistantIsEnabled = core.application.capabilities.observabilityAIAssistant?.show; diff --git a/x-pack/plugins/serverless_observability/public/types.ts b/x-pack/plugins/serverless_observability/public/types.ts index c93865f0f596e..23da6c12637d3 100644 --- a/x-pack/plugins/serverless_observability/public/types.ts +++ b/x-pack/plugins/serverless_observability/public/types.ts @@ -8,13 +8,14 @@ import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { DiscoverSetup } from '@kbn/discover-plugin/public'; import type { ManagementSetup, ManagementStart } from '@kbn/management-plugin/public'; -import { ObservabilityPublicSetup } from '@kbn/observability-plugin/public'; -import { +import type { ObservabilityPublicSetup } from '@kbn/observability-plugin/public'; +import type { ObservabilitySharedPluginSetup, ObservabilitySharedPluginStart, } from '@kbn/observability-shared-plugin/public'; -import { SecurityPluginStart } from '@kbn/security-plugin/public'; -import { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public'; +import type { SecurityPluginStart } from '@kbn/security-plugin/public'; +import type { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public'; +import type { StreamsPluginStart, StreamsPluginSetup } from '@kbn/streams-plugin/public'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface ServerlessObservabilityPublicSetup {} @@ -28,6 +29,7 @@ export interface ServerlessObservabilityPublicSetupDependencies { serverless: ServerlessPluginSetup; management: ManagementSetup; discover: DiscoverSetup; + streams?: StreamsPluginSetup; } export interface ServerlessObservabilityPublicStartDependencies { @@ -36,4 +38,5 @@ export interface ServerlessObservabilityPublicStartDependencies { management: ManagementStart; data: DataPublicPluginStart; security: SecurityPluginStart; + streams?: StreamsPluginStart; } diff --git a/x-pack/plugins/serverless_observability/tsconfig.json b/x-pack/plugins/serverless_observability/tsconfig.json index 3d909bf88b656..5aa97143107ae 100644 --- a/x-pack/plugins/serverless_observability/tsconfig.json +++ b/x-pack/plugins/serverless_observability/tsconfig.json @@ -30,5 +30,6 @@ "@kbn/discover-plugin", "@kbn/security-plugin", "@kbn/search-types", + "@kbn/streams-plugin", ] } diff --git a/x-pack/plugins/streams/common/index.ts b/x-pack/plugins/streams/common/index.ts new file mode 100644 index 0000000000000..3a7306e46cae2 --- /dev/null +++ b/x-pack/plugins/streams/common/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { StreamDefinition } from './types'; diff --git a/x-pack/plugins/streams/public/api/index.ts b/x-pack/plugins/streams/public/api/index.ts new file mode 100644 index 0000000000000..f64fc7f2fdce8 --- /dev/null +++ b/x-pack/plugins/streams/public/api/index.ts @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { CoreSetup, CoreStart, HttpFetchOptions } from '@kbn/core/public'; +import type { + ClientRequestParamsOf, + ReturnOf, + RouteRepositoryClient, +} from '@kbn/server-route-repository'; +import { createRepositoryClient } from '@kbn/server-route-repository-client'; +import type { StreamsRouteRepository } from '../../server'; + +type FetchOptions = Omit & { + body?: any; +}; + +export type StreamsRepositoryClientOptions = Omit< + FetchOptions, + 'query' | 'body' | 'pathname' | 'signal' +> & { + signal: AbortSignal | null; +}; + +export type StreamsRepositoryClient = RouteRepositoryClient< + StreamsRouteRepository, + StreamsRepositoryClientOptions +>; + +export type AutoAbortedStreamsRepositoryClient = RouteRepositoryClient< + StreamsRouteRepository, + Omit +>; + +export type StreamsRepositoryEndpoint = keyof StreamsRouteRepository; + +export type APIReturnType = ReturnOf< + StreamsRouteRepository, + TEndpoint +>; + +export type StreamsAPIClientRequestParamsOf = + ClientRequestParamsOf; + +export function createStreamsRepositoryClient( + core: CoreStart | CoreSetup +): StreamsRepositoryClient { + return createRepositoryClient(core); +} diff --git a/x-pack/plugins/streams/public/index.ts b/x-pack/plugins/streams/public/index.ts index 5b83ea1d297d3..bc90fb0f40066 100644 --- a/x-pack/plugins/streams/public/index.ts +++ b/x-pack/plugins/streams/public/index.ts @@ -7,7 +7,12 @@ import { PluginInitializer, PluginInitializerContext } from '@kbn/core/public'; import { Plugin } from './plugin'; +import { StreamsPluginSetup, StreamsPluginStart } from './types'; -export const plugin: PluginInitializer<{}, {}> = (context: PluginInitializerContext) => { +export type { StreamsPluginSetup, StreamsPluginStart }; + +export const plugin: PluginInitializer = ( + context: PluginInitializerContext +) => { return new Plugin(context); }; diff --git a/x-pack/plugins/streams/public/plugin.ts b/x-pack/plugins/streams/public/plugin.ts index f35d18e06ff70..5a2ae3e066845 100644 --- a/x-pack/plugins/streams/public/plugin.ts +++ b/x-pack/plugins/streams/public/plugin.ts @@ -8,25 +8,55 @@ import { CoreSetup, CoreStart, PluginInitializerContext } from '@kbn/core/public'; import { Logger } from '@kbn/logging'; +import { createRepositoryClient } from '@kbn/server-route-repository-client'; +import { from, shareReplay, startWith } from 'rxjs'; +import { once } from 'lodash'; import type { StreamsPublicConfig } from '../common/config'; import { StreamsPluginClass, StreamsPluginSetup, StreamsPluginStart } from './types'; +import { StreamsRepositoryClient } from './api'; export class Plugin implements StreamsPluginClass { public config: StreamsPublicConfig; public logger: Logger; + private repositoryClient!: StreamsRepositoryClient; + constructor(context: PluginInitializerContext<{}>) { this.config = context.config.get(); this.logger = context.logger.get(); } - setup(core: CoreSetup, pluginSetup: StreamsPluginSetup) { - return {}; + setup(core: CoreSetup<{}>, pluginSetup: {}): StreamsPluginSetup { + this.repositoryClient = createRepositoryClient(core); + return { + status$: createStatusObservable(this.logger, this.repositoryClient), + }; } - start(core: CoreStart) { - return {}; + start(core: CoreStart, pluginsStart: {}): StreamsPluginStart { + return { + streamsRepositoryClient: this.repositoryClient, + status$: createStatusObservable(this.logger, this.repositoryClient), + }; } stop() {} } + +const createStatusObservable = once((logger: Logger, repositoryClient: StreamsRepositoryClient) => { + return from( + repositoryClient + .fetch('GET /api/streams/_status', { + signal: new AbortController().signal, + }) + .then( + (response) => ({ + status: response.enabled ? ('enabled' as const) : ('disabled' as const), + }), + (error) => { + logger.error(error); + return { status: 'unknown' as const }; + } + ) + ).pipe(startWith({ status: 'unknown' as const }), shareReplay(1)); +}); diff --git a/x-pack/plugins/streams/public/types.ts b/x-pack/plugins/streams/public/types.ts index 61e5fa94098f0..fc88f2a6c20fe 100644 --- a/x-pack/plugins/streams/public/types.ts +++ b/x-pack/plugins/streams/public/types.ts @@ -6,11 +6,16 @@ */ import type { Plugin as PluginClass } from '@kbn/core/public'; +import { Observable } from 'rxjs'; +import type { StreamsRepositoryClient } from './api'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface StreamsPluginSetup {} +export interface StreamsPluginSetup { + status$: Observable<{ status: 'unknown' | 'enabled' | 'disabled' }>; +} -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface StreamsPluginStart {} +export interface StreamsPluginStart { + streamsRepositoryClient: StreamsRepositoryClient; + status$: Observable<{ status: 'unknown' | 'enabled' | 'disabled' }>; +} -export type StreamsPluginClass = PluginClass<{}, {}, StreamsPluginSetup, StreamsPluginStart>; +export type StreamsPluginClass = PluginClass; diff --git a/x-pack/plugins/streams/server/index.ts b/x-pack/plugins/streams/server/index.ts index bd8aee304ad15..9ef13c62d6b7b 100644 --- a/x-pack/plugins/streams/server/index.ts +++ b/x-pack/plugins/streams/server/index.ts @@ -17,3 +17,5 @@ export const plugin = async (context: PluginInitializerContext) = const { StreamsPlugin } = await import('./plugin'); return new StreamsPlugin(context); }; + +export type { ListStreamResponse } from './lib/streams/stream_crud'; diff --git a/x-pack/plugins/streams/server/lib/streams/stream_crud.ts b/x-pack/plugins/streams/server/lib/streams/stream_crud.ts index 78a126905d9a4..a74540cdcc62a 100644 --- a/x-pack/plugins/streams/server/lib/streams/stream_crud.ts +++ b/x-pack/plugins/streams/server/lib/streams/stream_crud.ts @@ -7,29 +7,29 @@ import { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; import { Logger } from '@kbn/logging'; -import { FieldDefinition, StreamDefinition } from '../../../common/types'; import { STREAMS_INDEX } from '../../../common/constants'; -import { DefinitionNotFound } from './errors'; -import { deleteTemplate, upsertTemplate } from './index_templates/manage_index_templates'; +import { FieldDefinition, StreamDefinition } from '../../../common/types'; import { generateLayer } from './component_templates/generate_layer'; -import { generateIngestPipeline } from './ingest_pipelines/generate_ingest_pipeline'; -import { generateReroutePipeline } from './ingest_pipelines/generate_reroute_pipeline'; -import { generateIndexTemplate } from './index_templates/generate_index_template'; import { deleteComponent, upsertComponent } from './component_templates/manage_component_templates'; -import { getIndexTemplateName } from './index_templates/name'; import { getComponentTemplateName } from './component_templates/name'; -import { getProcessingPipelineName, getReroutePipelineName } from './ingest_pipelines/name'; -import { - deleteIngestPipeline, - upsertIngestPipeline, -} from './ingest_pipelines/manage_ingest_pipelines'; -import { getAncestors } from './helpers/hierarchy'; -import { MalformedFields } from './errors/malformed_fields'; import { deleteDataStream, rolloverDataStreamIfNecessary, upsertDataStream, } from './data_streams/manage_data_streams'; +import { DefinitionNotFound } from './errors'; +import { MalformedFields } from './errors/malformed_fields'; +import { getAncestors } from './helpers/hierarchy'; +import { generateIndexTemplate } from './index_templates/generate_index_template'; +import { deleteTemplate, upsertTemplate } from './index_templates/manage_index_templates'; +import { getIndexTemplateName } from './index_templates/name'; +import { generateIngestPipeline } from './ingest_pipelines/generate_ingest_pipeline'; +import { generateReroutePipeline } from './ingest_pipelines/generate_reroute_pipeline'; +import { + deleteIngestPipeline, + upsertIngestPipeline, +} from './ingest_pipelines/manage_ingest_pipelines'; +import { getProcessingPipelineName, getReroutePipelineName } from './ingest_pipelines/name'; interface BaseParams { scopedClusterClient: IScopedClusterClient; @@ -88,23 +88,40 @@ async function upsertInternalStream({ definition, scopedClusterClient }: BasePar type ListStreamsParams = BaseParams; -export async function listStreams({ scopedClusterClient }: ListStreamsParams) { +export interface ListStreamResponse { + total: number; + definitions: StreamDefinition[]; +} + +export async function listStreams({ + scopedClusterClient, +}: ListStreamsParams): Promise { const response = await scopedClusterClient.asInternalUser.search({ index: STREAMS_INDEX, size: 10000, - fields: ['id'], - _source: false, sort: [{ id: 'asc' }], }); - const definitions = response.hits.hits.map((hit) => hit.fields as { id: string[] }); - return definitions; + const definitions = response.hits.hits.map((hit) => hit._source!); + const total = response.hits.total!; + + return { + definitions, + total: typeof total === 'number' ? total : total.value, + }; } interface ReadStreamParams extends BaseParams { id: string; } -export async function readStream({ id, scopedClusterClient }: ReadStreamParams) { +export interface ReadStreamResponse { + definition: StreamDefinition; +} + +export async function readStream({ + id, + scopedClusterClient, +}: ReadStreamParams): Promise { try { const response = await scopedClusterClient.asInternalUser.get({ id, @@ -126,12 +143,21 @@ interface ReadAncestorsParams extends BaseParams { id: string; } -export async function readAncestors({ id, scopedClusterClient }: ReadAncestorsParams) { +export interface ReadAncestorsResponse { + ancestors: Array<{ definition: StreamDefinition }>; +} + +export async function readAncestors({ + id, + scopedClusterClient, +}: ReadAncestorsParams): Promise { const ancestorIds = getAncestors(id); - return await Promise.all( - ancestorIds.map((ancestorId) => readStream({ scopedClusterClient, id: ancestorId })) - ); + return { + ancestors: await Promise.all( + ancestorIds.map((ancestorId) => readStream({ scopedClusterClient, id: ancestorId })) + ), + }; } interface ReadDescendantsParams extends BaseParams { @@ -167,7 +193,7 @@ export async function validateAncestorFields( id: string, fields: FieldDefinition[] ) { - const ancestors = await readAncestors({ + const { ancestors } = await readAncestors({ id, scopedClusterClient, }); diff --git a/x-pack/plugins/streams/server/plugin.ts b/x-pack/plugins/streams/server/plugin.ts index ef070984803d5..937f8c22b5be0 100644 --- a/x-pack/plugins/streams/server/plugin.ts +++ b/x-pack/plugins/streams/server/plugin.ts @@ -16,8 +16,7 @@ import { } from '@kbn/core/server'; import { registerRoutes } from '@kbn/server-route-repository'; import { StreamsConfig, configSchema, exposeToBrowserConfig } from '../common/config'; -import { StreamsRouteRepository } from './routes'; -import { RouteDependencies } from './routes/types'; +import { streamsRouteRepository } from './routes'; import { StreamsPluginSetupDependencies, StreamsPluginStartDependencies, @@ -58,8 +57,8 @@ export class StreamsPlugin logger: this.logger, } as StreamsServer; - registerRoutes({ - repository: StreamsRouteRepository, + registerRoutes({ + repository: streamsRouteRepository, dependencies: { server: this.server, getScopedClients: async ({ request }: { request: KibanaRequest }) => { diff --git a/x-pack/plugins/streams/server/routes/esql/route.ts b/x-pack/plugins/streams/server/routes/esql/route.ts new file mode 100644 index 0000000000000..0e0e41eee3c7e --- /dev/null +++ b/x-pack/plugins/streams/server/routes/esql/route.ts @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { excludeFrozenQuery } from '@kbn/observability-utils-common/es/queries/exclude_frozen_query'; +import { kqlQuery } from '@kbn/observability-utils-common/es/queries/kql_query'; +import { rangeQuery } from '@kbn/observability-utils-common/es/queries/range_query'; +import { + UnparsedEsqlResponse, + createObservabilityEsClient, +} from '@kbn/observability-utils-server/es/client/create_observability_es_client'; +import { z } from '@kbn/zod'; +import { isNumber } from 'lodash'; +import { createServerRoute } from '../create_server_route'; + +export const executeEsqlRoute = createServerRoute({ + endpoint: 'POST /internal/streams/esql', + params: z.object({ + body: z.object({ + query: z.string(), + operationName: z.string(), + filter: z.object({}).passthrough().optional(), + kuery: z.string().optional(), + start: z.number().optional(), + end: z.number().optional(), + }), + }), + handler: async ({ params, request, logger, getScopedClients }): Promise => { + const { scopedClusterClient } = await getScopedClients({ request }); + const observabilityEsClient = createObservabilityEsClient({ + client: scopedClusterClient.asCurrentUser, + logger, + plugin: 'streams', + }); + + const { + body: { operationName, query, filter, kuery, start, end }, + } = params; + + const response = await observabilityEsClient.esql( + operationName, + { + query, + filter: { + bool: { + filter: [ + filter || { match_all: {} }, + ...kqlQuery(kuery), + ...excludeFrozenQuery(), + ...(isNumber(start) && isNumber(end) ? rangeQuery(start, end) : []), + ], + }, + }, + }, + { transform: 'none' } + ); + + return response; + }, +}); + +export const esqlRoutes = { + ...executeEsqlRoute, +}; diff --git a/x-pack/plugins/streams/server/routes/index.ts b/x-pack/plugins/streams/server/routes/index.ts index 6fc734d3371b4..7267dbedeacff 100644 --- a/x-pack/plugins/streams/server/routes/index.ts +++ b/x-pack/plugins/streams/server/routes/index.ts @@ -5,15 +5,18 @@ * 2.0. */ +import { esqlRoutes } from './esql/route'; import { deleteStreamRoute } from './streams/delete'; +import { disableStreamsRoute } from './streams/disable'; import { editStreamRoute } from './streams/edit'; import { enableStreamsRoute } from './streams/enable'; import { forkStreamsRoute } from './streams/fork'; import { listStreamsRoute } from './streams/list'; import { readStreamRoute } from './streams/read'; import { resyncStreamsRoute } from './streams/resync'; +import { streamsStatusRoutes } from './streams/settings'; -export const StreamsRouteRepository = { +export const streamsRouteRepository = { ...enableStreamsRoute, ...resyncStreamsRoute, ...forkStreamsRoute, @@ -21,6 +24,9 @@ export const StreamsRouteRepository = { ...editStreamRoute, ...deleteStreamRoute, ...listStreamsRoute, + ...streamsStatusRoutes, + ...esqlRoutes, + ...disableStreamsRoute, }; -export type StreamsRouteRepository = typeof StreamsRouteRepository; +export type StreamsRouteRepository = typeof streamsRouteRepository; diff --git a/x-pack/plugins/streams/server/routes/streams/delete.ts b/x-pack/plugins/streams/server/routes/streams/delete.ts index 3820975dbe16a..369568ff9b7f0 100644 --- a/x-pack/plugins/streams/server/routes/streams/delete.ts +++ b/x-pack/plugins/streams/server/routes/streams/delete.ts @@ -8,6 +8,7 @@ import { z } from '@kbn/zod'; import { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; import { Logger } from '@kbn/logging'; +import { badRequest, internal, notFound } from '@hapi/boom'; import { DefinitionNotFound, ForkConditionMissing, @@ -20,18 +21,15 @@ import { MalformedStreamId } from '../../lib/streams/errors/malformed_stream_id' import { getParentId } from '../../lib/streams/helpers/hierarchy'; export const deleteStreamRoute = createServerRoute({ - endpoint: 'DELETE /api/streams/{id} 2023-10-31', + endpoint: 'DELETE /api/streams/{id}', options: { - access: 'public', - availability: { - stability: 'experimental', - }, - security: { - authz: { - enabled: false, - reason: - 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', - }, + access: 'internal', + }, + security: { + authz: { + enabled: false, + reason: + 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', }, }, params: z.object({ @@ -39,7 +37,13 @@ export const deleteStreamRoute = createServerRoute({ id: z.string(), }), }), - handler: async ({ response, params, logger, request, getScopedClients }) => { + handler: async ({ + response, + params, + logger, + request, + getScopedClients, + }): Promise<{ acknowledged: true }> => { try { const { scopedClusterClient } = await getScopedClients({ request }); @@ -52,10 +56,10 @@ export const deleteStreamRoute = createServerRoute({ await deleteStream(scopedClusterClient, params.path.id, logger); - return response.ok({ body: { acknowledged: true } }); + return { acknowledged: true }; } catch (e) { if (e instanceof IndexTemplateNotFound || e instanceof DefinitionNotFound) { - return response.notFound({ body: e }); + throw notFound(e); } if ( @@ -63,15 +67,19 @@ export const deleteStreamRoute = createServerRoute({ e instanceof ForkConditionMissing || e instanceof MalformedStreamId ) { - return response.customError({ body: e, statusCode: 400 }); + throw badRequest(e); } - return response.customError({ body: e, statusCode: 500 }); + throw internal(e); } }, }); -async function deleteStream(scopedClusterClient: IScopedClusterClient, id: string, logger: Logger) { +export async function deleteStream( + scopedClusterClient: IScopedClusterClient, + id: string, + logger: Logger +) { try { const { definition } = await readStream({ scopedClusterClient, id }); for (const child of definition.children) { diff --git a/x-pack/plugins/streams/server/routes/streams/disable.ts b/x-pack/plugins/streams/server/routes/streams/disable.ts new file mode 100644 index 0000000000000..b760b58f1fafd --- /dev/null +++ b/x-pack/plugins/streams/server/routes/streams/disable.ts @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { badRequest, internal } from '@hapi/boom'; +import { z } from '@kbn/zod'; +import { SecurityException } from '../../lib/streams/errors'; +import { createServerRoute } from '../create_server_route'; +import { deleteStream } from './delete'; + +export const disableStreamsRoute = createServerRoute({ + endpoint: 'POST /api/streams/_disable', + params: z.object({}), + options: { + access: 'internal', + }, + security: { + authz: { + requiredPrivileges: ['streams_write'], + }, + }, + handler: async ({ + request, + response, + logger, + getScopedClients, + }): Promise<{ acknowledged: true }> => { + try { + const { scopedClusterClient } = await getScopedClients({ request }); + + await deleteStream(scopedClusterClient, 'logs', logger); + + return { acknowledged: true }; + } catch (e) { + if (e instanceof SecurityException) { + throw badRequest(e); + } + throw internal(e); + } + }, +}); diff --git a/x-pack/plugins/streams/server/routes/streams/edit.ts b/x-pack/plugins/streams/server/routes/streams/edit.ts index b82b4d54044da..378f1ba3c8f01 100644 --- a/x-pack/plugins/streams/server/routes/streams/edit.ts +++ b/x-pack/plugins/streams/server/routes/streams/edit.ts @@ -8,6 +8,7 @@ import { z } from '@kbn/zod'; import { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; import { Logger } from '@kbn/logging'; +import { badRequest, internal, notFound } from '@hapi/boom'; import { DefinitionNotFound, ForkConditionMissing, @@ -28,18 +29,15 @@ import { getParentId } from '../../lib/streams/helpers/hierarchy'; import { MalformedChildren } from '../../lib/streams/errors/malformed_children'; export const editStreamRoute = createServerRoute({ - endpoint: 'PUT /api/streams/{id} 2023-10-31', + endpoint: 'PUT /api/streams/{id}', options: { - access: 'public', - availability: { - stability: 'experimental', - }, - security: { - authz: { - enabled: false, - reason: - 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', - }, + access: 'internal', + }, + security: { + authz: { + enabled: false, + reason: + 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', }, }, params: z.object({ @@ -99,10 +97,10 @@ export const editStreamRoute = createServerRoute({ }); } - return response.ok({ body: { acknowledged: true } }); + return { acknowledged: true }; } catch (e) { if (e instanceof IndexTemplateNotFound || e instanceof DefinitionNotFound) { - return response.notFound({ body: e }); + throw notFound(e); } if ( @@ -110,10 +108,10 @@ export const editStreamRoute = createServerRoute({ e instanceof ForkConditionMissing || e instanceof MalformedStreamId ) { - return response.customError({ body: e, statusCode: 400 }); + throw badRequest(e); } - return response.customError({ body: e, statusCode: 500 }); + throw internal(e); } }, }); diff --git a/x-pack/plugins/streams/server/routes/streams/enable.ts b/x-pack/plugins/streams/server/routes/streams/enable.ts index 27d8929b28e50..e163c6cbc8bb2 100644 --- a/x-pack/plugins/streams/server/routes/streams/enable.ts +++ b/x-pack/plugins/streams/server/routes/streams/enable.ts @@ -6,6 +6,7 @@ */ import { z } from '@kbn/zod'; +import { badRequest, internal } from '@hapi/boom'; import { SecurityException } from '../../lib/streams/errors'; import { createServerRoute } from '../create_server_route'; import { syncStream } from '../../lib/streams/stream_crud'; @@ -13,22 +14,24 @@ import { rootStreamDefinition } from '../../lib/streams/root_stream_definition'; import { createStreamsIndex } from '../../lib/streams/internal_stream_mapping'; export const enableStreamsRoute = createServerRoute({ - endpoint: 'POST /api/streams/_enable 2023-10-31', + endpoint: 'POST /api/streams/_enable', params: z.object({}), options: { - access: 'public', - availability: { - stability: 'experimental', - }, - security: { - authz: { - enabled: false, - reason: - 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', - }, + access: 'internal', + }, + security: { + authz: { + enabled: false, + reason: + 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', }, }, - handler: async ({ request, response, logger, getScopedClients }) => { + handler: async ({ + request, + response, + logger, + getScopedClients, + }): Promise<{ acknowledged: true }> => { try { const { scopedClusterClient } = await getScopedClients({ request }); await createStreamsIndex(scopedClusterClient); @@ -37,12 +40,12 @@ export const enableStreamsRoute = createServerRoute({ definition: rootStreamDefinition, logger, }); - return response.ok({ body: { acknowledged: true } }); + return { acknowledged: true }; } catch (e) { if (e instanceof SecurityException) { - return response.customError({ body: e, statusCode: 400 }); + throw badRequest(e); } - return response.customError({ body: e, statusCode: 500 }); + throw internal(e); } }, }); diff --git a/x-pack/plugins/streams/server/routes/streams/fork.ts b/x-pack/plugins/streams/server/routes/streams/fork.ts index 44f4052878003..8294aebb0b0e9 100644 --- a/x-pack/plugins/streams/server/routes/streams/fork.ts +++ b/x-pack/plugins/streams/server/routes/streams/fork.ts @@ -6,6 +6,7 @@ */ import { z } from '@kbn/zod'; +import { badRequest, internal, notFound } from '@hapi/boom'; import { DefinitionNotFound, ForkConditionMissing, @@ -19,18 +20,15 @@ import { MalformedStreamId } from '../../lib/streams/errors/malformed_stream_id' import { isChildOf } from '../../lib/streams/helpers/hierarchy'; export const forkStreamsRoute = createServerRoute({ - endpoint: 'POST /api/streams/{id}/_fork 2023-10-31', + endpoint: 'POST /api/streams/{id}/_fork', options: { - access: 'public', - availability: { - stability: 'experimental', - }, - security: { - authz: { - enabled: false, - reason: - 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', - }, + access: 'internal', + }, + security: { + authz: { + enabled: false, + reason: + 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', }, }, params: z.object({ @@ -39,7 +37,12 @@ export const forkStreamsRoute = createServerRoute({ }), body: z.object({ stream: streamDefinitonWithoutChildrenSchema, condition: conditionSchema }), }), - handler: async ({ response, params, logger, request, getScopedClients }) => { + handler: async ({ + params, + logger, + request, + getScopedClients, + }): Promise<{ acknowledged: true }> => { try { if (!params.body.condition) { throw new ForkConditionMissing('You must provide a condition to fork a stream'); @@ -92,10 +95,10 @@ export const forkStreamsRoute = createServerRoute({ logger, }); - return response.ok({ body: { acknowledged: true } }); + return { acknowledged: true }; } catch (e) { if (e instanceof IndexTemplateNotFound || e instanceof DefinitionNotFound) { - return response.notFound({ body: e }); + throw notFound(e); } if ( @@ -103,10 +106,10 @@ export const forkStreamsRoute = createServerRoute({ e instanceof ForkConditionMissing || e instanceof MalformedStreamId ) { - return response.customError({ body: e, statusCode: 400 }); + throw badRequest(e); } - return response.customError({ body: e, statusCode: 500 }); + throw internal(e); } }, }); diff --git a/x-pack/plugins/streams/server/routes/streams/list.ts b/x-pack/plugins/streams/server/routes/streams/list.ts index 2e4f13a89bb41..bd6a5200fe9ba 100644 --- a/x-pack/plugins/streams/server/routes/streams/list.ts +++ b/x-pack/plugins/streams/server/routes/streams/list.ts @@ -6,65 +6,78 @@ */ import { z } from '@kbn/zod'; +import { notFound, internal } from '@hapi/boom'; import { createServerRoute } from '../create_server_route'; import { DefinitionNotFound } from '../../lib/streams/errors'; import { listStreams } from '../../lib/streams/stream_crud'; +import { StreamDefinition } from '../../../common'; export const listStreamsRoute = createServerRoute({ - endpoint: 'GET /api/streams 2023-10-31', + endpoint: 'GET /api/streams', options: { - access: 'public', - availability: { - stability: 'experimental', - }, - security: { - authz: { - enabled: false, - reason: - 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', - }, + access: 'internal', + }, + security: { + authz: { + enabled: false, + reason: + 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', }, }, params: z.object({}), - handler: async ({ response, request, getScopedClients }) => { + handler: async ({ + response, + request, + getScopedClients, + }): Promise<{ definitions: StreamDefinition[]; trees: StreamTree[] }> => { try { const { scopedClusterClient } = await getScopedClients({ request }); - const definitions = await listStreams({ scopedClusterClient }); + const { definitions } = await listStreams({ scopedClusterClient }); const trees = asTrees(definitions); - return response.ok({ body: { streams: trees } }); + return { definitions, trees }; } catch (e) { if (e instanceof DefinitionNotFound) { - return response.notFound({ body: e }); + throw notFound(e); } - return response.customError({ body: e, statusCode: 500 }); + throw internal(e); } }, }); -interface ListStreamDefinition { +export interface StreamTree { id: string; - children: ListStreamDefinition[]; + children: StreamTree[]; } -function asTrees(definitions: Array<{ id: string[] }>) { - const trees: ListStreamDefinition[] = []; +function asTrees(definitions: StreamDefinition[]): StreamTree[] { + const nodes = new Map(); + + const rootNodes = new Set(); + + function getNode(id: string) { + let node = nodes.get(id); + if (!node) { + node = { id, children: [] }; + nodes.set(id, node); + } + return node; + } + definitions.forEach((definition) => { - const path = definition.id[0].split('.'); - let currentTree = trees; - path.forEach((_id, index) => { - const partialPath = path.slice(0, index + 1).join('.'); - const existingNode = currentTree.find((node) => node.id === partialPath); - if (existingNode) { - currentTree = existingNode.children; - } else { - const newNode = { id: partialPath, children: [] }; - currentTree.push(newNode); - currentTree = newNode.children; - } - }); + const path = definition.id.split('.'); + const parentId = path.slice(0, path.length - 1).join('.'); + const parentNode = parentId.length ? getNode(parentId) : undefined; + const selfNode = getNode(definition.id); + + if (parentNode) { + parentNode.children.push(selfNode); + } else { + rootNodes.add(selfNode); + } }); - return trees; + + return Array.from(rootNodes.values()); } diff --git a/x-pack/plugins/streams/server/routes/streams/read.ts b/x-pack/plugins/streams/server/routes/streams/read.ts index 5ea2aaf5f2542..b9d21ef25b673 100644 --- a/x-pack/plugins/streams/server/routes/streams/read.ts +++ b/x-pack/plugins/streams/server/routes/streams/read.ts @@ -6,29 +6,38 @@ */ import { z } from '@kbn/zod'; +import { notFound, internal } from '@hapi/boom'; import { createServerRoute } from '../create_server_route'; import { DefinitionNotFound } from '../../lib/streams/errors'; import { readAncestors, readStream } from '../../lib/streams/stream_crud'; +import { StreamDefinition } from '../../../common'; export const readStreamRoute = createServerRoute({ - endpoint: 'GET /api/streams/{id} 2023-10-31', + endpoint: 'GET /api/streams/{id}', options: { - access: 'public', - availability: { - stability: 'experimental', - }, - security: { - authz: { - enabled: false, - reason: - 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', - }, + access: 'internal', + }, + security: { + authz: { + enabled: false, + reason: + 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', }, }, params: z.object({ path: z.object({ id: z.string() }), }), - handler: async ({ response, params, request, getScopedClients }) => { + handler: async ({ + response, + params, + request, + logger, + getScopedClients, + }): Promise< + StreamDefinition & { + inheritedFields: Array; + } + > => { try { const { scopedClusterClient } = await getScopedClients({ request }); const streamEntity = await readStream({ @@ -36,7 +45,7 @@ export const readStreamRoute = createServerRoute({ id: params.path.id, }); - const ancestors = await readAncestors({ + const { ancestors } = await readAncestors({ id: streamEntity.definition.id, scopedClusterClient, }); @@ -48,13 +57,13 @@ export const readStreamRoute = createServerRoute({ ), }; - return response.ok({ body }); + return body; } catch (e) { if (e instanceof DefinitionNotFound) { - return response.notFound({ body: e }); + throw notFound(e); } - return response.customError({ body: e, statusCode: 500 }); + throw internal(e); } }, }); diff --git a/x-pack/plugins/streams/server/routes/streams/resync.ts b/x-pack/plugins/streams/server/routes/streams/resync.ts index 2365252ab00e6..8e520410ca5c2 100644 --- a/x-pack/plugins/streams/server/routes/streams/resync.ts +++ b/x-pack/plugins/streams/server/routes/streams/resync.ts @@ -10,31 +10,34 @@ import { createServerRoute } from '../create_server_route'; import { syncStream, readStream, listStreams } from '../../lib/streams/stream_crud'; export const resyncStreamsRoute = createServerRoute({ - endpoint: 'POST /api/streams/_resync 2023-10-31', + endpoint: 'POST /api/streams/_resync', options: { - access: 'public', - availability: { - stability: 'experimental', - }, - security: { - authz: { - enabled: false, - reason: - 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', - }, + access: 'internal', + }, + security: { + authz: { + enabled: false, + reason: + 'This API delegates security to the currently logged in user and their Elasticsearch permissions.', }, }, params: z.object({}), - handler: async ({ response, logger, request, getScopedClients }) => { + handler: async ({ + response, + logger, + request, + getScopedClients, + }): Promise<{ acknowledged: true }> => { const { scopedClusterClient } = await getScopedClients({ request }); - const streams = await listStreams({ scopedClusterClient }); + const { definitions: streams } = await listStreams({ scopedClusterClient }); for (const stream of streams) { const { definition } = await readStream({ scopedClusterClient, - id: stream.id[0], + id: stream.id, }); + await syncStream({ scopedClusterClient, definition, @@ -42,6 +45,6 @@ export const resyncStreamsRoute = createServerRoute({ }); } - return response.ok({}); + return { acknowledged: true }; }, }); diff --git a/x-pack/plugins/streams/server/routes/streams/settings.ts b/x-pack/plugins/streams/server/routes/streams/settings.ts new file mode 100644 index 0000000000000..6e133b3948dd0 --- /dev/null +++ b/x-pack/plugins/streams/server/routes/streams/settings.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { STREAMS_INDEX } from '../../../common/constants'; +import { createServerRoute } from '../create_server_route'; + +export const getStreamsStatusRoute = createServerRoute({ + endpoint: 'GET /api/streams/_status', + options: { + access: 'internal', + }, + security: { + authz: { + requiredPrivileges: ['streams_read'], + }, + }, + handler: async ({ request, getScopedClients }): Promise<{ enabled: boolean }> => { + const { scopedClusterClient } = await getScopedClients({ request }); + + return { + enabled: await scopedClusterClient.asInternalUser.indices.exists({ + index: STREAMS_INDEX, + }), + }; + }, +}); + +export const streamsStatusRoutes = { + ...getStreamsStatusRoute, +}; diff --git a/x-pack/plugins/streams/tsconfig.json b/x-pack/plugins/streams/tsconfig.json index c2fde35f9ca22..3f863145f4d22 100644 --- a/x-pack/plugins/streams/tsconfig.json +++ b/x-pack/plugins/streams/tsconfig.json @@ -27,5 +27,8 @@ "@kbn/zod", "@kbn/encrypted-saved-objects-plugin", "@kbn/licensing-plugin", + "@kbn/server-route-repository-client", + "@kbn/observability-utils-server", + "@kbn/observability-utils-common" ] } diff --git a/x-pack/plugins/streams_app/.storybook/get_mock_streams_app_context.tsx b/x-pack/plugins/streams_app/.storybook/get_mock_streams_app_context.tsx new file mode 100644 index 0000000000000..1660042b2cb66 --- /dev/null +++ b/x-pack/plugins/streams_app/.storybook/get_mock_streams_app_context.tsx @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { coreMock } from '@kbn/core/public/mocks'; +import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; +import type { StreamsPluginStart } from '@kbn/streams-plugin/public'; +import type { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import type { SharePublicStart } from '@kbn/share-plugin/public/plugin'; +import type { StreamsAppKibanaContext } from '../public/hooks/use_kibana'; + +export function getMockStreamsAppContext(): StreamsAppKibanaContext { + const core = coreMock.createStart(); + + return { + core, + dependencies: { + start: { + observabilityShared: {} as unknown as ObservabilitySharedPluginStart, + dataViews: {} as unknown as DataViewsPublicPluginStart, + data: {} as unknown as DataPublicPluginStart, + unifiedSearch: {} as unknown as UnifiedSearchPublicPluginStart, + streams: {} as unknown as StreamsPluginStart, + share: {} as unknown as SharePublicStart, + }, + }, + services: { + query: jest.fn(), + }, + }; +} diff --git a/x-pack/plugins/streams_app/.storybook/jest_setup.js b/x-pack/plugins/streams_app/.storybook/jest_setup.js new file mode 100644 index 0000000000000..32071b8aa3f62 --- /dev/null +++ b/x-pack/plugins/streams_app/.storybook/jest_setup.js @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { setGlobalConfig } from '@storybook/testing-react'; +import * as globalStorybookConfig from './preview'; + +setGlobalConfig(globalStorybookConfig); diff --git a/x-pack/plugins/streams_app/.storybook/main.js b/x-pack/plugins/streams_app/.storybook/main.js new file mode 100644 index 0000000000000..86b48c32f103e --- /dev/null +++ b/x-pack/plugins/streams_app/.storybook/main.js @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +module.exports = require('@kbn/storybook').defaultConfig; diff --git a/x-pack/plugins/streams_app/.storybook/preview.js b/x-pack/plugins/streams_app/.storybook/preview.js new file mode 100644 index 0000000000000..c8155e9c3d92c --- /dev/null +++ b/x-pack/plugins/streams_app/.storybook/preview.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiThemeProviderDecorator } from '@kbn/kibana-react-plugin/common'; +import * as jest from 'jest-mock'; + +window.jest = jest; + +export const decorators = [EuiThemeProviderDecorator]; diff --git a/x-pack/plugins/streams_app/.storybook/storybook_decorator.tsx b/x-pack/plugins/streams_app/.storybook/storybook_decorator.tsx new file mode 100644 index 0000000000000..617b5aee8128f --- /dev/null +++ b/x-pack/plugins/streams_app/.storybook/storybook_decorator.tsx @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React, { ComponentType, useMemo } from 'react'; +import { StreamsAppContextProvider } from '../public/components/streams_app_context_provider'; +import { getMockStreamsAppContext } from './get_mock_streams_app_context'; + +export function KibanaReactStorybookDecorator(Story: ComponentType) { + const context = useMemo(() => getMockStreamsAppContext(), []); + return ( + + + + ); +} diff --git a/x-pack/plugins/streams_app/README.md b/x-pack/plugins/streams_app/README.md new file mode 100644 index 0000000000000..6e03524f9274b --- /dev/null +++ b/x-pack/plugins/streams_app/README.md @@ -0,0 +1,3 @@ +# Streams app + +Home of the Streams app plugin, which allows users to manage Streams via the UI. diff --git a/x-pack/plugins/streams_app/common/entity_source_query.ts b/x-pack/plugins/streams_app/common/entity_source_query.ts new file mode 100644 index 0000000000000..c076d1f6bd87f --- /dev/null +++ b/x-pack/plugins/streams_app/common/entity_source_query.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export function entitySourceQuery({ entity }: { entity: Record }) { + return { + bool: { + filter: Object.entries(entity).map(([key, value]) => ({ term: { [key]: value } })), + }, + }; +} diff --git a/x-pack/plugins/streams_app/common/index.ts b/x-pack/plugins/streams_app/common/index.ts new file mode 100644 index 0000000000000..c41a05b84d307 --- /dev/null +++ b/x-pack/plugins/streams_app/common/index.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { StreamDefinition } from '@kbn/streams-plugin/common'; + +interface EntityBase { + type: string; + displayName: string; + properties: Record; +} + +export type StreamEntity = EntityBase & { type: 'stream'; properties: StreamDefinition }; + +export type Entity = StreamEntity; + +export interface EntityTypeDefinition { + displayName: string; +} diff --git a/x-pack/plugins/streams_app/jest.config.js b/x-pack/plugins/streams_app/jest.config.js new file mode 100644 index 0000000000000..d9c01c40a322d --- /dev/null +++ b/x-pack/plugins/streams_app/jest.config.js @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: [ + '/x-pack/plugins/streams_app/public', + '/x-pack/plugins/streams_app/common', + '/x-pack/plugins/streams_app/server', + ], + setupFiles: ['/x-pack/plugins/streams_app/.storybook/jest_setup.js'], + collectCoverage: true, + collectCoverageFrom: [ + '/x-pack/plugins/streams_app/{public,common,server}/**/*.{js,ts,tsx}', + ], + + coverageReporters: ['html'], +}; diff --git a/x-pack/plugins/streams_app/kibana.jsonc b/x-pack/plugins/streams_app/kibana.jsonc new file mode 100644 index 0000000000000..16666084c53e5 --- /dev/null +++ b/x-pack/plugins/streams_app/kibana.jsonc @@ -0,0 +1,26 @@ +{ + "type": "plugin", + "id": "@kbn/streams-app-plugin", + "owner": "@simianhacker @flash1293 @dgieselaar", + "group": "observability", + "visibility": "private", + "plugin": { + "id": "streamsApp", + "server": true, + "browser": true, + "configPath": ["xpack", "streamsApp"], + "requiredPlugins": [ + "streams", + "observabilityShared", + "data", + "dataViews", + "unifiedSearch", + "share" + ], + "requiredBundles": [ + "kibanaReact" + ], + "optionalPlugins": [], + "extraPublicDirs": [] + } +} diff --git a/x-pack/plugins/streams_app/public/application.tsx b/x-pack/plugins/streams_app/public/application.tsx new file mode 100644 index 0000000000000..720f785ecde4b --- /dev/null +++ b/x-pack/plugins/streams_app/public/application.tsx @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { APP_WRAPPER_CLASS, type AppMountParameters, type CoreStart } from '@kbn/core/public'; +import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; +import { css } from '@emotion/css'; +import type { StreamsAppStartDependencies } from './types'; +import { StreamsAppServices } from './services/types'; +import { AppRoot } from './components/app_root'; + +export const renderApp = ({ + coreStart, + pluginsStart, + services, + appMountParameters, +}: { + coreStart: CoreStart; + pluginsStart: StreamsAppStartDependencies; + services: StreamsAppServices; +} & { appMountParameters: AppMountParameters }) => { + const { element } = appMountParameters; + + const appWrapperClassName = css` + overflow: auto; + `; + const appWrapperElement = document.getElementsByClassName(APP_WRAPPER_CLASS)[1]; + appWrapperElement.classList.add(appWrapperClassName); + + ReactDOM.render( + + + , + element + ); + return () => { + ReactDOM.unmountComponentAtNode(element); + appWrapperElement.classList.remove(APP_WRAPPER_CLASS); + }; +}; diff --git a/x-pack/plugins/streams_app/public/components/app_root/index.tsx b/x-pack/plugins/streams_app/public/components/app_root/index.tsx new file mode 100644 index 0000000000000..c5e8b78ae2155 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/app_root/index.tsx @@ -0,0 +1,73 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app'; +import React from 'react'; +import { type AppMountParameters, type CoreStart } from '@kbn/core/public'; +import { + BreadcrumbsContextProvider, + RouteRenderer, + RouterProvider, +} from '@kbn/typed-react-router-config'; +import { HeaderMenuPortal } from '@kbn/observability-shared-plugin/public'; +import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { StreamsAppContextProvider } from '../streams_app_context_provider'; +import { streamsAppRouter } from '../../routes/config'; +import { StreamsAppStartDependencies } from '../../types'; +import { StreamsAppServices } from '../../services/types'; + +export function AppRoot({ + coreStart, + pluginsStart, + services, + appMountParameters, +}: { + coreStart: CoreStart; + pluginsStart: StreamsAppStartDependencies; + services: StreamsAppServices; +} & { appMountParameters: AppMountParameters }) { + const { history } = appMountParameters; + + const context = { + core: coreStart, + dependencies: { + start: pluginsStart, + }, + services, + }; + + return ( + + + + + + + + + + + ); +} + +export function StreamsAppHeaderActionMenu({ + appMountParameters, +}: { + appMountParameters: AppMountParameters; +}) { + const { setHeaderActionMenu, theme$ } = appMountParameters; + + return ( + + + + <> + + + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/entity_detail_view/index.tsx b/x-pack/plugins/streams_app/public/components/entity_detail_view/index.tsx new file mode 100644 index 0000000000000..d2ce4859e66d1 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/entity_detail_view/index.tsx @@ -0,0 +1,102 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { EuiFlexGroup, EuiIcon, EuiLink, EuiPanel } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React from 'react'; +import { useStreamsAppBreadcrumbs } from '../../hooks/use_streams_app_breadcrumbs'; +import { useStreamsAppRouter } from '../../hooks/use_streams_app_router'; +import { EntityOverviewTabList } from '../entity_overview_tab_list'; +import { LoadingPanel } from '../loading_panel'; +import { StreamsAppPageBody } from '../streams_app_page_body'; +import { StreamsAppPageHeader } from '../streams_app_page_header'; +import { StreamsAppPageHeaderTitle } from '../streams_app_page_header/streams_app_page_header_title'; + +export interface EntityViewTab { + name: string; + label: string; + content: React.ReactElement; +} + +export function EntityDetailViewWithoutParams({ + selectedTab, + tabs, + entity, +}: { + selectedTab: string; + tabs: EntityViewTab[]; + entity: { + displayName?: string; + id: string; + }; +}) { + const router = useStreamsAppRouter(); + useStreamsAppBreadcrumbs(() => { + if (!entity.displayName) { + return []; + } + + return [ + { + title: entity.displayName, + path: `/{key}`, + params: { path: { key: entity.id } }, + } as const, + ]; + }, [entity.displayName, entity.id]); + + if (!entity.displayName) { + return ; + } + + const tabMap = Object.fromEntries( + tabs.map((tab) => { + return [ + tab.name, + { + href: router.link('/{key}/{tab}', { + path: { key: entity.id, tab: tab.name }, + }), + label: tab.label, + content: tab.content, + }, + ]; + }) + ); + + const selectedTabObject = tabMap[selectedTab]; + + return ( + + + + + + {i18n.translate('xpack.streams.entityDetailView.goBackLinkLabel', { + defaultMessage: 'Back', + })} + + + + } + > + { + return { + name: tabKey, + label, + href, + selected: selectedTab === tabKey, + }; + })} + /> + + {selectedTabObject.content} + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/entity_detail_view_header_section/index.tsx b/x-pack/plugins/streams_app/public/components/entity_detail_view_header_section/index.tsx new file mode 100644 index 0000000000000..4aafb7a7e9bc6 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/entity_detail_view_header_section/index.tsx @@ -0,0 +1,30 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { EuiFlexGroup, EuiText } from '@elastic/eui'; +import { css } from '@emotion/css'; +import React from 'react'; + +export function EntityDetailViewHeaderSection({ + title, + children, +}: { + title: React.ReactNode; + children: React.ReactNode; +}) { + return ( + + + {title} + + {children} + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/entity_overview_tab_list/index.tsx b/x-pack/plugins/streams_app/public/components/entity_overview_tab_list/index.tsx new file mode 100644 index 0000000000000..08502b26f7ca3 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/entity_overview_tab_list/index.tsx @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { EuiTab, EuiTabs, useEuiTheme } from '@elastic/eui'; +import { css } from '@emotion/css'; + +export function EntityOverviewTabList< + T extends { name: string; label: string; href: string; selected: boolean } +>({ tabs }: { tabs: T[] }) { + const theme = useEuiTheme().euiTheme; + + return ( + + {tabs.map((tab) => { + return ( + + {tab.label} + + ); + })} + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/esql_chart/controlled_esql_chart.tsx b/x-pack/plugins/streams_app/public/components/esql_chart/controlled_esql_chart.tsx new file mode 100644 index 0000000000000..9008f8ee47098 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/esql_chart/controlled_esql_chart.tsx @@ -0,0 +1,174 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React, { useMemo } from 'react'; +import { + AreaSeries, + Axis, + BarSeries, + Chart, + CurveType, + LineSeries, + Position, + ScaleType, + Settings, + Tooltip, + niceTimeFormatter, +} from '@elastic/charts'; +import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiSpacer } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { getTimeZone } from '@kbn/observability-utils-browser/utils/ui_settings/get_timezone'; +import { css } from '@emotion/css'; +import { AbortableAsyncState } from '@kbn/observability-utils-browser/hooks/use_abortable_async'; +import type { UnparsedEsqlResponse } from '@kbn/observability-utils-server/es/client/create_observability_es_client'; +import { esqlResultToTimeseries } from '../../util/esql_result_to_timeseries'; +import { useKibana } from '../../hooks/use_kibana'; +import { LoadingPanel } from '../loading_panel'; + +const END_ZONE_LABEL = i18n.translate('xpack.streams.esqlChart.endzone', { + defaultMessage: + 'The selected time range does not include this entire bucket. It might contain partial data.', +}); + +function getChartType(type: 'area' | 'bar' | 'line') { + switch (type) { + case 'area': + return AreaSeries; + case 'bar': + return BarSeries; + default: + return LineSeries; + } +} + +export function ControlledEsqlChart({ + id, + result, + metricNames, + chartType = 'line', + height, +}: { + id: string; + result: AbortableAsyncState; + metricNames: T[]; + chartType?: 'area' | 'bar' | 'line'; + height: number; +}) { + const { + core: { uiSettings }, + } = useKibana(); + + const allTimeseries = useMemo( + () => + esqlResultToTimeseries({ + result, + metricNames, + }), + // eslint-disable-next-line react-hooks/exhaustive-deps + [result, ...metricNames] + ); + + if (result.loading && !result.value?.values.length) { + return ( + + ); + } + + const xValues = allTimeseries.flatMap(({ data }) => data.map(({ x }) => x)); + + const min = Math.min(...xValues); + const max = Math.max(...xValues); + + const isEmpty = min === 0 && max === 0; + + const xFormatter = niceTimeFormatter([min, max]); + + const xDomain = isEmpty ? { min: 0, max: 1 } : { min, max }; + + const yTickFormat = (value: number | null) => (value === null ? '' : String(value)); + const yLabelFormat = (label: string) => label; + + const timeZone = getTimeZone(uiSettings); + + return ( + + { + const formattedValue = xFormatter(value); + if (max === value) { + return ( + <> + + + + + {END_ZONE_LABEL} + + + {formattedValue} + + ); + } + return formattedValue; + }} + /> + + + + {allTimeseries.map((serie) => { + const Series = getChartType(chartType); + + return ( + + ); + })} + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/loading_panel/index.tsx b/x-pack/plugins/streams_app/public/components/loading_panel/index.tsx new file mode 100644 index 0000000000000..58e432b84a4bd --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/loading_panel/index.tsx @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { EuiFlexGroup, EuiLoadingSpinner, EuiSpacer } from '@elastic/eui'; +import React from 'react'; + +export function LoadingPanel({ + loading = true, + size, + className, +}: { + loading?: boolean; + size?: React.ComponentProps['size']; + className?: string; +}) { + if (!loading) { + return null; + } + + return ( + + + + + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/not_found/index.tsx b/x-pack/plugins/streams_app/public/components/not_found/index.tsx new file mode 100644 index 0000000000000..c0c1d50000cfc --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/not_found/index.tsx @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { EuiCallOut } from '@elastic/eui'; +import React from 'react'; +import { i18n } from '@kbn/i18n'; + +export function NotFound() { + return ( + + {i18n.translate('xpack.streams.notFound.calloutLabel', { + defaultMessage: 'The current page can not be found.', + })} + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/redirect_to/index.tsx b/x-pack/plugins/streams_app/public/components/redirect_to/index.tsx new file mode 100644 index 0000000000000..2bde67faa3b98 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/redirect_to/index.tsx @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React, { useLayoutEffect } from 'react'; +import { PathsOf, TypeOf } from '@kbn/typed-react-router-config'; +import { DeepPartial } from 'utility-types'; +import { merge } from 'lodash'; +import { StreamsAppRoutes } from '../../routes/config'; +import { useStreamsAppRouter } from '../../hooks/use_streams_app_router'; +import { useStreamsAppParams } from '../../hooks/use_streams_app_params'; + +export function RedirectTo< + TPath extends PathsOf, + TParams extends TypeOf +>({ path, params }: { path: TPath; params?: DeepPartial }) { + const router = useStreamsAppRouter(); + const currentParams = useStreamsAppParams('/*'); + useLayoutEffect(() => { + router.replace(path, ...([merge({}, currentParams, params)] as any)); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return <>; +} diff --git a/x-pack/plugins/streams_app/public/components/stream_detail_overview/index.tsx b/x-pack/plugins/streams_app/public/components/stream_detail_overview/index.tsx new file mode 100644 index 0000000000000..93a573fd4c01f --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/stream_detail_overview/index.tsx @@ -0,0 +1,168 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; +import { calculateAuto } from '@kbn/calculate-auto'; +import { i18n } from '@kbn/i18n'; +import { useDateRange } from '@kbn/observability-utils-browser/hooks/use_date_range'; +import { StreamDefinition } from '@kbn/streams-plugin/common'; +import moment from 'moment'; +import React, { useMemo } from 'react'; +import { useKibana } from '../../hooks/use_kibana'; +import { useStreamsAppFetch } from '../../hooks/use_streams_app_fetch'; +import { ControlledEsqlChart } from '../esql_chart/controlled_esql_chart'; +import { StreamsAppSearchBar } from '../streams_app_search_bar'; + +export function StreamDetailOverview({ definition }: { definition?: StreamDefinition }) { + const { + dependencies: { + start: { + data, + dataViews, + streams: { streamsRepositoryClient }, + share, + }, + }, + } = useKibana(); + + const { + timeRange, + absoluteTimeRange: { start, end }, + setTimeRange, + } = useDateRange({ data }); + + const indexPatterns = useMemo(() => { + if (!definition?.id) { + return undefined; + } + + const isRoot = definition.id.indexOf('.') === -1; + + const dataStreamOfDefinition = definition.id; + + return isRoot + ? [dataStreamOfDefinition, `${dataStreamOfDefinition}.*`] + : [`${dataStreamOfDefinition}*`]; + }, [definition?.id]); + + const discoverLocator = useMemo( + () => share.url.locators.get('DISCOVER_APP_LOCATOR'), + [share.url.locators] + ); + + const queries = useMemo(() => { + if (!indexPatterns) { + return undefined; + } + + const baseQuery = `FROM ${indexPatterns.join(', ')}`; + + const bucketSize = Math.round( + calculateAuto.atLeast(50, moment.duration(1, 'minute'))!.asSeconds() + ); + + const histogramQuery = `${baseQuery} | STATS metric = COUNT(*) BY @timestamp = BUCKET(@timestamp, ${bucketSize} seconds)`; + + return { + baseQuery, + histogramQuery, + }; + }, [indexPatterns]); + + const discoverLink = useMemo(() => { + if (!discoverLocator || !queries?.baseQuery) { + return undefined; + } + + return discoverLocator.getRedirectUrl({ + query: { + esql: queries.baseQuery, + }, + }); + }, [queries?.baseQuery, discoverLocator]); + + const histogramQueryFetch = useStreamsAppFetch( + async ({ signal }) => { + if (!queries?.histogramQuery || !indexPatterns) { + return undefined; + } + + const existingIndices = await dataViews.getExistingIndices(indexPatterns); + + if (existingIndices.length === 0) { + return undefined; + } + + return streamsRepositoryClient.fetch('POST /internal/streams/esql', { + params: { + body: { + operationName: 'get_histogram_for_stream', + query: queries.histogramQuery, + start, + end, + }, + }, + signal, + }); + }, + [indexPatterns, dataViews, streamsRepositoryClient, queries?.histogramQuery, start, end] + ); + + return ( + <> + + + + { + if (!isUpdate) { + histogramQueryFetch.refresh(); + return; + } + + if (dateRange) { + setTimeRange({ from: dateRange.from, to: dateRange?.to, mode: dateRange.mode }); + } + }} + onRefresh={() => { + histogramQueryFetch.refresh(); + }} + placeholder={i18n.translate( + 'xpack.streams.entityDetailOverview.searchBarPlaceholder', + { + defaultMessage: 'Filter data by using KQL', + } + )} + dateRangeFrom={timeRange.from} + dateRangeTo={timeRange.to} + /> + + + {i18n.translate('xpack.streams.streamDetailOverview.openInDiscoverButtonLabel', { + defaultMessage: 'Open in Discover', + })} + + + + + + + + + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/stream_detail_view/index.tsx b/x-pack/plugins/streams_app/public/components/stream_detail_view/index.tsx new file mode 100644 index 0000000000000..ebf72a58d32a8 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/stream_detail_view/index.tsx @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { i18n } from '@kbn/i18n'; +import { EntityDetailViewWithoutParams, EntityViewTab } from '../entity_detail_view'; +import { useStreamsAppParams } from '../../hooks/use_streams_app_params'; +import { useStreamsAppFetch } from '../../hooks/use_streams_app_fetch'; +import { useKibana } from '../../hooks/use_kibana'; +import { StreamDetailOverview } from '../stream_detail_overview'; + +export function StreamDetailView() { + const { + path: { key, tab }, + } = useStreamsAppParams('/{key}/{tab}'); + + const { + dependencies: { + start: { + streams: { streamsRepositoryClient }, + }, + }, + } = useKibana(); + + const { value: streamEntity } = useStreamsAppFetch( + ({ signal }) => { + return streamsRepositoryClient.fetch('GET /api/streams/{id}', { + signal, + params: { + path: { + id: key, + }, + }, + }); + }, + [streamsRepositoryClient, key] + ); + + const entity = { + id: key, + displayName: key, + }; + + const tabs: EntityViewTab[] = [ + { + name: 'overview', + content: , + label: i18n.translate('xpack.streams.streamDetailView.overviewTab', { + defaultMessage: 'Overview', + }), + }, + { + name: 'management', + content: <>, + label: i18n.translate('xpack.streams.streamDetailView.managementTab', { + defaultMessage: 'Management', + }), + }, + ]; + + return ; +} diff --git a/x-pack/plugins/streams_app/public/components/stream_list_view/index.tsx b/x-pack/plugins/streams_app/public/components/stream_list_view/index.tsx new file mode 100644 index 0000000000000..e0530fc6bf5f0 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/stream_list_view/index.tsx @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React, { useState } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiFlexGroup, EuiSearchBar } from '@elastic/eui'; +import { useKibana } from '../../hooks/use_kibana'; +import { useStreamsAppFetch } from '../../hooks/use_streams_app_fetch'; +import { StreamsAppPageHeader } from '../streams_app_page_header'; +import { StreamsAppPageHeaderTitle } from '../streams_app_page_header/streams_app_page_header_title'; +import { StreamsAppPageBody } from '../streams_app_page_body'; +import { StreamsTable } from '../streams_table'; + +export function StreamListView() { + const { + dependencies: { + start: { + streams: { streamsRepositoryClient }, + }, + }, + } = useKibana(); + + const [query, setQuery] = useState(''); + + const streamsListFetch = useStreamsAppFetch( + ({ signal }) => { + return streamsRepositoryClient.fetch('GET /api/streams', { + signal, + }); + }, + [streamsRepositoryClient] + ); + + return ( + + + } + /> + + + { + setQuery(nextQuery.queryText); + }} + /> + + + + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/streams_app_context_provider/index.tsx b/x-pack/plugins/streams_app/public/components/streams_app_context_provider/index.tsx new file mode 100644 index 0000000000000..fd5886c089396 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/streams_app_context_provider/index.tsx @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React, { useMemo } from 'react'; +import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; +import type { StreamsAppKibanaContext } from '../../hooks/use_kibana'; + +export function StreamsAppContextProvider({ + context, + children, +}: { + context: StreamsAppKibanaContext; + children: React.ReactNode; +}) { + const servicesForContext = useMemo(() => { + const { core, ...services } = context; + return { + ...core, + ...services, + }; + }, [context]); + + return {children}; +} diff --git a/x-pack/plugins/streams_app/public/components/streams_app_page_body/index.tsx b/x-pack/plugins/streams_app/public/components/streams_app_page_body/index.tsx new file mode 100644 index 0000000000000..0f13dc31e277b --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/streams_app_page_body/index.tsx @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { EuiPanel, useEuiTheme } from '@elastic/eui'; +import { css } from '@emotion/css'; + +export function StreamsAppPageBody({ children }: { children: React.ReactNode }) { + const theme = useEuiTheme().euiTheme; + return ( + + {children} + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/streams_app_page_header/index.tsx b/x-pack/plugins/streams_app/public/components/streams_app_page_header/index.tsx new file mode 100644 index 0000000000000..1171772116f2a --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/streams_app_page_header/index.tsx @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { EuiFlexGroup, EuiPageHeader, useEuiTheme } from '@elastic/eui'; +import { css } from '@emotion/css'; +import React from 'react'; + +export function StreamsAppPageHeader({ + title, + children, + verticalPaddingSize = 'l', +}: { + title: React.ReactNode; + children?: React.ReactNode; + verticalPaddingSize?: 'none' | 'l'; +}) { + const theme = useEuiTheme().euiTheme; + + return ( + + + {title} + + {children} + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/streams_app_page_header/streams_app_page_header_title.tsx b/x-pack/plugins/streams_app/public/components/streams_app_page_header/streams_app_page_header_title.tsx new file mode 100644 index 0000000000000..ff7d6581dea4f --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/streams_app_page_header/streams_app_page_header_title.tsx @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { EuiTitle } from '@elastic/eui'; +import React from 'react'; + +export function StreamsAppPageHeaderTitle({ title }: { title: string }) { + return ( + +

{title}

+ + ); +} diff --git a/x-pack/plugins/streams_app/public/components/streams_app_page_template/index.tsx b/x-pack/plugins/streams_app/public/components/streams_app_page_template/index.tsx new file mode 100644 index 0000000000000..c474f54c22745 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/streams_app_page_template/index.tsx @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { css } from '@emotion/css'; +import React from 'react'; +import { EuiPanel, EuiSpacer } from '@elastic/eui'; +import { useKibana } from '../../hooks/use_kibana'; + +export function StreamsAppPageTemplate({ children }: { children: React.ReactNode }) { + const { + dependencies: { + start: { observabilityShared }, + }, + } = useKibana(); + + const { PageTemplate } = observabilityShared.navigation; + + return ( + + + + {children} + + + ); +} diff --git a/x-pack/plugins/streams_app/public/components/streams_app_router_breadcrumb/index.tsx b/x-pack/plugins/streams_app/public/components/streams_app_router_breadcrumb/index.tsx new file mode 100644 index 0000000000000..88aab4662de61 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/streams_app_router_breadcrumb/index.tsx @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { createRouterBreadcrumbComponent } from '@kbn/typed-react-router-config'; +import type { StreamsAppRoutes } from '../../routes/config'; + +export const StreamsAppRouterBreadcrumb = createRouterBreadcrumbComponent(); diff --git a/x-pack/plugins/streams_app/public/components/streams_app_search_bar/index.tsx b/x-pack/plugins/streams_app/public/components/streams_app_search_bar/index.tsx new file mode 100644 index 0000000000000..563fb752efbd5 --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/streams_app_search_bar/index.tsx @@ -0,0 +1,78 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { css } from '@emotion/css'; +import type { TimeRange } from '@kbn/es-query'; +import { SearchBar } from '@kbn/unified-search-plugin/public'; +import React, { useMemo } from 'react'; +import type { DataView } from '@kbn/data-views-plugin/common'; +import { useKibana } from '../../hooks/use_kibana'; + +const parentClassName = css` + width: 100%; +`; + +interface Props { + query?: string; + dateRangeFrom?: string; + dateRangeTo?: string; + onQueryChange?: (payload: { dateRange?: TimeRange; query: string }) => void; + onQuerySubmit?: (payload: { dateRange?: TimeRange; query: string }, isUpdate?: boolean) => void; + onRefresh?: Required>['onRefresh']; + placeholder?: string; + dataViews?: DataView[]; +} + +export function StreamsAppSearchBar({ + dateRangeFrom, + dateRangeTo, + onQueryChange, + onQuerySubmit, + onRefresh, + query, + placeholder, + dataViews, +}: Props) { + const { + dependencies: { + start: { unifiedSearch }, + }, + } = useKibana(); + + const queryObj = useMemo(() => (query ? { query, language: 'kuery' } : undefined), [query]); + + const showQueryInput = query === undefined; + + return ( +
+ { + onQuerySubmit?.( + { dateRange, query: (nextQuery?.query as string | undefined) ?? '' }, + isUpdate + ); + }} + onQueryChange={({ dateRange, query: nextQuery }) => { + onQueryChange?.({ dateRange, query: (nextQuery?.query as string | undefined) ?? '' }); + }} + query={queryObj} + showQueryInput={showQueryInput} + showFilterBar={false} + showQueryMenu={false} + showDatePicker={Boolean(dateRangeFrom && dateRangeTo)} + showSubmitButton={true} + dateRangeFrom={dateRangeFrom} + dateRangeTo={dateRangeTo} + onRefresh={onRefresh} + displayStyle="inPage" + disableQueryLanguageSwitcher + placeholder={placeholder} + indexPatterns={dataViews} + /> +
+ ); +} diff --git a/x-pack/plugins/streams_app/public/components/streams_table/index.tsx b/x-pack/plugins/streams_app/public/components/streams_table/index.tsx new file mode 100644 index 0000000000000..f92c94f115e9b --- /dev/null +++ b/x-pack/plugins/streams_app/public/components/streams_table/index.tsx @@ -0,0 +1,78 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { + EuiBasicTable, + EuiBasicTableColumn, + EuiFlexGroup, + EuiIcon, + EuiLink, + EuiTitle, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import type { AbortableAsyncState } from '@kbn/observability-utils-browser/hooks/use_abortable_async'; +import { StreamDefinition } from '@kbn/streams-plugin/common'; +import React, { useMemo } from 'react'; +import { useStreamsAppRouter } from '../../hooks/use_streams_app_router'; + +export function StreamsTable({ + listFetch, + query, +}: { + listFetch: AbortableAsyncState<{ definitions: StreamDefinition[] }>; + query: string; +}) { + const router = useStreamsAppRouter(); + + const items = useMemo(() => { + return listFetch.value?.definitions ?? []; + }, [listFetch.value?.definitions]); + + const filteredItems = useMemo(() => { + if (!query) { + return items; + } + + return items.filter((item) => item.id.toLowerCase().includes(query.toLowerCase())); + }, [query, items]); + + const columns = useMemo>>(() => { + return [ + { + field: 'id', + name: i18n.translate('xpack.streams.streamsTable.nameColumnTitle', { + defaultMessage: 'Name', + }), + render: (_, { id }) => { + return ( + + + + {id} + + + ); + }, + }, + ]; + }, [router]); + + return ( + + +

+ {i18n.translate('xpack.streams.streamsTable.tableTitle', { + defaultMessage: 'Streams', + })} +

+
+ +
+ ); +} diff --git a/x-pack/plugins/streams_app/public/hooks/use_kibana.tsx b/x-pack/plugins/streams_app/public/hooks/use_kibana.tsx new file mode 100644 index 0000000000000..9c6b23465fb11 --- /dev/null +++ b/x-pack/plugins/streams_app/public/hooks/use_kibana.tsx @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { CoreStart } from '@kbn/core/public'; +import { useMemo } from 'react'; +import { useKibana } from '@kbn/kibana-react-plugin/public'; +import type { StreamsAppStartDependencies } from '../types'; +import type { StreamsAppServices } from '../services/types'; + +export interface StreamsAppKibanaContext { + core: CoreStart; + dependencies: { + start: StreamsAppStartDependencies; + }; + services: StreamsAppServices; +} + +const useTypedKibana = (): StreamsAppKibanaContext => { + const context = useKibana>(); + + return useMemo(() => { + const { dependencies, services, ...core } = context.services; + + return { + core, + dependencies, + services, + }; + }, [context.services]); +}; + +export { useTypedKibana as useKibana }; diff --git a/x-pack/plugins/streams_app/public/hooks/use_streams_app_breadcrumbs.ts b/x-pack/plugins/streams_app/public/hooks/use_streams_app_breadcrumbs.ts new file mode 100644 index 0000000000000..e3ac760e3b779 --- /dev/null +++ b/x-pack/plugins/streams_app/public/hooks/use_streams_app_breadcrumbs.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { createUseBreadcrumbs } from '@kbn/typed-react-router-config'; +import { StreamsAppRoutes } from '../routes/config'; + +export const useStreamsAppBreadcrumbs = createUseBreadcrumbs(); diff --git a/x-pack/plugins/streams_app/public/hooks/use_streams_app_fetch.ts b/x-pack/plugins/streams_app/public/hooks/use_streams_app_fetch.ts new file mode 100644 index 0000000000000..08b112d4f207a --- /dev/null +++ b/x-pack/plugins/streams_app/public/hooks/use_streams_app_fetch.ts @@ -0,0 +1,73 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { + UseAbortableAsync, + useAbortableAsync, +} from '@kbn/observability-utils-browser/hooks/use_abortable_async'; +import { omit } from 'lodash'; +import { useKibana } from './use_kibana'; + +export const useStreamsAppFetch: UseAbortableAsync<{}, { disableToastOnError?: boolean }> = ( + callback, + deps, + options +) => { + const { + core: { notifications }, + } = useKibana(); + + const onError = (error: Error) => { + let requestUrl: string | undefined; + + if (!options?.disableToastOnError) { + if ( + 'body' in error && + typeof error.body === 'object' && + !!error.body && + 'message' in error.body && + typeof error.body.message === 'string' + ) { + error.message = error.body.message; + } + + if ( + 'request' in error && + typeof error.request === 'object' && + !!error.request && + 'url' in error.request && + typeof error.request.url === 'string' + ) { + requestUrl = error.request.url; + } + + notifications.toasts.addError(error, { + title: i18n.translate('xpack.streams.failedToFetchError', { + defaultMessage: 'Failed to fetch data{requestUrlSuffix}', + values: { + requestUrlSuffix: requestUrl ? ` (${requestUrl})` : '', + }, + }), + }); + } + }; + + const optionsForHook = { + ...omit(options, 'disableToastOnError'), + onError, + }; + + return useAbortableAsync( + ({ signal }) => { + return callback({ signal }); + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + deps, + optionsForHook + ); +}; diff --git a/x-pack/plugins/streams_app/public/hooks/use_streams_app_params.ts b/x-pack/plugins/streams_app/public/hooks/use_streams_app_params.ts new file mode 100644 index 0000000000000..2931a6fa64f8b --- /dev/null +++ b/x-pack/plugins/streams_app/public/hooks/use_streams_app_params.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { type PathsOf, type TypeOf, useParams } from '@kbn/typed-react-router-config'; +import type { StreamsAppRoutes } from '../routes/config'; + +export function useStreamsAppParams>( + path: TPath +): TypeOf { + return useParams(path)! as TypeOf; +} diff --git a/x-pack/plugins/streams_app/public/hooks/use_streams_app_route_path.ts b/x-pack/plugins/streams_app/public/hooks/use_streams_app_route_path.ts new file mode 100644 index 0000000000000..78e63ead57da6 --- /dev/null +++ b/x-pack/plugins/streams_app/public/hooks/use_streams_app_route_path.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { PathsOf, useRoutePath } from '@kbn/typed-react-router-config'; +import type { StreamsAppRoutes } from '../routes/config'; + +export function useStreamsAppRoutePath() { + const path = useRoutePath(); + + return path as PathsOf; +} diff --git a/x-pack/plugins/streams_app/public/hooks/use_streams_app_router.ts b/x-pack/plugins/streams_app/public/hooks/use_streams_app_router.ts new file mode 100644 index 0000000000000..17472044b7b4d --- /dev/null +++ b/x-pack/plugins/streams_app/public/hooks/use_streams_app_router.ts @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { PathsOf, TypeAsArgs, TypeOf } from '@kbn/typed-react-router-config'; +import { useMemo } from 'react'; +import type { StreamsAppRouter, StreamsAppRoutes } from '../routes/config'; +import { streamsAppRouter } from '../routes/config'; +import { useKibana } from './use_kibana'; + +interface StatefulStreamsAppRouter extends StreamsAppRouter { + push>( + path: T, + ...params: TypeAsArgs> + ): void; + replace>( + path: T, + ...params: TypeAsArgs> + ): void; +} + +export function useStreamsAppRouter(): StatefulStreamsAppRouter { + const { + core: { + http, + application: { navigateToApp }, + }, + } = useKibana(); + + const link = (...args: any[]) => { + // @ts-expect-error + return streamsAppRouter.link(...args); + }; + + return useMemo( + () => ({ + ...streamsAppRouter, + push: (...args) => { + const next = link(...args); + navigateToApp('streams', { path: next, replace: false }); + }, + replace: (path, ...args) => { + const next = link(path, ...args); + navigateToApp('streams', { path: next, replace: true }); + }, + link: (path, ...args) => { + return http.basePath.prepend('/app/streams' + link(path, ...args)); + }, + }), + [navigateToApp, http.basePath] + ); +} diff --git a/x-pack/plugins/streams_app/public/index.ts b/x-pack/plugins/streams_app/public/index.ts new file mode 100644 index 0000000000000..eea2d8b7452a8 --- /dev/null +++ b/x-pack/plugins/streams_app/public/index.ts @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import type { PluginInitializer, PluginInitializerContext } from '@kbn/core/public'; + +import { StreamsAppPlugin } from './plugin'; +import type { + StreamsAppPublicSetup, + StreamsAppPublicStart, + StreamsAppSetupDependencies, + StreamsAppStartDependencies, + ConfigSchema, +} from './types'; + +export type { StreamsAppPublicSetup, StreamsAppPublicStart }; + +export const plugin: PluginInitializer< + StreamsAppPublicSetup, + StreamsAppPublicStart, + StreamsAppSetupDependencies, + StreamsAppStartDependencies +> = (pluginInitializerContext: PluginInitializerContext) => + new StreamsAppPlugin(pluginInitializerContext); diff --git a/x-pack/plugins/streams_app/public/plugin.ts b/x-pack/plugins/streams_app/public/plugin.ts new file mode 100644 index 0000000000000..9df399693d02c --- /dev/null +++ b/x-pack/plugins/streams_app/public/plugin.ts @@ -0,0 +1,139 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { map } from 'rxjs'; +import { + AppMountParameters, + AppUpdater, + CoreSetup, + CoreStart, + DEFAULT_APP_CATEGORIES, + Plugin, + PluginInitializerContext, +} from '@kbn/core/public'; +import type { Logger } from '@kbn/logging'; +import { STREAMS_APP_ID } from '@kbn/deeplinks-observability/constants'; +import type { + ConfigSchema, + StreamsAppPublicSetup, + StreamsAppPublicStart, + StreamsAppSetupDependencies, + StreamsAppStartDependencies, +} from './types'; +import { StreamsAppServices } from './services/types'; + +export class StreamsAppPlugin + implements + Plugin< + StreamsAppPublicSetup, + StreamsAppPublicStart, + StreamsAppSetupDependencies, + StreamsAppStartDependencies + > +{ + logger: Logger; + + constructor(context: PluginInitializerContext) { + this.logger = context.logger.get(); + } + setup( + coreSetup: CoreSetup, + pluginsSetup: StreamsAppSetupDependencies + ): StreamsAppPublicSetup { + pluginsSetup.observabilityShared.navigation.registerSections( + pluginsSetup.streams.status$.pipe( + map(({ status }) => { + if (status !== 'enabled') { + return []; + } + + return [ + { + label: '', + sortKey: 101, + entries: [ + { + label: i18n.translate('xpack.streams.streamsAppLinkTitle', { + defaultMessage: 'Streams', + }), + app: STREAMS_APP_ID, + path: '/', + isTechnicalPreview: true, + matchPath(currentPath: string) { + return ['/', ''].some((testPath) => currentPath.startsWith(testPath)); + }, + }, + ], + }, + ]; + }) + ) + ); + + coreSetup.application.register({ + id: STREAMS_APP_ID, + title: i18n.translate('xpack.streams.appTitle', { + defaultMessage: 'Streams', + }), + euiIconType: 'logoObservability', + appRoute: '/app/streams', + category: DEFAULT_APP_CATEGORIES.observability, + order: 8001, + updater$: pluginsSetup.streams.status$.pipe( + map(({ status }): AppUpdater => { + return (app) => { + if (status !== 'enabled') { + return { + visibleIn: [], + deepLinks: [], + }; + } + + return { + visibleIn: ['sideNav', 'globalSearch'], + deepLinks: + status === 'enabled' + ? [ + { + id: 'streams', + title: i18n.translate('xpack.streams.streamsAppDeepLinkTitle', { + defaultMessage: 'Streams', + }), + path: '/', + }, + ] + : [], + }; + }; + }) + ), + mount: async (appMountParameters: AppMountParameters) => { + // Load application bundle and Get start services + const [{ renderApp }, [coreStart, pluginsStart]] = await Promise.all([ + import('./application'), + coreSetup.getStartServices(), + ]); + + const services: StreamsAppServices = {}; + + return renderApp({ + coreStart, + pluginsStart, + services, + appMountParameters, + }); + }, + }); + + return {}; + } + + start(coreStart: CoreStart, pluginsStart: StreamsAppStartDependencies): StreamsAppPublicStart { + return {}; + } +} diff --git a/x-pack/plugins/streams_app/public/routes/config.tsx b/x-pack/plugins/streams_app/public/routes/config.tsx new file mode 100644 index 0000000000000..e3efdc6d871e7 --- /dev/null +++ b/x-pack/plugins/streams_app/public/routes/config.tsx @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { i18n } from '@kbn/i18n'; +import { createRouter, Outlet, RouteMap } from '@kbn/typed-react-router-config'; +import * as t from 'io-ts'; +import React from 'react'; +import { StreamDetailView } from '../components/stream_detail_view'; +import { StreamsAppPageTemplate } from '../components/streams_app_page_template'; +import { StreamsAppRouterBreadcrumb } from '../components/streams_app_router_breadcrumb'; +import { RedirectTo } from '../components/redirect_to'; +import { StreamListView } from '../components/stream_list_view'; + +/** + * The array of route definitions to be used when the application + * creates the routes. + */ +const streamsAppRoutes = { + '/': { + element: ( + + + + + + ), + children: { + '/{key}': { + element: , + params: t.type({ + path: t.type({ + key: t.string, + }), + }), + children: { + '/{key}': { + element: , + }, + '/{key}/{tab}': { + element: , + params: t.type({ + path: t.type({ + tab: t.string, + }), + }), + }, + }, + }, + '/': { + element: , + }, + }, + }, +} satisfies RouteMap; + +export type StreamsAppRoutes = typeof streamsAppRoutes; + +export const streamsAppRouter = createRouter(streamsAppRoutes); + +export type StreamsAppRouter = typeof streamsAppRouter; diff --git a/x-pack/plugins/streams_app/public/services/types.ts b/x-pack/plugins/streams_app/public/services/types.ts new file mode 100644 index 0000000000000..7f75493d2525c --- /dev/null +++ b/x-pack/plugins/streams_app/public/services/types.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface StreamsAppServices {} diff --git a/x-pack/plugins/streams_app/public/types.ts b/x-pack/plugins/streams_app/public/types.ts new file mode 100644 index 0000000000000..58d44784fe031 --- /dev/null +++ b/x-pack/plugins/streams_app/public/types.ts @@ -0,0 +1,43 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; +import type { + DataViewsPublicPluginSetup, + DataViewsPublicPluginStart, +} from '@kbn/data-views-plugin/public'; +import type { + ObservabilitySharedPluginSetup, + ObservabilitySharedPluginStart, +} from '@kbn/observability-shared-plugin/public'; +import type { StreamsPluginSetup, StreamsPluginStart } from '@kbn/streams-plugin/public'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import type { SharePublicSetup, SharePublicStart } from '@kbn/share-plugin/public/plugin'; +/* eslint-disable @typescript-eslint/no-empty-interface*/ + +export interface ConfigSchema {} + +export interface StreamsAppSetupDependencies { + streams: StreamsPluginSetup; + data: DataPublicPluginSetup; + dataViews: DataViewsPublicPluginSetup; + observabilityShared: ObservabilitySharedPluginSetup; + unifiedSearch: {}; + share: SharePublicSetup; +} + +export interface StreamsAppStartDependencies { + streams: StreamsPluginStart; + data: DataPublicPluginStart; + dataViews: DataViewsPublicPluginStart; + observabilityShared: ObservabilitySharedPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; + share: SharePublicStart; +} + +export interface StreamsAppPublicSetup {} + +export interface StreamsAppPublicStart {} diff --git a/x-pack/plugins/streams_app/public/util/esql_result_to_timeseries.ts b/x-pack/plugins/streams_app/public/util/esql_result_to_timeseries.ts new file mode 100644 index 0000000000000..c32bbf89135bd --- /dev/null +++ b/x-pack/plugins/streams_app/public/util/esql_result_to_timeseries.ts @@ -0,0 +1,99 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import type { AbortableAsyncState } from '@kbn/observability-utils-browser/hooks/use_abortable_async'; +import type { UnparsedEsqlResponse } from '@kbn/observability-utils-server/es/client/create_observability_es_client'; +import { orderBy } from 'lodash'; + +interface Timeseries { + id: string; + label: string; + metricNames: T[]; + data: Array<{ x: number } & Record>; +} + +export function esqlResultToTimeseries({ + result, + metricNames, +}: { + result: AbortableAsyncState; + metricNames: T[]; +}): Array> { + const columns = result.value?.columns; + + const rows = result.value?.values; + + if (!columns?.length || !rows?.length) { + return []; + } + + const timestampColumn = columns.find((col) => col.name === '@timestamp'); + + if (!timestampColumn) { + return []; + } + + const collectedSeries: Map> = new Map(); + + rows.forEach((columnsInRow) => { + const values = new Map(); + const labels = new Map(); + let timestamp: number; + + columnsInRow.forEach((value, index) => { + const column = columns[index]; + const isTimestamp = column.name === '@timestamp'; + const isMetric = metricNames.indexOf(column.name as T) !== -1; + + if (isTimestamp) { + timestamp = new Date(value as string | number).getTime(); + } else if (isMetric) { + values.set(column.name, value as number | null); + } else { + labels.set(column.name, String(value)); + } + }); + + const seriesKey = + Array.from(labels.entries()) + .map(([key, value]) => [key, value].join(':')) + .sort() + .join(',') || '-'; + + if (!collectedSeries.has(seriesKey)) { + collectedSeries.set(seriesKey, { + id: seriesKey, + data: [], + label: seriesKey, + metricNames, + }); + } + + const series = collectedSeries.get(seriesKey)!; + + const coordinate = { + x: timestamp!, + } as { x: number } & Record; + + values.forEach((value, key) => { + if (key !== 'x') { + // @ts-expect-error + coordinate[key as T] = value; + } + }); + + series.data.push(coordinate); + + return collectedSeries; + }); + + return Array.from(collectedSeries.entries()).map(([id, timeseries]) => { + return { + ...timeseries, + data: orderBy(timeseries.data, 'x', 'asc'), + }; + }); +} diff --git a/x-pack/plugins/streams_app/server/config.ts b/x-pack/plugins/streams_app/server/config.ts new file mode 100644 index 0000000000000..73e631c7f6d9f --- /dev/null +++ b/x-pack/plugins/streams_app/server/config.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { schema, type TypeOf } from '@kbn/config-schema'; + +export const config = schema.object({ + enabled: schema.boolean({ defaultValue: true }), +}); + +export type StreamsAppConfig = TypeOf; diff --git a/x-pack/plugins/streams_app/server/index.ts b/x-pack/plugins/streams_app/server/index.ts new file mode 100644 index 0000000000000..1ca3b3c6e3de7 --- /dev/null +++ b/x-pack/plugins/streams_app/server/index.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import type { + PluginConfigDescriptor, + PluginInitializer, + PluginInitializerContext, +} from '@kbn/core/server'; +import type { StreamsAppConfig } from './config'; +import { StreamsAppPlugin } from './plugin'; +import type { + StreamsAppServerSetup, + StreamsAppServerStart, + StreamsAppSetupDependencies, + StreamsAppStartDependencies, +} from './types'; + +export type { StreamsAppServerSetup, StreamsAppServerStart }; + +import { config as configSchema } from './config'; + +export const config: PluginConfigDescriptor = { + schema: configSchema, +}; + +export const plugin: PluginInitializer< + StreamsAppServerSetup, + StreamsAppServerStart, + StreamsAppSetupDependencies, + StreamsAppStartDependencies +> = async (pluginInitializerContext: PluginInitializerContext) => + new StreamsAppPlugin(pluginInitializerContext); diff --git a/x-pack/plugins/streams_app/server/plugin.ts b/x-pack/plugins/streams_app/server/plugin.ts new file mode 100644 index 0000000000000..00fb61c1a9ccf --- /dev/null +++ b/x-pack/plugins/streams_app/server/plugin.ts @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/server'; +import type { Logger } from '@kbn/logging'; +import type { + ConfigSchema, + StreamsAppServerSetup, + StreamsAppServerStart, + StreamsAppSetupDependencies, + StreamsAppStartDependencies, +} from './types'; + +export class StreamsAppPlugin + implements + Plugin< + StreamsAppServerSetup, + StreamsAppServerStart, + StreamsAppSetupDependencies, + StreamsAppStartDependencies + > +{ + logger: Logger; + + constructor(context: PluginInitializerContext) { + this.logger = context.logger.get(); + } + setup( + coreSetup: CoreSetup, + pluginsSetup: StreamsAppSetupDependencies + ): StreamsAppServerSetup { + return {}; + } + + start(core: CoreStart, pluginsStart: StreamsAppStartDependencies): StreamsAppServerStart { + return {}; + } +} diff --git a/x-pack/plugins/streams_app/server/types.ts b/x-pack/plugins/streams_app/server/types.ts new file mode 100644 index 0000000000000..e425ae7422d75 --- /dev/null +++ b/x-pack/plugins/streams_app/server/types.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import type { StreamsPluginStart, StreamsPluginSetup } from '@kbn/streams-plugin/server'; + +/* eslint-disable @typescript-eslint/no-empty-interface*/ + +export interface ConfigSchema {} + +export interface StreamsAppSetupDependencies { + streams: StreamsPluginSetup; +} + +export interface StreamsAppStartDependencies { + streams: StreamsPluginStart; +} + +export interface StreamsAppServerSetup {} + +export interface StreamsAppServerStart {} diff --git a/x-pack/plugins/streams_app/tsconfig.json b/x-pack/plugins/streams_app/tsconfig.json new file mode 100644 index 0000000000000..39acb94665ae5 --- /dev/null +++ b/x-pack/plugins/streams_app/tsconfig.json @@ -0,0 +1,37 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types" + }, + "include": [ + "../../../typings/**/*", + "common/**/*", + "public/**/*", + "typings/**/*", + "public/**/*.json", + "server/**/*", + ".storybook/**/*" + ], + "exclude": ["target/**/*", ".storybook/**/*.js"], + "kbn_references": [ + "@kbn/core", + "@kbn/data-plugin", + "@kbn/data-views-plugin", + "@kbn/observability-shared-plugin", + "@kbn/unified-search-plugin", + "@kbn/react-kibana-context-render", + "@kbn/shared-ux-link-redirect-app", + "@kbn/typed-react-router-config", + "@kbn/i18n", + "@kbn/observability-utils-browser", + "@kbn/kibana-react-plugin", + "@kbn/es-query", + "@kbn/logging", + "@kbn/deeplinks-observability", + "@kbn/config-schema", + "@kbn/calculate-auto", + "@kbn/streams-plugin", + "@kbn/share-plugin", + "@kbn/observability-utils-server", + ] +} diff --git a/yarn.lock b/yarn.lock index f299e48d4bb2d..58264896a8260 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7482,6 +7482,10 @@ version "0.0.0" uid "" +"@kbn/streams-app-plugin@link:x-pack/plugins/streams_app": + version "0.0.0" + uid "" + "@kbn/streams-plugin@link:x-pack/plugins/streams": version "0.0.0" uid "" From 94c9012f1b1ec9a608247f41b11efb439d8a65da Mon Sep 17 00:00:00 2001 From: Tre Date: Mon, 25 Nov 2024 14:01:07 +0000 Subject: [PATCH 23/71] [Ownership] Assign test files to search team (#200988) ## Summary Assign test files to search team Contributes to: #192979 Co-authored-by: Elastic Machine --- .github/CODEOWNERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2ef66f43460c5..f32672d30922d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1938,6 +1938,12 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib # Enterprise Search # search +/x-pack/test/functional/es_archives/data/search_sessions @elastic/search-kibana +/x-pack/test/common/services/search_secure.ts @elastic/search-kibana +/test/functional/page_objects/unified_search_page.ts @elastic/search-kibana +/test/functional/fixtures/kbn_archiver/ccs @elastic/search-kibana +/test/functional/fixtures/kbn_archiver/annotation_listing_page_search.json @elastic/search-kibana +/test/functional/fixtures/es_archiver/search/downsampled @elastic/search-kibana /x-pack/test/functional_solution_sidenav/tests/search_sidenav.ts @elastic/search-kibana /x-pack/test/functional/services/search_sessions.ts @elastic/search-kibana /x-pack/test/functional/page_objects/search_* @elastic/search-kibana From 9d44c14f66e2e5d0030966d84418f042860c645d Mon Sep 17 00:00:00 2001 From: Tre Date: Mon, 25 Nov 2024 14:01:56 +0000 Subject: [PATCH 24/71] [Ownership] Assign test files to obs ai assist team (#200936) ## Summary Assign test files to obs ai assist team Contributes to: #192979 --------- Co-authored-by: Elastic Machine --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f32672d30922d..f30aca5a6adfc 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1225,6 +1225,7 @@ packages/kbn-monaco/src/esql @elastic/kibana-esql /x-pack/test/observability_ai_assistant_api_integration @elastic/obs-ai-assistant /x-pack/test/observability_ai_assistant_functional @elastic/obs-ai-assistant /x-pack/test_serverless/**/test_suites/observability/ai_assistant @elastic/obs-ai-assistant +/x-pack/test/functional/es_archives/observability/ai_assistant @elastic/obs-ai-assistant # Infra Obs ## This plugin mostly contains the codebase for the infra services, but also includes some code for the Logs UI app. From da1a7c49f3e6948b95e38bbccd3000dc12309e17 Mon Sep 17 00:00:00 2001 From: Tre Date: Mon, 25 Nov 2024 14:03:43 +0000 Subject: [PATCH 25/71] [Ownership] Assign more to presentation team (#201551) ## Summary Assign more to presentation team Contributes to: #192979 --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f30aca5a6adfc..188430d89bddf 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1413,6 +1413,7 @@ packages/kbn-monaco/src/esql @elastic/kibana-esql ### END Observability Plugins # Presentation +/test/functional/fixtures/kbn_archiver/legacy.json @elastic/kibana-presentation # Assigned per https://github.com/elastic/kibana/pull/200934#discussion_r1856407606 /x-pack/test/functional/fixtures/kbn_archiver/maps.json @elastic/kibana-presentation /x-pack/test/functional/fixtures/kbn_archiver/canvas @elastic/kibana-presentation /x-pack/test/functional/es_archives/dashboard/async_search @elastic/kibana-presentation From d44f70fd5f0f6b9a4525f6e73c9446d0b417386c Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 25 Nov 2024 08:04:40 -0600 Subject: [PATCH 26/71] skip suites failing es promotion (#158318,#163254,#163255,#167676) --- .../group3/incompatible_cluster_routing_allocation.test.ts | 3 ++- .../saved_objects/migrations/group3/multiple_es_nodes.test.ts | 3 ++- .../saved_objects/migrations/group3/read_batch_size.test.ts | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/server/integration_tests/saved_objects/migrations/group3/incompatible_cluster_routing_allocation.test.ts b/src/core/server/integration_tests/saved_objects/migrations/group3/incompatible_cluster_routing_allocation.test.ts index 8213c880c0fa4..e8a523b5de50e 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/group3/incompatible_cluster_routing_allocation.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/group3/incompatible_cluster_routing_allocation.test.ts @@ -92,7 +92,8 @@ async function updateRoutingAllocations( }); } -describe('incompatible_cluster_routing_allocation', () => { +// Failing ES promotion: https://github.com/elastic/kibana/issues/158318 +describe.skip('incompatible_cluster_routing_allocation', () => { let client: ElasticsearchClient; let root: Root; diff --git a/src/core/server/integration_tests/saved_objects/migrations/group3/multiple_es_nodes.test.ts b/src/core/server/integration_tests/saved_objects/migrations/group3/multiple_es_nodes.test.ts index 6898962077b9c..5be7b4671ef72 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/group3/multiple_es_nodes.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/group3/multiple_es_nodes.test.ts @@ -96,7 +96,8 @@ function createRoot({ logFileName, hosts }: RootConfig) { }); } -describe('migration v2', () => { +// Failing ES promotion: https://github.com/elastic/kibana/issues/167676 +describe.skip('migration v2', () => { let esServer: TestElasticsearchUtils; let root: Root; const migratedIndexAlias = `.kibana_${pkg.version}`; diff --git a/src/core/server/integration_tests/saved_objects/migrations/group3/read_batch_size.test.ts b/src/core/server/integration_tests/saved_objects/migrations/group3/read_batch_size.test.ts index 9f970ed234d71..6ebc7ee5a66f6 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/group3/read_batch_size.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/group3/read_batch_size.test.ts @@ -19,7 +19,9 @@ import { getFips } from 'crypto'; const logFilePath = join(__dirname, 'read_batch_size.log'); -describe('migration v2 - read batch size', () => { +// Failing ES promotion: https://github.com/elastic/kibana/issues/163254 +// Failing ES promotion: https://github.com/elastic/kibana/issues/163255 +describe.skip('migration v2 - read batch size', () => { let esServer: TestElasticsearchUtils; let root: Root; let logs: string; From fcf319e7c447f3fe5057461a33d4a814ebc6a2c8 Mon Sep 17 00:00:00 2001 From: florent-leborgne Date: Mon, 25 Nov 2024 15:09:07 +0100 Subject: [PATCH 27/71] [Docs] Document ability to drag and drop columns in Discover (#201571) This PR adds docs related to https://github.com/elastic/kibana/pull/197832 for Discover Rel: https://github.com/elastic/platform-docs-team/issues/562 --- docs/discover/document-explorer.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/discover/document-explorer.asciidoc b/docs/discover/document-explorer.asciidoc index 921e0504f4596..47b4a5bc3fcfd 100644 --- a/docs/discover/document-explorer.asciidoc +++ b/docs/discover/document-explorer.asciidoc @@ -29,7 +29,7 @@ image:images/discover-customize-table.png[Options to customize the table in Disc [[document-explorer-columns]] ==== Reorder and resize the columns -* To move a single column, open the column's contextual options, and select *Move left* or *Move right* in the available options. +* To move a single column, drag its header and drop it to the position you want. You can also open the column's contextual options, and select *Move left* or *Move right* in the available options. * To move multiple columns, click *Columns*. In the pop-up, drag the column names to their new order. From c69e8b279ffce8815d1a733d8285cadfbd57bca8 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 26 Nov 2024 01:11:38 +1100 Subject: [PATCH 28/71] skip failing test suite (#201334) --- .../detection_engine/rule_edit/eql_query_rule.cy.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_edit/eql_query_rule.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_edit/eql_query_rule.cy.ts index 994dbb2eb8ce8..d7bd6d8ebce77 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_edit/eql_query_rule.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_edit/eql_query_rule.cy.ts @@ -15,7 +15,8 @@ import { } from '../../../../tasks/edit_rule'; import { login } from '../../../../tasks/login'; -describe('EQL query rules', { tags: ['@ess', '@serverless'] }, () => { +// Failing: See https://github.com/elastic/kibana/issues/201334 +describe.skip('EQL query rules', { tags: ['@ess', '@serverless'] }, () => { context('Editing rule with non-blocking query validation errors', () => { beforeEach(() => { login(); From d28d2c341560e8d5ac70366c8de6faf6b15b255b Mon Sep 17 00:00:00 2001 From: Larry Gregory Date: Mon, 25 Nov 2024 09:12:32 -0500 Subject: [PATCH 29/71] Dependency ownership for Kibana Core team, part 1 (#201380) ## Summary This updates our `renovate.json` configuration to mark the Core team as owners of their set of dependencies. --- renovate.json | 97 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 22 deletions(-) diff --git a/renovate.json b/renovate.json index 96af2c90b498d..9ec7446ebf5dc 100644 --- a/renovate.json +++ b/renovate.json @@ -307,6 +307,76 @@ "enabled": true, "minimumReleaseAge": "7 days" }, + { + "groupName": "formatjs dependencies", + "matchDepNames": [ + "@formatjs/icu-messageformat-parser", + "@formatjs/intl", + "@formatjs/intl-pluralrules", + "@formatjs/intl-relativetimeformat", + "@formatjs/intl-utils", + "@formatjs/ts-transformer" + ], + "reviewers": [ + "team:kibana-core" + ], + "matchBaseBranches": [ + "main" + ], + "labels": [ + "Team:Core", + "release_note:skip", + "backport:all-open" + ], + "enabled": true, + "minimumReleaseAge": "7 days" + }, + { + "groupName": "@elastic/kibana-core dependencies", + "matchDepNames": [ + "@elastic/request-crypto", + "ansi-regex", + "axios", + "cacheable-lookup", + "getos", + "has-ansi", + "joi-to-json", + "json5", + "load-json-file", + "mime-types", + "mock-fs", + "node-fetch", + "react-intl", + "reflect-metadata", + "type-detect", + "utility-types", + "@types/getos", + "@types/hapi__cookie", + "@types/hapi__h2o2", + "@types/hapi__hapi", + "@types/hapi__inert", + "@types/has-ansi", + "@types/json5", + "@types/mime", + "@types/mime-types", + "@types/mock-fs", + "@types/node-fetch", + "@types/type-detect" + ], + "reviewers": [ + "team:kibana-core" + ], + "matchBaseBranches": [ + "main" + ], + "labels": [ + "Team:Core", + "release_note:skip", + "backport:all-open" + ], + "enabled": true, + "minimumReleaseAge": "7 days" + }, { "groupName": "@elastic/charts", "matchDepNames": [ @@ -487,7 +557,7 @@ "labels": [ "release_note:skip", "Team:Core", - "backport:skip" + "backport:all-open" ], "enabled": true }, @@ -510,29 +580,12 @@ ], "enabled": true }, - { - "groupName": "ansi-regex", - "matchDepNames": [ - "ansi-regex" - ], - "reviewers": [ - "team:kibana-core" - ], - "matchBaseBranches": [ - "main" - ], - "labels": [ - "release_note:skip", - "Team:Core", - "backport:skip" - ], - "minimumReleaseAge": "7 days", - "enabled": true - }, { "groupName": "OpenAPI Spec", "matchDepNames": [ - "@redocly/cli" + "@apidevtools/swagger-parser", + "@redocly/cli", + "openapi-types" ], "reviewers": [ "team:kibana-core" @@ -543,7 +596,7 @@ "labels": [ "release_note:skip", "Team:Core", - "backport:skip" + "backport:all-open" ], "minimumReleaseAge": "7 days", "enabled": true From 691f493cd4a8adeddc6a6eb8df626c948f0c5e02 Mon Sep 17 00:00:00 2001 From: "Eyo O. Eyo" <7893459+eokoneyo@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:18:14 +0100 Subject: [PATCH 30/71] [React18] Migrate test suites to account for testing library upgrades obs-ux-infra_services-team (#201168) This PR migrates test suites that use `renderHook` from the library `@testing-library/react-hooks` to adopt the equivalent and replacement of `renderHook` from the export that is now available from `@testing-library/react`. This work is required for the planned migration to react18. ## Context In this PR, usages of `waitForNextUpdate` that previously could have been destructured from `renderHook` are now been replaced with `waitFor` exported from `@testing-library/react`, furthermore `waitFor` that would also have been destructured from the same renderHook result is now been replaced with `waitFor` from the export of `@testing-library/react`. ***Why is `waitFor` a sufficient enough replacement for `waitForNextUpdate`, and better for testing values subject to async computations?*** WaitFor will retry the provided callback if an error is returned, till the configured timeout elapses. By default the retry interval is `50ms` with a timeout value of `1000ms` that effectively translates to at least 20 retries for assertions placed within waitFor. See https://testing-library.com/docs/dom-testing-library/api-async/#waitfor for more information. This however means that for person's writing tests, said person has to be explicit about expectations that describe the internal state of the hook being tested. This implies checking for instance when a react query hook is being rendered, there's an assertion that said hook isn't loading anymore. In this PR you'd notice that this pattern has been adopted, with most existing assertions following an invocation of `waitForNextUpdate` being placed within a `waitFor` invocation. In some cases the replacement is simply a `waitFor(() => new Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for point out exactly why this works), where this suffices the assertions that follow aren't placed within a waitFor so this PR doesn't get larger than it needs to be. It's also worth pointing out this PR might also contain changes to test and application code to improve said existing test. ### What to do next? 1. Review the changes in this PR. 2. If you think the changes are correct, approve the PR. ## Any questions? If you have any questions or need help with this PR, please leave comments in this PR. --------- Co-authored-by: Elastic Machine --- ..._failed_transactions_correlations.test.tsx | 94 +++++---- .../use_latency_correlations.test.tsx | 83 ++++---- .../infra_tabs/use_tabs.test.tsx | 2 +- .../app/service_map/empty_banner.test.tsx | 9 +- .../use_cytoscape_event_handlers.test.tsx | 2 +- .../app/trace_link/trace_link.test.tsx | 9 +- .../apm_service_template/use_tabs.test.tsx | 2 +- .../timeline/marker/error_marker.test.tsx | 3 +- ...ervice_transactions_overview_link.test.tsx | 5 +- .../apm/transaction_overview_link.test.tsx | 5 +- .../apm/public/hooks/use_breakpoints.test.tsx | 2 +- .../apm/public/hooks/use_debounce.test.tsx | 23 ++- .../apm/public/hooks/use_fetcher.test.tsx | 194 +++++++++++------- .../apm/public/hooks/use_time_range.test.ts | 5 +- .../use_container_metrics_charts.test.ts | 32 +-- .../hooks/use_host_metrics_charts.test.ts | 32 ++- .../hooks/use_loading_state.test.ts | 10 +- .../hooks/use_profiling_kuery.test.tsx | 2 +- .../hooks/use_request_observable.test.ts | 12 +- .../ml/infra_ml_module_status.test.ts | 2 +- .../containers/plugin_config_context.test.tsx | 9 +- .../public/hooks/use_alerts_count.test.ts | 24 +-- .../public/hooks/use_lens_attributes.test.ts | 14 +- .../pages/link_to/use_host_ip_to_name.test.ts | 16 +- .../hosts/hooks/use_hosts_table.test.ts | 2 +- .../hosts/hooks/use_metrics_charts.test.ts | 14 +- .../hooks/use_waffle_filters.test.ts | 2 +- .../hooks/use_waffle_options.test.ts | 2 +- .../hooks/use_metric_explorer_state.test.tsx | 14 +- .../hooks/use_metrics_explorer_data.test.tsx | 69 ++++--- .../use_metrics_explorer_options.test.tsx | 2 +- .../use_data_search_request.test.tsx | 2 +- ...test_partial_data_search_response.test.tsx | 2 +- .../hooks/use_detail_view_redirect.test.ts | 2 +- .../hooks/use_is_loading_complete.test.ts | 2 +- .../use_layer_list.test.ts | 2 +- 36 files changed, 394 insertions(+), 312 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_failed_transactions_correlations.test.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_failed_transactions_correlations.test.tsx index 5432c70e57ab1..4b93123b589bf 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_failed_transactions_correlations.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_failed_transactions_correlations.test.tsx @@ -5,10 +5,11 @@ * 2.0. */ -import React, { ReactNode } from 'react'; +import React, { PropsWithChildren } from 'react'; import { merge } from 'lodash'; import { createMemoryHistory } from 'history'; -import { renderHook, act } from '@testing-library/react-hooks'; + +import { act, waitFor, renderHook } from '@testing-library/react'; import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context'; import { @@ -22,7 +23,7 @@ import { fromQuery } from '../../shared/links/url_helpers'; import { useFailedTransactionsCorrelations } from './use_failed_transactions_correlations'; import type { APIEndpoint } from '../../../../server'; -function wrapper({ children, error = false }: { children?: ReactNode; error: boolean }) { +function wrapper({ children, error = false }: PropsWithChildren<{ error?: boolean }>) { const getHttpMethodMock = (method: 'GET' | 'POST') => jest.fn().mockImplementation(async (pathname) => { await delay(100); @@ -107,17 +108,18 @@ describe('useFailedTransactionsCorrelations', () => { wrapper, }); - try { + await waitFor(() => expect(result.current.progress).toEqual({ isRunning: true, loaded: 0, - }); - expect(result.current.response).toEqual({ ccsWarning: false }); - expect(typeof result.current.startFetch).toEqual('function'); - expect(typeof result.current.cancelFetch).toEqual('function'); - } finally { - unmount(); - } + }) + ); + + expect(result.current.response).toEqual({ ccsWarning: false }); + expect(result.current.startFetch).toEqual(expect.any(Function)); + expect(result.current.cancelFetch).toEqual(expect.any(Function)); + + unmount(); }); it('should not have received any results after 50ms', async () => { @@ -125,21 +127,21 @@ describe('useFailedTransactionsCorrelations', () => { wrapper, }); - try { - jest.advanceTimersByTime(50); + jest.advanceTimersByTime(50); + await waitFor(() => expect(result.current.progress).toEqual({ isRunning: true, loaded: 0, - }); - expect(result.current.response).toEqual({ ccsWarning: false }); - } finally { - unmount(); - } + }) + ); + + expect(result.current.response).toEqual({ ccsWarning: false }); + unmount(); }); it('should receive partial updates and finish running', async () => { - const { result, unmount, waitFor } = renderHook(() => useFailedTransactionsCorrelations(), { + const { result, unmount } = renderHook(() => useFailedTransactionsCorrelations(), { wrapper, }); @@ -253,29 +255,37 @@ describe('useFailedTransactionsCorrelations', () => { }); describe('when throwing an error', () => { it('should automatically start fetching results', async () => { - const { result, unmount } = renderHook(() => useFailedTransactionsCorrelations(), { - wrapper, - initialProps: { - error: true, - }, + const { result, unmount } = renderHook(useFailedTransactionsCorrelations, { + wrapper: ({ children }) => + React.createElement( + wrapper, + { + error: true, + }, + children + ), }); - try { + await waitFor(() => expect(result.current.progress).toEqual({ isRunning: true, loaded: 0, - }); - } finally { - unmount(); - } + }) + ); + + unmount(); }); it('should still be running after 50ms', async () => { - const { result, unmount } = renderHook(() => useFailedTransactionsCorrelations(), { - wrapper, - initialProps: { - error: true, - }, + const { result, unmount } = renderHook(useFailedTransactionsCorrelations, { + wrapper: ({ children }) => + React.createElement( + wrapper, + { + error: true, + }, + children + ), }); try { @@ -292,11 +302,15 @@ describe('useFailedTransactionsCorrelations', () => { }); it('should stop and return an error after more than 100ms', async () => { - const { result, unmount, waitFor } = renderHook(() => useFailedTransactionsCorrelations(), { - wrapper, - initialProps: { - error: true, - }, + const { result, unmount } = renderHook(useFailedTransactionsCorrelations, { + wrapper: ({ children }) => + React.createElement( + wrapper, + { + error: true, + }, + children + ), }); try { @@ -316,7 +330,7 @@ describe('useFailedTransactionsCorrelations', () => { describe('when canceled', () => { it('should stop running', async () => { - const { result, unmount, waitFor } = renderHook(() => useFailedTransactionsCorrelations(), { + const { result, unmount } = renderHook(() => useFailedTransactionsCorrelations(), { wrapper, }); diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_latency_correlations.test.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_latency_correlations.test.tsx index 70446d1d2b1fd..e76420e3c1a92 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_latency_correlations.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_latency_correlations.test.tsx @@ -5,10 +5,11 @@ * 2.0. */ -import React, { ReactNode } from 'react'; +import React, { PropsWithChildren } from 'react'; import { merge } from 'lodash'; import { createMemoryHistory } from 'history'; -import { renderHook, act } from '@testing-library/react-hooks'; + +import { act, waitFor, renderHook } from '@testing-library/react'; import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context'; import { @@ -22,7 +23,7 @@ import { fromQuery } from '../../shared/links/url_helpers'; import { useLatencyCorrelations } from './use_latency_correlations'; import type { APIEndpoint } from '../../../../server'; -function wrapper({ children, error = false }: { children?: ReactNode; error: boolean }) { +function wrapper({ children, error = false }: PropsWithChildren<{ error?: boolean }>) { const getHttpMethodMock = (method: 'GET' | 'POST') => jest.fn().mockImplementation(async (pathname) => { await delay(100); @@ -86,16 +87,17 @@ function wrapper({ children, error = false }: { children?: ReactNode; error: boo } describe('useLatencyCorrelations', () => { - beforeEach(async () => { - jest.useFakeTimers({ legacyFakeTimers: true }); - }); - afterEach(() => { - jest.useRealTimers(); - }); - describe('when successfully loading results', () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + + afterEach(() => { + jest.useRealTimers(); + }); + it('should automatically start fetching results', async () => { - const { result, unmount } = renderHook(() => useLatencyCorrelations(), { + const { result, unmount } = renderHook(useLatencyCorrelations, { wrapper, }); @@ -113,7 +115,7 @@ describe('useLatencyCorrelations', () => { }); it('should not have received any results after 50ms', async () => { - const { result, unmount } = renderHook(() => useLatencyCorrelations(), { + const { result, unmount } = renderHook(useLatencyCorrelations, { wrapper, }); @@ -131,7 +133,7 @@ describe('useLatencyCorrelations', () => { }); it('should receive partial updates and finish running', async () => { - const { result, unmount, waitFor } = renderHook(() => useLatencyCorrelations(), { + const { result, unmount } = renderHook(useLatencyCorrelations, { wrapper, }); @@ -213,12 +215,17 @@ describe('useLatencyCorrelations', () => { }); describe('when throwing an error', () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + + afterEach(() => { + jest.useRealTimers(); + }); + it('should automatically start fetching results', async () => { - const { result, unmount } = renderHook(() => useLatencyCorrelations(), { - wrapper, - initialProps: { - error: true, - }, + const { result, unmount } = renderHook(useLatencyCorrelations, { + wrapper: ({ children }) => wrapper({ children, error: true }), }); try { @@ -232,11 +239,8 @@ describe('useLatencyCorrelations', () => { }); it('should still be running after 50ms', async () => { - const { result, unmount } = renderHook(() => useLatencyCorrelations(), { - wrapper, - initialProps: { - error: true, - }, + const { result, unmount } = renderHook(useLatencyCorrelations, { + wrapper: ({ children }) => wrapper({ children, error: true }), }); try { @@ -253,22 +257,21 @@ describe('useLatencyCorrelations', () => { }); it('should stop and return an error after more than 100ms', async () => { - const { result, unmount, waitFor } = renderHook(() => useLatencyCorrelations(), { - wrapper, - initialProps: { - error: true, - }, + const { result, unmount } = renderHook(useLatencyCorrelations, { + wrapper: ({ children }) => wrapper({ children, error: true }), }); try { - jest.advanceTimersByTime(150); - await waitFor(() => expect(result.current.progress.error).toBeDefined()); - - expect(result.current.progress).toEqual({ - error: 'Something went wrong', - isRunning: false, - loaded: 0, + act(() => { + jest.advanceTimersByTime(150); }); + await waitFor(() => + expect(result.current.progress).toEqual({ + error: 'Something went wrong', + isRunning: false, + loaded: 0, + }) + ); } finally { unmount(); } @@ -276,8 +279,16 @@ describe('useLatencyCorrelations', () => { }); describe('when canceled', () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + + afterEach(() => { + jest.useRealTimers(); + }); + it('should stop running', async () => { - const { result, unmount, waitFor } = renderHook(() => useLatencyCorrelations(), { + const { result, unmount } = renderHook(useLatencyCorrelations, { wrapper, }); diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/infra_overview/infra_tabs/use_tabs.test.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/infra_overview/infra_tabs/use_tabs.test.tsx index 245d4e90631a1..b1a1fea3924ee 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/infra_overview/infra_tabs/use_tabs.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/infra_overview/infra_tabs/use_tabs.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ import React, { ReactNode } from 'react'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useTabs } from './use_tabs'; import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public'; import { CoreStart } from '@kbn/core/public'; diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/service_map/empty_banner.test.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/service_map/empty_banner.test.tsx index 20149d0f40795..168180e89c97e 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/service_map/empty_banner.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/service_map/empty_banner.test.tsx @@ -58,11 +58,12 @@ describe('EmptyBanner', () => { it('does not render null', async () => { const component = renderWithTheme(, { wrapper }); - await act(async () => { + act(() => { cy.add({ data: { id: 'test id' } }); - await waitFor(() => { - expect(component.container.children.length).toBeGreaterThan(0); - }); + }); + + await waitFor(() => { + expect(component.container.children.length).toBeGreaterThan(0); }); }); }); diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/service_map/use_cytoscape_event_handlers.test.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/service_map/use_cytoscape_event_handlers.test.tsx index 0f7fd67ae7c0f..31604d8934019 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/service_map/use_cytoscape_event_handlers.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/service_map/use_cytoscape_event_handlers.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import cytoscape from 'cytoscape'; import dagre from 'cytoscape-dagre'; import { EuiTheme } from '@kbn/kibana-react-plugin/common'; diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/trace_link/trace_link.test.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/trace_link/trace_link.test.tsx index 3250702b0cb80..06f7101520bab 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/trace_link/trace_link.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/trace_link/trace_link.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { act, render, waitFor } from '@testing-library/react'; +import { render, waitFor } from '@testing-library/react'; import { shallow } from 'enzyme'; import React, { ReactNode } from 'react'; import { MemoryRouter } from 'react-router-dom'; @@ -67,12 +67,9 @@ describe('TraceLink', () => { }, }); - let result; - act(() => { - const component = render(, renderOptions); + const component = render(, renderOptions); - result = component.getByText('Fetching trace...'); - }); + const result = component.getByText('Fetching trace...'); await waitFor(() => {}); expect(result).toBeDefined(); }); diff --git a/x-pack/plugins/observability_solution/apm/public/components/routing/templates/apm_service_template/use_tabs.test.tsx b/x-pack/plugins/observability_solution/apm/public/components/routing/templates/apm_service_template/use_tabs.test.tsx index 05c8464929d55..fee28395960c9 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/routing/templates/apm_service_template/use_tabs.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/routing/templates/apm_service_template/use_tabs.test.tsx @@ -6,7 +6,7 @@ */ import { CoreStart } from '@kbn/core/public'; import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { createMemoryHistory } from 'history'; import React, { ReactNode } from 'react'; import { ServerlessType } from '../../../../../common/serverless'; diff --git a/x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/error_marker.test.tsx b/x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/error_marker.test.tsx index d71562e425e99..748b783661743 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/error_marker.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/error_marker.test.tsx @@ -5,8 +5,7 @@ * 2.0. */ -import { fireEvent } from '@testing-library/react'; -import { act } from '@testing-library/react-hooks'; +import { fireEvent, act } from '@testing-library/react'; import React, { ReactNode } from 'react'; import { MemoryRouter } from 'react-router-dom'; import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context'; diff --git a/x-pack/plugins/observability_solution/apm/public/components/shared/links/apm/service_transactions_overview_link.test.tsx b/x-pack/plugins/observability_solution/apm/public/components/shared/links/apm/service_transactions_overview_link.test.tsx index 54999ead161ba..ce2a56a3ecc81 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/shared/links/apm/service_transactions_overview_link.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/shared/links/apm/service_transactions_overview_link.test.tsx @@ -5,8 +5,7 @@ * 2.0. */ -import { render } from '@testing-library/react'; -import { renderHook } from '@testing-library/react-hooks'; +import { render, renderHook } from '@testing-library/react'; import { createMemoryHistory } from 'history'; import React from 'react'; import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context'; @@ -19,7 +18,7 @@ import { const history = createMemoryHistory(); function wrapper({ queryParams }: { queryParams?: Record }) { - return ({ children }: { children: React.ReactElement }) => ( + return ({ children }: React.PropsWithChildren) => ( {children} diff --git a/x-pack/plugins/observability_solution/apm/public/components/shared/links/apm/transaction_overview_link.test.tsx b/x-pack/plugins/observability_solution/apm/public/components/shared/links/apm/transaction_overview_link.test.tsx index bf095a4925fc9..a1836a2a336e0 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/shared/links/apm/transaction_overview_link.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/shared/links/apm/transaction_overview_link.test.tsx @@ -5,8 +5,7 @@ * 2.0. */ -import { render } from '@testing-library/react'; -import { renderHook } from '@testing-library/react-hooks'; +import { render, renderHook } from '@testing-library/react'; import { createMemoryHistory } from 'history'; import React from 'react'; import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context'; @@ -15,7 +14,7 @@ import { TransactionOverviewLink, useTransactionsOverviewHref } from './transact const history = createMemoryHistory(); -function Wrapper({ children }: { children: React.ReactElement }) { +function Wrapper({ children }: React.PropsWithChildren) { return ( {children} diff --git a/x-pack/plugins/observability_solution/apm/public/hooks/use_breakpoints.test.tsx b/x-pack/plugins/observability_solution/apm/public/hooks/use_breakpoints.test.tsx index d311f48fa0e58..7a9a7aa33b6b2 100644 --- a/x-pack/plugins/observability_solution/apm/public/hooks/use_breakpoints.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/hooks/use_breakpoints.test.tsx @@ -6,7 +6,7 @@ */ import React, { FC, PropsWithChildren } from 'react'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { EuiProvider } from '@elastic/eui'; import { useBreakpoints } from './use_breakpoints'; diff --git a/x-pack/plugins/observability_solution/apm/public/hooks/use_debounce.test.tsx b/x-pack/plugins/observability_solution/apm/public/hooks/use_debounce.test.tsx index 6701024eea9e9..98543601cab2a 100644 --- a/x-pack/plugins/observability_solution/apm/public/hooks/use_debounce.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/hooks/use_debounce.test.tsx @@ -4,11 +4,11 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { renderHook, act } from '@testing-library/react-hooks'; + +import { renderHook, act } from '@testing-library/react'; import { useStateDebounced } from './use_debounce'; // Replace 'your-module' with the actual module path describe('useStateDebounced', () => { - jest.useFakeTimers(); beforeAll(() => { // Mocks console.error so it won't polute tests output when testing the api throwing error jest.spyOn(console, 'error').mockImplementation(() => null); @@ -18,6 +18,14 @@ describe('useStateDebounced', () => { jest.restoreAllMocks(); }); + beforeEach(() => { + jest.useFakeTimers(); + }); + + afterEach(() => { + jest.useRealTimers(); + }); + it('returns the initial value and a debounced setter function', () => { const { result } = renderHook(() => useStateDebounced('initialValue', 300)); @@ -34,7 +42,9 @@ describe('useStateDebounced', () => { result.current[1]('updatedValue'); }); expect(result.current[0]).toBe('initialValue'); - jest.advanceTimersByTime(300); + act(() => { + jest.advanceTimersByTime(300); + }); expect(result.current[0]).toBe('updatedValue'); }); @@ -44,12 +54,15 @@ describe('useStateDebounced', () => { act(() => { result.current[1]('updatedValue'); }); - jest.advanceTimersByTime(150); + act(() => { + jest.advanceTimersByTime(150); + }); expect(result.current[0]).toBe('initialValue'); act(() => { result.current[1]('newUpdatedValue'); + jest.advanceTimersByTime(400); }); - jest.advanceTimersByTime(400); + expect(result.current[0]).toBe('newUpdatedValue'); }); }); diff --git a/x-pack/plugins/observability_solution/apm/public/hooks/use_fetcher.test.tsx b/x-pack/plugins/observability_solution/apm/public/hooks/use_fetcher.test.tsx index 14c58ab3977ee..be61a03e2bd80 100644 --- a/x-pack/plugins/observability_solution/apm/public/hooks/use_fetcher.test.tsx +++ b/x-pack/plugins/observability_solution/apm/public/hooks/use_fetcher.test.tsx @@ -5,46 +5,42 @@ * 2.0. */ -import { renderHook, RenderHookResult } from '@testing-library/react-hooks'; -import React, { ReactNode } from 'react'; +import React from 'react'; +import { waitFor, act, renderHook, type RenderHookResult } from '@testing-library/react'; import { CoreStart } from '@kbn/core/public'; import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public'; import { delay } from '../utils/test_helpers'; -import { FetcherResult, useFetcher, isPending, FETCH_STATUS } from './use_fetcher'; +import { useFetcher, isPending, FETCH_STATUS } from './use_fetcher'; // Wrap the hook with a provider so it can useKibana const KibanaReactContext = createKibanaReactContext({ notifications: { toasts: { add: () => {}, danger: () => {} } }, } as unknown as Partial); -interface WrapperProps { - children?: ReactNode; - callback: () => Promise; - args: string[]; -} -function wrapper({ children }: WrapperProps) { +function wrapper({ children }: React.PropsWithChildren) { return {children}; } describe('useFetcher', () => { describe('when resolving after 500ms', () => { - let hook: RenderHookResult< - WrapperProps, - FetcherResult & { - refetch: () => void; - } - >; + let hook: RenderHookResult, Parameters>; beforeEach(() => { - jest.useFakeTimers({ legacyFakeTimers: true }); + jest.useFakeTimers(); + async function fn() { await delay(500); return 'response from hook'; } - hook = renderHook(() => useFetcher(() => fn(), []), { wrapper }); + + hook = renderHook(() => useFetcher(fn, []), { wrapper }); }); - it('should have loading spinner initally', async () => { + afterEach(() => { + jest.useRealTimers(); + }); + + it('should have loading spinner initially', () => { expect(hook.result.current).toEqual({ data: undefined, error: undefined, @@ -53,8 +49,10 @@ describe('useFetcher', () => { }); }); - it('should still show loading spinner after 100ms', async () => { - jest.advanceTimersByTime(100); + it('should still show loading spinner after 100ms', () => { + act(() => { + jest.advanceTimersByTime(100); + }); expect(hook.result.current).toEqual({ data: undefined, @@ -65,8 +63,11 @@ describe('useFetcher', () => { }); it('should show success after 1 second', async () => { - jest.advanceTimersByTime(1000); - await hook.waitForNextUpdate(); + act(() => { + jest.advanceTimersByTime(1000); + }); + + await waitFor(() => expect(hook.result.current.status).toBe('success')); expect(hook.result.current).toEqual({ data: 'response from hook', @@ -78,23 +79,23 @@ describe('useFetcher', () => { }); describe('when throwing after 500ms', () => { - let hook: RenderHookResult< - WrapperProps, - FetcherResult & { - refetch: () => void; - } - >; + let hook: RenderHookResult, Parameters>; beforeEach(() => { - jest.useFakeTimers({ legacyFakeTimers: true }); + jest.useFakeTimers(); + async function fn(): Promise { await delay(500); throw new Error('Something went wrong'); } - hook = renderHook(() => useFetcher(() => fn(), []), { wrapper }); + hook = renderHook(() => useFetcher(fn, []), { wrapper }); + }); + + afterEach(() => { + jest.useRealTimers(); }); - it('should have loading spinner initally', async () => { + it('should have loading spinner initially', () => { expect(hook.result.current).toEqual({ data: undefined, error: undefined, @@ -103,8 +104,10 @@ describe('useFetcher', () => { }); }); - it('should still show loading spinner after 100ms', async () => { - jest.advanceTimersByTime(100); + it('should still show loading spinner after 100ms', () => { + act(() => { + jest.advanceTimersByTime(100); + }); expect(hook.result.current).toEqual({ data: undefined, @@ -115,8 +118,11 @@ describe('useFetcher', () => { }); it('should show error after 1 second', async () => { - jest.advanceTimersByTime(1000); - await hook.waitForNextUpdate(); + act(() => { + jest.advanceTimersByTime(1000); + }); + + await waitFor(() => expect(hook.result.current.status).toBe('failure')); expect(hook.result.current).toEqual({ data: undefined, @@ -128,20 +134,27 @@ describe('useFetcher', () => { }); describe('when a hook already has data', () => { - it('should show "first response" while loading "second response"', async () => { - jest.useFakeTimers({ legacyFakeTimers: true }); + beforeEach(() => { + jest.useFakeTimers(); + }); + + afterEach(() => { + jest.useRealTimers(); + }); + it('should show "first response" while loading "second response"', async () => { const hook = renderHook( /* eslint-disable-next-line react-hooks/exhaustive-deps */ ({ callback, args }) => useFetcher(callback, args), { initialProps: { - callback: async () => 'first response', + callback: () => Promise.resolve('first response'), args: ['a'], }, wrapper, } ); + expect(hook.result.current).toEqual({ data: undefined, error: undefined, @@ -149,15 +162,15 @@ describe('useFetcher', () => { status: 'loading', }); - await hook.waitForNextUpdate(); - // assert: first response has loaded and should be rendered - expect(hook.result.current).toEqual({ - data: 'first response', - error: undefined, - refetch: expect.any(Function), - status: 'success', - }); + await waitFor(() => + expect(hook.result.current).toEqual({ + data: 'first response', + error: undefined, + refetch: expect.any(Function), + status: 'success', + }) + ); // act: re-render hook with async callback hook.rerender({ @@ -168,55 +181,92 @@ describe('useFetcher', () => { args: ['b'], }); - jest.advanceTimersByTime(100); - - // assert: while loading new data the previous data should still be rendered - expect(hook.result.current).toEqual({ - data: 'first response', - error: undefined, - refetch: expect.any(Function), - status: 'loading', + act(() => { + jest.advanceTimersByTime(100); }); - jest.advanceTimersByTime(500); - await hook.waitForNextUpdate(); + // assert: while loading new data the previous data should still be rendered + await waitFor(() => + expect(hook.result.current).toEqual({ + data: 'first response', + error: undefined, + refetch: expect.any(Function), + status: 'loading', + }) + ); - // assert: "second response" has loaded and should be rendered - expect(hook.result.current).toEqual({ - data: 'second response', - error: undefined, - refetch: expect.any(Function), - status: 'success', + act(() => { + jest.advanceTimersByTime(500); }); + + await waitFor(() => + expect(hook.result.current).toEqual({ + data: 'second response', + error: undefined, + refetch: expect.any(Function), + status: 'success', + }) + ); }); it('should return the same object reference when data is unchanged between rerenders', async () => { + const initialProps = { + callback: () => Promise.resolve('data response'), + args: ['a'], + }; + const hook = renderHook( /* eslint-disable-next-line react-hooks/exhaustive-deps */ ({ callback, args }) => useFetcher(callback, args), { - initialProps: { - callback: async () => 'data response', - args: ['a'], - }, + initialProps, wrapper, } ); - await hook.waitForNextUpdate(); + + act(() => { + jest.runAllTimers(); + }); + + // assert: initial data has loaded; + await waitFor(() => + expect(hook.result.current).toEqual( + expect.objectContaining({ + data: 'data response', + status: 'success', + }) + ) + ); + const firstResult = hook.result.current; - hook.rerender(); + hook.rerender(initialProps); + + expect(hook.result.current).toEqual( + expect.objectContaining({ + data: 'data response', + status: 'success', + }) + ); + const secondResult = hook.result.current; // assert: subsequent rerender returns the same object reference expect(secondResult === firstResult).toEqual(true); hook.rerender({ - callback: async () => { - return 'second response'; - }, + callback: () => Promise.resolve('second response'), args: ['b'], }); - await hook.waitForNextUpdate(); + + await waitFor(() => + expect(hook.result.current).toEqual( + expect.objectContaining({ + data: 'second response', + status: 'success', + }) + ) + ); + const thirdResult = hook.result.current; // assert: rerender with different data returns a new object diff --git a/x-pack/plugins/observability_solution/apm/public/hooks/use_time_range.test.ts b/x-pack/plugins/observability_solution/apm/public/hooks/use_time_range.test.ts index 2bbc5c60ca91e..2f6c08aad8ccf 100644 --- a/x-pack/plugins/observability_solution/apm/public/hooks/use_time_range.test.ts +++ b/x-pack/plugins/observability_solution/apm/public/hooks/use_time_range.test.ts @@ -4,11 +4,12 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { renderHook, RenderHookResult } from '@testing-library/react-hooks'; + +import { renderHook, RenderHookResult } from '@testing-library/react'; import { useTimeRange } from './use_time_range'; describe('useTimeRange', () => { - let hook: RenderHookResult[0], ReturnType>; + let hook: RenderHookResult, Parameters[0]>; beforeEach(() => { Date.now = jest.fn(() => new Date(Date.UTC(2021, 0, 1, 12)).valueOf()); diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_container_metrics_charts.test.ts b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_container_metrics_charts.test.ts index 392582d4f9eed..496029a8b436b 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_container_metrics_charts.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_container_metrics_charts.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { waitFor, renderHook } from '@testing-library/react'; import { ContainerMetricTypes } from '../charts/types'; import { useK8sContainerPageViewMetricsCharts, @@ -48,10 +48,10 @@ describe('useDockerContainerCharts', () => { async (metric) => { const expectedOrder = getContainerChartsExpectedOrder(metric); - const { result, waitForNextUpdate } = renderHook(() => + const { result } = renderHook(() => useDockerContainerPageViewMetricsCharts({ metricsDataViewId, metric }) ); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); const { charts } = result.current; @@ -68,13 +68,14 @@ describe('useDockerContainerCharts', () => { describe('useDockerKPIMetricsCharts', () => { it('should return an array of charts with correct order', async () => { const expectedOrder = ['cpuUsage', 'memoryUsage']; - const { result, waitForNextUpdate } = renderHook(() => + const { result } = renderHook(() => useDockerContainerKpiCharts({ dataViewId: metricsDataViewId }) ); - await waitForNextUpdate(); - expect(result.current).toHaveLength(expectedOrder.length); - result.current.forEach((chart, index) => { - expect(chart).toHaveProperty('id', expectedOrder[index]); + await waitFor(() => { + expect(result.current).toHaveLength(expectedOrder.length); + result.current.forEach((chart, index) => { + expect(chart).toHaveProperty('id', expectedOrder[index]); + }); }); }); }); @@ -86,10 +87,10 @@ describe('useK8sContainerCharts', () => { async (metric) => { const expectedOrder = getK8sContainerChartsExpectedOrder(metric); - const { result, waitForNextUpdate } = renderHook(() => + const { result } = renderHook(() => useK8sContainerPageViewMetricsCharts({ metricsDataViewId, metric }) ); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); const { charts } = result.current; @@ -106,13 +107,14 @@ describe('useK8sContainerCharts', () => { describe('useK8sContainerKPIMetricsCharts', () => { it('should return an array of charts with correct order', async () => { const expectedOrder = ['k8sCpuUsage', 'k8sMemoryUsage']; - const { result, waitForNextUpdate } = renderHook(() => + const { result } = renderHook(() => useK8sContainerKpiCharts({ dataViewId: metricsDataViewId }) ); - await waitForNextUpdate(); - expect(result.current).toHaveLength(expectedOrder.length); - result.current.forEach((chart, index) => { - expect(chart).toHaveProperty('id', expectedOrder[index]); + await waitFor(() => { + expect(result.current).toHaveLength(expectedOrder.length); + result.current.forEach((chart, index) => { + expect(chart).toHaveProperty('id', expectedOrder[index]); + }); }); }); }); diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_host_metrics_charts.test.ts b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_host_metrics_charts.test.ts index 006fae9bec753..f95ab156222eb 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_host_metrics_charts.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_host_metrics_charts.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { waitFor, renderHook } from '@testing-library/react'; import { HostMetricTypes } from '../charts/types'; import { useHostKpiCharts, useHostCharts, useKubernetesCharts } from './use_host_metrics_charts'; @@ -40,10 +40,8 @@ describe('useHostCharts', () => { async (metric) => { const expectedOrder = getHostChartsExpectedOrder(metric, false); - const { result, waitForNextUpdate } = renderHook(() => - useHostCharts({ dataViewId, metric }) - ); - await waitForNextUpdate(); + const { result } = renderHook(() => useHostCharts({ dataViewId, metric })); + await waitFor(() => new Promise((resolve) => resolve(null))); const { charts } = result.current; @@ -60,10 +58,10 @@ describe('useHostCharts', () => { async (metric) => { const expectedOrder = getHostChartsExpectedOrder(metric, true); - const { result, waitForNextUpdate } = renderHook(() => + const { result } = renderHook(() => useHostCharts({ dataViewId, metric, overview: true }) ); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); const { charts } = result.current; @@ -80,10 +78,8 @@ describe('useHostCharts', () => { describe('useKubernetesCharts', () => { it('should return an array of charts with correct order - overview', async () => { - const { result, waitForNextUpdate } = renderHook(() => - useKubernetesCharts({ dataViewId, overview: true }) - ); - await waitForNextUpdate(); + const { result } = renderHook(() => useKubernetesCharts({ dataViewId, overview: true })); + await waitFor(() => new Promise((resolve) => resolve(null))); const expectedOrder = ['nodeCpuCapacity', 'nodeMemoryCapacity']; @@ -97,8 +93,8 @@ describe('useKubernetesCharts', () => { }); it('should return an array of charts with correct order', async () => { - const { result, waitForNextUpdate } = renderHook(() => useKubernetesCharts({ dataViewId })); - await waitForNextUpdate(); + const { result } = renderHook(() => useKubernetesCharts({ dataViewId })); + await waitFor(() => new Promise((resolve) => resolve(null))); const expectedOrder = [ 'nodeCpuCapacity', @@ -119,8 +115,8 @@ describe('useKubernetesCharts', () => { describe('useHostKpiCharts', () => { it('should return an array of charts with correct order', async () => { - const { result, waitForNextUpdate } = renderHook(() => useHostKpiCharts({ dataViewId })); - await waitForNextUpdate(); + const { result } = renderHook(() => useHostKpiCharts({ dataViewId })); + await waitFor(() => new Promise((resolve) => resolve(null))); const expectedOrder = ['cpuUsage', 'normalizedLoad1m', 'memoryUsage', 'diskUsage']; @@ -140,10 +136,8 @@ describe('useHostKpiCharts', () => { getSubtitle: () => 'Custom Subtitle', }; - const { result, waitForNextUpdate } = renderHook(() => - useHostKpiCharts({ dataViewId, ...options }) - ); - await waitForNextUpdate(); + const { result } = renderHook(() => useHostKpiCharts({ dataViewId, ...options })); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(result.current).toHaveLength(4); diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_loading_state.test.ts b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_loading_state.test.ts index becd0e81c0a9a..2475c97cec0e8 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_loading_state.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_loading_state.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, waitFor, renderHook } from '@testing-library/react'; import { useLoadingState } from './use_loading_state'; import { useDatePickerContext, type UseDateRangeProviderProps } from './use_date_picker'; import { BehaviorSubject, EMPTY, of, Subject, Subscription, skip } from 'rxjs'; @@ -102,7 +102,7 @@ describe('useLoadingState', () => { }); it('should set isAutoRefreshRequestPending to true when there are requests pending', async () => { - const { result, unmount, waitFor } = renderHook(() => useLoadingState()); + const { result, unmount } = renderHook(() => useLoadingState()); let receivedValue = false; subscription.add( @@ -128,7 +128,7 @@ describe('useLoadingState', () => { }); it('should set isAutoRefreshRequestPending to false when all requests complete', async () => { - const { result, unmount, waitFor } = renderHook(() => useLoadingState()); + const { result, unmount } = renderHook(() => useLoadingState()); let receivedValue = true; subscription.add( @@ -153,7 +153,7 @@ describe('useLoadingState', () => { }); it('should not call updateSearchSessionId if waitUntilNextSessionCompletesMock$ returns empty', async () => { - const { unmount, waitFor } = renderHook(() => useLoadingState()); + const { unmount } = renderHook(() => useLoadingState()); // waitUntilNextSessionCompletes$ returns EMPTY when the status is loading or none sessionState$.next(SearchSessionState.Loading); @@ -171,7 +171,7 @@ describe('useLoadingState', () => { }); it('should call updateSearchSessionId when waitUntilNextSessionCompletesMock$ returns', async () => { - const { unmount, waitFor } = renderHook(() => useLoadingState()); + const { unmount } = renderHook(() => useLoadingState()); // waitUntilNextSessionCompletes$ returns something when the status is Completed or BackgroundCompleted sessionState$.next(SearchSessionState.Loading); diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_profiling_kuery.test.tsx b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_profiling_kuery.test.tsx index 10325ce51f81f..0d4db96a23fad 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_profiling_kuery.test.tsx +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_profiling_kuery.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { MemoryRouter, useHistory } from 'react-router-dom'; -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { useProfilingKuery } from './use_profiling_kuery'; import { useAssetDetailsRenderPropsContext } from './use_asset_details_render_props'; diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_request_observable.test.ts b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_request_observable.test.ts index 9ca4bd17ca34b..9be24cbfcf3f4 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_request_observable.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_request_observable.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook, act } from '@testing-library/react-hooks'; +import { act, waitFor, renderHook } from '@testing-library/react'; import { useRequestObservable } from './use_request_observable'; import { type RequestState, useLoadingStateContext } from './use_loading_state'; import { useDatePickerContext, type UseDateRangeProviderProps } from './use_date_picker'; @@ -69,7 +69,7 @@ describe('useRequestObservable', () => { }); it('should process a valid request function', async () => { - const { result, waitFor, unmount } = renderHook(() => useRequestObservable()); + const { result, unmount } = renderHook(() => useRequestObservable()); act(() => { result.current.request$.next(() => Promise.resolve()); @@ -85,7 +85,7 @@ describe('useRequestObservable', () => { }); it('should be able to make new requests if isAutoRefreshRequestPending is false', async () => { - const { result, waitFor, unmount } = renderHook(() => useRequestObservable()); + const { result, unmount } = renderHook(() => useRequestObservable()); act(() => { isAutoRefreshRequestPendingMock$.next(false); @@ -102,7 +102,7 @@ describe('useRequestObservable', () => { }); it('should block new requests when isAutoRefreshRequestPending is true', async () => { - const { result, waitFor, unmount } = renderHook(() => useRequestObservable()); + const { result, unmount } = renderHook(() => useRequestObservable()); act(() => { isAutoRefreshRequestPendingMock$.next(false); @@ -123,7 +123,7 @@ describe('useRequestObservable', () => { }); it('should not block new requests when auto-refresh is paused', async () => { - const { result, waitFor, unmount } = renderHook(() => useRequestObservable()); + const { result, unmount } = renderHook(() => useRequestObservable()); act(() => { autoRefreshConfig$.next({ isPaused: true, interval: 5000 }); @@ -144,7 +144,7 @@ describe('useRequestObservable', () => { }); it('should complete the request when an error is thrown', async () => { - const { result, waitFor, unmount } = renderHook(() => useRequestObservable()); + const { result, unmount } = renderHook(() => useRequestObservable()); act(() => { autoRefreshConfig$.next({ isPaused: true, interval: 5000 }); diff --git a/x-pack/plugins/observability_solution/infra/public/containers/ml/infra_ml_module_status.test.ts b/x-pack/plugins/observability_solution/infra/public/containers/ml/infra_ml_module_status.test.ts index 80d538ef1e50b..b754537107e46 100644 --- a/x-pack/plugins/observability_solution/infra/public/containers/ml/infra_ml_module_status.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/containers/ml/infra_ml_module_status.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { useModuleStatus } from './infra_ml_module_status'; describe('useModuleStatus', () => { diff --git a/x-pack/plugins/observability_solution/infra/public/containers/plugin_config_context.test.tsx b/x-pack/plugins/observability_solution/infra/public/containers/plugin_config_context.test.tsx index 62c582a818240..a33c3432f06fa 100644 --- a/x-pack/plugins/observability_solution/infra/public/containers/plugin_config_context.test.tsx +++ b/x-pack/plugins/observability_solution/infra/public/containers/plugin_config_context.test.tsx @@ -6,15 +6,15 @@ */ import type { InfraConfig } from '../../common/plugin_config_types'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import React from 'react'; import { PluginConfigProvider, usePluginConfig } from './plugin_config_context'; describe('usePluginConfig()', () => { it('throws an error if the context value was not set before using the hook', () => { - const { result } = renderHook(() => usePluginConfig()); - - expect(result.error).not.toEqual(undefined); + expect(() => renderHook(() => usePluginConfig())).toThrow( + /PluginConfigContext value was not initialized./ + ); }); it('returns the plugin config what was set through the provider', () => { @@ -40,7 +40,6 @@ describe('usePluginConfig()', () => { }, }); - expect(result.error).toEqual(undefined); expect(result.current).toEqual(config); }); }); diff --git a/x-pack/plugins/observability_solution/infra/public/hooks/use_alerts_count.test.ts b/x-pack/plugins/observability_solution/infra/public/hooks/use_alerts_count.test.ts index 2b2dc755c94c1..87db1db65398a 100644 --- a/x-pack/plugins/observability_solution/infra/public/hooks/use_alerts_count.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/hooks/use_alerts_count.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { waitFor, renderHook } from '@testing-library/react'; import { ALERT_STATUS, ValidFeatureId } from '@kbn/rule-data-utils'; import { useAlertsCount } from './use_alerts_count'; @@ -66,12 +66,12 @@ describe('useAlertsCount', () => { it('should return the mocked data from API', async () => { mockedPostAPI.mockResolvedValue(mockedAlertsCountResponse); - const { result, waitForNextUpdate } = renderHook(() => useAlertsCount({ featureIds })); + const { result } = renderHook(() => useAlertsCount({ featureIds })); expect(result.current.loading).toBe(true); expect(result.current.alertsCount).toEqual(undefined); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); const { alertsCount, loading, error } = result.current; expect(alertsCount).toEqual(expectedResult); @@ -88,15 +88,13 @@ describe('useAlertsCount', () => { }; mockedPostAPI.mockResolvedValue(mockedAlertsCountResponse); - const { waitForNextUpdate } = renderHook(() => + renderHook(() => useAlertsCount({ featureIds, query, }) ); - await waitForNextUpdate(); - const body = JSON.stringify({ aggs: { count: { @@ -108,9 +106,11 @@ describe('useAlertsCount', () => { size: 0, }); - expect(mockedPostAPI).toHaveBeenCalledWith( - '/internal/rac/alerts/find', - expect.objectContaining({ body }) + await waitFor(() => + expect(mockedPostAPI).toHaveBeenCalledWith( + '/internal/rac/alerts/find', + expect.objectContaining({ body }) + ) ); }); @@ -118,10 +118,8 @@ describe('useAlertsCount', () => { const error = new Error('Fetch Alerts Count Failed'); mockedPostAPI.mockRejectedValueOnce(error); - const { result, waitForNextUpdate } = renderHook(() => useAlertsCount({ featureIds })); - - await waitForNextUpdate(); + const { result } = renderHook(() => useAlertsCount({ featureIds })); - expect(result.current.error?.message).toMatch(error.message); + await waitFor(() => expect(result.current.error?.message).toMatch(error.message)); }); }); diff --git a/x-pack/plugins/observability_solution/infra/public/hooks/use_lens_attributes.test.ts b/x-pack/plugins/observability_solution/infra/public/hooks/use_lens_attributes.test.ts index 0a619069c04a4..5e5f00fd66139 100644 --- a/x-pack/plugins/observability_solution/infra/public/hooks/use_lens_attributes.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/hooks/use_lens_attributes.test.ts @@ -6,7 +6,7 @@ */ import 'jest-canvas-mock'; -import { renderHook } from '@testing-library/react-hooks'; +import { waitFor, renderHook } from '@testing-library/react'; import { useLensAttributes } from './use_lens_attributes'; import { coreMock } from '@kbn/core/public/mocks'; import { type KibanaReactContextValue, useKibana } from '@kbn/kibana-react-plugin/public'; @@ -72,15 +72,15 @@ describe('useLensAttributes hook', () => { }); it('should return the basic lens attributes', async () => { - const { waitForNextUpdate } = renderHook(() => useLensAttributes(params)); - await waitForNextUpdate(); - - expect(LensConfigBuilderMock.mock.instances[0].build).toHaveBeenCalledWith(params); + renderHook(() => useLensAttributes(params)); + await waitFor(() => + expect(LensConfigBuilderMock.mock.instances[0].build).toHaveBeenCalledWith(params) + ); }); it('should return extra actions', async () => { - const { result, waitForNextUpdate } = renderHook(() => useLensAttributes(params)); - await waitForNextUpdate(); + const { result } = renderHook(() => useLensAttributes(params)); + await waitFor(() => new Promise((resolve) => resolve(null))); const extraActions = result.current.getExtraActions({ timeRange: { diff --git a/x-pack/plugins/observability_solution/infra/public/pages/link_to/use_host_ip_to_name.test.ts b/x-pack/plugins/observability_solution/infra/public/pages/link_to/use_host_ip_to_name.test.ts index 150416a204b05..2a9d56a6f4dfa 100644 --- a/x-pack/plugins/observability_solution/infra/public/pages/link_to/use_host_ip_to_name.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/pages/link_to/use_host_ip_to_name.test.ts @@ -6,7 +6,7 @@ */ import { useHostIpToName } from './use_host_ip_to_name'; -import { renderHook } from '@testing-library/react-hooks'; +import { waitFor, renderHook } from '@testing-library/react'; const renderUseHostIpToNameHook = () => renderHook((props) => useHostIpToName(props.ipAddress, props.indexPattern), { @@ -32,10 +32,10 @@ jest.mock('@kbn/kibana-react-plugin/public', () => { describe('useHostIpToName Hook', () => { it('should basically work', async () => { mockedFetch.mockResolvedValue({ host: 'example-01' } as any); - const { result, waitForNextUpdate } = renderUseHostIpToNameHook(); + const { result } = renderUseHostIpToNameHook(); expect(result.current.name).toBe(null); expect(result.current.loading).toBe(true); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(result.current.name).toBe('example-01'); expect(result.current.loading).toBe(false); expect(result.current.error).toBe(null); @@ -44,10 +44,10 @@ describe('useHostIpToName Hook', () => { it('should handle errors', async () => { const error = new Error('Host not found'); mockedFetch.mockRejectedValue(error); - const { result, waitForNextUpdate } = renderUseHostIpToNameHook(); + const { result } = renderUseHostIpToNameHook(); expect(result.current.name).toBe(null); expect(result.current.loading).toBe(true); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(result.current.name).toBe(null); expect(result.current.loading).toBe(false); expect(result.current.error).toBe(error); @@ -56,16 +56,16 @@ describe('useHostIpToName Hook', () => { it('should reset errors', async () => { const error = new Error('Host not found'); mockedFetch.mockRejectedValue(error); - const { result, waitForNextUpdate, rerender } = renderUseHostIpToNameHook(); + const { result, rerender } = renderUseHostIpToNameHook(); expect(result.current.name).toBe(null); expect(result.current.loading).toBe(true); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(result.current.name).toBe(null); expect(result.current.loading).toBe(false); expect(result.current.error).toBe(error); mockedFetch.mockResolvedValue({ host: 'example-01' } as any); rerender({ ipAddress: '192.168.1.2', indexPattern: 'metricbeat-*' }); - await waitForNextUpdate(); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(result.current.name).toBe('example-01'); expect(result.current.loading).toBe(false); expect(result.current.error).toBe(null); diff --git a/x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/hooks/use_hosts_table.test.ts b/x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/hooks/use_hosts_table.test.ts index a0ebb20184912..abae2d5cadbff 100644 --- a/x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/hooks/use_hosts_table.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/hooks/use_hosts_table.test.ts @@ -6,7 +6,7 @@ */ import { type HostNodeRow, useHostsTable } from './use_hosts_table'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { InfraAssetMetricsItem } from '../../../../../common/http_api'; import * as useUnifiedSearchHooks from './use_unified_search'; import * as useHostsViewHooks from './use_hosts_view'; diff --git a/x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/hooks/use_metrics_charts.test.ts b/x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/hooks/use_metrics_charts.test.ts index b76d5938f0cb5..9d68b3ff76e77 100644 --- a/x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/hooks/use_metrics_charts.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/hooks/use_metrics_charts.test.ts @@ -6,16 +6,14 @@ */ import type { LensSeriesLayer } from '@kbn/lens-embeddable-utils/config_builder'; -import { renderHook } from '@testing-library/react-hooks'; +import { waitFor, renderHook } from '@testing-library/react'; import { PAGE_SIZE_OPTIONS } from '../constants'; import { useMetricsCharts } from './use_metrics_charts'; describe('useMetricsCharts', () => { it('should return an array of charts with breakdown config', async () => { - const { result, waitForNextUpdate } = renderHook(() => - useMetricsCharts({ dataViewId: 'dataViewId' }) - ); - await waitForNextUpdate(); + const { result } = renderHook(() => useMetricsCharts({ dataViewId: 'dataViewId' })); + await waitFor(() => new Promise((resolve) => resolve(null))); expect(result.current).toHaveLength(11); @@ -29,10 +27,8 @@ describe('useMetricsCharts', () => { }); it('should return an array of charts with correct order', async () => { - const { result, waitForNextUpdate } = renderHook(() => - useMetricsCharts({ dataViewId: 'dataViewId' }) - ); - await waitForNextUpdate(); + const { result } = renderHook(() => useMetricsCharts({ dataViewId: 'dataViewId' })); + await waitFor(() => new Promise((resolve) => resolve(null))); const expectedOrder = [ 'cpuUsage', diff --git a/x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_filters.test.ts b/x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_filters.test.ts index 7fe7b8b3fe18c..533857130b114 100644 --- a/x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_filters.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_filters.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { DataView } from '@kbn/data-views-plugin/common'; import { useWaffleFilters, WaffleFiltersState } from './use_waffle_filters'; import { TIMESTAMP_FIELD } from '../../../../../common/constants'; diff --git a/x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_options.test.ts b/x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_options.test.ts index 50f4e95b58a37..757a0e955b4df 100644 --- a/x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_options.test.ts +++ b/x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_options.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { useWaffleOptions, WaffleOptionsState } from './use_waffle_options'; diff --git a/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metric_explorer_state.test.tsx b/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metric_explorer_state.test.tsx index bcea796c3b00a..0e70071f199ff 100644 --- a/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metric_explorer_state.test.tsx +++ b/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metric_explorer_state.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { useMetricsExplorerState } from './use_metric_explorer_state'; import { MetricsExplorerOptionsContainer } from './use_metrics_explorer_options'; import React from 'react'; @@ -75,6 +75,10 @@ describe('useMetricsExplorerState', () => { delete STORE.MetricsExplorerTimeRange; }); + afterEach(() => { + jest.clearAllMocks(); + }); + it('should just work', async () => { mockedUseMetricsExplorerData.mockReturnValue({ isLoading: false, @@ -92,12 +96,14 @@ describe('useMetricsExplorerState', () => { describe('handleRefresh', () => { it('should trigger an addition request when handleRefresh is called', async () => { const { result } = renderUseMetricsExplorerStateHook(); - expect(result.all.length).toBe(2); - const numberOfHookCalls = result.all.length; + + const numberOfHookCalls = mockedUseMetricsExplorerData.mock.calls.length; + + expect(numberOfHookCalls).toEqual(2); act(() => { result.current.refresh(); }); - expect(result.all.length).toBe(numberOfHookCalls + 1); + expect(mockedUseMetricsExplorerData).toHaveBeenCalledTimes(numberOfHookCalls + 1); }); }); diff --git a/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_data.test.tsx b/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_data.test.tsx index 202ae51990ad2..8cc6bff922d92 100644 --- a/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_data.test.tsx +++ b/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_data.test.tsx @@ -9,7 +9,7 @@ import React, { FC, PropsWithChildren } from 'react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { useMetricsExplorerData } from './use_metrics_explorer_data'; import { DataView } from '@kbn/data-views-plugin/common'; -import { renderHook } from '@testing-library/react-hooks'; +import { waitFor, act, renderHook } from '@testing-library/react'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { @@ -108,15 +108,14 @@ describe('useMetricsExplorerData Hook', () => { it('should just work', async () => { mockedFetch.mockResolvedValue(resp); - const { result, waitForNextUpdate } = renderUseMetricsExplorerDataHook(); + const { result } = renderUseMetricsExplorerDataHook(); expect(result.current.data).toBeUndefined(); expect(result.current.isLoading).toBe(true); - await waitForNextUpdate(); + await waitFor(() => expect(result.current.isLoading).toBe(false)); expect(result.current.data!.pages[0]).toEqual(resp); - expect(result.current.isLoading).toBe(false); const { series } = result.current.data!.pages[0]; expect(series).toBeDefined(); expect(series.length).toBe(3); @@ -124,12 +123,11 @@ describe('useMetricsExplorerData Hook', () => { it('should paginate', async () => { mockedFetch.mockResolvedValue(resp); - const { result, waitForNextUpdate } = renderUseMetricsExplorerDataHook(); + const { result } = renderUseMetricsExplorerDataHook(); expect(result.current.data).toBeUndefined(); expect(result.current.isLoading).toBe(true); - await waitForNextUpdate(); + await waitFor(() => expect(result.current.isLoading).toBe(false)); expect(result.current.data!.pages[0]).toEqual(resp); - expect(result.current.isLoading).toBe(false); const { series } = result.current.data!.pages[0]; expect(series).toBeDefined(); expect(series.length).toBe(3); @@ -137,41 +135,45 @@ describe('useMetricsExplorerData Hook', () => { pageInfo: { total: 10, afterKey: 'host-06' }, series: [createSeries('host-04'), createSeries('host-05'), createSeries('host-06')], } as any); - result.current.fetchNextPage(); - await waitForNextUpdate(); - expect(result.current.isLoading).toBe(false); - const { series: nextSeries } = result.current.data!.pages[1]; - expect(nextSeries).toBeDefined(); - expect(nextSeries.length).toBe(3); + await act(async () => { + await result.current.fetchNextPage(); + }); + await waitFor(() => { + expect(result.current.isLoading).toBe(false); + const { series: nextSeries } = result.current.data!.pages[1]; + expect(nextSeries).toBeDefined(); + expect(nextSeries.length).toBe(3); + }); }); it('should reset error upon recovery', async () => { const error = new Error('Network Error'); mockedFetch.mockRejectedValue(error); - const { result, waitForNextUpdate } = renderUseMetricsExplorerDataHook(); + const { result } = renderUseMetricsExplorerDataHook(); expect(result.current.data).toBeUndefined(); expect(result.current.error).toEqual(null); expect(result.current.isLoading).toBe(true); - await waitForNextUpdate(); + await waitFor(() => expect(result.current.isLoading).toBe(false)); expect(result.current.data).toBeUndefined(); expect(result.current.error).toEqual(error); - expect(result.current.isLoading).toBe(false); mockedFetch.mockResolvedValue(resp as any); - result.current.refetch(); - await waitForNextUpdate(); - expect(result.current.data!.pages[0]).toEqual(resp); - expect(result.current.isLoading).toBe(false); - expect(result.current.error).toBe(null); + await act(async () => { + await result.current.refetch(); + }); + await waitFor(() => { + expect(result.current.isLoading).toBe(false); + expect(result.current.data!.pages[0]).toEqual(resp); + expect(result.current.error).toBe(null); + }); }); it('should not paginate on option change', async () => { mockedFetch.mockResolvedValue(resp as any); - const { result, waitForNextUpdate, rerender } = renderUseMetricsExplorerDataHook(); + const { result, rerender } = renderUseMetricsExplorerDataHook(); expect(result.current.data).toBeUndefined(); expect(result.current.isLoading).toBe(true); - await waitForNextUpdate(); + await waitFor(() => expect(result.current.isLoading).toBe(false)); expect(result.current.data!.pages[0]).toEqual(resp); - expect(result.current.isLoading).toBe(false); const { series } = result.current.data!.pages[0]; expect(series).toBeDefined(); expect(series.length).toBe(3); @@ -187,19 +189,19 @@ describe('useMetricsExplorerData Hook', () => { timestamps, }); expect(result.current.isLoading).toBe(true); - await waitForNextUpdate(); - expect(result.current.data!.pages[0]).toEqual(resp); - expect(result.current.isLoading).toBe(false); + await waitFor(() => { + expect(result.current.isLoading).toBe(false); + expect(result.current.data!.pages[0]).toEqual(resp); + }); }); it('should not paginate on time change', async () => { mockedFetch.mockResolvedValue(resp as any); - const { result, waitForNextUpdate, rerender } = renderUseMetricsExplorerDataHook(); + const { result, rerender } = renderUseMetricsExplorerDataHook(); expect(result.current.data).toBeUndefined(); expect(result.current.isLoading).toBe(true); - await waitForNextUpdate(); + await waitFor(() => expect(result.current.isLoading).toBe(false)); expect(result.current.data!.pages[0]).toEqual(resp); - expect(result.current.isLoading).toBe(false); const { series } = result.current.data!.pages[0]; expect(series).toBeDefined(); expect(series.length).toBe(3); @@ -211,8 +213,9 @@ describe('useMetricsExplorerData Hook', () => { timestamps: { fromTimestamp: 1678378092225, toTimestamp: 1678381693477, interval: '>=10s' }, }); expect(result.current.isLoading).toBe(true); - await waitForNextUpdate(); - expect(result.current.data!.pages[0]).toEqual(resp); - expect(result.current.isLoading).toBe(false); + await waitFor(() => { + expect(result.current.isLoading).toBe(false); + expect(result.current.data!.pages[0]).toEqual(resp); + }); }); }); diff --git a/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_options.test.tsx b/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_options.test.tsx index 795728fa8d8ef..f5c257e1f86ac 100644 --- a/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_options.test.tsx +++ b/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_options.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { useMetricsExplorerOptions, MetricsExplorerOptions, diff --git a/x-pack/plugins/observability_solution/infra/public/utils/data_search/use_data_search_request.test.tsx b/x-pack/plugins/observability_solution/infra/public/utils/data_search/use_data_search_request.test.tsx index 33369c1125e15..08907b1627086 100644 --- a/x-pack/plugins/observability_solution/infra/public/utils/data_search/use_data_search_request.test.tsx +++ b/x-pack/plugins/observability_solution/infra/public/utils/data_search/use_data_search_request.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { act, renderHook } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import React from 'react'; import { firstValueFrom, Observable, of, Subject } from 'rxjs'; import type { ISearchGeneric, IKibanaSearchResponse } from '@kbn/search-types'; diff --git a/x-pack/plugins/observability_solution/infra/public/utils/data_search/use_latest_partial_data_search_response.test.tsx b/x-pack/plugins/observability_solution/infra/public/utils/data_search/use_latest_partial_data_search_response.test.tsx index a4b01be03d80b..24433f23bc677 100644 --- a/x-pack/plugins/observability_solution/infra/public/utils/data_search/use_latest_partial_data_search_response.test.tsx +++ b/x-pack/plugins/observability_solution/infra/public/utils/data_search/use_latest_partial_data_search_response.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { act, renderHook } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { BehaviorSubject, Observable, of, Subject } from 'rxjs'; import { IKibanaSearchRequest } from '@kbn/search-types'; import { ParsedDataSearchRequestDescriptor, ParsedKibanaSearchResponse } from './types'; diff --git a/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.test.ts b/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.test.ts index 233c1a1076b79..d0406aa32884d 100644 --- a/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.test.ts +++ b/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useDetailViewRedirect } from './use_detail_view_redirect'; import { useKibana } from './use_kibana'; import { diff --git a/x-pack/plugins/observability_solution/inventory/public/hooks/use_is_loading_complete.test.ts b/x-pack/plugins/observability_solution/inventory/public/hooks/use_is_loading_complete.test.ts index 61306a0b66a3b..4706301eb0fca 100644 --- a/x-pack/plugins/observability_solution/inventory/public/hooks/use_is_loading_complete.test.ts +++ b/x-pack/plugins/observability_solution/inventory/public/hooks/use_is_loading_complete.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useIsLoadingComplete } from './use_is_loading_complete'; describe('useIsLoadingComplete', () => { diff --git a/x-pack/plugins/observability_solution/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.test.ts b/x-pack/plugins/observability_solution/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.test.ts index f4e733baf6ef7..025481c6b879b 100644 --- a/x-pack/plugins/observability_solution/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.test.ts +++ b/x-pack/plugins/observability_solution/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { mockLayerList } from './__mocks__/regions_layer.mock'; import { useLayerList } from './use_layer_list'; From cb63818b6faccdd9602cc1992b8bb337913fc9a7 Mon Sep 17 00:00:00 2001 From: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com> Date: Mon, 25 Nov 2024 14:40:16 +0000 Subject: [PATCH 31/71] [Index Management] Small copy change for index settings callout (#201264) ## Summary A small update on the copy of the index settings callout, based on feedback we received from @tylerperk. Screenshot 2024-11-21 at 18 07 40 --- .../index_template_wizard/template_create.test.tsx | 2 +- .../shared/components/wizard_steps/step_settings.tsx | 4 ++-- .../functional/apps/index_management/index_template_wizard.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx index 7ba6832b8833d..4992c1391635f 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx @@ -315,7 +315,7 @@ describe('', () => { expect(exists('indexModeCallout')).toBe(true); expect(find('indexModeCallout').text()).toContain( - 'The index.mode setting has been set to Standard within template Logistics.' + 'The index.mode setting has been set to Standard within the Logistics step.' ); }); diff --git a/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_settings.tsx b/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_settings.tsx index 38a11f03c7ee6..cc12cfc988d5b 100644 --- a/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_settings.tsx +++ b/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_settings.tsx @@ -92,7 +92,7 @@ export const StepSettings: React.FunctionComponent = React.memo( title={ @@ -110,7 +110,7 @@ export const StepSettings: React.FunctionComponent = React.memo( {i18n.translate( 'xpack.idxMgmt.formWizard.stepSettings.indexModeCallout.logisticsLinkLabel', { - defaultMessage: 'Logistics', + defaultMessage: 'Logistics step', } )} diff --git a/x-pack/test/functional/apps/index_management/index_template_wizard.ts b/x-pack/test/functional/apps/index_management/index_template_wizard.ts index d932b96d4f6a1..8103dfc0776db 100644 --- a/x-pack/test/functional/apps/index_management/index_template_wizard.ts +++ b/x-pack/test/functional/apps/index_management/index_template_wizard.ts @@ -70,7 +70,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { // Verify that index mode callout is displayed const indexModeCalloutText = await testSubjects.getVisibleText('indexModeCallout'); expect(indexModeCalloutText).to.be( - 'The index.mode setting has been set to Standard within template Logistics. Any changes to index.mode set on this page will be overwritten by the Logistics selection.' + 'The index.mode setting has been set to Standard within the Logistics step. Any changes to index.mode set on this page will be overwritten by the Logistics selection.' ); // Click Next button From d0f0809b0625cd81aec34e12ca60c7e8545f0b21 Mon Sep 17 00:00:00 2001 From: Tre Date: Mon, 25 Nov 2024 15:08:55 +0000 Subject: [PATCH 32/71] [Ownership] Assign test files to mgmt team (#200989) ## Summary Assign test files to mgmt team Contributes to: #192979 --- .github/CODEOWNERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 188430d89bddf..f6da54f1b3790 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1966,6 +1966,9 @@ x-pack/test/api_integration/apis/management/index_management/inference_endpoints /x-pack/test/functional_search/ @elastic/search-kibana # Management Experience - Deployment Management +/test/functional/fixtures/kbn_archiver/management.json @elastic/kibana-management @elastic/kibana-data-discovery # Assigned per 2 uses: test/functional/apps/management/_import_objects.ts && test/functional/apps/management/data_views/_scripted_fields_filter.ts +/x-pack/test/functional/fixtures/kbn_archiver/home/feature_controls/security/security.json @elastic/kibana-management +/x-pack/test/functional/es_archives/upgrade_assistant @elastic/kibana-management /x-pack/test/functional/services/ace_editor.js @elastic/kibana-management /x-pack/test/functional/page_objects/remote_clusters_page.ts @elastic/kibana-management /x-pack/test/stack_functional_integration/apps/ccs @elastic/kibana-management From f3bc0930745e8b82d4484130ef3483944655cdc2 Mon Sep 17 00:00:00 2001 From: Maria Iriarte <106958839+mariairiartef@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:23:48 +0100 Subject: [PATCH 33/71] [Lens] Update DatatableComponent header and footer styles and make background transparent (#199813) ## Summary Closes https://github.com/elastic/kibana/issues/193910 #### Description - Update Lens' current table visualization `EuiDataGrid` prop for `gridStyle` to use the shade value for `header` and `footer` - Make table's background transparent #### Screenshots ![Screenshot 2024-11-12 at 16 24 27](https://github.com/user-attachments/assets/b42d4daa-37ae-456d-9bd8-c6b6930b187b) ![Screenshot 2024-11-12 at 16 25 44](https://github.com/user-attachments/assets/6c69ea05-d915-4200-9c5c-6e19c9c32019) ![Screenshot 2024-11-13 at 11 02 47](https://github.com/user-attachments/assets/f530b74e-a238-456b-bbbc-e3d8607ec102) ### Checklist - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels) - [ ] This will appear in the **Release Notes** and follow the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../visualizations/datatable/components/table_basic.scss | 5 +++++ .../visualizations/datatable/components/table_basic.tsx | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.scss b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.scss index 0f0ed53a10021..117c6797c3620 100644 --- a/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.scss +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.scss @@ -1,5 +1,10 @@ .lnsDataTableContainer { height: 100%; + + // EUI issue to make background transparent https://github.com/elastic/eui/issues/8136 + .euiDataGrid__content { + background: transparent; + } } .lnsTableCell--multiline { diff --git a/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx index 0633c13b8097a..f30686a44a6ad 100644 --- a/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx @@ -70,7 +70,8 @@ export const DataContext = React.createContext({}); const gridStyle: EuiDataGridStyle = { border: 'horizontal', - header: 'underline', + header: 'shade', + footer: 'shade', }; export const DEFAULT_PAGE_SIZE = 10; From 0ab703e3ef0b5d93538f6406fb0b2a4837e5744a Mon Sep 17 00:00:00 2001 From: Tre Date: Mon, 25 Nov 2024 15:28:58 +0000 Subject: [PATCH 34/71] [Ownership] Assign test files to data discovery team (#200932) ## Summary Assign test files to data discovery team Contributes to: #192979 --- .github/CODEOWNERS | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f6da54f1b3790..0b1ff9850ad54 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1049,6 +1049,23 @@ x-pack/test_serverless/api_integration/test_suites/common/platform_security @ela # Data Discovery +/x-pack/test/functional/fixtures/kbn_archiver/kibana_scripted_fields_on_logstash.json @elastic/kibana-data-discovery # Assigned per only use: https://github.com/elastic/kibana/blob/main/x-pack/test/functional/apps/discover/async_scripted_fields.ts#L35 +/x-pack/test/functional/es_archives/getting_started/shakespeare @elastic/kibana-data-discovery +/x-pack/test/functional/fixtures/kbn_archiver/discover @elastic/kibana-data-discovery +/test/functional/fixtures/kbn_archiver/unmapped_fields.json @elastic/kibana-data-discovery # Assigned per only use: https://github.com/elastic/kibana/blob/main/test/functional/apps/discover/group7/_indexpattern_with_unmapped_fields.ts#L28 +/test/functional/fixtures/kbn_archiver/testlargestring.json @elastic/kibana-data-discovery # Assigned per only use: https://github.com/elastic/kibana/blob/main/test/functional/apps/discover/group5/_large_string.ts#L28 +/test/functional/fixtures/kbn_archiver/message_with_newline.json @elastic/kibana-data-discovery # Assigned per only use: https://github.com/elastic/kibana/blob/main/test/functional/apps/discover/classic/_doc_table_newline.ts#L26 +/test/functional/fixtures/kbn_archiver/invalid_scripted_field.json @elastic/kibana-data-discovery +/test/functional/fixtures/kbn_archiver/index_pattern_without_timefield.json @elastic/kibana-data-discovery +/test/functional/fixtures/kbn_archiver/discover @elastic/kibana-data-discovery +/test/functional/fixtures/kbn_archiver/discover.json @elastic/kibana-data-discovery +/test/functional/fixtures/kbn_archiver/date_nested.json @elastic/kibana-data-discovery +/test/functional/fixtures/kbn_archiver/date_* @elastic/kibana-data-discovery +/test/functional/fixtures/es_archiver/unmapped_fields @elastic/kibana-data-discovery # Assigned per the only use: https://github.com/elastic/kibana/blob/main/test/functional/apps/discover/group7/_indexpattern_with_unmapped_fields.ts#L26 +/test/functional/fixtures/es_archiver/message_with_newline @elastic/kibana-data-discovery # Assigned per the only use: https://github.com/elastic/kibana/blob/main/test/functional/apps/discover/classic/_doc_table_newline.ts#L24 +/test/functional/fixtures/es_archiver/hamlet @elastic/kibana-data-discovery # Assigned per the only use: https://github.com/elastic/kibana/blob/main/test/functional/apps/discover/group5/_large_string.ts#L30 +/test/api_integration/fixtures/kbn_archiver/index_patterns @elastic/kibana-data-discovery +/test/api_integration/fixtures/es_archiver/index_patterns @elastic/kibana-data-discovery /test/functional/fixtures/es_archiver/alias @elastic/kibana-data-discovery /test/functional/page_objects/context_page.ts @elastic/kibana-data-discovery /test/functional/services/data_views.ts @elastic/kibana-data-discovery From ff97e5234b58599a503c76549f41afb6ce595dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Marcondes?= <55978943+cauemarcondes@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:51:23 +0000 Subject: [PATCH 35/71] [Profiling x APM Integration] Use both host.hostname or host.name and container.id to correlate profiling data on APM (#201403) closes https://github.com/elastic/kibana/issues/180036 The logic now, first checks if there are `container.ids` on the selected service, if not, it falls back to the `host.name` or `host.hostname`. ## container.id Screenshot 2024-11-25 at 10 53 44 Screenshot 2024-11-25 at 10 53 55 Screenshot 2024-11-25 at 11 06 55 ## host.name Screenshot 2024-11-25 at 11 02 49 Screenshot 2024-11-25 at 11 03 00 Screenshot 2024-11-25 at 11 03 08 ## host.hostname Screenshot 2024-11-25 at 11 04 24 Screenshot 2024-11-25 at 11 04 34 Screenshot 2024-11-25 at 11 04 51 --- .../app/profiling_overview/filter_warning.tsx | 66 +++++++++++++++++++ .../host_names_filter_warning.tsx | 42 ------------ .../profiling_hosts_flamegraph.tsx | 13 ++-- .../profiling_hosts_top_functions.tsx | 13 ++-- ...s.ts => get_service_correlation_fields.ts} | 48 ++++++++++++-- .../server/routes/profiling/hosts/route.ts | 34 ++++++---- .../translations/translations/fr-FR.json | 11 ++-- .../translations/translations/ja-JP.json | 11 ++-- .../translations/translations/zh-CN.json | 11 ++-- 9 files changed, 160 insertions(+), 89 deletions(-) create mode 100644 x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/filter_warning.tsx delete mode 100644 x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/host_names_filter_warning.tsx rename x-pack/plugins/observability_solution/apm/server/routes/profiling/{get_service_host_names.ts => get_service_correlation_fields.ts} (51%) diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/filter_warning.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/filter_warning.tsx new file mode 100644 index 0000000000000..71b487ff626c5 --- /dev/null +++ b/x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/filter_warning.tsx @@ -0,0 +1,66 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText, EuiToolTip } from '@elastic/eui'; +import React from 'react'; +import { i18n } from '@kbn/i18n'; + +interface Props { + hostNames?: string[]; + containerIds?: string[]; +} + +export function FilterWarning({ containerIds = [], hostNames = [] }: Props) { + const hasContainerIds = containerIds.length > 0; + + return hasContainerIds ? ( + + ) : ( + + ); +} + +interface FilterWarningToolTipProps { + values: string[]; + label: string; +} +function FilterWarningToolTip({ values = [], label }: FilterWarningToolTipProps) { + function renderTooltipOptions() { + return ( +
    + {values.map((value) => ( +
  • {`- ${value}`}
  • + ))} +
+ ); + } + + return ( + + + + {label} + + + + + + + + + ); +} diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/host_names_filter_warning.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/host_names_filter_warning.tsx deleted file mode 100644 index 0f3fb6cdb69fb..0000000000000 --- a/x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/host_names_filter_warning.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText, EuiToolTip } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import React from 'react'; - -interface Props { - hostNames?: string[]; -} -export function HostnamesFilterWarning({ hostNames = [] }: Props) { - function renderTooltipOptions() { - return ( -
    - {hostNames.map((hostName) => ( -
  • {`- ${hostName}`}
  • - ))} -
- ); - } - - return ( - - - - {i18n.translate('xpack.apm.profiling.flamegraph.filteredLabel', { - defaultMessage: "Displaying profiling insights from the service's host(s)", - })} - - - - - - - - - ); -} diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/profiling_hosts_flamegraph.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/profiling_hosts_flamegraph.tsx index 92442d223390f..0d6681d942d55 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/profiling_hosts_flamegraph.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/profiling_overview/profiling_hosts_flamegraph.tsx @@ -9,12 +9,12 @@ import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import React from 'react'; import { ApmDataSourceWithSummary } from '../../../../common/data_source'; import { ApmDocumentType } from '../../../../common/document_type'; -import { HOST_NAME } from '../../../../common/es_fields/apm'; +import { CONTAINER_ID, HOST_NAME } from '../../../../common/es_fields/apm'; import { mergeKueries, toKueryFilterFormat } from '../../../../common/utils/kuery_utils'; import { useFetcher } from '../../../hooks/use_fetcher'; import { FlamegraphChart } from '../../shared/charts/flamegraph'; import { ProfilingFlamegraphLink } from '../../shared/profiling/flamegraph/flamegraph_link'; -import { HostnamesFilterWarning } from './host_names_filter_warning'; +import { FilterWarning } from './filter_warning'; interface Props { serviceName: string; @@ -60,17 +60,20 @@ export function ProfilingHostsFlamegraph({ [dataSource, serviceName, start, end, environment, kuery] ); - const hostNamesKueryFormat = toKueryFilterFormat(HOST_NAME, data?.hostNames || []); + const profilingKueryFilter = + data?.containerIds && data.containerIds.length > 0 + ? toKueryFilterFormat(CONTAINER_ID, data?.containerIds || []) + : toKueryFilterFormat(HOST_NAME, data?.hostNames || []); return ( <> - + 0 + ? toKueryFilterFormat(CONTAINER_ID, data?.containerIds || []) + : toKueryFilterFormat(HOST_NAME, data?.hostNames || []); return ( <> - + +) => buckets?.map((bucket) => bucket.key as string) || []; + +export async function getServiceCorrelationFields({ apmEventClient, serviceName, start, @@ -45,15 +58,36 @@ export async function getServiceHostNames({ }, }, aggs: { - hostNames: { + hostHostNames: { terms: { field: HOST_HOSTNAME, size: 500, }, }, + hostNames: { + terms: { + field: HOST_NAME, + size: 500, + }, + }, + containerIds: { + terms: { + field: CONTAINER_ID, + size: 500, + }, + }, }, }, }); - return response.aggregations?.hostNames.buckets.map((bucket) => bucket.key as string) || []; + const allHostNames = [ + ...getBucketKeysAsString(response.aggregations?.hostHostNames.buckets), + ...getBucketKeysAsString(response.aggregations?.hostNames.buckets), + ]; + const hostNames = new Set(allHostNames); + + return { + hostNames: Array.from(hostNames), + containerIds: getBucketKeysAsString(response.aggregations?.containerIds.buckets), + }; } diff --git a/x-pack/plugins/observability_solution/apm/server/routes/profiling/hosts/route.ts b/x-pack/plugins/observability_solution/apm/server/routes/profiling/hosts/route.ts index 5a748ddf5e11a..3ddd2782f1085 100644 --- a/x-pack/plugins/observability_solution/apm/server/routes/profiling/hosts/route.ts +++ b/x-pack/plugins/observability_solution/apm/server/routes/profiling/hosts/route.ts @@ -8,7 +8,7 @@ import { toNumberRt } from '@kbn/io-ts-utils'; import type { BaseFlameGraph, TopNFunctions } from '@kbn/profiling-utils'; import * as t from 'io-ts'; -import { HOST_NAME } from '../../../../common/es_fields/apm'; +import { CONTAINER_ID, HOST_NAME } from '../../../../common/es_fields/apm'; import { mergeKueries, toKueryFilterFormat } from '../../../../common/utils/kuery_utils'; import { getApmEventClient } from '../../../lib/helpers/get_apm_event_client'; import { createApmServerRoute } from '../../apm_routes/create_apm_server_route'; @@ -20,7 +20,7 @@ import { } from '../../default_api_types'; import { fetchFlamegraph } from '../fetch_flamegraph'; import { fetchFunctions } from '../fetch_functions'; -import { getServiceHostNames } from '../get_service_host_names'; +import { getServiceCorrelationFields } from '../get_service_correlation_fields'; const profilingHostsFlamegraphRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/services/{serviceName}/profiling/hosts/flamegraph', @@ -31,7 +31,9 @@ const profilingHostsFlamegraphRoute = createApmServerRoute({ options: { tags: ['access:apm'] }, handler: async ( resources - ): Promise<{ flamegraph: BaseFlameGraph; hostNames: string[] } | undefined> => { + ): Promise< + { flamegraph: BaseFlameGraph; hostNames: string[]; containerIds: string[] } | undefined + > => { const { context, plugins, params } = resources; const core = await context.core; const [esClient, apmEventClient, profilingDataAccessStart] = await Promise.all([ @@ -43,7 +45,7 @@ const profilingHostsFlamegraphRoute = createApmServerRoute({ const { start, end, environment, documentType, rollupInterval, kuery } = params.query; const { serviceName } = params.path; - const serviceHostNames = await getServiceHostNames({ + const { hostNames, containerIds } = await getServiceCorrelationFields({ apmEventClient, start, end, @@ -53,7 +55,7 @@ const profilingHostsFlamegraphRoute = createApmServerRoute({ rollupInterval, }); - if (!serviceHostNames.length) { + if (!hostNames.length && !containerIds.length) { return undefined; } const startSecs = start / 1000; @@ -65,10 +67,13 @@ const profilingHostsFlamegraphRoute = createApmServerRoute({ esClient: esClient.asCurrentUser, start: startSecs, end: endSecs, - kuery: mergeKueries([`(${toKueryFilterFormat(HOST_NAME, serviceHostNames)})`, kuery]), + kuery: + containerIds.length > 0 + ? mergeKueries([`(${toKueryFilterFormat(CONTAINER_ID, containerIds)})`, kuery]) + : mergeKueries([`(${toKueryFilterFormat(HOST_NAME, hostNames)})`, kuery]), }); - return { flamegraph, hostNames: serviceHostNames }; + return { flamegraph, hostNames, containerIds }; } return undefined; @@ -90,7 +95,9 @@ const profilingHostsFunctionsRoute = createApmServerRoute({ options: { tags: ['access:apm'] }, handler: async ( resources - ): Promise<{ functions: TopNFunctions; hostNames: string[] } | undefined> => { + ): Promise< + { functions: TopNFunctions; hostNames: string[]; containerIds: string[] } | undefined + > => { const { context, plugins, params } = resources; const core = await context.core; const [esClient, apmEventClient, profilingDataAccessStart] = await Promise.all([ @@ -103,7 +110,7 @@ const profilingHostsFunctionsRoute = createApmServerRoute({ params.query; const { serviceName } = params.path; - const serviceHostNames = await getServiceHostNames({ + const { hostNames, containerIds } = await getServiceCorrelationFields({ apmEventClient, start, end, @@ -113,7 +120,7 @@ const profilingHostsFunctionsRoute = createApmServerRoute({ rollupInterval, }); - if (!serviceHostNames.length) { + if (!hostNames.length && !containerIds.length) { return undefined; } @@ -128,10 +135,13 @@ const profilingHostsFunctionsRoute = createApmServerRoute({ endIndex, start: startSecs, end: endSecs, - kuery: mergeKueries([`(${toKueryFilterFormat(HOST_NAME, serviceHostNames)})`, kuery]), + kuery: + containerIds.length > 0 + ? mergeKueries([`(${toKueryFilterFormat(CONTAINER_ID, containerIds)})`, kuery]) + : mergeKueries([`(${toKueryFilterFormat(HOST_NAME, hostNames)})`, kuery]), }); - return { functions, hostNames: serviceHostNames }; + return { functions, hostNames, containerIds }; } return undefined; diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 0672227df5017..1034b3a6f01f7 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -11527,7 +11527,6 @@ "xpack.apm.profiling.callout.dismiss": "Rejeter", "xpack.apm.profiling.callout.learnMore": "En savoir plus", "xpack.apm.profiling.callout.title": "Affichage des informations de profilage de l'hôte ou des hôtes exécutant des services {serviceName}", - "xpack.apm.profiling.flamegraph.filteredLabel": "Affichage des informations de profilage du ou des hôtes des services", "xpack.apm.profiling.flamegraph.link": "Accéder au flame-graph d'Universal Profiling", "xpack.apm.profiling.flamegraph.noDataFound": "Aucune donnée trouvée", "xpack.apm.profiling.tabs.flamegraph": "Flame-graph", @@ -11696,8 +11695,8 @@ "xpack.apm.serviceIcons.service": "Service", "xpack.apm.serviceIcons.serviceDetails.cloud.architecture": "Architecture", "xpack.apm.serviceIcons.serviceDetails.cloud.availabilityZoneLabel": "{zones, plural, =0 {Zone de disponibilité} one {Zone de disponibilité} other {Zones de disponibilité}}", - "xpack.apm.serviceIcons.serviceDetails.cloud.functionNameLabel": "{functionNames, plural, =0 {Nom de fonction} one {Nom de fonction} other {Noms de fonction}}", "xpack.apm.serviceIcons.serviceDetails.cloud.faasTriggerTypeLabel": "{triggerTypes, plural, =0 {Type de déclencheur} one {Type de déclencheur} other {Types de déclencheurs}}", + "xpack.apm.serviceIcons.serviceDetails.cloud.functionNameLabel": "{functionNames, plural, =0 {Nom de fonction} one {Nom de fonction} other {Noms de fonction}}", "xpack.apm.serviceIcons.serviceDetails.cloud.machineTypesLabel": "{machineTypes, plural, =0{Type de machine} one {Type de machine} other {Types de machines}}", "xpack.apm.serviceIcons.serviceDetails.cloud.projectIdLabel": "ID de projet", "xpack.apm.serviceIcons.serviceDetails.cloud.providerLabel": "Fournisseur cloud", @@ -28259,8 +28258,8 @@ "xpack.maps.source.esSearch.descendingLabel": "décroissant", "xpack.maps.source.esSearch.extentFilterLabel": "Filtre dynamique pour les données de la zone de carte visible", "xpack.maps.source.esSearch.fieldNotFoundMsg": "Impossible de trouver \"{fieldName}\" dans le modèle d'indexation \"{indexPatternName}\".", - "xpack.maps.source.esSearch.geoFieldLabel": "Champ géospatial", "xpack.maps.source.esSearch.geofieldLabel": "Champ géospatial", + "xpack.maps.source.esSearch.geoFieldLabel": "Champ géospatial", "xpack.maps.source.esSearch.geoFieldTypeLabel": "Type de champ géospatial", "xpack.maps.source.esSearch.indexOverOneLengthEditError": "Votre vue de données pointe vers plusieurs index. Un seul index est autorisé par vue de données.", "xpack.maps.source.esSearch.indexZeroLengthEditError": "Votre vue de données ne pointe vers aucun index.", @@ -38012,8 +38011,8 @@ "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.maxAlertsFieldLessThanWarning": "Kibana ne permet qu'un maximum de {maxNumber} {maxNumber, plural, =1 {alerte} other {alertes}} par exécution de règle.", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.nameFieldRequiredError": "Nom obligatoire.", "xpack.securitySolution.detectionEngine.createRule.stepAboutrule.noteHelpText": "Ajouter un guide d'investigation sur les règles...", - "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.setupHelpText": "Fournissez des instructions sur les conditions préalables à la règle, telles que les intégrations requises, les étapes de configuration et tout ce qui est nécessaire au bon fonctionnement de la règle.", "xpack.securitySolution.detectionEngine.createRule.stepAboutrule.setupHelpText": "Ajouter le guide de configuration de règle...", + "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.setupHelpText": "Fournissez des instructions sur les conditions préalables à la règle, telles que les intégrations requises, les étapes de configuration et tout ce qui est nécessaire au bon fonctionnement de la règle.", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.setupLabel": "Guide de configuration", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.tagFieldEmptyError": "Une balise ne doit pas être vide", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.threatIndicatorPathFieldEmptyError": "Le remplacement du préfixe d'indicateur ne peut pas être vide.", @@ -43801,8 +43800,8 @@ "xpack.slo.sloEmbeddable.config.sloSelector.placeholder": "Sélectionner un SLO", "xpack.slo.sloEmbeddable.displayName": "Aperçu du SLO", "xpack.slo.sloEmbeddable.overview.sloNotFoundText": "Le SLO a été supprimé. Vous pouvez supprimer sans risque le widget du tableau de bord.", - "xpack.slo.sLOGridItem.targetFlexItemLabel": "Cible {target}", "xpack.slo.sloGridItem.targetFlexItemLabel": "Cible {target}", + "xpack.slo.sLOGridItem.targetFlexItemLabel": "Cible {target}", "xpack.slo.sloGroupConfiguration.customFiltersLabel": "Personnaliser le filtre", "xpack.slo.sloGroupConfiguration.customFiltersOptional": "Facultatif", "xpack.slo.sloGroupConfiguration.customFilterText": "Personnaliser le filtre", @@ -45327,8 +45326,8 @@ "xpack.stackConnectors.components.casesWebhookxpack.stackConnectors.components.casesWebhook.connectorTypeTitle": "Webhook - Données de gestion des cas", "xpack.stackConnectors.components.d3security.bodyCodeEditorAriaLabel": "Éditeur de code", "xpack.stackConnectors.components.d3security.bodyFieldLabel": "Corps", - "xpack.stackConnectors.components.d3Security.connectorTypeTitle": "D3 Security", "xpack.stackConnectors.components.d3security.connectorTypeTitle": "Données D3", + "xpack.stackConnectors.components.d3Security.connectorTypeTitle": "D3 Security", "xpack.stackConnectors.components.d3security.eventTypeFieldLabel": "Type d'événement", "xpack.stackConnectors.components.d3security.invalidActionText": "Nom d'action non valide.", "xpack.stackConnectors.components.d3security.requiredActionText": "L'action est requise.", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index c8781e36fe43a..b942c80200d9a 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -11510,7 +11510,6 @@ "xpack.apm.profiling.callout.dismiss": "閉じる", "xpack.apm.profiling.callout.learnMore": "詳細", "xpack.apm.profiling.callout.title": "{serviceName}サービスを実行しているホストからプロファイリングインサイトを表示しています", - "xpack.apm.profiling.flamegraph.filteredLabel": "サービスのホストからプロファイリングインサイトを表示しています", "xpack.apm.profiling.flamegraph.link": "ユニバーサルプロファイリングFlamegraphに移動", "xpack.apm.profiling.flamegraph.noDataFound": "データが見つかりません", "xpack.apm.profiling.tabs.flamegraph": "Flamegraph", @@ -11679,8 +11678,8 @@ "xpack.apm.serviceIcons.service": "サービス", "xpack.apm.serviceIcons.serviceDetails.cloud.architecture": "アーキテクチャー", "xpack.apm.serviceIcons.serviceDetails.cloud.availabilityZoneLabel": "{zones, plural, other {可用性ゾーン}}", - "xpack.apm.serviceIcons.serviceDetails.cloud.functionNameLabel": "{functionNames, plural, other {関数名}}", "xpack.apm.serviceIcons.serviceDetails.cloud.faasTriggerTypeLabel": "{triggerTypes, plural, other {トリガータイプ}}", + "xpack.apm.serviceIcons.serviceDetails.cloud.functionNameLabel": "{functionNames, plural, other {関数名}}", "xpack.apm.serviceIcons.serviceDetails.cloud.machineTypesLabel": "{machineTypes, plural, other {コンピュータータイプ} }\n", "xpack.apm.serviceIcons.serviceDetails.cloud.projectIdLabel": "プロジェクト ID", "xpack.apm.serviceIcons.serviceDetails.cloud.providerLabel": "クラウドプロバイダー", @@ -28231,8 +28230,8 @@ "xpack.maps.source.esSearch.descendingLabel": "降順", "xpack.maps.source.esSearch.extentFilterLabel": "マップの表示範囲でデータを動的にフィルタリング", "xpack.maps.source.esSearch.fieldNotFoundMsg": "インデックスパターン''{indexPatternName}''に''{fieldName}''が見つかりません。", - "xpack.maps.source.esSearch.geoFieldLabel": "地理空間フィールド", "xpack.maps.source.esSearch.geofieldLabel": "地理空間フィールド", + "xpack.maps.source.esSearch.geoFieldLabel": "地理空間フィールド", "xpack.maps.source.esSearch.geoFieldTypeLabel": "地理空間フィールドタイプ", "xpack.maps.source.esSearch.indexOverOneLengthEditError": "データビューは複数のインデックスを参照しています。データビューごとに1つのインデックスのみが許可されています。", "xpack.maps.source.esSearch.indexZeroLengthEditError": "データビューはどのインデックスも参照していません。", @@ -37979,8 +37978,8 @@ "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.maxAlertsFieldLessThanWarning": "Kibanaで許可される最大数は、1回の実行につき、{maxNumber} {maxNumber, plural, other {アラート}}です。", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.nameFieldRequiredError": "名前が必要です。", "xpack.securitySolution.detectionEngine.createRule.stepAboutrule.noteHelpText": "ルール調査ガイドを追加...", - "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.setupHelpText": "必要な統合、構成ステップ、ルールが正常に動作するために必要な他のすべての項目といった、ルール前提条件に関する指示を入力します。", "xpack.securitySolution.detectionEngine.createRule.stepAboutrule.setupHelpText": "ルールセットアップガイドを追加...", + "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.setupHelpText": "必要な統合、構成ステップ、ルールが正常に動作するために必要な他のすべての項目といった、ルール前提条件に関する指示を入力します。", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.setupLabel": "セットアップガイド", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.tagFieldEmptyError": "タグを空にすることはできません", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.threatIndicatorPathFieldEmptyError": "インジケータープレフィックスの無効化を空にすることはできません", @@ -43765,8 +43764,8 @@ "xpack.slo.sloEmbeddable.config.sloSelector.placeholder": "SLOを選択", "xpack.slo.sloEmbeddable.displayName": "SLO概要", "xpack.slo.sloEmbeddable.overview.sloNotFoundText": "SLOが削除されました。ウィジェットをダッシュボードから安全に削除できます。", - "xpack.slo.sLOGridItem.targetFlexItemLabel": "目標{target}", "xpack.slo.sloGridItem.targetFlexItemLabel": "目標{target}", + "xpack.slo.sLOGridItem.targetFlexItemLabel": "目標{target}", "xpack.slo.sloGroupConfiguration.customFiltersLabel": "カスタムフィルター", "xpack.slo.sloGroupConfiguration.customFiltersOptional": "オプション", "xpack.slo.sloGroupConfiguration.customFilterText": "カスタムフィルター", @@ -45286,8 +45285,8 @@ "xpack.stackConnectors.components.casesWebhookxpack.stackConnectors.components.casesWebhook.connectorTypeTitle": "Webフック - ケース管理データ", "xpack.stackConnectors.components.d3security.bodyCodeEditorAriaLabel": "コードエディター", "xpack.stackConnectors.components.d3security.bodyFieldLabel": "本文", - "xpack.stackConnectors.components.d3Security.connectorTypeTitle": "D3セキュリティ", "xpack.stackConnectors.components.d3security.connectorTypeTitle": "D3データ", + "xpack.stackConnectors.components.d3Security.connectorTypeTitle": "D3セキュリティ", "xpack.stackConnectors.components.d3security.eventTypeFieldLabel": "イベントタイプ", "xpack.stackConnectors.components.d3security.invalidActionText": "無効なアクション名です。", "xpack.stackConnectors.components.d3security.requiredActionText": "アクションが必要です。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index c6bb9b8da3ae9..e7b6beb56ccb5 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -11294,7 +11294,6 @@ "xpack.apm.profiling.callout.dismiss": "关闭", "xpack.apm.profiling.callout.learnMore": "了解详情", "xpack.apm.profiling.callout.title": "正在显示运行 {serviceName} 服务的主机中的分析洞见", - "xpack.apm.profiling.flamegraph.filteredLabel": "正在显示服务主机中的分析洞见", "xpack.apm.profiling.flamegraph.link": "前往 Universal Profiling 火焰图", "xpack.apm.profiling.flamegraph.noDataFound": "未找到任何数据", "xpack.apm.profiling.tabs.flamegraph": "火焰图", @@ -11449,8 +11448,8 @@ "xpack.apm.serviceIcons.service": "服务", "xpack.apm.serviceIcons.serviceDetails.cloud.architecture": "架构", "xpack.apm.serviceIcons.serviceDetails.cloud.availabilityZoneLabel": "{zones, plural, other {可用性区域}}", - "xpack.apm.serviceIcons.serviceDetails.cloud.functionNameLabel": "{functionNames, plural, other {功能名称}}", "xpack.apm.serviceIcons.serviceDetails.cloud.faasTriggerTypeLabel": "{triggerTypes, plural, other {触发类型}}", + "xpack.apm.serviceIcons.serviceDetails.cloud.functionNameLabel": "{functionNames, plural, other {功能名称}}", "xpack.apm.serviceIcons.serviceDetails.cloud.machineTypesLabel": "{machineTypes, plural, other {机器类型}}", "xpack.apm.serviceIcons.serviceDetails.cloud.projectIdLabel": "项目 ID", "xpack.apm.serviceIcons.serviceDetails.cloud.providerLabel": "云服务提供商", @@ -27740,8 +27739,8 @@ "xpack.maps.source.esSearch.convertToGeoJsonErrorMsg": "无法将搜索响应转换成 geoJson 功能集合,错误:{errorMsg}", "xpack.maps.source.esSearch.descendingLabel": "降序", "xpack.maps.source.esSearch.extentFilterLabel": "在可见地图区域中动态筛留数据", - "xpack.maps.source.esSearch.geoFieldLabel": "地理空间字段", "xpack.maps.source.esSearch.geofieldLabel": "地理空间字段", + "xpack.maps.source.esSearch.geoFieldLabel": "地理空间字段", "xpack.maps.source.esSearch.geoFieldTypeLabel": "地理空间字段类型", "xpack.maps.source.esSearch.indexOverOneLengthEditError": "您的数据视图指向多个索引。每个数据视图只允许一个索引。", "xpack.maps.source.esSearch.indexZeroLengthEditError": "您的数据视图未指向任何索引。", @@ -37376,8 +37375,8 @@ "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.maxAlertsFieldLessThanWarning": "每次规则运行时,Kibana 最多只允许 {maxNumber} 个{maxNumber, plural, other {告警}}。", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.nameFieldRequiredError": "名称必填。", "xpack.securitySolution.detectionEngine.createRule.stepAboutrule.noteHelpText": "添加规则调查指南......", - "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.setupHelpText": "提供有关规则先决条件的说明,如所需集成、配置步骤,以及规则正常运行所需的任何其他内容。", "xpack.securitySolution.detectionEngine.createRule.stepAboutrule.setupHelpText": "添加规则设置指南......", + "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.setupHelpText": "提供有关规则先决条件的说明,如所需集成、配置步骤,以及规则正常运行所需的任何其他内容。", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.setupLabel": "设置指南", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.tagFieldEmptyError": "标签不得为空", "xpack.securitySolution.detectionEngine.createRule.stepAboutRule.threatIndicatorPathFieldEmptyError": "指标前缀覆盖不得为空", @@ -43114,8 +43113,8 @@ "xpack.slo.sloEmbeddable.config.sloSelector.placeholder": "选择 SLO", "xpack.slo.sloEmbeddable.displayName": "SLO 概览", "xpack.slo.sloEmbeddable.overview.sloNotFoundText": "SLO 已删除。您可以放心从仪表板中删除小组件。", - "xpack.slo.sLOGridItem.targetFlexItemLabel": "目标 {target}", "xpack.slo.sloGridItem.targetFlexItemLabel": "目标 {target}", + "xpack.slo.sLOGridItem.targetFlexItemLabel": "目标 {target}", "xpack.slo.sloGroupConfiguration.customFiltersLabel": "定制筛选", "xpack.slo.sloGroupConfiguration.customFiltersOptional": "可选", "xpack.slo.sloGroupConfiguration.customFilterText": "定制筛选", @@ -44587,8 +44586,8 @@ "xpack.stackConnectors.components.casesWebhookxpack.stackConnectors.components.casesWebhook.connectorTypeTitle": "Webhook - 案例管理数据", "xpack.stackConnectors.components.d3security.bodyCodeEditorAriaLabel": "代码编辑器", "xpack.stackConnectors.components.d3security.bodyFieldLabel": "正文", - "xpack.stackConnectors.components.d3Security.connectorTypeTitle": "D3 Security", "xpack.stackConnectors.components.d3security.connectorTypeTitle": "D3 数据", + "xpack.stackConnectors.components.d3Security.connectorTypeTitle": "D3 Security", "xpack.stackConnectors.components.d3security.eventTypeFieldLabel": "事件类型", "xpack.stackConnectors.components.d3security.invalidActionText": "操作名称无效。", "xpack.stackConnectors.components.d3security.requiredActionText": "'操作'必填。", From f4be0979f2aa9735bd0d7dc60d72966cf81f6695 Mon Sep 17 00:00:00 2001 From: seanrathier Date: Mon, 25 Nov 2024 11:08:32 -0500 Subject: [PATCH 36/71] [Cloud Security] [Agentless] Create GHA Cloud Security workflow sanity tests for Agentless ESS deployments. (#192182) --- .../cloud_tests/agentless_api_sanity.ts | 52 ++++++++++ .../cloud_tests/agentless_sanity.ts | 98 ------------------- .../cloud_tests/index.ts | 1 + 3 files changed, 53 insertions(+), 98 deletions(-) create mode 100644 x-pack/test/cloud_security_posture_functional/cloud_tests/agentless_api_sanity.ts delete mode 100644 x-pack/test/cloud_security_posture_functional/cloud_tests/agentless_sanity.ts diff --git a/x-pack/test/cloud_security_posture_functional/cloud_tests/agentless_api_sanity.ts b/x-pack/test/cloud_security_posture_functional/cloud_tests/agentless_api_sanity.ts new file mode 100644 index 0000000000000..da4eb02a813c0 --- /dev/null +++ b/x-pack/test/cloud_security_posture_functional/cloud_tests/agentless_api_sanity.ts @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import type { FtrProviderContext } from '../ftr_provider_context'; +// eslint-disable-next-line import/no-default-export +export default function ({ getPageObjects, getService }: FtrProviderContext) { + const queryBar = getService('queryBar'); + const pageObjects = getPageObjects(['common', 'header', 'cisAddIntegration', 'findings']); + + describe('Agentless Cloud - Sanity Tests', function () { + this.tags(['cloud_security_posture_ui_sanity']); + + it(`should have agentless agent findings for AWS provider`, async () => { + const findings = pageObjects.findings; + + await findings.navigateToLatestFindingsPage(); + await pageObjects.header.waitUntilLoadingHasFinished(); + + await queryBar.setQuery('agent.name: *agentless* and cloud.provider : "aws"'); + await queryBar.submitQuery(); + await pageObjects.header.waitUntilLoadingHasFinished(); + + const agentlessFindingsRowsCount = await findings + .createDataTableObject('latest_findings_table') + .getRowsCount(); + + expect(agentlessFindingsRowsCount).to.be.greaterThan(0); + }); + + it(`should have agentless agent findings for Azure provider`, async () => { + const findings = pageObjects.findings; + + await findings.navigateToLatestFindingsPage(); + await pageObjects.header.waitUntilLoadingHasFinished(); + + await queryBar.setQuery('agent.name: *agentless* and cloud.provider : "gcp"'); + await queryBar.submitQuery(); + await pageObjects.header.waitUntilLoadingHasFinished(); + + const agentlessFindingsRowsCount = await findings + .createDataTableObject('latest_findings_table') + .getRowsCount(); + + expect(agentlessFindingsRowsCount).to.be.greaterThan(0); + }); + }); +} diff --git a/x-pack/test/cloud_security_posture_functional/cloud_tests/agentless_sanity.ts b/x-pack/test/cloud_security_posture_functional/cloud_tests/agentless_sanity.ts deleted file mode 100644 index d1a27bf5d8c1d..0000000000000 --- a/x-pack/test/cloud_security_posture_functional/cloud_tests/agentless_sanity.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { CLOUD_CREDENTIALS_PACKAGE_VERSION } from '@kbn/cloud-security-posture-plugin/common/constants'; -import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../ftr_provider_context'; -// eslint-disable-next-line import/no-default-export -export default function ({ getPageObjects, getService }: FtrProviderContext) { - const pageObjects = getPageObjects([ - 'common', - 'cspSecurity', - 'security', - 'header', - 'cisAddIntegration', - ]); - - const CIS_AWS_OPTION_TEST_ID = 'cisAwsTestId'; - - const AWS_SINGLE_ACCOUNT_TEST_ID = 'awsSingleTestId'; - - describe('Agentless cloud', function () { - let cisIntegration: typeof pageObjects.cisAddIntegration; - let cisIntegrationAws: typeof pageObjects.cisAddIntegration.cisAws; - - before(async () => { - cisIntegration = pageObjects.cisAddIntegration; - cisIntegrationAws = pageObjects.cisAddIntegration.cisAws; // Start the usage api mock server on port 8081 - }); - - after(async () => { - await pageObjects.cspSecurity.logout(); - }); - - it(`should create agentless-agent`, async () => { - const integrationPolicyName = `cloud_security_posture-${new Date().toISOString()}`; - await cisIntegration.navigateToAddIntegrationCspmWithVersionPage( - CLOUD_CREDENTIALS_PACKAGE_VERSION - ); - - await cisIntegration.clickOptionButton(CIS_AWS_OPTION_TEST_ID); - await cisIntegration.clickOptionButton(AWS_SINGLE_ACCOUNT_TEST_ID); - - await cisIntegration.inputIntegrationName(integrationPolicyName); - - await cisIntegration.selectSetupTechnology('agentless'); - await cisIntegration.selectAwsCredentials('direct'); - - await pageObjects.header.waitUntilLoadingHasFinished(); - - await cisIntegration.clickSaveButton(); - await pageObjects.header.waitUntilLoadingHasFinished(); - - expect(await cisIntegrationAws.showPostInstallCloudFormationModal()).to.be(false); - - await cisIntegration.navigateToIntegrationCspList(); - await pageObjects.header.waitUntilLoadingHasFinished(); - - expect(await cisIntegration.getFirstCspmIntegrationPageIntegration()).to.be( - integrationPolicyName - ); - expect(await cisIntegration.getFirstCspmIntegrationPageAgent()).to.be( - `Agentless policy for ${integrationPolicyName}` - ); - }); - - it(`should create default agent-based agent`, async () => { - const integrationPolicyName = `cloud_security_posture-${new Date().toISOString()}`; - - await cisIntegration.navigateToAddIntegrationCspmWithVersionPage( - CLOUD_CREDENTIALS_PACKAGE_VERSION - ); - - await cisIntegration.clickOptionButton(CIS_AWS_OPTION_TEST_ID); - await cisIntegration.clickOptionButton(AWS_SINGLE_ACCOUNT_TEST_ID); - - await cisIntegration.inputIntegrationName(integrationPolicyName); - - await cisIntegration.clickSaveButton(); - await pageObjects.header.waitUntilLoadingHasFinished(); - - expect(await cisIntegrationAws.showPostInstallCloudFormationModal()).to.be(true); - - const agentPolicyName = await cisIntegration.getAgentBasedPolicyValue(); - - await cisIntegration.navigateToIntegrationCspList(); - await pageObjects.header.waitUntilLoadingHasFinished(); - - expect(await cisIntegration.getFirstCspmIntegrationPageIntegration()).to.be( - integrationPolicyName - ); - expect(await cisIntegration.getFirstCspmIntegrationPageAgent()).to.be(agentPolicyName); - }); - }); -} diff --git a/x-pack/test/cloud_security_posture_functional/cloud_tests/index.ts b/x-pack/test/cloud_security_posture_functional/cloud_tests/index.ts index 80afb04563326..37e74d1d6ede5 100644 --- a/x-pack/test/cloud_security_posture_functional/cloud_tests/index.ts +++ b/x-pack/test/cloud_security_posture_functional/cloud_tests/index.ts @@ -10,6 +10,7 @@ import { FtrProviderContext } from '../ftr_provider_context'; // eslint-disable-next-line import/no-default-export export default function ({ loadTestFile }: FtrProviderContext) { describe('Cloud Security Posture', function () { + loadTestFile(require.resolve('./agentless_api_sanity')); loadTestFile(require.resolve('./dashboard_sanity')); loadTestFile(require.resolve('./benchmark_sanity')); loadTestFile(require.resolve('./findings_sanity')); From c6a278b3f4249d88dfd0bb96f3fd0cd91b1057e7 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Mon, 25 Nov 2024 17:10:19 +0100 Subject: [PATCH 37/71] [Console] Update location yml config (#201634) ## Summary Update location.yml with the missing entry from the newly added console definitions pipeline https://github.com/elastic/kibana/pull/200935 --- .buildkite/pipeline-resource-definitions/locations.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/pipeline-resource-definitions/locations.yml b/.buildkite/pipeline-resource-definitions/locations.yml index c88e37490eb43..ca454f64c2696 100644 --- a/.buildkite/pipeline-resource-definitions/locations.yml +++ b/.buildkite/pipeline-resource-definitions/locations.yml @@ -15,6 +15,7 @@ spec: - https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-artifacts-trigger.yml - https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-chrome-forward-testing.yml - https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-codeql.yml + - https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-console-definitions-sync.yml - https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-coverage-daily.yml - https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-deploy-project.yml - https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-es-forward-testing.yml From 493bd47db502aa98059ff75c32eedbc31bcfa726 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 25 Nov 2024 17:20:04 +0100 Subject: [PATCH 38/71] =?UTF-8?q?=F0=9F=8C=8A=20Data=20generation=20and=20?= =?UTF-8?q?fixes=20(#200783)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds a synthtrace scenario for the main logs streams endpoint called `slash_logs`. It can be invoked like this: ``` node scripts/synthtrace.js slash_logs --live --kibana=http://elastic:changeme@localhost:5601 --target=http://elastic:changeme@localhost:9200 --liveBucketSize=1000 ``` ## Changes on synthtrace I had to adapt a couple things: * Add the `--liveBucketSize` flag because it's really annoying to wait for a minute to see whether data gets processed correctly * Extend the existing log mock module that's also used for the unstructured logs scenario in a couple ways * Add the ability to route directly to an index by adding `_index` to a document (otherwise it will use the DSNS) ## Changes on streams I fixed a couple things I realized were broken: * Check whether a field exists before accessing it in the routing condition (otherwise it rejects the document) * Update ES objects in the right order - if the routing is put in place before the receiving child data stream is ready, it will auto-create an index with the wrong mapping * Allow to not specify a condition for a child - in this case it's not routing to this child * Set `subobjects: true` for now - otherwise fields are not indexed properly, I think this is an Elasticsearch bug, I will follow up on this with the Elasticsearch team * Set `dynamic: false` - that somehow got lost in refactorings --- .../src/lib/logs/index.ts | 20 + .../src/cli/run_synthtrace.ts | 5 + .../src/cli/utils/parse_run_cli_flags.ts | 3 +- .../src/cli/utils/start_live_data_upload.ts | 2 +- .../data_stream_get_routing_transform.ts | 2 +- .../src/scenarios/helpers/logs_mock_data.ts | 372 +++++++++++++++++- .../src/scenarios/slash_logs.ts | 137 +++++++ .../src/scenarios/unstructured_logs.ts | 19 +- x-pack/plugins/streams/common/types.ts | 2 +- .../component_templates/generate_layer.ts | 3 +- .../helpers/condition_to_painless.test.ts | 30 +- .../streams/helpers/condition_to_painless.ts | 2 +- .../streams/server/routes/streams/delete.ts | 1 + .../streams/server/routes/streams/edit.ts | 32 +- .../streams/server/routes/streams/fork.ts | 15 +- 15 files changed, 582 insertions(+), 63 deletions(-) create mode 100644 packages/kbn-apm-synthtrace/src/scenarios/slash_logs.ts diff --git a/packages/kbn-apm-synthtrace-client/src/lib/logs/index.ts b/packages/kbn-apm-synthtrace-client/src/lib/logs/index.ts index 8b3ed0cda1072..8fa7a5997f4f7 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/logs/index.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/logs/index.ts @@ -24,6 +24,7 @@ const defaultLogsOptions: LogsOptions = { export type LogDocument = Fields & Partial<{ + _index?: string; 'input.type': string; 'log.file.path'?: string; 'service.name'?: string; @@ -74,6 +75,14 @@ export type LogDocument = Fields & svc: string; hostname: string; [LONG_FIELD_NAME]: string; + 'http.status_code'?: number; + 'http.request.method'?: string; + 'url.path'?: string; + 'process.name'?: string; + 'kubernetes.namespace'?: string; + 'kubernetes.pod.name'?: string; + 'kubernetes.container.name'?: string; + 'orchestrator.resource.name'?: string; }>; class Log extends Serializable { @@ -155,6 +164,16 @@ function create(logsOptions: LogsOptions = defaultLogsOptions): Log { ).dataset('synth'); } +function createForIndex(index: string): Log { + return new Log( + { + 'input.type': 'logs', + _index: index, + }, + defaultLogsOptions + ); +} + function createMinimal({ dataset = 'synth', namespace = 'default', @@ -176,6 +195,7 @@ function createMinimal({ export const log = { create, + createForIndex, createMinimal, }; diff --git a/packages/kbn-apm-synthtrace/src/cli/run_synthtrace.ts b/packages/kbn-apm-synthtrace/src/cli/run_synthtrace.ts index d6f899b2084ac..f4646de82d19f 100644 --- a/packages/kbn-apm-synthtrace/src/cli/run_synthtrace.ts +++ b/packages/kbn-apm-synthtrace/src/cli/run_synthtrace.ts @@ -48,6 +48,11 @@ function options(y: Argv) { description: 'Generate and index data continuously', boolean: true, }) + .option('liveBucketSize', { + description: 'Bucket size in ms for live streaming', + default: 1000, + number: true, + }) .option('clean', { describe: 'Clean APM indices before indexing new data', default: false, diff --git a/packages/kbn-apm-synthtrace/src/cli/utils/parse_run_cli_flags.ts b/packages/kbn-apm-synthtrace/src/cli/utils/parse_run_cli_flags.ts index d069f89b168a2..1a7b82dcd364b 100644 --- a/packages/kbn-apm-synthtrace/src/cli/utils/parse_run_cli_flags.ts +++ b/packages/kbn-apm-synthtrace/src/cli/utils/parse_run_cli_flags.ts @@ -74,7 +74,8 @@ export function parseRunCliFlags(flags: RunCliFlags) { 'concurrency', 'versionOverride', 'clean', - 'assume-package-version' + 'assume-package-version', + 'liveBucketSize' ), logLevel: parsedLogLevel, file: parsedFile, diff --git a/packages/kbn-apm-synthtrace/src/cli/utils/start_live_data_upload.ts b/packages/kbn-apm-synthtrace/src/cli/utils/start_live_data_upload.ts index 38404be151612..9478ae8f26af2 100644 --- a/packages/kbn-apm-synthtrace/src/cli/utils/start_live_data_upload.ts +++ b/packages/kbn-apm-synthtrace/src/cli/utils/start_live_data_upload.ts @@ -52,7 +52,7 @@ export async function startLiveDataUpload({ }); } - const bucketSizeInMs = 1000 * 60; + const bucketSizeInMs = runOptions.liveBucketSize; let requestedUntil = start; let currentStreams: PassThrough[] = []; diff --git a/packages/kbn-apm-synthtrace/src/lib/shared/data_stream_get_routing_transform.ts b/packages/kbn-apm-synthtrace/src/lib/shared/data_stream_get_routing_transform.ts index 40d1b05878c04..daa631a5ff111 100644 --- a/packages/kbn-apm-synthtrace/src/lib/shared/data_stream_get_routing_transform.ts +++ b/packages/kbn-apm-synthtrace/src/lib/shared/data_stream_get_routing_transform.ts @@ -16,7 +16,7 @@ export function getRoutingTransform(dataStreamType: string) { transform(document: ESDocumentWithOperation, encoding, callback) { if ('data_stream.dataset' in document && 'data_stream.namespace' in document) { document._index = `${dataStreamType}-${document['data_stream.dataset']}-${document['data_stream.namespace']}`; - } else { + } else if (!('_index' in document)) { throw new Error('Cannot determine index for event'); } diff --git a/packages/kbn-apm-synthtrace/src/scenarios/helpers/logs_mock_data.ts b/packages/kbn-apm-synthtrace/src/scenarios/helpers/logs_mock_data.ts index 5f3cbd5f054dd..9a8e90f295c61 100644 --- a/packages/kbn-apm-synthtrace/src/scenarios/helpers/logs_mock_data.ts +++ b/packages/kbn-apm-synthtrace/src/scenarios/helpers/logs_mock_data.ts @@ -22,12 +22,351 @@ const { // Arrays for data const LOG_LEVELS: string[] = ['FATAL', 'ERROR', 'WARN', 'INFO', 'DEBUG', 'TRACE']; -const JAVA_LOG_MESSAGES = [ +export const LINUX_PROCESSES = ['cron', 'sshd', 'systemd', 'nginx', 'apache2']; + +// generate 20 short ids to cycle through +const shortIds = Array.from({ length: 20 }, (_, i) => generateShortId()); + +export function getStableShortId() { + return shortIds[Math.floor(Math.random() * shortIds.length)]; +} + +export const getLinuxMessages = () => + ({ + cron: [ + `(${moment().toISOString()}) INFO: (CRON) User ran command: '/usr/bin/backup.sh'.`, + `(${moment().toISOString()}) WARN: (CRON) Missing crontab entry for user .`, + `(${moment().toISOString()}) ERROR: (CRON) Failed to execute '/usr/bin/backup.sh'.`, + `(${moment().toISOString()}) INFO: (CRON) New cron job added for user .`, + `(${moment().toISOString()}) DEBUG: (CRON) Skipping execution of disabled job 'jobID-${getStableShortId()}'.`, + `(${moment().toISOString()}) INFO: (CRON) Daily backup completed successfully in ${Math.floor( + Math.random() * 300 + )} seconds.`, + `(${moment().toISOString()}) ERROR: (CRON) Syntax error in crontab file for user .`, + `(${moment().toISOString()}) INFO: (CRON) Purged old log files during job 'jobID-${getStableShortId()}'.`, + `(${moment().toISOString()}) WARN: (CRON) Job 'jobID-${getStableShortId()}' exceeded timeout of ${Math.floor( + Math.random() * 3600 + )} seconds.`, + `(${moment().toISOString()}) INFO: (CRON) Executing job 'jobID-${getStableShortId()}' as user .`, + ], + sshd: [ + `${moment().toISOString()} INFO: sshd[${Math.floor( + Math.random() * 10000 + )}]: Accepted password for user from ${getIpAddress()} port ${ + 1024 + Math.floor(Math.random() * 50000) + }.`, + `${moment().toISOString()} WARN: sshd[${Math.floor( + Math.random() * 10000 + )}]: Failed password attempt for user from ${getIpAddress()} port ${ + 1024 + Math.floor(Math.random() * 50000) + }.`, + `${moment().toISOString()} INFO: sshd[${Math.floor( + Math.random() * 10000 + )}]: Connection closed by ${getIpAddress()} port ${ + 1024 + Math.floor(Math.random() * 50000) + }.`, + `${moment().toISOString()} ERROR: sshd[${Math.floor( + Math.random() * 10000 + )}]: Invalid public key for user .`, + `${moment().toISOString()} INFO: sshd[${Math.floor( + Math.random() * 10000 + )}]: Starting session for user .`, + `${moment().toISOString()} WARN: sshd[${Math.floor( + Math.random() * 10000 + )}]: Too many authentication failures from ${getIpAddress()}.`, + `${moment().toISOString()} INFO: sshd[${Math.floor( + Math.random() * 10000 + )}]: User disconnected.`, + `${moment().toISOString()} ERROR: sshd[${Math.floor( + Math.random() * 10000 + )}]: Attempt to use forbidden user .`, + `${moment().toISOString()} INFO: sshd[${Math.floor( + Math.random() * 10000 + )}]: Received SIGHUP signal. Reloading configuration.`, + `${moment().toISOString()} DEBUG: sshd[${Math.floor( + Math.random() * 10000 + )}]: Monitoring connections on port 22.`, + ], + systemd: [ + `${moment().toISOString()} INFO: systemd[${Math.floor( + Math.random() * 10000 + )}]: Started service .`, + `${moment().toISOString()} ERROR: systemd[${Math.floor( + Math.random() * 10000 + )}]: Failed to start service .`, + `${moment().toISOString()} INFO: systemd[${Math.floor( + Math.random() * 10000 + )}]: Stopped service .`, + `${moment().toISOString()} DEBUG: systemd[${Math.floor( + Math.random() * 10000 + )}]: Reloading daemon configuration.`, + `${moment().toISOString()} WARN: systemd[${Math.floor( + Math.random() * 10000 + )}]: Service restarted too many times.`, + `${moment().toISOString()} INFO: systemd[${Math.floor( + Math.random() * 10000 + )}]: Mounted .`, + `${moment().toISOString()} ERROR: systemd[${Math.floor( + Math.random() * 10000 + )}]: Unit entered failed state.`, + `${moment().toISOString()} INFO: systemd[${Math.floor( + Math.random() * 10000 + )}]: Timer triggered.`, + `${moment().toISOString()} WARN: systemd[${Math.floor( + Math.random() * 10000 + )}]: Service is inactive.`, + `${moment().toISOString()} DEBUG: systemd[${Math.floor( + Math.random() * 10000 + )}]: Service received SIGTERM.`, + ], + nginx: [ + `${moment().toISOString()} INFO: nginx[${Math.floor( + Math.random() * 10000 + )}]: Access log: ${getIpAddress()} - - [${moment().format( + 'DD/MMM/YYYY:HH:mm:ss Z' + )}] "GET /path-${getStableShortId()} HTTP/1.1" ${ + 200 + Math.floor(Math.random() * 100) + } ${Math.floor(Math.random() * 10000)}.`, + `${moment().toISOString()} ERROR: nginx[${Math.floor( + Math.random() * 10000 + )}]: 502 Bad Gateway for request to /path-${getStableShortId()}.`, + `${moment().toISOString()} WARN: nginx[${Math.floor( + Math.random() * 10000 + )}]: Upstream server timed out on /path-${getStableShortId()}.`, + `${moment().toISOString()} INFO: nginx[${Math.floor( + Math.random() * 10000 + )}]: Server restarted successfully.`, + `${moment().toISOString()} DEBUG: nginx[${Math.floor( + Math.random() * 10000 + )}]: Cache hit for /path-${getStableShortId()}.`, + ], + apache2: [ + `${moment().toISOString()} INFO: apache2[${Math.floor( + Math.random() * 10000 + )}]: GET /path-${getStableShortId()} HTTP/1.1" ${ + 200 + Math.floor(Math.random() * 100) + } ${Math.floor(Math.random() * 10000)} bytes.`, + `${moment().toISOString()} ERROR: apache2[${Math.floor( + Math.random() * 10000 + )}]: 500 Internal Server Error for request /path-${getStableShortId()}.`, + `${moment().toISOString()} WARN: apache2[${Math.floor( + Math.random() * 10000 + )}]: Worker process terminated unexpectedly.`, + `${moment().toISOString()} INFO: apache2[${Math.floor( + Math.random() * 10000 + )}]: Server restarted.`, + `${moment().toISOString()} DEBUG: apache2[${Math.floor( + Math.random() * 10000 + )}]: Keep-alive timeout on connection ${Math.floor(Math.random() * 10000)}.`, + ], + } as Record); + +export const KUBERNETES_SERVICES = [ + 'auth-service', + 'payment-service', + 'inventory-service', + 'ui-service', + 'notification-service', +]; + +export const getKubernetesMessages = () => + ({ + 'auth-service': [ + `User authenticated successfully at ${moment().toISOString()}.`, + `Failed login attempt for user at ${moment().toISOString()}.`, + `Token expired for user .`, + `Session started for user .`, + `Password reset requested by user .`, + `Invalid JWT token provided for user .`, + `New user registered at ${moment().toISOString()}.`, + `MFA challenge triggered for user .`, + `MFA challenge succeeded for user .`, + `MFA challenge failed for user .`, + `Access revoked for user .`, + `User deleted their account.`, + `Permission granted for resource .`, + `Permission denied for resource .`, + `Role updated for user .`, + `User logged out.`, + `Invalid credentials provided for user .`, + `Security alert triggered at ${moment().toISOString()} for user .`, + `Session expired for user .`, + `Password changed successfully for user .`, + ], + 'payment-service': [ + `Payment of $${(Math.random() * 1000).toFixed( + 2 + )} processed successfully at ${moment().toISOString()}.`, + `Card declined for transaction .`, + `Refund initiated for transaction .`, + `Refund of $${(Math.random() * 500).toFixed(2)} processed successfully.`, + `Payment gateway timeout during transaction .`, + `Fraudulent transaction detected at ${moment().toISOString()}.`, + `Payment pending approval for transaction .`, + `Payment gateway configuration error.`, + `Payment of $${(Math.random() * 200).toFixed( + 2 + )} canceled by user .`, + `Recurring payment of $${(Math.random() * 50).toFixed(2)} initiated.`, + `Subscription for renewed successfully.`, + `Subscription for canceled.`, + `Invoice generated.`, + `Invoice sent to user .`, + `Payment method added for user .`, + `Payment method removed for user .`, + `Credit limit exceeded for user .`, + `Insufficient funds for transaction .`, + `Transaction rollback initiated for .`, + `Chargeback received for transaction .`, + ], + 'inventory-service': [ + `Stock level updated for item : ${Math.floor( + Math.random() * 500 + )} units remaining.`, + `Item added to catalog at ${moment().toISOString()}.`, + `Item removed from catalog.`, + `Stock alert for item : Low inventory (${Math.floor( + Math.random() * 20 + )} units left).`, + `Stock replenished for item .`, + `Inventory check completed for warehouse .`, + `Item flagged as discontinued.`, + `Bulk update performed on inventory.`, + `Price updated for item .`, + `Warehouse status: Operational.`, + `Warehouse reported system failure.`, + `Item backordered.`, + `New shipment received for item .`, + `Item sold out.`, + `Item marked for promotion.`, + `Warehouse restocked.`, + `Stock audit started at ${moment().toISOString()}.`, + `Inventory discrepancy reported for item .`, + `Restock delayed for item .`, + `Item reserved for order .`, + ], + 'ui-service': [ + `Page rendered successfully at ${moment().toISOString()}.`, + `User clicked button .`, + `API call to completed in ${Math.floor( + Math.random() * 300 + )}ms.`, + `UI component loaded successfully.`, + `UI component failed to load.`, + `Session timeout for user .`, + `Error rendering component : Invalid data.`, + `User navigated to .`, + `CSS stylesheet loaded.`, + `JavaScript file executed.`, + `UI error at ${moment().toISOString()}: Cannot read property 'undefined'.`, + `Form submitted by user .`, + `Dialog displayed.`, + `Modal closed by user.`, + `Drag-and-drop interaction started.`, + `Drag-and-drop interaction completed.`, + `Keyboard shortcut activated: Ctrl+${String.fromCharCode( + 65 + Math.floor(Math.random() * 26) + )}.`, + `New notification displayed to user .`, + `UI settings updated by user .`, + `User logged out from UI.`, + ], + 'notification-service': [ + `Email sent to user .`, + `Push notification delivered to user .`, + `SMS sent to phone number .`, + `Email delivery failed for user .`, + `Push notification failed for user .`, + `SMS delivery failed for phone number .`, + `User opted out of notifications.`, + `New email template created.`, + `New push notification template created.`, + `New SMS template created.`, + `Batch email sent to ${Math.floor(Math.random() * 500)} recipients.`, + `Batch push notifications sent to ${Math.floor(Math.random() * 500)} recipients.`, + `Batch SMS sent to ${Math.floor(Math.random() * 500)} recipients.`, + `Template deleted.`, + `Notification settings updated for user .`, + `Email verification sent to user .`, + `Password reset notification sent to user .`, + `Marketing email sent to user .`, + `Reminder notification sent to user .`, + `System maintenance notification sent to all users.`, + ], + } as Record); + +export const getJavaMessages = () => [ '[main] com.example1.core.ApplicationCore - Critical failure: NullPointerException encountered during startup', - '[main] com.example.service.UserService - User registration completed for userId: 12345', + '[main] com.example1.core.ApplicationCore - Application started successfully in 3456ms', + '[main] com.example1.core.ApplicationCore - Configuring bean "dataSource" of type HikariCP', + '[main] com.example1.core.ApplicationCore - Memory usage threshold exceeded. GC invoked.', + '[main] com.example1.core.ApplicationCore - Shutting down gracefully on SIGTERM', + + '[main] com.example2.service.PaymentService - Payment processed successfully for orderId: ORD-' + + generateShortId(), + '[main] com.example2.service.PaymentService - Failed to process payment for orderId: ORD-' + + generateShortId() + + '. Reason: Insufficient funds.', + '[main] com.example2.service.PaymentService - Payment gateway timeout for orderId: ORD-' + + generateShortId(), + '[main] com.example2.service.PaymentService - Initiating refund for transactionId: TXN-' + + generateShortId(), + '[main] com.example2.service.PaymentService - Payment retry attempt started for orderId: ORD-' + + generateShortId(), + '[main] com.example3.util.JsonParser - Parsing JSON response from external API', - '[main] com.example4.security.AuthManager - Unauthorized access attempt detected for userId: 67890', + '[main] com.example3.util.JsonParser - Invalid JSON encountered: {"invalid_key":"missing_value"}', + '[main] com.example3.util.JsonParser - Successfully parsed JSON for userId: ' + + Math.floor(Math.random() * 10000), + '[main] com.example3.util.JsonParser - JSON parsing failed due to org.json.JSONException: Unterminated string', + '[main] com.example3.util.JsonParser - Fallback to default configuration triggered due to parsing error', + + '[main] com.example4.security.AuthManager - Unauthorized access attempt detected for userId: ' + + Math.floor(Math.random() * 100000), + '[main] com.example4.security.AuthManager - Password updated for userId: ' + + Math.floor(Math.random() * 100000), + '[main] com.example4.security.AuthManager - User account locked after 3 failed login attempts for userId: ' + + Math.floor(Math.random() * 100000), + '[main] com.example4.security.AuthManager - Token validation failed for token: TOKEN-' + + generateShortId(), + '[main] com.example4.security.AuthManager - User session terminated for userId: ' + + Math.floor(Math.random() * 100000), + '[main] com.example5.dao.UserDao - Database query failed: java.sql.SQLException: Timeout expired', + '[main] com.example5.dao.UserDao - Retrieved 10 results for query: SELECT * FROM users WHERE status = "active"', + '[main] com.example5.dao.UserDao - Connection pool exhausted. Waiting for available connection.', + '[main] com.example5.dao.UserDao - Insert operation succeeded for userId: ' + + Math.floor(Math.random() * 100000), + '[main] com.example5.dao.UserDao - Detected stale connection. Retrying operation.', + + '[main] com.example6.metrics.MetricsCollector - Reporting CPU usage: ' + + (Math.random() * 100).toFixed(2) + + '%', + '[main] com.example6.metrics.MetricsCollector - Application uptime: ' + + Math.floor(Math.random() * 86400) + + ' seconds', + '[main] com.example6.metrics.MetricsCollector - Memory usage: Heap=128MB Non-Heap=64MB', + '[main] com.example6.metrics.MetricsCollector - GC activity detected. Time taken: ' + + Math.floor(Math.random() * 100) + + 'ms', + '[main] com.example6.metrics.MetricsCollector - Collected metrics for 15 services', + + '[main] com.example7.messaging.MessageQueue - Message published to queue "orders" with messageId: MSG-' + + generateShortId(), + '[main] com.example7.messaging.MessageQueue - Consumer failed to process messageId: MSG-' + + generateShortId() + + '. Error: NullPointerException', + '[main] com.example7.messaging.MessageQueue - Queue "notifications" has 50 pending messages', + '[main] com.example7.messaging.MessageQueue - Retrying message delivery for messageId: MSG-' + + generateShortId(), + '[main] com.example7.messaging.MessageQueue - Dead-letter queue reached maximum size. Oldest messages purged.', + + '[main] com.example8.integration.ExternalServiceClient - HTTP 200: Successfully received response from "https://api.example.com/v1/resource"', + '[main] com.example8.integration.ExternalServiceClient - HTTP 500: Internal Server Error while accessing "https://api.example.com/v1/resource"', + '[main] com.example8.integration.ExternalServiceClient - Connection timeout occurred after 30 seconds', + '[main] com.example8.integration.ExternalServiceClient - Retrying request to endpoint "https://api.example.com/v1/resource"', + '[main] com.example8.integration.ExternalServiceClient - API key validation failed for key: APIKEY-' + + generateShortId(), ]; const IP_ADDRESSES = [ @@ -71,14 +410,25 @@ export const getCloudRegion = (index?: number) => getAtIndexOrRandom(CLOUD_REGIO export const getServiceName = (index?: number) => getAtIndexOrRandom(SERVICE_NAMES, index); export const getAgentName = (index?: number) => getAtIndexOrRandom(ELASTIC_AGENT_NAMES, index); -export const getJavaLog = () => - `${moment().format('YYYY-MM-DD HH:mm:ss,SSS')} ${getAtIndexOrRandom( - LOG_LEVELS - )} ${getAtIndexOrRandom(JAVA_LOG_MESSAGES)}`; +export const getJavaLogs = () => { + const javaLogMessages = getJavaMessages(); + return getRandomRange().map( + () => + `${moment().format('YYYY-MM-DD HH:mm:ss,SSS')} ${getAtIndexOrRandom( + LOG_LEVELS + )} ${getAtIndexOrRandom(javaLogMessages)}` + ); +}; + +export function getRandomRange() { + return Array.from({ length: Math.floor(Math.random() * 1000) + 1 }).fill(null); +} -export const getWebLog = () => { - const path = `/api/${noun()}/${verb()}`; - const bytes = randomInt(100, 4000); +export const getWebLogs = () => { + return getRandomRange().map(() => { + const path = `/api/${noun()}/${verb()}`; + const bytes = randomInt(100, 4000); - return `${ipv4()} - - [${moment().toISOString()}] "${httpMethod()} ${path} HTTP/1.1" ${httpStatusCode()} ${bytes} "-" "${userAgent()}"`; + return `${ipv4()} - - [${moment().toISOString()}] "${httpMethod()} ${path} HTTP/1.1" ${httpStatusCode()} ${bytes} "-" "${userAgent()}"`; + }); }; diff --git a/packages/kbn-apm-synthtrace/src/scenarios/slash_logs.ts b/packages/kbn-apm-synthtrace/src/scenarios/slash_logs.ts new file mode 100644 index 0000000000000..26c998f658661 --- /dev/null +++ b/packages/kbn-apm-synthtrace/src/scenarios/slash_logs.ts @@ -0,0 +1,137 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { LogDocument, generateShortId, log } from '@kbn/apm-synthtrace-client'; +import { Scenario } from '../cli/scenario'; +import { withClient } from '../lib/utils/with_client'; +import { + getAgentName, + getCloudProvider, + getCloudRegion, + getIpAddress, + getJavaLogs, + getServiceName, + getWebLogs, + getKubernetesMessages, + getLinuxMessages, + KUBERNETES_SERVICES, + getStableShortId, + getRandomRange, +} from './helpers/logs_mock_data'; +import { getAtIndexOrRandom } from './helpers/get_at_index_or_random'; + +const LINUX_PROCESSES = ['cron', 'sshd', 'systemd', 'nginx', 'apache2']; + +const scenario: Scenario = async (runOptions) => { + const constructCommonMetadata = () => ({ + 'agent.name': getAgentName(), + 'cloud.provider': getCloudProvider(), + 'cloud.region': getCloudRegion(Math.floor(Math.random() * 3)), + 'cloud.availability_zone': `${getCloudRegion(0)}a`, + 'cloud.instance.id': generateShortId(), + 'cloud.project.id': generateShortId(), + }); + + const generateNginxLogs = (timestamp: number) => { + return getWebLogs().map((message) => { + return log + .createForIndex('logs') + .setHostIp(getIpAddress()) + .message(message) + .defaults({ + ...constructCommonMetadata(), + 'log.file.path': `/var/log/nginx/access-${getStableShortId()}.log`, + }) + .timestamp(timestamp); + }); + }; + + const generateSyslogData = (timestamp: number) => { + const messages: Record = getLinuxMessages(); + + return getRandomRange().map(() => { + const processName = getAtIndexOrRandom(LINUX_PROCESSES); + const message = getAtIndexOrRandom(messages[processName]); + return log + .createForIndex('logs') + .message(message) + .setHostIp(getIpAddress()) + .defaults({ + ...constructCommonMetadata(), + 'process.name': processName, + 'log.file.path': `/var/log/${processName}.log`, + }) + .timestamp(timestamp); + }); + }; + + const generateKubernetesLogs = (timestamp: number) => { + const messages: Record = getKubernetesMessages(); + + return getRandomRange().map(() => { + const service = getAtIndexOrRandom(KUBERNETES_SERVICES); + const isStringifiedJSON = Math.random() > 0.5; + const message = isStringifiedJSON + ? JSON.stringify({ + serviceName: service, + message: getAtIndexOrRandom(messages[service]), + }) + : getAtIndexOrRandom(messages[service]); + return log + .createForIndex('logs') + .message(message) + .setHostIp(getIpAddress()) + .defaults({ + ...constructCommonMetadata(), + 'kubernetes.namespace': 'default', + 'kubernetes.pod.name': `${service}-pod-${getStableShortId()}`, + 'kubernetes.container.name': `${service}-container`, + 'orchestrator.resource.name': service, + }) + .timestamp(timestamp); + }); + }; + + const generateUnparsedJavaLogs = (timestamp: number) => { + return getJavaLogs().map((message) => { + const serviceName = getServiceName(Math.floor(Math.random() * 3)); + return log + .createForIndex('logs') + .message(message) + .defaults({ + ...constructCommonMetadata(), + 'service.name': serviceName, + }) + .timestamp(timestamp); + }); + }; + + return { + generate: ({ range, clients: { logsEsClient } }) => { + const { logger } = runOptions; + + const nginxLogs = range.interval('1m').generator(generateNginxLogs); + const syslogData = range.interval('1m').generator(generateSyslogData); + const kubernetesLogs = range.interval('1m').generator(generateKubernetesLogs); + const unparsedJavaLogs = range.interval('1m').generator(generateUnparsedJavaLogs); + + return withClient( + logsEsClient, + logger.perf('generating_messy_logs', () => [ + nginxLogs, + syslogData, + kubernetesLogs, + unparsedJavaLogs, + ]) + ); + }, + }; +}; + +export default scenario; diff --git a/packages/kbn-apm-synthtrace/src/scenarios/unstructured_logs.ts b/packages/kbn-apm-synthtrace/src/scenarios/unstructured_logs.ts index 704cfd21bbc09..b87fd7038a7d3 100644 --- a/packages/kbn-apm-synthtrace/src/scenarios/unstructured_logs.ts +++ b/packages/kbn-apm-synthtrace/src/scenarios/unstructured_logs.ts @@ -12,7 +12,7 @@ import { Scenario } from '../cli/scenario'; import { IndexTemplateName } from '../lib/logs/custom_logsdb_index_templates'; import { withClient } from '../lib/utils/with_client'; import { parseLogsScenarioOpts } from './helpers/logs_scenario_opts_parser'; -import { getJavaLog, getWebLog } from './helpers/logs_mock_data'; +import { getJavaLogs, getWebLogs } from './helpers/logs_mock_data'; const scenario: Scenario = async (runOptions) => { const { isLogsDb } = parseLogsScenarioOpts(runOptions.scenarioOpts); @@ -23,19 +23,18 @@ const scenario: Scenario = async (runOptions) => { generate: ({ range, clients: { logsEsClient } }) => { const { logger } = runOptions; - const datasetJavaLogs = (timestamp: number) => - log.create({ isLogsDb }).dataset('java').message(getJavaLog()).timestamp(timestamp); - - const datasetWebLogs = (timestamp: number) => - log.create({ isLogsDb }).dataset('web').message(getWebLog()).timestamp(timestamp); - const logs = range .interval('1m') .rate(1) .generator((timestamp) => { - return Array(200) - .fill(0) - .flatMap((_, index) => [datasetJavaLogs(timestamp), datasetWebLogs(timestamp)]); + return [ + ...getJavaLogs().map((message) => + log.create({ isLogsDb }).dataset('java').message(message).timestamp(timestamp) + ), + ...getWebLogs().map((message) => + log.create({ isLogsDb }).dataset('web').message(message).timestamp(timestamp) + ), + ]; }); return withClient( diff --git a/x-pack/plugins/streams/common/types.ts b/x-pack/plugins/streams/common/types.ts index 6cdb2f923f6f4..d3aa43911ec2c 100644 --- a/x-pack/plugins/streams/common/types.ts +++ b/x-pack/plugins/streams/common/types.ts @@ -72,7 +72,7 @@ export const streamWithoutIdDefinitonSchema = z.object({ .array( z.object({ id: z.string(), - condition: conditionSchema, + condition: z.optional(conditionSchema), }) ) .default([]), diff --git a/x-pack/plugins/streams/server/lib/streams/component_templates/generate_layer.ts b/x-pack/plugins/streams/server/lib/streams/component_templates/generate_layer.ts index 82c89c9ab9171..4763aacb44478 100644 --- a/x-pack/plugins/streams/server/lib/streams/component_templates/generate_layer.ts +++ b/x-pack/plugins/streams/server/lib/streams/component_templates/generate_layer.ts @@ -30,7 +30,8 @@ export function generateLayer( template: { settings: isRoot(definition.id) ? logsSettings : {}, mappings: { - subobjects: false, + subobjects: true, // TODO set to false once this works on Elasticsearch side - right now fields are not properly indexed. + dynamic: false, properties, }, }, diff --git a/x-pack/plugins/streams/server/lib/streams/helpers/condition_to_painless.test.ts b/x-pack/plugins/streams/server/lib/streams/helpers/condition_to_painless.test.ts index aab7f27f12d14..8c63d7caa8811 100644 --- a/x-pack/plugins/streams/server/lib/streams/helpers/condition_to_painless.test.ts +++ b/x-pack/plugins/streams/server/lib/streams/helpers/condition_to_painless.test.ts @@ -7,48 +7,48 @@ import { conditionToPainless } from './condition_to_painless'; -const operatorConditionAndResutls = [ +const operatorConditionAndResults = [ { condition: { field: 'log.logger', operator: 'eq' as const, value: 'nginx_proxy' }, - result: 'ctx.log?.logger == "nginx_proxy"', + result: '(ctx.log?.logger !== null && ctx.log?.logger == "nginx_proxy")', }, { condition: { field: 'log.logger', operator: 'neq' as const, value: 'nginx_proxy' }, - result: 'ctx.log?.logger != "nginx_proxy"', + result: '(ctx.log?.logger !== null && ctx.log?.logger != "nginx_proxy")', }, { condition: { field: 'http.response.status_code', operator: 'lt' as const, value: 500 }, - result: 'ctx.http?.response?.status_code < 500', + result: '(ctx.http?.response?.status_code !== null && ctx.http?.response?.status_code < 500)', }, { condition: { field: 'http.response.status_code', operator: 'lte' as const, value: 500 }, - result: 'ctx.http?.response?.status_code <= 500', + result: '(ctx.http?.response?.status_code !== null && ctx.http?.response?.status_code <= 500)', }, { condition: { field: 'http.response.status_code', operator: 'gt' as const, value: 500 }, - result: 'ctx.http?.response?.status_code > 500', + result: '(ctx.http?.response?.status_code !== null && ctx.http?.response?.status_code > 500)', }, { condition: { field: 'http.response.status_code', operator: 'gte' as const, value: 500 }, - result: 'ctx.http?.response?.status_code >= 500', + result: '(ctx.http?.response?.status_code !== null && ctx.http?.response?.status_code >= 500)', }, { condition: { field: 'log.logger', operator: 'startsWith' as const, value: 'nginx' }, - result: 'ctx.log?.logger.startsWith("nginx")', + result: '(ctx.log?.logger !== null && ctx.log?.logger.startsWith("nginx"))', }, { condition: { field: 'log.logger', operator: 'endsWith' as const, value: 'proxy' }, - result: 'ctx.log?.logger.endsWith("proxy")', + result: '(ctx.log?.logger !== null && ctx.log?.logger.endsWith("proxy"))', }, { condition: { field: 'log.logger', operator: 'contains' as const, value: 'proxy' }, - result: 'ctx.log?.logger.contains("proxy")', + result: '(ctx.log?.logger !== null && ctx.log?.logger.contains("proxy"))', }, ]; describe('conditionToPainless', () => { describe('operators', () => { - operatorConditionAndResutls.forEach((setup) => { + operatorConditionAndResults.forEach((setup) => { test(`${setup.condition.operator}`, () => { expect(conditionToPainless(setup.condition)).toEqual(setup.result); }); @@ -65,7 +65,7 @@ describe('conditionToPainless', () => { }; expect( expect(conditionToPainless(condition)).toEqual( - 'ctx.log?.logger == "nginx_proxy" && ctx.log?.level == "error"' + '(ctx.log?.logger !== null && ctx.log?.logger == "nginx_proxy") && (ctx.log?.level !== null && ctx.log?.level == "error")' ) ); }); @@ -81,7 +81,7 @@ describe('conditionToPainless', () => { }; expect( expect(conditionToPainless(condition)).toEqual( - 'ctx.log?.logger == "nginx_proxy" || ctx.log?.level == "error"' + '(ctx.log?.logger !== null && ctx.log?.logger == "nginx_proxy") || (ctx.log?.level !== null && ctx.log?.level == "error")' ) ); }); @@ -102,7 +102,7 @@ describe('conditionToPainless', () => { }; expect( expect(conditionToPainless(condition)).toEqual( - 'ctx.log?.logger == "nginx_proxy" && (ctx.log?.level == "error" || ctx.log?.level == "ERROR")' + '(ctx.log?.logger !== null && ctx.log?.logger == "nginx_proxy") && ((ctx.log?.level !== null && ctx.log?.level == "error") || (ctx.log?.level !== null && ctx.log?.level == "ERROR"))' ) ); }); @@ -125,7 +125,7 @@ describe('conditionToPainless', () => { }; expect( expect(conditionToPainless(condition)).toEqual( - '(ctx.log?.logger == "nginx_proxy" || ctx.service?.name == "nginx") && (ctx.log?.level == "error" || ctx.log?.level == "ERROR")' + '((ctx.log?.logger !== null && ctx.log?.logger == "nginx_proxy") || (ctx.service?.name !== null && ctx.service?.name == "nginx")) && ((ctx.log?.level !== null && ctx.log?.level == "error") || (ctx.log?.level !== null && ctx.log?.level == "ERROR"))' ) ); }); diff --git a/x-pack/plugins/streams/server/lib/streams/helpers/condition_to_painless.ts b/x-pack/plugins/streams/server/lib/streams/helpers/condition_to_painless.ts index 539ad3603535b..2cccef260d7e1 100644 --- a/x-pack/plugins/streams/server/lib/streams/helpers/condition_to_painless.ts +++ b/x-pack/plugins/streams/server/lib/streams/helpers/condition_to_painless.ts @@ -69,7 +69,7 @@ function toPainless(condition: FilterCondition) { export function conditionToPainless(condition: Condition, nested = false): string { if (isFilterCondition(condition)) { - return toPainless(condition); + return `(${safePainlessField(condition)} !== null && ${toPainless(condition)})`; } if (isAndCondition(condition)) { const and = condition.and.map((filter) => conditionToPainless(filter, true)).join(' && '); diff --git a/x-pack/plugins/streams/server/routes/streams/delete.ts b/x-pack/plugins/streams/server/routes/streams/delete.ts index 369568ff9b7f0..a2092838792cf 100644 --- a/x-pack/plugins/streams/server/routes/streams/delete.ts +++ b/x-pack/plugins/streams/server/routes/streams/delete.ts @@ -52,6 +52,7 @@ export const deleteStreamRoute = createServerRoute({ throw new MalformedStreamId('Cannot delete root stream'); } + // need to update parent first to cut off documents streaming down await updateParentStream(scopedClusterClient, params.path.id, parentId, logger); await deleteStream(scopedClusterClient, params.path.id, logger); diff --git a/x-pack/plugins/streams/server/routes/streams/edit.ts b/x-pack/plugins/streams/server/routes/streams/edit.ts index 378f1ba3c8f01..cda73907d2302 100644 --- a/x-pack/plugins/streams/server/routes/streams/edit.ts +++ b/x-pack/plugins/streams/server/routes/streams/edit.ts @@ -57,22 +57,10 @@ export const editStreamRoute = createServerRoute({ const parentId = getParentId(params.path.id); let parentDefinition: StreamDefinition | undefined; - if (parentId) { - parentDefinition = await updateParentStream( - scopedClusterClient, - parentId, - params.path.id, - logger - ); - } const streamDefinition = { ...params.body }; - await syncStream({ - scopedClusterClient, - definition: { ...streamDefinition, id: params.path.id }, - rootDefinition: parentDefinition, - logger, - }); + // always need to go from the leaves to the parent when syncing ingest pipelines, otherwise data + // will be routed before the data stream is ready for (const child of streamDefinition.children) { const streamExists = await checkStreamExists({ @@ -97,6 +85,22 @@ export const editStreamRoute = createServerRoute({ }); } + await syncStream({ + scopedClusterClient, + definition: { ...streamDefinition, id: params.path.id }, + rootDefinition: parentDefinition, + logger, + }); + + if (parentId) { + parentDefinition = await updateParentStream( + scopedClusterClient, + parentId, + params.path.id, + logger + ); + } + return { acknowledged: true }; } catch (e) { if (e instanceof IndexTemplateNotFound || e instanceof DefinitionNotFound) { diff --git a/x-pack/plugins/streams/server/routes/streams/fork.ts b/x-pack/plugins/streams/server/routes/streams/fork.ts index 8294aebb0b0e9..12dce248dcdd1 100644 --- a/x-pack/plugins/streams/server/routes/streams/fork.ts +++ b/x-pack/plugins/streams/server/routes/streams/fork.ts @@ -76,21 +76,22 @@ export const forkStreamsRoute = createServerRoute({ params.body.stream.fields ); - rootDefinition.children.push({ - id: params.body.stream.id, - condition: params.body.condition, - }); - + // need to create the child first, otherwise we risk streaming data even though the child data stream is not ready await syncStream({ scopedClusterClient, - definition: rootDefinition, + definition: childDefinition, rootDefinition, logger, }); + rootDefinition.children.push({ + id: params.body.stream.id, + condition: params.body.condition, + }); + await syncStream({ scopedClusterClient, - definition: childDefinition, + definition: rootDefinition, rootDefinition, logger, }); From 77f08541e146ac071d18d1df52b2ab6284608df7 Mon Sep 17 00:00:00 2001 From: Sander Philipse <94373878+sphilipse@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:22:16 +0100 Subject: [PATCH 39/71] [Search] Fix button without a11y aria-label (#201236) Also adds a tooltip to the document count to explain why the count might differ. --- .../components/result/result_field.tsx | 6 ++++++ .../public/components/quick_stats/quick_stat.tsx | 8 ++++++++ .../public/components/quick_stats/quick_stats.tsx | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/packages/kbn-search-index-documents/components/result/result_field.tsx b/packages/kbn-search-index-documents/components/result/result_field.tsx index acd495f71cd44..cfc9263cf87fe 100644 --- a/packages/kbn-search-index-documents/components/result/result_field.tsx +++ b/packages/kbn-search-index-documents/components/result/result_field.tsx @@ -85,6 +85,12 @@ export const ResultField: React.FC = ({ setIsPopoverOpen(!isPopoverOpen)} iconType={iconType || (fieldType ? iconMap[fieldType] : defaultToken)} /> diff --git a/x-pack/plugins/search_indices/public/components/quick_stats/quick_stat.tsx b/x-pack/plugins/search_indices/public/components/quick_stats/quick_stat.tsx index cdd5f12408480..9df28ccec4bd6 100644 --- a/x-pack/plugins/search_indices/public/components/quick_stats/quick_stat.tsx +++ b/x-pack/plugins/search_indices/public/components/quick_stats/quick_stat.tsx @@ -18,6 +18,7 @@ import { EuiText, useEuiTheme, useGeneratedHtmlId, + EuiIconTip, } from '@elastic/eui'; interface BaseQuickStatProps { @@ -33,6 +34,7 @@ interface BaseQuickStatProps { }>; setOpen: (open: boolean) => void; first?: boolean; + tooltipContent?: string; } export const QuickStat: React.FC = ({ @@ -45,6 +47,7 @@ export const QuickStat: React.FC = ({ secondaryTitle, iconColor, content, + tooltipContent, ...rest }) => { const { euiTheme } = useEuiTheme(); @@ -93,6 +96,11 @@ export const QuickStat: React.FC = ({ {secondaryTitle}
+ {tooltipContent && ( + + + + )} } diff --git a/x-pack/plugins/search_indices/public/components/quick_stats/quick_stats.tsx b/x-pack/plugins/search_indices/public/components/quick_stats/quick_stats.tsx index e051fee17d2e2..de1ebe0a8dccf 100644 --- a/x-pack/plugins/search_indices/public/components/quick_stats/quick_stats.tsx +++ b/x-pack/plugins/search_indices/public/components/quick_stats/quick_stats.tsx @@ -28,6 +28,7 @@ export interface QuickStatsProps { index: Index; mappings: Mappings; indexDocuments: IndexDocuments; + tooltipContent?: string; } export const SetupAISearchButton: React.FC = () => { @@ -107,6 +108,10 @@ export const QuickStats: React.FC = ({ index, mappings, indexDo description: index.size ?? '0b', }, ]} + tooltipContent={i18n.translate('xpack.searchIndices.quickStats.documentCountTooltip', { + defaultMessage: + 'This excludes nested documents, which Elasticsearch uses internally to store chunks of vectors.', + })} first /> From ac5e9b6653ace0b715cf5b1e60e4e3901b133045 Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 25 Nov 2024 10:23:31 -0600 Subject: [PATCH 40/71] [ci] Remove archive kibana distribution (#199565) This isn't used, carryover from jenkins. https://github.com/elastic/kibana/blob/cfbb8db093e73b47b1ba3c45495bb401d0c57e23/test/scripts/jenkins_xpack_build_kibana.sh#L20-L26 --- .buildkite/scripts/build_kibana.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.buildkite/scripts/build_kibana.sh b/.buildkite/scripts/build_kibana.sh index b9e35097bbbff..acebf857504d5 100755 --- a/.buildkite/scripts/build_kibana.sh +++ b/.buildkite/scripts/build_kibana.sh @@ -42,12 +42,3 @@ if is_pr_with_label "ci:build-cloud-image"; then Kibana cloud image: \`$CLOUD_IMAGE\` EOF fi - -echo "--- Archive Kibana Distribution" -version="$(jq -r '.version' package.json)" -linuxBuild="$KIBANA_DIR/target/kibana-$version-SNAPSHOT-linux-x86_64.tar.gz" -installDir="$KIBANA_DIR/install/kibana" -mkdir -p "$installDir" -tar -xzf "$linuxBuild" -C "$installDir" --strip=1 -mkdir -p "$KIBANA_BUILD_LOCATION" -cp -pR install/kibana/. "$KIBANA_BUILD_LOCATION/" From a81a47404a1dbe4baabf38849e41aeeb46c1c0ca Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 26 Nov 2024 03:30:55 +1100 Subject: [PATCH 41/71] skip failing test suite (#200748) --- test/functional/apps/dashboard/group6/view_edit.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/functional/apps/dashboard/group6/view_edit.ts b/test/functional/apps/dashboard/group6/view_edit.ts index 487adc753e652..9304b51d302d5 100644 --- a/test/functional/apps/dashboard/group6/view_edit.ts +++ b/test/functional/apps/dashboard/group6/view_edit.ts @@ -25,7 +25,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const filterBar = getService('filterBar'); const security = getService('security'); - describe('dashboard view edit mode', function viewEditModeTests() { + // Failing: See https://github.com/elastic/kibana/issues/200748 + describe.skip('dashboard view edit mode', function viewEditModeTests() { before(async () => { await kibanaServer.savedObjects.cleanStandardList(); await kibanaServer.importExport.load( From 33f06c5a85b4effa6442b87bed4d139c44ff92d1 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 26 Nov 2024 03:31:07 +1100 Subject: [PATCH 42/71] skip failing test suite (#201071) --- test/functional/apps/discover/group4/_data_view_edit.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/functional/apps/discover/group4/_data_view_edit.ts b/test/functional/apps/discover/group4/_data_view_edit.ts index c0c5216010191..809902857eac5 100644 --- a/test/functional/apps/discover/group4/_data_view_edit.ts +++ b/test/functional/apps/discover/group4/_data_view_edit.ts @@ -25,7 +25,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'unifiedFieldList', ]); - describe('data view flyout', function () { + // Failing: See https://github.com/elastic/kibana/issues/201071 + describe.skip('data view flyout', function () { before(async () => { await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']); await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json'); From 280961c9628e4880155655e4f8c910123cf67c4e Mon Sep 17 00:00:00 2001 From: "Eyo O. Eyo" <7893459+eokoneyo@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:33:22 +0100 Subject: [PATCH 43/71] [React18] Migrate test suites to account for testing library upgrades obs-knowledge-team,obs-ux-infra_services-team (#201169) This PR migrates test suites that use `renderHook` from the library `@testing-library/react-hooks` to adopt the equivalent and replacement of `renderHook` from the export that is now available from `@testing-library/react`. This work is required for the planned migration to react18. ## Context In this PR, usages of `waitForNextUpdate` that previously could have been destructured from `renderHook` are now been replaced with `waitFor` exported from `@testing-library/react`, furthermore `waitFor` that would also have been destructured from the same renderHook result is now been replaced with `waitFor` from the export of `@testing-library/react`. ***Why is `waitFor` a sufficient enough replacement for `waitForNextUpdate`, and better for testing values subject to async computations?*** WaitFor will retry the provided callback if an error is returned, till the configured timeout elapses. By default the retry interval is `50ms` with a timeout value of `1000ms` that effectively translates to at least 20 retries for assertions placed within waitFor. See https://testing-library.com/docs/dom-testing-library/api-async/#waitfor for more information. This however means that for person's writing tests, said person has to be explicit about expectations that describe the internal state of the hook being tested. This implies checking for instance when a react query hook is being rendered, there's an assertion that said hook isn't loading anymore. In this PR you'd notice that this pattern has been adopted, with most existing assertions following an invocation of `waitForNextUpdate` being placed within a `waitFor` invocation. In some cases the replacement is simply a `waitFor(() => new Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for point out exactly why this works), where this suffices the assertions that follow aren't placed within a waitFor so this PR doesn't get larger than it needs to be. It's also worth pointing out this PR might also contain changes to test and application code to improve said existing test. ### What to do next? 1. Review the changes in this PR. 2. If you think the changes are correct, approve the PR. ## Any questions? If you have any questions or need help with this PR, please leave comments in this PR. Co-authored-by: Elastic Machine --- .../container/use_container_metrics_table.test.ts | 8 +++++++- .../host/use_host_metrics_table.test.ts | 8 +++++++- .../pod/use_pod_metrics_table.test.ts | 8 +++++++- .../pages/link_to/use_asset_detail_redirect.test.tsx | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/container/use_container_metrics_table.test.ts b/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/container/use_container_metrics_table.test.ts index ec22fe1df6f91..d9da73336bf0a 100644 --- a/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/container/use_container_metrics_table.test.ts +++ b/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/container/use_container_metrics_table.test.ts @@ -7,7 +7,7 @@ import { useContainerMetricsTable } from './use_container_metrics_table'; import { useInfrastructureNodeMetrics } from '../shared'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { createMetricsClientMock } from '../test_helpers'; jest.mock('../shared', () => ({ @@ -33,6 +33,12 @@ describe('useContainerMetricsTable hook', () => { }, }; + // include this to prevent rendering error in test + useInfrastructureNodeMetricsMock.mockReturnValue({ + isLoading: true, + data: { state: 'empty-indices' }, + }); + renderHook(() => useContainerMetricsTable({ timerange: { from: 'now-30d', to: 'now' }, diff --git a/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/host/use_host_metrics_table.test.ts b/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/host/use_host_metrics_table.test.ts index f34fccc6e442e..ab21b0c1ca76c 100644 --- a/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/host/use_host_metrics_table.test.ts +++ b/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/host/use_host_metrics_table.test.ts @@ -7,7 +7,7 @@ import { useHostMetricsTable } from './use_host_metrics_table'; import { useInfrastructureNodeMetrics } from '../shared'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { createMetricsClientMock } from '../test_helpers'; jest.mock('../shared', () => ({ @@ -40,6 +40,12 @@ describe('useHostMetricsTable hook', () => { }, }; + // include this to prevent rendering error in test + useInfrastructureNodeMetricsMock.mockReturnValue({ + isLoading: true, + data: { state: 'empty-indices' }, + }); + renderHook(() => useHostMetricsTable({ timerange: { from: 'now-30d', to: 'now' }, diff --git a/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/pod/use_pod_metrics_table.test.ts b/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/pod/use_pod_metrics_table.test.ts index fc6d14b03d08b..14f3330e856ad 100644 --- a/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/pod/use_pod_metrics_table.test.ts +++ b/x-pack/plugins/observability_solution/metrics_data_access/public/components/infrastructure_node_metrics_tables/pod/use_pod_metrics_table.test.ts @@ -7,7 +7,7 @@ import { usePodMetricsTable } from './use_pod_metrics_table'; import { useInfrastructureNodeMetrics } from '../shared'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { createMetricsClientMock } from '../test_helpers'; jest.mock('../shared', () => ({ @@ -33,6 +33,12 @@ describe('usePodMetricsTable hook', () => { }, }; + // include this to prevent rendering error in test + useInfrastructureNodeMetricsMock.mockReturnValue({ + isLoading: true, + data: { state: 'empty-indices' }, + }); + renderHook(() => usePodMetricsTable({ timerange: { from: 'now-30d', to: 'now' }, diff --git a/x-pack/plugins/observability_solution/metrics_data_access/public/pages/link_to/use_asset_detail_redirect.test.tsx b/x-pack/plugins/observability_solution/metrics_data_access/public/pages/link_to/use_asset_detail_redirect.test.tsx index cf783e78bd67e..1183979d60581 100644 --- a/x-pack/plugins/observability_solution/metrics_data_access/public/pages/link_to/use_asset_detail_redirect.test.tsx +++ b/x-pack/plugins/observability_solution/metrics_data_access/public/pages/link_to/use_asset_detail_redirect.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { coreMock } from '@kbn/core/public/mocks'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; From dea9312246554c6af0ce148e2ec967bb5f9cca8a Mon Sep 17 00:00:00 2001 From: Maxim Palenov Date: Mon, 25 Nov 2024 18:12:35 +0100 Subject: [PATCH 44/71] [Security Solution] Unlock Prebuil Rules Customization workflow for rules with missing base version (#201301) **Resolves: https://github.com/elastic/kibana/issues/200904** ## Summary This PR unlocks Prebuilt Rules Customization workflow for rules with missing base version. ## Details Each Prebuilt Rule update contains `version` diff. `version` is a special non-customizable field we use to track prebuilt rule version. It always gets target rule version's value after rule upgrade. A generic `numberDiffAlgorithm` algorithm was used for `version` field. It produces a `SOLVABLE` conflict when rule's base version is missing. It blocked the workflow in UI. We check the number of field with conflicts versus resolved conflicts to decide when a rule is ready for upgrade. In case `version` field got a conflict user had no possibility to resolve it. The fix adds a new `forceTargetVersionDiffAlgorithm` diff algorithm applied only for `version` field. It produces a non-conflict diff all the time even when base version is missing. The reason behind is that `version` always gets target rule's version. --- ...orce_target_version_diff_algorithm.test.ts | 78 +++++++++++++++++++ .../force_target_version_diff_algorithm.ts | 45 +++++++++++ .../diff/calculation/algorithms/index.ts | 1 + .../calculation/calculate_rule_fields_diff.ts | 7 +- ...eview_prebuilt_rules.data_source_fields.ts | 6 +- ..._review_prebuilt_rules.eql_query_fields.ts | 6 +- ...review_prebuilt_rules.esql_query_fields.ts | 6 +- ..._review_prebuilt_rules.kql_query_fields.ts | 6 +- ...prebuilt_rules.multi_line_string_fields.ts | 4 +- ...ade_review_prebuilt_rules.number_fields.ts | 6 +- ..._review_prebuilt_rules.rule_type_fields.ts | 6 +- ...view_prebuilt_rules.scalar_array_fields.ts | 6 +- ...rebuilt_rules.single_line_string_fields.ts | 6 +- 13 files changed, 156 insertions(+), 27 deletions(-) create mode 100644 x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/force_target_version_diff_algorithm.test.ts create mode 100644 x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/force_target_version_diff_algorithm.ts diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/force_target_version_diff_algorithm.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/force_target_version_diff_algorithm.test.ts new file mode 100644 index 0000000000000..f6035c9e87ca0 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/force_target_version_diff_algorithm.test.ts @@ -0,0 +1,78 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { ThreeVersionsOf } from '../../../../../../../../common/api/detection_engine'; +import { + ThreeWayMergeOutcome, + MissingVersion, + ThreeWayDiffConflict, +} from '../../../../../../../../common/api/detection_engine'; +import { forceTargetVersionDiffAlgorithm } from './force_target_version_diff_algorithm'; + +describe('forceTargetVersionDiffAlgorithm', () => { + describe('when base version exists', () => { + it('returns a NON conflict diff', () => { + const mockVersions: ThreeVersionsOf = { + base_version: 1, + current_version: 1, + target_version: 2, + }; + + const result = forceTargetVersionDiffAlgorithm(mockVersions); + + expect(result).toMatchObject({ + conflict: ThreeWayDiffConflict.NONE, + }); + }); + + it('return merge outcome TARGET', () => { + const mockVersions: ThreeVersionsOf = { + base_version: 1, + current_version: 1, + target_version: 2, + }; + + const result = forceTargetVersionDiffAlgorithm(mockVersions); + + expect(result).toMatchObject({ + has_base_version: true, + merge_outcome: ThreeWayMergeOutcome.Target, + }); + }); + }); + + describe('when base version missing', () => { + it('returns a NON conflict diff', () => { + const mockVersions: ThreeVersionsOf = { + base_version: MissingVersion, + current_version: 1, + target_version: 2, + }; + + const result = forceTargetVersionDiffAlgorithm(mockVersions); + + expect(result).toMatchObject({ + conflict: ThreeWayDiffConflict.NONE, + }); + }); + + it('return merge outcome TARGET', () => { + const mockVersions: ThreeVersionsOf = { + base_version: MissingVersion, + current_version: 1, + target_version: 2, + }; + + const result = forceTargetVersionDiffAlgorithm(mockVersions); + + expect(result).toMatchObject({ + has_base_version: false, + merge_outcome: ThreeWayMergeOutcome.Target, + }); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/force_target_version_diff_algorithm.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/force_target_version_diff_algorithm.ts new file mode 100644 index 0000000000000..ed19be0275aec --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/force_target_version_diff_algorithm.ts @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { + ThreeVersionsOf, + ThreeWayDiff, +} from '../../../../../../../../common/api/detection_engine/prebuilt_rules'; +import { + MissingVersion, + ThreeWayDiffConflict, + ThreeWayMergeOutcome, + determineDiffOutcome, +} from '../../../../../../../../common/api/detection_engine/prebuilt_rules'; + +/** + * Diff algorithm forcing target version. Useful for special fields like `version`. + */ +export const forceTargetVersionDiffAlgorithm = ( + versions: ThreeVersionsOf +): ThreeWayDiff => { + const { + base_version: baseVersion, + current_version: currentVersion, + target_version: targetVersion, + } = versions; + const hasBaseVersion = baseVersion !== MissingVersion; + const hasUpdate = targetVersion !== currentVersion; + + return { + has_base_version: hasBaseVersion, + base_version: hasBaseVersion ? baseVersion : undefined, + current_version: currentVersion, + target_version: targetVersion, + merged_version: targetVersion, + merge_outcome: ThreeWayMergeOutcome.Target, + + diff_outcome: determineDiffOutcome(baseVersion, currentVersion, targetVersion), + has_update: hasUpdate, + conflict: ThreeWayDiffConflict.NONE, + }; +}; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/index.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/index.ts index c8b55a49edc00..b0f192cf70e42 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/index.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/algorithms/index.ts @@ -15,3 +15,4 @@ export { kqlQueryDiffAlgorithm } from './kql_query_diff_algorithm'; export { eqlQueryDiffAlgorithm } from './eql_query_diff_algorithm'; export { esqlQueryDiffAlgorithm } from './esql_query_diff_algorithm'; export { ruleTypeDiffAlgorithm } from './rule_type_diff_algorithm'; +export { forceTargetVersionDiffAlgorithm } from './force_target_version_diff_algorithm'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/calculate_rule_fields_diff.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/calculate_rule_fields_diff.ts index 5730af03789d1..78ea28137bbf5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/calculate_rule_fields_diff.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/diff/calculation/calculate_rule_fields_diff.ts @@ -48,6 +48,7 @@ import { eqlQueryDiffAlgorithm, esqlQueryDiffAlgorithm, ruleTypeDiffAlgorithm, + forceTargetVersionDiffAlgorithm, } from './algorithms'; const BASE_TYPE_ERROR = `Base version can't be of different rule type`; @@ -179,7 +180,11 @@ const calculateCommonFieldsDiff = ( const commonFieldsDiffAlgorithms: FieldsDiffAlgorithmsFor = { rule_id: simpleDiffAlgorithm, - version: numberDiffAlgorithm, + /** + * `version` shouldn't have a conflict. It always get target value automatically. + * Diff has informational purpose. + */ + version: forceTargetVersionDiffAlgorithm, name: singleLineStringDiffAlgorithm, tags: scalarArrayDiffAlgorithm, description: multiLineStringDiffAlgorithm, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.data_source_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.data_source_fields.ts index f3b009a8ade47..b95208856a275 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.data_source_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.data_source_fields.ts @@ -897,11 +897,11 @@ export default ({ getService }: FtrProviderContext): void => { expect(fieldDiffObject.data_source).toBeUndefined(); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(1); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // version is considered conflict + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(0); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); - expect(reviewResponse.stats.num_rules_with_conflicts).toBe(1); + expect(reviewResponse.stats.num_rules_with_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_with_non_solvable_conflicts).toBe(0); }); }); @@ -958,7 +958,7 @@ export default ({ getService }: FtrProviderContext): void => { }); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(2); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(2); // version + tags + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // tags expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.eql_query_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.eql_query_fields.ts index f500f8691485b..eef3e4b6b7ce4 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.eql_query_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.eql_query_fields.ts @@ -382,11 +382,11 @@ export default ({ getService }: FtrProviderContext): void => { expect(fieldDiffObject.eql_query).toBeUndefined(); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(1); // `version` is considered an updated field - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // `version` is considered conflict + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(0); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); - expect(reviewResponse.stats.num_rules_with_conflicts).toBe(1); + expect(reviewResponse.stats.num_rules_with_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_with_non_solvable_conflicts).toBe(0); }); }); @@ -451,7 +451,7 @@ export default ({ getService }: FtrProviderContext): void => { }); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(2); // version + query - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(2); // version + query + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // query expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.esql_query_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.esql_query_fields.ts index f77f59b16a3e1..9561393e84549 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.esql_query_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.esql_query_fields.ts @@ -356,11 +356,11 @@ export default ({ getService }: FtrProviderContext): void => { expect(fieldDiffObject.esql_query).toBeUndefined(); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(1); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // version is considered conflict + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(0); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); - expect(reviewResponse.stats.num_rules_with_conflicts).toBe(1); + expect(reviewResponse.stats.num_rules_with_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_with_non_solvable_conflicts).toBe(0); }); }); @@ -420,7 +420,7 @@ export default ({ getService }: FtrProviderContext): void => { }); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(2); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(2); // version + query + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // query expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.kql_query_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.kql_query_fields.ts index 3afb63a4c7975..e8f9d2f48b9e0 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.kql_query_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.kql_query_fields.ts @@ -1042,11 +1042,11 @@ export default ({ getService }: FtrProviderContext): void => { expect(fieldDiffObject.kql_query).toBeUndefined(); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(1); // `version` is considered an updated field - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // `version` is considered conflict + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(0); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); - expect(reviewResponse.stats.num_rules_with_conflicts).toBe(1); + expect(reviewResponse.stats.num_rules_with_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_with_non_solvable_conflicts).toBe(0); }); }); @@ -1114,7 +1114,7 @@ export default ({ getService }: FtrProviderContext): void => { }); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(2); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(2); // version + query + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // query expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.multi_line_string_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.multi_line_string_fields.ts index d9c20fc28b43a..23bfd08f5b520 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.multi_line_string_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.multi_line_string_fields.ts @@ -386,7 +386,7 @@ export default ({ getService }: FtrProviderContext): void => { expect(reviewResponse.rules[0].diff.fields.description).toBeUndefined(); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(1); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(0); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); }); }); @@ -430,7 +430,7 @@ export default ({ getService }: FtrProviderContext): void => { has_base_version: false, }); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(2); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(2); + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.number_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.number_fields.ts index 51ab509d16904..bd059ec137a96 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.number_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.number_fields.ts @@ -274,11 +274,11 @@ export default ({ getService }: FtrProviderContext): void => { expect(reviewResponse.rules[0].diff.fields.risk_score).toBeUndefined(); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(1); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(0); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); - expect(reviewResponse.stats.num_rules_with_conflicts).toBe(1); + expect(reviewResponse.stats.num_rules_with_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_with_non_solvable_conflicts).toBe(0); }); }); @@ -322,7 +322,7 @@ export default ({ getService }: FtrProviderContext): void => { has_base_version: false, }); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(2); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(2); + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.rule_type_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.rule_type_fields.ts index 0764bac554bf5..3f6784108487c 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.rule_type_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.rule_type_fields.ts @@ -298,11 +298,11 @@ export default ({ getService }: FtrProviderContext): void => { expect(reviewResponse.rules[0].diff.fields.type).toBeUndefined(); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(1); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // version is considered a conflict + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(0); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); - expect(reviewResponse.stats.num_rules_with_conflicts).toBe(1); + expect(reviewResponse.stats.num_rules_with_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_with_non_solvable_conflicts).toBe(0); }); }); @@ -348,7 +348,7 @@ export default ({ getService }: FtrProviderContext): void => { }); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(3); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(3); // type + version + query are all considered conflicts + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(2); // type + query are all considered conflicts expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(1); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.scalar_array_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.scalar_array_fields.ts index 503a51f84f812..881e8e6122175 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.scalar_array_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.scalar_array_fields.ts @@ -423,11 +423,11 @@ export default ({ getService }: FtrProviderContext): void => { expect(reviewResponse.rules[0].diff.fields.tags).toBeUndefined(); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(1); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // version is considered conflict + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(0); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); - expect(reviewResponse.stats.num_rules_with_conflicts).toBe(1); + expect(reviewResponse.stats.num_rules_with_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_with_non_solvable_conflicts).toBe(0); }); }); @@ -472,7 +472,7 @@ export default ({ getService }: FtrProviderContext): void => { }); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(2); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(2); // version + tags + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // tags expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.single_line_string_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.single_line_string_fields.ts index b887e18813ec6..6fe10b9fa6012 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.single_line_string_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/upgrade_review_prebuilt_rules.single_line_string_fields.ts @@ -277,11 +277,11 @@ export default ({ getService }: FtrProviderContext): void => { expect(reviewResponse.rules[0].diff.fields.name).toBeUndefined(); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(1); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // version is considered a conflict + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(0); expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); - expect(reviewResponse.stats.num_rules_with_conflicts).toBe(1); + expect(reviewResponse.stats.num_rules_with_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_with_non_solvable_conflicts).toBe(0); }); }); @@ -326,7 +326,7 @@ export default ({ getService }: FtrProviderContext): void => { }); expect(reviewResponse.rules[0].diff.num_fields_with_updates).toBe(2); - expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(2); // name + version are both considered conflicts + expect(reviewResponse.rules[0].diff.num_fields_with_conflicts).toBe(1); // name is considered as a conflict expect(reviewResponse.rules[0].diff.num_fields_with_non_solvable_conflicts).toBe(0); expect(reviewResponse.stats.num_rules_to_upgrade_total).toBe(1); From ce27885874821627849f15ed11da5b73029df6ad Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 25 Nov 2024 18:27:43 +0100 Subject: [PATCH 45/71] Make dashboard listing load faster (#201401) ## Summary close https://github.com/elastic/kibana-team/issues/1239 close https://github.com/elastic/kibana/issues/193109 This PR is an easy improvement to make dashboard listing load faster for deployments with a lot of dashboards. See the investigation: https://github.com/elastic/kibana-team/issues/1239#issuecomment-2491145140 For our overview cluster by excluding not needed references we reduce the **gzipped** response size from **~550kb -> ~75kb** Longer term we should implement proper server-side pagination --- .../hooks/use_dashboard_listing_table.tsx | 4 + .../content_management/dashboard_storage.ts | 5 +- .../content_management/v3/cm_services.ts | 1 + .../v3/transform_utils.test.ts | 58 +++++++++++++- .../content_management/v3/transform_utils.ts | 27 +++++-- .../content_management/dashboard_search.ts | 76 +++++++++++++++++++ .../apis/content_management/index.ts | 1 + 7 files changed, 165 insertions(+), 7 deletions(-) create mode 100644 x-pack/test/api_integration/apis/content_management/dashboard_search.ts diff --git a/src/plugins/dashboard/public/dashboard_listing/hooks/use_dashboard_listing_table.tsx b/src/plugins/dashboard/public/dashboard_listing/hooks/use_dashboard_listing_table.tsx index 6c8c8f11d6a13..e434fe19d7b26 100644 --- a/src/plugins/dashboard/public/dashboard_listing/hooks/use_dashboard_listing_table.tsx +++ b/src/plugins/dashboard/public/dashboard_listing/hooks/use_dashboard_listing_table.tsx @@ -213,6 +213,10 @@ export const useDashboardListingTable = ({ size: listingLimit, hasReference: references, hasNoReference: referencesToExclude, + options: { + // include only tags references in the response to save bandwidth + includeReferences: ['tag'], + }, }) .then(({ total, hits }) => { const searchEndTime = window.performance.now(); diff --git a/src/plugins/dashboard/server/content_management/dashboard_storage.ts b/src/plugins/dashboard/server/content_management/dashboard_storage.ts index e65002802989f..d113d509f5e89 100644 --- a/src/plugins/dashboard/server/content_management/dashboard_storage.ts +++ b/src/plugins/dashboard/server/content_management/dashboard_storage.ts @@ -341,7 +341,10 @@ export class DashboardStorage { const soResponse = await soClient.find(soQuery); const hits = soResponse.saved_objects .map((so) => { - const { item } = savedObjectToItem(so, false, soQuery.fields); + const { item } = savedObjectToItem(so, false, { + allowedAttributes: soQuery.fields, + allowedReferences: optionsToLatest?.includeReferences, + }); return item; }) // Ignore any saved objects that failed to convert to items. diff --git a/src/plugins/dashboard/server/content_management/v3/cm_services.ts b/src/plugins/dashboard/server/content_management/v3/cm_services.ts index e086d1cc1460a..d2a53309704c6 100644 --- a/src/plugins/dashboard/server/content_management/v3/cm_services.ts +++ b/src/plugins/dashboard/server/content_management/v3/cm_services.ts @@ -437,6 +437,7 @@ export const dashboardSearchOptionsSchema = schema.maybe( { onlyTitle: schema.maybe(schema.boolean()), fields: schema.maybe(schema.arrayOf(schema.string())), + includeReferences: schema.maybe(schema.arrayOf(schema.oneOf([schema.literal('tag')]))), kuery: schema.maybe(schema.string()), cursor: schema.maybe(schema.number()), limit: schema.maybe(schema.number()), diff --git a/src/plugins/dashboard/server/content_management/v3/transform_utils.test.ts b/src/plugins/dashboard/server/content_management/v3/transform_utils.test.ts index 627f1c4211033..1cb10c8a10def 100644 --- a/src/plugins/dashboard/server/content_management/v3/transform_utils.test.ts +++ b/src/plugins/dashboard/server/content_management/v3/transform_utils.test.ts @@ -432,7 +432,9 @@ describe('savedObjectToItem', () => { }, }; - const { item, error } = savedObjectToItem(input, true, ['title', 'description']); + const { item, error } = savedObjectToItem(input, true, { + allowedAttributes: ['title', 'description'], + }); expect(error).toBeNull(); expect(item).toEqual({ ...commonSavedObject, @@ -457,6 +459,60 @@ describe('savedObjectToItem', () => { expect(item).toBeNull(); expect(error).not.toBe(null); }); + + it('should include only requested references', () => { + const input = { + ...commonSavedObject, + references: [ + { + type: 'tag', + id: 'tag1', + name: 'tag-ref-tag1', + }, + { + type: 'index-pattern', + id: 'index-pattern1', + name: 'index-pattern-ref-index-pattern1', + }, + ], + attributes: { + title: 'title', + description: 'my description', + timeRestore: false, + }, + }; + + { + const { item } = savedObjectToItem(input, true, { + allowedAttributes: ['title', 'description'], + }); + expect(item?.references).toEqual(input.references); + } + + { + const { item } = savedObjectToItem(input, true, { + allowedAttributes: ['title', 'description'], + allowedReferences: ['tag'], + }); + expect(item?.references).toEqual([input.references[0]]); + } + + { + const { item } = savedObjectToItem(input, true, { + allowedAttributes: ['title', 'description'], + allowedReferences: [], + }); + expect(item?.references).toEqual([]); + } + + { + const { item } = savedObjectToItem({ ...input, references: undefined }, true, { + allowedAttributes: ['title', 'description'], + allowedReferences: [], + }); + expect(item?.references).toBeUndefined(); + } + }); }); describe('getResultV3ToV2', () => { diff --git a/src/plugins/dashboard/server/content_management/v3/transform_utils.ts b/src/plugins/dashboard/server/content_management/v3/transform_utils.ts index 843dd59f849f3..18c9085df4ec0 100644 --- a/src/plugins/dashboard/server/content_management/v3/transform_utils.ts +++ b/src/plugins/dashboard/server/content_management/v3/transform_utils.ts @@ -304,24 +304,35 @@ type PartialSavedObject = Omit>, 'references'> & { references: SavedObjectReference[] | undefined; }; +export interface SavedObjectToItemOptions { + /** + * attributes to include in the output item + */ + allowedAttributes?: string[]; + /** + * references to include in the output item + */ + allowedReferences?: string[]; +} + export function savedObjectToItem( savedObject: SavedObject, partial: false, - allowedAttributes?: string[] + opts?: SavedObjectToItemOptions ): SavedObjectToItemReturn; export function savedObjectToItem( savedObject: PartialSavedObject, partial: true, - allowedAttributes?: string[] + opts?: SavedObjectToItemOptions ): SavedObjectToItemReturn; export function savedObjectToItem( savedObject: | SavedObject | PartialSavedObject, - partial: boolean, - allowedAttributes?: string[] + partial: boolean /* partial arg is used to enforce the correct savedObject type */, + { allowedAttributes, allowedReferences }: SavedObjectToItemOptions = {} ): SavedObjectToItemReturn { const { id, @@ -342,6 +353,12 @@ export function savedObjectToItem( const attributesOut = allowedAttributes ? pick(dashboardAttributesOut(attributes), allowedAttributes) : dashboardAttributesOut(attributes); + + // if includeReferences is provided, only include references of those types + const referencesOut = allowedReferences + ? references?.filter((reference) => allowedReferences.includes(reference.type)) + : references; + return { item: { id, @@ -353,7 +370,7 @@ export function savedObjectToItem( attributes: attributesOut, error, namespaces, - references, + references: referencesOut, version, managed, }, diff --git a/x-pack/test/api_integration/apis/content_management/dashboard_search.ts b/x-pack/test/api_integration/apis/content_management/dashboard_search.ts new file mode 100644 index 0000000000000..9a1739d508d1f --- /dev/null +++ b/x-pack/test/api_integration/apis/content_management/dashboard_search.ts @@ -0,0 +1,76 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { sampleDashboard } from './helpers'; + +export default function ({ getService }: FtrProviderContext) { + const kibanaServer = getService('kibanaServer'); + const supertest = getService('supertest'); + + describe('search dashboards', function () { + const createPayload = { + ...sampleDashboard, + options: { + ...sampleDashboard.options, + references: [ + { + type: 'tag', + id: 'tag1', + name: 'tag-ref-tag1', + }, + { + type: 'index-pattern', + id: 'index-pattern1', + name: 'index-pattern-ref-index-pattern1', + }, + ], + }, + }; + before(async () => { + await kibanaServer.savedObjects.clean({ + types: ['dashboard'], + }); + + await supertest + .post('/api/content_management/rpc/create') + .set('kbn-xsrf', 'true') + .send(createPayload) + .expect(200); + }); + + it('can specify references to return', async () => { + const searchPayload = { + contentTypeId: 'dashboard', + version: 3, + query: {}, + options: {}, + }; + + { + const { body } = await supertest + .post('/api/content_management/rpc/search') + .set('kbn-xsrf', 'true') + .send(searchPayload) + .expect(200); + + expect(body.result.result.hits[0].references).to.eql(createPayload.options.references); + } + + { + const { body } = await supertest + .post('/api/content_management/rpc/search') + .set('kbn-xsrf', 'true') + .send({ ...searchPayload, options: { includeReferences: ['tag'] } }) + .expect(200); + + expect(body.result.result.hits[0].references).to.eql([createPayload.options.references[0]]); + } + }); + }); +} diff --git a/x-pack/test/api_integration/apis/content_management/index.ts b/x-pack/test/api_integration/apis/content_management/index.ts index 992aafa74d27b..26541d6e7e468 100644 --- a/x-pack/test/api_integration/apis/content_management/index.ts +++ b/x-pack/test/api_integration/apis/content_management/index.ts @@ -12,5 +12,6 @@ export default function ({ loadTestFile, getService }: FtrProviderContext) { loadTestFile(require.resolve('./created_by')); loadTestFile(require.resolve('./updated_by')); loadTestFile(require.resolve('./favorites')); + loadTestFile(require.resolve('./dashboard_search')); }); } From eb41db27b195bc363ff47bc22ff05ea345c5aa08 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Mon, 25 Nov 2024 18:46:08 +0100 Subject: [PATCH 46/71] [Console] Always render editor hover states below the cursor (#201415) --- .../application/containers/editor/monaco_editor.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/console/public/application/containers/editor/monaco_editor.tsx b/src/plugins/console/public/application/containers/editor/monaco_editor.tsx index bc174b772bb1c..3e4728da27ae3 100644 --- a/src/plugins/console/public/application/containers/editor/monaco_editor.tsx +++ b/src/plugins/console/public/application/containers/editor/monaco_editor.tsx @@ -211,9 +211,11 @@ export const MonacoEditor = ({ localStorageValue, value, setValue }: EditorProps fontSize: settings.fontSize, wordWrap: settings.wrapMode === true ? 'on' : 'off', theme: CONSOLE_THEME_ID, - // Make the quick-fix window be fixed to the window rather than clipped by - // the parent content set with overflow: hidden/auto - fixedOverflowWidgets: true, + // Force the hover views to always render below the cursor to avoid clipping + // when the cursor is near the top of the editor. + hover: { + above: false, + }, }} suggestionProvider={suggestionProvider} enableFindAction={true} From b6586a95f2f5fb0bd79a5d79bfd6ae85d91adbe4 Mon Sep 17 00:00:00 2001 From: Sergi Massaneda Date: Mon, 25 Nov 2024 18:48:02 +0100 Subject: [PATCH 47/71] [Siem migrations] Implement UI service and migrations polling (#201503) ## Summary Sends "Rule migration complete" notifications from anywhere in the Security Solution app, whenever a rule migration finishes, with a link to the migrated rules. The polling logic has been encapsulated in the new `siemMigrations.rules` service so the request loop is centralized in one place. The value updates are broadcasted using the `latestStats$` observable. It will only keep requesting while there are _running_ migrations and will stop automatically when no more migrations are _running_. The reusable `useLatestStats` hook has been created for the UI components to consume. This approach allows multiple components to listen and update their content automatically with every rule migration stats update, having only one request loop running. The polling will only start if it's not already running and only if the SIEM migration functionality is available, which includes: - Experimental flag enabled - _Enterprise_ license - TODO: feature capability check (RBAC [issue](https://github.com/elastic/security-team/issues/11262)) The polling will try to start when: - Automatically with the Security Solution application starts - The first render of every page that uses `useLatestStats` hook. - TODO: A new migration is created from the onboarding page ([issue](https://github.com/elastic/security-team/issues/10667)) Tests will be implemented in [this task](https://github.com/elastic/security-team/issues/11256) ## Example A Rule migration finishes while using Timeline in the Alerts page: https://github.com/user-attachments/assets/aac2b2c8-27fe-40d5-9f32-0bee74c9dc6a --- .../model/api/rules/rule_migration.gen.ts | 5 +- .../api/rules/rule_migration.schema.yaml | 4 +- .../model/rule_migration.gen.ts | 22 ++--- .../model/rule_migration.schema.yaml | 22 ++--- .../public/plugin_services.ts | 2 + .../use_get_rule_migrations_stats_all.ts | 30 ------- .../rules/hooks/use_latest_stats.ts | 23 +++++ .../siem_migrations/rules/pages/index.tsx | 17 ++-- .../rules/service/rule_migrations_service.ts | 87 +++++++++++++++++++ .../rules/service/success_notification.tsx | 67 ++++++++++++++ .../public/siem_migrations/rules/types.ts | 13 +++ .../public/siem_migrations/service/index.ts | 18 ++++ .../service/siem_migrations_service.ts | 17 ++++ .../plugins/security_solution/public/types.ts | 2 + .../data/rule_migrations_data_rules_client.ts | 29 ++++--- .../rules/task/rule_migrations_task_client.ts | 9 +- 16 files changed, 278 insertions(+), 89 deletions(-) delete mode 100644 x-pack/plugins/security_solution/public/siem_migrations/rules/api/hooks/use_get_rule_migrations_stats_all.ts create mode 100644 x-pack/plugins/security_solution/public/siem_migrations/rules/hooks/use_latest_stats.ts create mode 100644 x-pack/plugins/security_solution/public/siem_migrations/rules/service/rule_migrations_service.ts create mode 100644 x-pack/plugins/security_solution/public/siem_migrations/rules/service/success_notification.tsx create mode 100644 x-pack/plugins/security_solution/public/siem_migrations/rules/types.ts create mode 100644 x-pack/plugins/security_solution/public/siem_migrations/service/index.ts create mode 100644 x-pack/plugins/security_solution/public/siem_migrations/service/siem_migrations_service.ts diff --git a/x-pack/plugins/security_solution/common/siem_migrations/model/api/rules/rule_migration.gen.ts b/x-pack/plugins/security_solution/common/siem_migrations/model/api/rules/rule_migration.gen.ts index ac15080f2e0a4..36728e0e928a0 100644 --- a/x-pack/plugins/security_solution/common/siem_migrations/model/api/rules/rule_migration.gen.ts +++ b/x-pack/plugins/security_solution/common/siem_migrations/model/api/rules/rule_migration.gen.ts @@ -22,9 +22,8 @@ import { ElasticRulePartial, RuleMigrationTranslationResult, RuleMigrationComments, - RuleMigrationAllTaskStats, - RuleMigration, RuleMigrationTaskStats, + RuleMigration, RuleMigrationResourceData, RuleMigrationResourceType, RuleMigrationResource, @@ -44,7 +43,7 @@ export const CreateRuleMigrationResponse = z.object({ }); export type GetAllStatsRuleMigrationResponse = z.infer; -export const GetAllStatsRuleMigrationResponse = RuleMigrationAllTaskStats; +export const GetAllStatsRuleMigrationResponse = z.array(RuleMigrationTaskStats); export type GetRuleMigrationRequestParams = z.infer; export const GetRuleMigrationRequestParams = z.object({ diff --git a/x-pack/plugins/security_solution/common/siem_migrations/model/api/rules/rule_migration.schema.yaml b/x-pack/plugins/security_solution/common/siem_migrations/model/api/rules/rule_migration.schema.yaml index 7785304671129..fdb589e7b45cd 100644 --- a/x-pack/plugins/security_solution/common/siem_migrations/model/api/rules/rule_migration.schema.yaml +++ b/x-pack/plugins/security_solution/common/siem_migrations/model/api/rules/rule_migration.schema.yaml @@ -93,7 +93,9 @@ paths: content: application/json: schema: - $ref: '../../rule_migration.schema.yaml#/components/schemas/RuleMigrationAllTaskStats' + type: array + items: + $ref: '../../rule_migration.schema.yaml#/components/schemas/RuleMigrationTaskStats' ## Specific rule migration APIs diff --git a/x-pack/plugins/security_solution/common/siem_migrations/model/rule_migration.gen.ts b/x-pack/plugins/security_solution/common/siem_migrations/model/rule_migration.gen.ts index 38d7e2c4584bb..2260b83190e22 100644 --- a/x-pack/plugins/security_solution/common/siem_migrations/model/rule_migration.gen.ts +++ b/x-pack/plugins/security_solution/common/siem_migrations/model/rule_migration.gen.ts @@ -191,6 +191,10 @@ export const RuleMigration = z */ export type RuleMigrationTaskStats = z.infer; export const RuleMigrationTaskStats = z.object({ + /** + * The migration id + */ + id: NonEmptyString, /** * Indicates if the migration task status. */ @@ -220,24 +224,16 @@ export const RuleMigrationTaskStats = z.object({ */ failed: z.number().int(), }), + /** + * The moment the migration was created. + */ + created_at: z.string(), /** * The moment of the last update. */ - last_updated_at: z.string().optional(), + last_updated_at: z.string(), }); -export type RuleMigrationAllTaskStats = z.infer; -export const RuleMigrationAllTaskStats = z.array( - RuleMigrationTaskStats.merge( - z.object({ - /** - * The migration id - */ - migration_id: NonEmptyString, - }) - ) -); - /** * The type of the rule migration resource. */ diff --git a/x-pack/plugins/security_solution/common/siem_migrations/model/rule_migration.schema.yaml b/x-pack/plugins/security_solution/common/siem_migrations/model/rule_migration.schema.yaml index 552d192a641f3..17c70665b9ad3 100644 --- a/x-pack/plugins/security_solution/common/siem_migrations/model/rule_migration.schema.yaml +++ b/x-pack/plugins/security_solution/common/siem_migrations/model/rule_migration.schema.yaml @@ -145,9 +145,15 @@ components: type: object description: The rule migration task stats object. required: + - id - status - rules + - created_at + - last_updated_at properties: + id: + description: The migration id + $ref: './common.schema.yaml#/components/schemas/NonEmptyString' status: type: string description: Indicates if the migration task status. @@ -181,23 +187,13 @@ components: failed: type: integer description: The number of rules that have failed migration. + created_at: + type: string + description: The moment the migration was created. last_updated_at: type: string description: The moment of the last update. - RuleMigrationAllTaskStats: - type: array - items: - allOf: - - $ref: '#/components/schemas/RuleMigrationTaskStats' - - type: object - required: - - migration_id - properties: - migration_id: - description: The migration id - $ref: './common.schema.yaml#/components/schemas/NonEmptyString' - RuleMigrationTranslationResult: type: string description: The rule translation result. diff --git a/x-pack/plugins/security_solution/public/plugin_services.ts b/x-pack/plugins/security_solution/public/plugin_services.ts index 97b9a163b9f80..92b4bc586a5b6 100644 --- a/x-pack/plugins/security_solution/public/plugin_services.ts +++ b/x-pack/plugins/security_solution/public/plugin_services.ts @@ -19,6 +19,7 @@ import type { ConfigSettings } from '../common/config_settings'; import { parseConfigSettings } from '../common/config_settings'; import { APP_UI_ID } from '../common/constants'; import { TopValuesPopoverService } from './app/components/top_values_popover/top_values_popover_service'; +import { createSiemMigrationsService } from './siem_migrations/service'; import type { SecuritySolutionUiConfigType } from './common/types'; import type { PluginStart, @@ -152,6 +153,7 @@ export class PluginServices { customDataService, timelineDataService, topValuesPopover: new TopValuesPopoverService(), + siemMigrations: await createSiemMigrationsService(coreStart), ...(params && { onAppLeave: params.onAppLeave, setHeaderActionMenu: params.setHeaderActionMenu, diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/api/hooks/use_get_rule_migrations_stats_all.ts b/x-pack/plugins/security_solution/public/siem_migrations/rules/api/hooks/use_get_rule_migrations_stats_all.ts deleted file mode 100644 index 026e407050e97..0000000000000 --- a/x-pack/plugins/security_solution/public/siem_migrations/rules/api/hooks/use_get_rule_migrations_stats_all.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { UseQueryOptions } from '@tanstack/react-query'; -import { useQuery } from '@tanstack/react-query'; -import { DEFAULT_QUERY_OPTIONS } from './constants'; -import { getRuleMigrationsStatsAll } from '../api'; -import type { GetAllStatsRuleMigrationResponse } from '../../../../../common/siem_migrations/model/api/rules/rule_migration.gen'; -import { SIEM_RULE_MIGRATIONS_ALL_STATS_PATH } from '../../../../../common/siem_migrations/constants'; - -export const GET_RULE_MIGRATIONS_STATS_ALL_QUERY_KEY = ['GET', SIEM_RULE_MIGRATIONS_ALL_STATS_PATH]; - -export const useGetRuleMigrationsStatsAllQuery = ( - options?: UseQueryOptions -) => { - return useQuery( - GET_RULE_MIGRATIONS_STATS_ALL_QUERY_KEY, - async ({ signal }) => { - return getRuleMigrationsStatsAll({ signal }); - }, - { - ...DEFAULT_QUERY_OPTIONS, - ...options, - } - ); -}; diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/hooks/use_latest_stats.ts b/x-pack/plugins/security_solution/public/siem_migrations/rules/hooks/use_latest_stats.ts new file mode 100644 index 0000000000000..c681af0d2a21c --- /dev/null +++ b/x-pack/plugins/security_solution/public/siem_migrations/rules/hooks/use_latest_stats.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import useObservable from 'react-use/lib/useObservable'; +import { useEffect, useMemo } from 'react'; +import { useKibana } from '../../../common/lib/kibana'; + +export const useLatestStats = () => { + const { siemMigrations } = useKibana().services; + + useEffect(() => { + siemMigrations.rules.startPolling(); + }, [siemMigrations.rules]); + + const latestStats$ = useMemo(() => siemMigrations.rules.getLatestStats$(), [siemMigrations]); + const latestStats = useObservable(latestStats$, null); + + return { data: latestStats ?? [], isLoading: latestStats === null }; +}; diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/pages/index.tsx b/x-pack/plugins/security_solution/public/siem_migrations/rules/pages/index.tsx index 616c85e7e7dee..83392f0a70d2a 100644 --- a/x-pack/plugins/security_solution/public/siem_migrations/rules/pages/index.tsx +++ b/x-pack/plugins/security_solution/public/siem_migrations/rules/pages/index.tsx @@ -9,23 +9,20 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { EuiSkeletonLoading, EuiSkeletonText, EuiSkeletonTitle } from '@elastic/eui'; import type { RuleMigration } from '../../../../common/siem_migrations/model/rule_migration.gen'; -import { SecurityPageName } from '../../../app/types'; import { HeaderPage } from '../../../common/components/header_page'; import { SecuritySolutionPageWrapper } from '../../../common/components/page_wrapper'; -import { SpyRoute } from '../../../common/utils/route/spy_routes'; import * as i18n from './translations'; import { RulesTable } from '../components/rules_table'; import { NeedAdminForUpdateRulesCallOut } from '../../../detections/components/callouts/need_admin_for_update_callout'; import { MissingPrivilegesCallOut } from '../../../detections/components/callouts/missing_privileges_callout'; import { HeaderButtons } from '../components/header_buttons'; -import { useGetRuleMigrationsStatsAllQuery } from '../api/hooks/use_get_rule_migrations_stats_all'; import { useRulePreviewFlyout } from '../hooks/use_rule_preview_flyout'; import { NoMigrations } from '../components/no_migrations'; +import { useLatestStats } from '../hooks/use_latest_stats'; -const RulesPageComponent: React.FC = () => { - const { data: ruleMigrationsStatsAll, isLoading: isLoadingMigrationsStats } = - useGetRuleMigrationsStatsAllQuery(); +export const RulesPage = React.memo(() => { + const { data: ruleMigrationsStatsAll, isLoading: isLoadingMigrationsStats } = useLatestStats(); const migrationsIds = useMemo(() => { if (isLoadingMigrationsStats || !ruleMigrationsStatsAll?.length) { @@ -33,7 +30,7 @@ const RulesPageComponent: React.FC = () => { } return ruleMigrationsStatsAll .filter((migration) => migration.status === 'finished') - .map((migration) => migration.migration_id); + .map((migration) => migration.id); }, [isLoadingMigrationsStats, ruleMigrationsStatsAll]); const [selectedMigrationId, setSelectedMigrationId] = useState(); @@ -94,11 +91,7 @@ const RulesPageComponent: React.FC = () => { /> {rulePreviewFlyout} - - ); -}; - -export const RulesPage = React.memo(RulesPageComponent); +}); RulesPage.displayName = 'RulesPage'; diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/service/rule_migrations_service.ts b/x-pack/plugins/security_solution/public/siem_migrations/rules/service/rule_migrations_service.ts new file mode 100644 index 0000000000000..ba6543f5171d3 --- /dev/null +++ b/x-pack/plugins/security_solution/public/siem_migrations/rules/service/rule_migrations_service.ts @@ -0,0 +1,87 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { BehaviorSubject, type Observable } from 'rxjs'; +import type { CoreStart } from '@kbn/core/public'; +import { i18n } from '@kbn/i18n'; +import { ExperimentalFeaturesService } from '../../../common/experimental_features_service'; +import { licenseService } from '../../../common/hooks/use_license'; +import { getRuleMigrationsStatsAll } from '../api/api'; +import type { RuleMigrationStats } from '../types'; +import { getSuccessToast } from './success_notification'; + +const POLLING_ERROR_TITLE = i18n.translate( + 'xpack.securitySolution.siemMigrations.rulesService.polling.errorTitle', + { defaultMessage: 'Error fetching rule migrations' } +); + +export class SiemRulesMigrationsService { + private readonly pollingInterval = 5000; + private readonly latestStats$: BehaviorSubject; + private isPolling = false; + + constructor(private readonly core: CoreStart) { + this.latestStats$ = new BehaviorSubject([]); + this.startPolling(); + } + + public getLatestStats$(): Observable { + return this.latestStats$.asObservable(); + } + + public isAvailable() { + return ExperimentalFeaturesService.get().siemMigrationsEnabled && licenseService.isEnterprise(); + } + + public startPolling() { + if (this.isPolling || !this.isAvailable()) { + return; + } + + this.isPolling = true; + this.startStatsPolling() + .catch((e) => { + this.core.notifications.toasts.addError(e, { title: POLLING_ERROR_TITLE }); + }) + .finally(() => { + this.isPolling = false; + }); + } + + private async startStatsPolling(): Promise { + let pendingMigrationIds: string[] = []; + do { + const results = await this.fetchRuleMigrationsStats(); + this.latestStats$.next(results); + + if (pendingMigrationIds.length > 0) { + // send notifications for finished migrations + pendingMigrationIds.forEach((pendingMigrationId) => { + const migration = results.find((item) => item.id === pendingMigrationId); + if (migration && migration.status === 'finished') { + this.core.notifications.toasts.addSuccess(getSuccessToast(migration, this.core)); + } + }); + } + + // reassign pending migrations + pendingMigrationIds = results.reduce((acc, item) => { + if (item.status === 'running') { + acc.push(item.id); + } + return acc; + }, []); + + await new Promise((resolve) => setTimeout(resolve, this.pollingInterval)); + } while (pendingMigrationIds.length > 0); + } + + private async fetchRuleMigrationsStats(): Promise { + const stats = await getRuleMigrationsStatsAll({ signal: new AbortController().signal }); + return stats.map((stat, index) => ({ ...stat, number: index + 1 })); // the array order (by creation) is guaranteed by the API + } +} diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/service/success_notification.tsx b/x-pack/plugins/security_solution/public/siem_migrations/rules/service/success_notification.tsx new file mode 100644 index 0000000000000..f87755943f830 --- /dev/null +++ b/x-pack/plugins/security_solution/public/siem_migrations/rules/service/success_notification.tsx @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import type { CoreStart } from '@kbn/core-lifecycle-browser'; +import { i18n } from '@kbn/i18n'; +import { + SecurityPageName, + useNavigation, + NavigationProvider, +} from '@kbn/security-solution-navigation'; +import type { ToastInput } from '@kbn/core-notifications-browser'; +import { toMountPoint } from '@kbn/react-kibana-mount'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import type { RuleMigrationStats } from '../types'; + +export const getSuccessToast = (migration: RuleMigrationStats, core: CoreStart): ToastInput => ({ + color: 'success', + iconType: 'check', + toastLifeTimeMs: 1000 * 60 * 30, // 30 minutes + title: i18n.translate('xpack.securitySolution.siemMigrations.rulesService.polling.successTitle', { + defaultMessage: 'Rules translation complete.', + }), + text: toMountPoint( + + + , + core + ), +}); + +const SuccessToastContent: React.FC<{ migration: RuleMigrationStats }> = ({ migration }) => { + const navigation = { deepLinkId: SecurityPageName.siemMigrationsRules, path: migration.id }; + + const { navigateTo, getAppUrl } = useNavigation(); + const onClick: React.MouseEventHandler = (ev) => { + ev.preventDefault(); + navigateTo(navigation); + }; + const url = getAppUrl(navigation); + + return ( + + + + + + {/* eslint-disable-next-line @elastic/eui/href-or-on-click */} + + {i18n.translate( + 'xpack.securitySolution.siemMigrations.rulesService.polling.successLinkText', + { defaultMessage: 'Go to translated rules' } + )} + + + + ); +}; diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/types.ts b/x-pack/plugins/security_solution/public/siem_migrations/rules/types.ts new file mode 100644 index 0000000000000..db9ca9507702f --- /dev/null +++ b/x-pack/plugins/security_solution/public/siem_migrations/rules/types.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { RuleMigrationTaskStats } from '../../../common/siem_migrations/model/rule_migration.gen'; + +export interface RuleMigrationStats extends RuleMigrationTaskStats { + /** The sequential number of the migration */ + number: number; +} diff --git a/x-pack/plugins/security_solution/public/siem_migrations/service/index.ts b/x-pack/plugins/security_solution/public/siem_migrations/service/index.ts new file mode 100644 index 0000000000000..08a50d018976b --- /dev/null +++ b/x-pack/plugins/security_solution/public/siem_migrations/service/index.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { CoreStart } from '@kbn/core-lifecycle-browser'; + +export type { SiemMigrationsService } from './siem_migrations_service'; + +export const createSiemMigrationsService = async (coreStart: CoreStart) => { + const { SiemMigrationsService } = await import( + /* webpackChunkName: "lazySiemMigrationsService" */ + './siem_migrations_service' + ); + return new SiemMigrationsService(coreStart); +}; diff --git a/x-pack/plugins/security_solution/public/siem_migrations/service/siem_migrations_service.ts b/x-pack/plugins/security_solution/public/siem_migrations/service/siem_migrations_service.ts new file mode 100644 index 0000000000000..1775296f6e230 --- /dev/null +++ b/x-pack/plugins/security_solution/public/siem_migrations/service/siem_migrations_service.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { CoreStart } from '@kbn/core/public'; +import { SiemRulesMigrationsService } from '../rules/service/rule_migrations_service'; + +export class SiemMigrationsService { + public rules: SiemRulesMigrationsService; + + constructor(coreStart: CoreStart) { + this.rules = new SiemRulesMigrationsService(coreStart); + } +} diff --git a/x-pack/plugins/security_solution/public/types.ts b/x-pack/plugins/security_solution/public/types.ts index 9829fe2ad0c25..d0387c5d3abe0 100644 --- a/x-pack/plugins/security_solution/public/types.ts +++ b/x-pack/plugins/security_solution/public/types.ts @@ -94,6 +94,7 @@ import type { ConfigSettings } from '../common/config_settings'; import type { OnboardingService } from './onboarding/service'; import type { SolutionNavigation } from './app/solution_navigation/solution_navigation'; import type { TelemetryServiceStart } from './common/lib/telemetry'; +import type { SiemMigrationsService } from './siem_migrations/service'; export interface SetupPlugins { cloud?: CloudSetup; @@ -193,6 +194,7 @@ export type StartServices = CoreStart & customDataService: DataPublicPluginStart; topValuesPopover: TopValuesPopoverService; timelineDataService: DataPublicPluginStart; + siemMigrations: SiemMigrationsService; }; export type StartRenderServices = Pick< diff --git a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/data/rule_migrations_data_rules_client.ts b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/data/rule_migrations_data_rules_client.ts index a01d36e9a1195..06e257b9862c5 100644 --- a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/data/rule_migrations_data_rules_client.ts +++ b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/data/rule_migrations_data_rules_client.ts @@ -6,8 +6,10 @@ */ import type { + AggregationsAggregationContainer, AggregationsFilterAggregate, AggregationsMaxAggregate, + AggregationsMinAggregate, AggregationsStringTermsAggregate, AggregationsStringTermsBucket, QueryDslQueryContainer, @@ -30,7 +32,7 @@ export type UpdateRuleMigrationInput = { elastic_rule?: Partial } & 'id' | 'translation_result' | 'comments' >; export type RuleMigrationDataStats = Omit; -export type RuleMigrationAllDataStats = Array; +export type RuleMigrationAllDataStats = RuleMigrationDataStats[]; /* BULK_MAX_SIZE defines the number to break down the bulk operations by. * The 500 number was chosen as a reasonable number to avoid large payloads. It can be adjusted if needed. @@ -217,6 +219,7 @@ export class RuleMigrationsDataRulesClient extends RuleMigrationsDataBaseClient processing: { filter: { term: { status: SiemMigrationStatus.PROCESSING } } }, completed: { filter: { term: { status: SiemMigrationStatus.COMPLETED } } }, failed: { filter: { term: { status: SiemMigrationStatus.FAILED } } }, + createdAt: { min: { field: '@timestamp' } }, lastUpdatedAt: { max: { field: 'updated_at' } }, }; const result = await this.esClient @@ -226,30 +229,33 @@ export class RuleMigrationsDataRulesClient extends RuleMigrationsDataBaseClient throw error; }); - const { pending, processing, completed, lastUpdatedAt, failed } = result.aggregations ?? {}; + const bucket = result.aggregations ?? {}; return { + id: migrationId, rules: { total: this.getTotalHits(result), - pending: (pending as AggregationsFilterAggregate)?.doc_count ?? 0, - processing: (processing as AggregationsFilterAggregate)?.doc_count ?? 0, - completed: (completed as AggregationsFilterAggregate)?.doc_count ?? 0, - failed: (failed as AggregationsFilterAggregate)?.doc_count ?? 0, + pending: (bucket.pending as AggregationsFilterAggregate)?.doc_count ?? 0, + processing: (bucket.processing as AggregationsFilterAggregate)?.doc_count ?? 0, + completed: (bucket.completed as AggregationsFilterAggregate)?.doc_count ?? 0, + failed: (bucket.failed as AggregationsFilterAggregate)?.doc_count ?? 0, }, - last_updated_at: (lastUpdatedAt as AggregationsMaxAggregate)?.value_as_string, + created_at: (bucket.createdAt as AggregationsMinAggregate)?.value_as_string ?? '', + last_updated_at: (bucket.lastUpdatedAt as AggregationsMaxAggregate)?.value_as_string ?? '', }; } - /** Retrieves the stats for all the rule migrations aggregated by migration id */ + /** Retrieves the stats for all the rule migrations aggregated by migration id, in creation order */ async getAllStats(): Promise { const index = await this.getIndexName(); - const aggregations = { + const aggregations: { migrationIds: AggregationsAggregationContainer } = { migrationIds: { - terms: { field: 'migration_id' }, + terms: { field: 'migration_id', order: { createdAt: 'asc' } }, aggregations: { pending: { filter: { term: { status: SiemMigrationStatus.PENDING } } }, processing: { filter: { term: { status: SiemMigrationStatus.PROCESSING } } }, completed: { filter: { term: { status: SiemMigrationStatus.COMPLETED } } }, failed: { filter: { term: { status: SiemMigrationStatus.FAILED } } }, + createdAt: { min: { field: '@timestamp' } }, lastUpdatedAt: { max: { field: 'updated_at' } }, }, }, @@ -264,7 +270,7 @@ export class RuleMigrationsDataRulesClient extends RuleMigrationsDataBaseClient const migrationsAgg = result.aggregations?.migrationIds as AggregationsStringTermsAggregate; const buckets = (migrationsAgg?.buckets as AggregationsStringTermsBucket[]) ?? []; return buckets.map((bucket) => ({ - migration_id: bucket.key, + id: bucket.key, rules: { total: bucket.doc_count, pending: bucket.pending?.doc_count ?? 0, @@ -272,6 +278,7 @@ export class RuleMigrationsDataRulesClient extends RuleMigrationsDataBaseClient completed: bucket.completed?.doc_count ?? 0, failed: bucket.failed?.doc_count ?? 0, }, + created_at: bucket.createdAt?.value_as_string, last_updated_at: bucket.lastUpdatedAt?.value_as_string, })); } diff --git a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/rule_migrations_task_client.ts b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/rule_migrations_task_client.ts index b7cc545001f91..56c7e8485d315 100644 --- a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/rule_migrations_task_client.ts +++ b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/rule_migrations_task_client.ts @@ -9,10 +9,7 @@ import type { AuthenticatedUser, Logger } from '@kbn/core/server'; import { AbortError, abortSignalToPromise } from '@kbn/kibana-utils-plugin/server'; import type { RunnableConfig } from '@langchain/core/runnables'; import { SiemMigrationStatus } from '../../../../../common/siem_migrations/constants'; -import type { - RuleMigrationAllTaskStats, - RuleMigrationTaskStats, -} from '../../../../../common/siem_migrations/model/rule_migration.gen'; +import type { RuleMigrationTaskStats } from '../../../../../common/siem_migrations/model/rule_migration.gen'; import type { RuleMigrationsDataClient } from '../data/rule_migrations_data_client'; import type { RuleMigrationDataStats } from '../data/rule_migrations_data_rules_client'; import { getRuleMigrationAgent } from './agent'; @@ -229,10 +226,10 @@ export class RuleMigrationsTaskClient { } /** Returns the stats of all migrations */ - async getAllStats(): Promise { + async getAllStats(): Promise { const allDataStats = await this.data.rules.getAllStats(); return allDataStats.map((dataStats) => { - const status = this.getTaskStatus(dataStats.migration_id, dataStats.rules); + const status = this.getTaskStatus(dataStats.id, dataStats.rules); return { status, ...dataStats }; }); } From cdeb1e984425e4ad40d5125e4d224e01f1a6936e Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 25 Nov 2024 10:51:05 -0700 Subject: [PATCH 48/71] [dashboard] fix time_to_data does not capture entire client-side rendering (#200640) Closes https://github.com/elastic/kibana/issues/194489 PR adds new `PublishesRendered` interface. Embeddables can implement this interface to provide feedback when rendering is complete. PR updates ReactEmbeddableRender phase tracking logic to include check for `PublishesRendered` value when interface is implemented. --------- Co-authored-by: Elastic Machine --- .../presentation_publishing/index.ts | 1 + .../interfaces/publishes_rendered.ts | 20 ++++ .../phase_tracker.test.ts | 100 ++++++++++++++++++ .../react_embeddable_system/phase_tracker.ts | 48 +++++++++ .../react_embeddable_renderer.tsx | 35 ++---- .../visualizations/public/embeddable/types.ts | 2 + .../embeddable/visualize_embeddable.tsx | 2 +- 7 files changed, 179 insertions(+), 29 deletions(-) create mode 100644 packages/presentation/presentation_publishing/interfaces/publishes_rendered.ts create mode 100644 src/plugins/embeddable/public/react_embeddable_system/phase_tracker.test.ts create mode 100644 src/plugins/embeddable/public/react_embeddable_system/phase_tracker.ts diff --git a/packages/presentation/presentation_publishing/index.ts b/packages/presentation/presentation_publishing/index.ts index 2b96c6d353eee..d3b9c44f6fd36 100644 --- a/packages/presentation/presentation_publishing/index.ts +++ b/packages/presentation/presentation_publishing/index.ts @@ -108,6 +108,7 @@ export { type PhaseEventType, type PublishesPhaseEvents, } from './interfaces/publishes_phase_events'; +export { apiPublishesRendered, type PublishesRendered } from './interfaces/publishes_rendered'; export { apiPublishesSavedObjectId, type PublishesSavedObjectId, diff --git a/packages/presentation/presentation_publishing/interfaces/publishes_rendered.ts b/packages/presentation/presentation_publishing/interfaces/publishes_rendered.ts new file mode 100644 index 0000000000000..9acbd8c3f258f --- /dev/null +++ b/packages/presentation/presentation_publishing/interfaces/publishes_rendered.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { PublishingSubject } from '../publishing_subject'; + +export interface PublishesRendered { + rendered$: PublishingSubject; +} + +export const apiPublishesRendered = ( + unknownApi: null | unknown +): unknownApi is PublishesRendered => { + return Boolean(unknownApi && (unknownApi as PublishesRendered)?.rendered$ !== undefined); +}; diff --git a/src/plugins/embeddable/public/react_embeddable_system/phase_tracker.test.ts b/src/plugins/embeddable/public/react_embeddable_system/phase_tracker.test.ts new file mode 100644 index 0000000000000..700c90f08ce5b --- /dev/null +++ b/src/plugins/embeddable/public/react_embeddable_system/phase_tracker.test.ts @@ -0,0 +1,100 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { BehaviorSubject, skip } from 'rxjs'; +import { PhaseTracker } from './phase_tracker'; + +describe('PhaseTracker', () => { + describe('api does not implement PublishesDataLoading or PublishesRendered', () => { + test(`should emit 'rendered' event`, (done) => { + const phaseTracker = new PhaseTracker(); + phaseTracker + .getPhase$() + .pipe(skip(1)) + .subscribe((phaseEvent) => { + expect(phaseEvent?.status).toBe('rendered'); + done(); + }); + phaseTracker.trackPhaseEvents('1', {}); + }); + }); + + describe('api implements PublishesDataLoading', () => { + test(`should emit 'loading' event when dataLoading is true`, (done) => { + const phaseTracker = new PhaseTracker(); + phaseTracker + .getPhase$() + .pipe(skip(1)) + .subscribe((phaseEvent) => { + expect(phaseEvent?.status).toBe('loading'); + done(); + }); + phaseTracker.trackPhaseEvents('1', { dataLoading: new BehaviorSubject(true) }); + }); + + test(`should emit 'rendered' event when dataLoading is false`, (done) => { + const phaseTracker = new PhaseTracker(); + phaseTracker + .getPhase$() + .pipe(skip(1)) + .subscribe((phaseEvent) => { + expect(phaseEvent?.status).toBe('rendered'); + done(); + }); + phaseTracker.trackPhaseEvents('1', { dataLoading: new BehaviorSubject(false) }); + }); + }); + + describe('api implements PublishesDataLoading and PublishesRendered', () => { + test(`should emit 'loading' event when dataLoading is true`, (done) => { + const phaseTracker = new PhaseTracker(); + phaseTracker + .getPhase$() + .pipe(skip(1)) + .subscribe((phaseEvent) => { + expect(phaseEvent?.status).toBe('loading'); + done(); + }); + phaseTracker.trackPhaseEvents('1', { + dataLoading: new BehaviorSubject(true), + rendered$: new BehaviorSubject(false), + }); + }); + + test(`should emit 'loading' event when dataLoading is false but rendered is false`, (done) => { + const phaseTracker = new PhaseTracker(); + phaseTracker + .getPhase$() + .pipe(skip(1)) + .subscribe((phaseEvent) => { + expect(phaseEvent?.status).toBe('loading'); + done(); + }); + phaseTracker.trackPhaseEvents('1', { + dataLoading: new BehaviorSubject(false), + rendered$: new BehaviorSubject(false), + }); + }); + + test(`should emit 'rendered' event only when rendered is true`, (done) => { + const phaseTracker = new PhaseTracker(); + phaseTracker + .getPhase$() + .pipe(skip(1)) + .subscribe((phaseEvent) => { + expect(phaseEvent?.status).toBe('rendered'); + done(); + }); + phaseTracker.trackPhaseEvents('1', { + dataLoading: new BehaviorSubject(false), + rendered$: new BehaviorSubject(true), + }); + }); + }); +}); diff --git a/src/plugins/embeddable/public/react_embeddable_system/phase_tracker.ts b/src/plugins/embeddable/public/react_embeddable_system/phase_tracker.ts new file mode 100644 index 0000000000000..037599ab646cc --- /dev/null +++ b/src/plugins/embeddable/public/react_embeddable_system/phase_tracker.ts @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { + PhaseEvent, + apiPublishesDataLoading, + apiPublishesRendered, +} from '@kbn/presentation-publishing'; +import { BehaviorSubject, Subscription, combineLatest } from 'rxjs'; + +export class PhaseTracker { + private firstLoadCompleteTime: number | undefined; + private embeddableStartTime = performance.now(); + private subscriptions = new Subscription(); + private phase$ = new BehaviorSubject(undefined); + + getPhase$() { + return this.phase$; + } + + public trackPhaseEvents(uuid: string, api: unknown) { + const dataLoading$ = apiPublishesDataLoading(api) + ? api.dataLoading + : new BehaviorSubject(false); + const rendered$ = apiPublishesRendered(api) ? api.rendered$ : new BehaviorSubject(true); + + this.subscriptions.add( + combineLatest([dataLoading$, rendered$]).subscribe(([dataLoading, rendered]) => { + if (!this.firstLoadCompleteTime) { + this.firstLoadCompleteTime = performance.now(); + } + const duration = this.firstLoadCompleteTime - this.embeddableStartTime; + const status = dataLoading || !rendered ? 'loading' : 'rendered'; + this.phase$.next({ id: uuid, status, timeToEvent: duration }); + }) + ); + } + + public cleanup() { + this.subscriptions.unsubscribe(); + } +} diff --git a/src/plugins/embeddable/public/react_embeddable_system/react_embeddable_renderer.tsx b/src/plugins/embeddable/public/react_embeddable_system/react_embeddable_renderer.tsx index c3dc06e198cd8..7cf9d9f203fc3 100644 --- a/src/plugins/embeddable/public/react_embeddable_system/react_embeddable_renderer.tsx +++ b/src/plugins/embeddable/public/react_embeddable_system/react_embeddable_renderer.tsx @@ -16,12 +16,7 @@ import { SerializedPanelState, } from '@kbn/presentation-containers'; import { PresentationPanel, PresentationPanelProps } from '@kbn/presentation-panel-plugin/public'; -import { - apiPublishesDataLoading, - ComparatorDefinition, - PhaseEvent, - StateComparators, -} from '@kbn/presentation-publishing'; +import { ComparatorDefinition, StateComparators } from '@kbn/presentation-publishing'; import React, { useEffect, useImperativeHandle, useMemo, useRef } from 'react'; import { BehaviorSubject, combineLatest, debounceTime, skip, Subscription, switchMap } from 'rxjs'; import { v4 as generateId } from 'uuid'; @@ -31,6 +26,7 @@ import { DefaultEmbeddableApi, SetReactEmbeddableApiRegistration, } from './types'; +import { PhaseTracker } from './phase_tracker'; const ON_STATE_CHANGE_DEBOUNCE = 100; @@ -78,25 +74,12 @@ export const ReactEmbeddableRenderer = < onAnyStateChange?: (state: SerializedPanelState) => void; }) => { const cleanupFunction = useRef<(() => void) | null>(null); - const firstLoadCompleteTime = useRef(null); + const phaseTracker = useRef(new PhaseTracker()); const componentPromise = useMemo( () => { const uuid = maybeId ?? generateId(); - /** - * Phase tracking instrumentation for telemetry - */ - const phase$ = new BehaviorSubject(undefined); - const embeddableStartTime = performance.now(); - const reportPhaseChange = (loading: boolean) => { - if (firstLoadCompleteTime.current === null) { - firstLoadCompleteTime.current = performance.now(); - } - const duration = firstLoadCompleteTime.current - embeddableStartTime; - phase$.next({ id: uuid, status: loading ? 'loading' : 'rendered', timeToEvent: duration }); - }; - /** * Build the embeddable promise */ @@ -126,7 +109,7 @@ export const ReactEmbeddableRenderer = < return { ...apiRegistration, uuid, - phase$, + phase$: phaseTracker.current.getPhase$(), parentApi, hasLockedHoverActions$, lockHoverActions: (lock: boolean) => { @@ -186,6 +169,7 @@ export const ReactEmbeddableRenderer = < cleanupFunction.current = () => { subscriptions.unsubscribe(); + phaseTracker.current.cleanup(); unsavedChanges.cleanup(); }; return fullApi as Api & HasSnapshottableState; @@ -200,13 +184,8 @@ export const ReactEmbeddableRenderer = < lastSavedRuntimeState ); - if (apiPublishesDataLoading(api)) { - subscriptions.add( - api.dataLoading.subscribe((loading) => reportPhaseChange(Boolean(loading))) - ); - } else { - reportPhaseChange(false); - } + phaseTracker.current.trackPhaseEvents(uuid, api); + return { api, Component }; }; diff --git a/src/plugins/visualizations/public/embeddable/types.ts b/src/plugins/visualizations/public/embeddable/types.ts index f4215d923e1d5..80e7e2d9179e8 100644 --- a/src/plugins/visualizations/public/embeddable/types.ts +++ b/src/plugins/visualizations/public/embeddable/types.ts @@ -17,6 +17,7 @@ import { HasSupportedTriggers, PublishesDataLoading, PublishesDataViews, + PublishesRendered, PublishesTimeRange, SerializedTimeRange, SerializedTitles, @@ -92,6 +93,7 @@ export const isVisualizeRuntimeState = (state: unknown): state is VisualizeRunti export type VisualizeApi = Partial & PublishesDataViews & PublishesDataLoading & + PublishesRendered & HasVisualizeConfig & HasInspectorAdapters & HasSupportedTriggers & diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx b/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx index 7b48521265d6f..4993c0168313a 100644 --- a/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx @@ -179,6 +179,7 @@ export const getVisualizeEmbeddableFactory: (deps: { defaultPanelTitle, dataLoading: dataLoading$, dataViews: new BehaviorSubject(initialDataViews), + rendered$: hasRendered$, supportedTriggers: () => [ ACTION_CONVERT_TO_LENS, APPLY_FILTER_TRIGGER, @@ -397,7 +398,6 @@ export const getVisualizeEmbeddableFactory: (deps: { if (hasRendered$.getValue() === true) return; hasRendered$.next(true); - hasRendered$.complete(); }, onEvent: async (event) => { // Visualize doesn't respond to sizing events, so ignore. From d3ee297d9fc5e007d7333816074b02463dd0c646 Mon Sep 17 00:00:00 2001 From: Sergi Massaneda Date: Mon, 25 Nov 2024 18:56:28 +0100 Subject: [PATCH 49/71] [SecuritySolution][Navigation] Prevent initial re-render using project nav (#201431) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Prevents an initial re-render when the `project` navigation style is set (serverless and new solution nav for stateful). This re-render was affecting all the top-level pages in Security Solution. --------- Co-authored-by: Michael Olorunnisola --- .../app/home/template_wrapper/index.test.tsx | 64 +++++++++++-------- .../app/home/template_wrapper/index.tsx | 8 +-- .../use_security_solution_navigation.test.tsx | 18 +++++- .../use_security_solution_navigation.tsx | 12 ++-- 4 files changed, 66 insertions(+), 36 deletions(-) diff --git a/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.test.tsx b/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.test.tsx index c1d3760813a15..49508dd79b1e1 100644 --- a/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.test.tsx +++ b/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.test.tsx @@ -22,32 +22,11 @@ jest.mock('./timeline', () => ({ Timeline: () =>
{'Timeline'}
, })); -jest.mock('../../../common/components/navigation/use_security_solution_navigation', () => { - return { - useSecuritySolutionNavigation: () => ({ - icon: 'logoSecurity', - items: [ - { - id: 'investigate', - name: 'Investigate', - items: [ - { - 'data-href': 'some-data-href', - 'data-test-subj': 'navigation-cases', - disabled: false, - href: 'some-href', - id: 'cases', - isSelected: true, - name: 'Cases', - }, - ], - tabIndex: undefined, - }, - ], - name: 'Security', - }), - }; -}); +const navProps = { icon: 'logoSecurity', items: [], name: 'Security' }; +const mockUseSecuritySolutionNavigation = jest.fn(); +jest.mock('../../../common/components/navigation/use_security_solution_navigation', () => ({ + useSecuritySolutionNavigation: () => mockUseSecuritySolutionNavigation(), +})); const mockUseRouteSpy = jest.fn((): [{ pageName: string }] => [ { pageName: SecurityPageName.alerts }, @@ -69,6 +48,39 @@ const renderComponent = ({ describe('SecuritySolutionTemplateWrapper', () => { beforeEach(() => { jest.clearAllMocks(); + mockUseSecuritySolutionNavigation.mockReturnValue(navProps); + }); + + describe('when navigation props are defined (classic nav)', () => { + beforeEach(() => { + mockUseSecuritySolutionNavigation.mockReturnValue(navProps); + }); + it('should render the children', async () => { + const { queryByText } = renderComponent(); + expect(queryByText('child of wrapper')).toBeInTheDocument(); + }); + }); + + describe('when navigation props are null (project nav)', () => { + beforeEach(() => { + mockUseSecuritySolutionNavigation.mockReturnValue(null); + }); + + it('should render the children', async () => { + const { queryByText } = renderComponent(); + expect(queryByText('child of wrapper')).toBeInTheDocument(); + }); + }); + + describe('when navigation props are undefined (loading)', () => { + beforeEach(() => { + mockUseSecuritySolutionNavigation.mockReturnValue(undefined); + }); + + it('should not render the children', async () => { + const { queryByText } = renderComponent(); + expect(queryByText('child of wrapper')).not.toBeInTheDocument(); + }); }); it('Should render with bottom bar when user allowed', async () => { diff --git a/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx b/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx index 19e8d55aa2dd5..f547d128ab54b 100644 --- a/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx +++ b/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx @@ -69,8 +69,8 @@ export const SecuritySolutionTemplateWrapper: React.FC - {isNotEmpty && ( + {renderChildren && ( <> { beforeEach(() => { jest.clearAllMocks(); }); + describe('while chrome style is undefined', () => { + beforeAll(() => { + mockGetChromeStyle$.mockReturnValue(of()); + }); + + it('should return proper navigation props', async () => { + const { result } = renderHook(useSecuritySolutionNavigation); + expect(result.current).toEqual(undefined); + + // check rendering of SecuritySideNav children + expect(mockSecuritySideNav).not.toHaveBeenCalled(); + }); + }); + describe('when classic navigation is enabled', () => { beforeAll(() => { mockGetChromeStyle$.mockReturnValue(of('classic')); @@ -77,9 +91,9 @@ describe('Security Solution Navigation', () => { mockGetChromeStyle$.mockReturnValue(of('project')); }); - it('should return undefined props when disabled', () => { + it('should return null props when disabled', () => { const { result } = renderHook(useSecuritySolutionNavigation); - expect(result.current).toEqual(undefined); + expect(result.current).toEqual(null); }); it('should initialize breadcrumbs', () => { diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_security_solution_navigation.tsx b/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_security_solution_navigation.tsx index a2f54c04ca467..9abebcbb359ce 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_security_solution_navigation.tsx +++ b/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_security_solution_navigation.tsx @@ -23,16 +23,20 @@ const translatedNavTitle = i18n.translate('xpack.securitySolution.navigation.mai defaultMessage: 'Security', }); -export const useSecuritySolutionNavigation = (): KibanaPageTemplateProps['solutionNav'] => { +export const useSecuritySolutionNavigation = (): KibanaPageTemplateProps['solutionNav'] | null => { const { chrome } = useKibana().services; const chromeStyle$ = useMemo(() => chrome.getChromeStyle$(), [chrome]); - const chromeStyle = useObservable(chromeStyle$, 'classic'); + const chromeStyle = useObservable(chromeStyle$, undefined); useBreadcrumbsNav(); + if (chromeStyle === undefined) { + return undefined; // wait for chromeStyle to be initialized + } + if (chromeStyle === 'project') { - // new shared-ux 'project' navigation enabled, return undefined to disable the 'classic' navigation - return undefined; + // new shared-ux 'project' navigation enabled, return null to disable the 'classic' navigation + return null; } return { From 29309b5f479d33ea91831f2f174c1f52ee1fd887 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 25 Nov 2024 12:24:30 -0600 Subject: [PATCH 50/71] Revert "[ci] Remove archive kibana distribution (#199565)" This reverts commit ac5e9b6653ace0b715cf5b1e60e4e3901b133045. --- .buildkite/scripts/build_kibana.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.buildkite/scripts/build_kibana.sh b/.buildkite/scripts/build_kibana.sh index acebf857504d5..b9e35097bbbff 100755 --- a/.buildkite/scripts/build_kibana.sh +++ b/.buildkite/scripts/build_kibana.sh @@ -42,3 +42,12 @@ if is_pr_with_label "ci:build-cloud-image"; then Kibana cloud image: \`$CLOUD_IMAGE\` EOF fi + +echo "--- Archive Kibana Distribution" +version="$(jq -r '.version' package.json)" +linuxBuild="$KIBANA_DIR/target/kibana-$version-SNAPSHOT-linux-x86_64.tar.gz" +installDir="$KIBANA_DIR/install/kibana" +mkdir -p "$installDir" +tar -xzf "$linuxBuild" -C "$installDir" --strip=1 +mkdir -p "$KIBANA_BUILD_LOCATION" +cp -pR install/kibana/. "$KIBANA_BUILD_LOCATION/" From 1411c09ed5eaf5355fc00b227884a7b3b13f93fc Mon Sep 17 00:00:00 2001 From: Kylie Meli Date: Mon, 25 Nov 2024 13:33:28 -0500 Subject: [PATCH 51/71] [Automatic Import] remove duplicate preserve flag from http_endpoint (#201622) ## Summary Removes an erroneous duplicate `Preserve Original Event` flag as we additionally add one from the common settings file. --- .../templates/manifest/http_endpoint_manifest.yml.njk | 6 ------ 1 file changed, 6 deletions(-) diff --git a/x-pack/plugins/integration_assistant/server/templates/manifest/http_endpoint_manifest.yml.njk b/x-pack/plugins/integration_assistant/server/templates/manifest/http_endpoint_manifest.yml.njk index b62a582a1cfc9..b35471ad4a631 100644 --- a/x-pack/plugins/integration_assistant/server/templates/manifest/http_endpoint_manifest.yml.njk +++ b/x-pack/plugins/integration_assistant/server/templates/manifest/http_endpoint_manifest.yml.njk @@ -42,12 +42,6 @@ The Ingest Node pipeline ID to be used by the integration. required: false show_user: true - - name: preserve_original_event - type: bool - title: Preserve Original Event - description: This option copies the raw unmodified body of the incoming request to the event.original field as a string before sending the event to Elasticsearch. - required: false - show_user: true - name: prefix type: text title: Prefix From 655cb7933371ce07b717eb40c3691fbc5ca08933 Mon Sep 17 00:00:00 2001 From: seanrathier Date: Mon, 25 Nov 2024 14:00:42 -0500 Subject: [PATCH 52/71] [Cloud Security] Remove preconfigured Agentless policy solution and feature flag (#197338) --- .../fleet/common/constants/agent_policy.ts | 2 - .../fleet/common/experimental_features.ts | 1 - .../fleet/common/types/models/agent_policy.ts | 1 - .../package_policy_input_panel.test.tsx | 6 - .../single_page_layout/hooks/form.tsx | 15 +- .../hooks/setup_technology.test.ts | 249 ++++-------------- .../hooks/setup_technology.ts | 65 +---- .../single_page_layout/index.test.tsx | 118 --------- .../routes/package_policy/utils/index.ts | 4 +- .../server/services/agent_policy.test.ts | 40 ++- .../server/services/agents/agentless_agent.ts | 49 ++-- .../server/services/preconfiguration.test.ts | 8 +- .../server/services/utils/agentless.test.ts | 114 +------- .../fleet/server/services/utils/agentless.ts | 11 +- 14 files changed, 97 insertions(+), 586 deletions(-) diff --git a/x-pack/plugins/fleet/common/constants/agent_policy.ts b/x-pack/plugins/fleet/common/constants/agent_policy.ts index b89577ed7c365..c3baf3b6e1755 100644 --- a/x-pack/plugins/fleet/common/constants/agent_policy.ts +++ b/x-pack/plugins/fleet/common/constants/agent_policy.ts @@ -38,7 +38,5 @@ export const LICENSE_FOR_SCHEDULE_UPGRADE = 'platinum'; export const DEFAULT_MAX_AGENT_POLICIES_WITH_INACTIVITY_TIMEOUT = 750; -export const AGENTLESS_POLICY_ID = 'agentless'; // the policy id defined here: https://github.com/elastic/project-controller/blob/main/internal/project/security/security_kibana_config.go#L86 - export const AGENT_LOG_LEVELS = ['error', 'warning', 'info', 'debug'] as const; export const DEFAULT_LOG_LEVEL = 'info' as const; diff --git a/x-pack/plugins/fleet/common/experimental_features.ts b/x-pack/plugins/fleet/common/experimental_features.ts index 730bcb393e987..07fd2caf0f061 100644 --- a/x-pack/plugins/fleet/common/experimental_features.ts +++ b/x-pack/plugins/fleet/common/experimental_features.ts @@ -21,7 +21,6 @@ const _allowedExperimentalValues = { kafkaOutput: true, outputSecretsStorage: true, remoteESOutput: true, - agentless: false, enableStrictKQLValidation: true, subfeaturePrivileges: false, advancedPolicySettings: true, diff --git a/x-pack/plugins/fleet/common/types/models/agent_policy.ts b/x-pack/plugins/fleet/common/types/models/agent_policy.ts index 841b98b239b29..fb19953a1f731 100644 --- a/x-pack/plugins/fleet/common/types/models/agent_policy.ts +++ b/x-pack/plugins/fleet/common/types/models/agent_policy.ts @@ -272,7 +272,6 @@ export interface FleetServerPolicy { export interface AgentlessApiResponse { id: string; - region_id: string; } // Definitions for agent policy outputs endpoints diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_panel.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_panel.test.tsx index 5accdf37e95e7..0222e8a238b9d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_panel.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_panel.test.tsx @@ -360,11 +360,8 @@ describe('PackagePolicyInputPanel', () => { beforeEach(() => { useAgentlessMock.mockReturnValue({ isAgentlessEnabled: true, - isAgentlessPackagePolicy: jest.fn(), isAgentlessAgentPolicy: jest.fn(), isAgentlessIntegration: jest.fn(), - isAgentlessApiEnabled: true, - isDefaultAgentlessPolicyEnabled: false, }); }); @@ -395,11 +392,8 @@ describe('PackagePolicyInputPanel', () => { beforeEach(() => { useAgentlessMock.mockReturnValue({ isAgentlessEnabled: false, - isAgentlessPackagePolicy: jest.fn(), isAgentlessAgentPolicy: jest.fn(), isAgentlessIntegration: jest.fn(), - isAgentlessApiEnabled: true, - isDefaultAgentlessPolicyEnabled: false, }); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/form.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/form.tsx index 3dbe300b119bd..4c4c7b311cb06 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/form.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/form.tsx @@ -178,8 +178,7 @@ export function useOnSubmit({ const [hasAgentPolicyError, setHasAgentPolicyError] = useState(false); const hasErrors = validationResults ? validationHasErrors(validationResults) : false; - const { isAgentlessIntegration, isAgentlessAgentPolicy, isAgentlessPackagePolicy } = - useAgentless(); + const { isAgentlessIntegration, isAgentlessAgentPolicy } = useAgentless(); // Update agent policy method const updateAgentPolicies = useCallback( @@ -316,9 +315,7 @@ export function useOnSubmit({ (agentCount !== 0 || (agentPolicies.length === 0 && selectedPolicyTab !== SelectedPolicyTab.NEW)) && !( - isAgentlessIntegration(packageInfo) || - isAgentlessPackagePolicy(packagePolicy) || - isAgentlessAgentPolicy(overrideCreatedAgentPolicy) + isAgentlessIntegration(packageInfo) || isAgentlessAgentPolicy(overrideCreatedAgentPolicy) ) && formState !== 'CONFIRM' ) { @@ -365,9 +362,7 @@ export function useOnSubmit({ : packagePolicy.policy_ids; const shouldForceInstallOnAgentless = - isAgentlessAgentPolicy(createdPolicy) || - isAgentlessIntegration(packageInfo) || - isAgentlessPackagePolicy(packagePolicy); + isAgentlessAgentPolicy(createdPolicy) || isAgentlessIntegration(packageInfo); const forceInstall = force || shouldForceInstallOnAgentless; @@ -390,8 +385,7 @@ export function useOnSubmit({ const hasGoogleCloudShell = data?.item ? getCloudShellUrlFromPackagePolicy(data.item) : false; // Check if agentless is configured in ESS and Serverless until Agentless API migrates to Serverless - const isAgentlessConfigured = - isAgentlessAgentPolicy(createdPolicy) || (data && isAgentlessPackagePolicy(data.item)); + const isAgentlessConfigured = isAgentlessAgentPolicy(createdPolicy); // Removing this code will disabled the Save and Continue button. We need code below update form state and trigger correct modal depending on agent count if (hasFleetAddAgentsPrivileges && !isAgentlessConfigured) { @@ -479,7 +473,6 @@ export function useOnSubmit({ selectedPolicyTab, packagePolicy, isAgentlessAgentPolicy, - isAgentlessPackagePolicy, hasFleetAddAgentsPrivileges, withSysMonitoring, newAgentPolicy, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.test.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.test.ts index 0953f2367d05c..ead6dd71dba79 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.test.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.test.ts @@ -11,8 +11,7 @@ import { createPackagePolicyMock } from '../../../../../../../../common/mocks'; import type { RegistryPolicyTemplate, PackageInfo } from '../../../../../../../../common/types'; import { SetupTechnology } from '../../../../../../../../common/types'; -import { ExperimentalFeaturesService } from '../../../../../services'; -import { sendGetOneAgentPolicy, useStartServices, useConfig } from '../../../../../hooks'; +import { useStartServices, useConfig } from '../../../../../hooks'; import { SelectedPolicyTab } from '../../components'; import { generateNewAgentPolicyWithDefaults } from '../../../../../../../../common/services/generate_new_agent_policy'; @@ -30,12 +29,7 @@ jest.mock('../../../../../../../../common/services/generate_new_agent_policy'); type MockFn = jest.MockedFunction; describe('useAgentless', () => { - const mockedExperimentalFeaturesService = jest.mocked(ExperimentalFeaturesService); - beforeEach(() => { - mockedExperimentalFeaturesService.get.mockReturnValue({ - agentless: false, - } as any); (useConfig as MockFn).mockReturnValue({ agentless: undefined, } as any); @@ -48,33 +42,25 @@ describe('useAgentless', () => { jest.clearAllMocks(); }); - it('should not return isAgentless when agentless is not enabled', () => { + it('should return isAgentlessEnabled as falsy when agentless is not enabled', () => { const { result } = renderHook(() => useAgentless()); expect(result.current.isAgentlessEnabled).toBeFalsy(); - expect(result.current.isAgentlessApiEnabled).toBeFalsy(); - expect(result.current.isDefaultAgentlessPolicyEnabled).toBeFalsy(); }); - it('should return isAgentlessEnabled as falsy if agentless.enabled is true and experimental feature agentless is truthy without cloud or serverless', () => { + it('should return isAgentlessEnabled as falsy if agentless.enabled true without cloud or serverless', () => { (useConfig as MockFn).mockReturnValue({ agentless: { enabled: true, }, } as any); - mockedExperimentalFeaturesService.get.mockReturnValue({ - agentless: false, - } as any); - const { result } = renderHook(() => useAgentless()); expect(result.current.isAgentlessEnabled).toBeFalsy(); - expect(result.current.isAgentlessApiEnabled).toBeFalsy(); - expect(result.current.isDefaultAgentlessPolicyEnabled).toBeFalsy(); }); - it('should return isAgentlessEnabled and isAgentlessApiEnabled as truthy with isCloudEnabled', () => { + it('should return isAgentlessEnabled as truthy with isCloudEnabled', () => { (useConfig as MockFn).mockReturnValue({ agentless: { enabled: true, @@ -91,14 +77,9 @@ describe('useAgentless', () => { const { result } = renderHook(() => useAgentless()); expect(result.current.isAgentlessEnabled).toBeTruthy(); - expect(result.current.isAgentlessApiEnabled).toBeTruthy(); - expect(result.current.isDefaultAgentlessPolicyEnabled).toBeFalsy(); }); - it('should return isAgentlessEnabled and isDefaultAgentlessPolicyEnabled as truthy with isServerlessEnabled and experimental feature agentless is truthy', () => { - mockedExperimentalFeaturesService.get.mockReturnValue({ - agentless: true, - } as any); + it('should return isAgentlessEnabled truthy with isServerlessEnabled', () => { (useStartServices as MockFn).mockReturnValue({ cloud: { isServerlessEnabled: true, @@ -106,18 +87,18 @@ describe('useAgentless', () => { }, }); + (useConfig as MockFn).mockReturnValue({ + agentless: { + enabled: true, + }, + } as any); + const { result } = renderHook(() => useAgentless()); expect(result.current.isAgentlessEnabled).toBeTruthy(); - expect(result.current.isAgentlessApiEnabled).toBeFalsy(); - expect(result.current.isDefaultAgentlessPolicyEnabled).toBeTruthy(); }); - it('should return isAgentlessEnabled as falsy and isDefaultAgentlessPolicyEnabled as falsy with isServerlessEnabled and experimental feature agentless is falsy', () => { - mockedExperimentalFeaturesService.get.mockReturnValue({ - agentless: false, - } as any); - + it('should return isAgentlessEnabled as falsy with isServerlessEnabled and without agentless config', () => { (useStartServices as MockFn).mockReturnValue({ cloud: { isServerlessEnabled: true, @@ -128,8 +109,6 @@ describe('useAgentless', () => { const { result } = renderHook(() => useAgentless()); expect(result.current.isAgentlessEnabled).toBeFalsy(); - expect(result.current.isAgentlessApiEnabled).toBeFalsy(); - expect(result.current.isDefaultAgentlessPolicyEnabled).toBeFalsy(); }); }); @@ -178,20 +157,10 @@ describe('useSetupTechnology', () => { const packagePolicyMock = createPackagePolicyMock(); - const mockedExperimentalFeaturesService = jest.mocked(ExperimentalFeaturesService); - beforeEach(() => { - mockedExperimentalFeaturesService.get.mockReturnValue({ - agentless: true, - } as any); (useConfig as MockFn).mockReturnValue({ agentless: undefined, } as any); - (sendGetOneAgentPolicy as MockFn).mockResolvedValue({ - data: { - item: { id: 'agentless-policy-id' }, - }, - }); (useStartServices as MockFn).mockReturnValue({ cloud: { isServerlessEnabled: true, @@ -207,46 +176,12 @@ describe('useSetupTechnology', () => { }); it('should initialize with default values when agentless is disabled', () => { - mockedExperimentalFeaturesService.get.mockReturnValue({ - agentless: false, - } as any); - - const { result } = renderHook(() => - useSetupTechnology({ - setNewAgentPolicy, - newAgentPolicy: newAgentPolicyMock, - updateAgentPolicies: updateAgentPoliciesMock, - setSelectedPolicyTab: setSelectedPolicyTabMock, - packagePolicy: packagePolicyMock, - }) - ); - - expect(sendGetOneAgentPolicy).not.toHaveBeenCalled(); - expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); - }); - - it('should set the default selected setup technology to agent-based when creating a non agentless-only package policy', async () => { - (useConfig as MockFn).mockReturnValue({ - agentless: { - enabled: true, - api: { - url: 'https://agentless.api.url', - }, - }, - } as any); - (useStartServices as MockFn).mockReturnValue({ - cloud: { - isCloudEnabled: true, - }, - }); - const { result } = renderHook(() => useSetupTechnology({ setNewAgentPolicy, newAgentPolicy: newAgentPolicyMock, updateAgentPolicies: updateAgentPoliciesMock, setSelectedPolicyTab: setSelectedPolicyTabMock, - packageInfo: packageInfoMock, packagePolicy: packagePolicyMock, }) ); @@ -254,61 +189,6 @@ describe('useSetupTechnology', () => { expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); }); - it('should set the default selected setup technology to agentless when creating an agentless-only package policy', async () => { - (useConfig as MockFn).mockReturnValue({ - agentless: { - enabled: true, - api: { - url: 'https://agentless.api.url', - }, - }, - } as any); - (useStartServices as MockFn).mockReturnValue({ - cloud: { - isCloudEnabled: true, - }, - }); - const agentlessOnlyPackageInfoMock = { - policy_templates: [ - { - deployment_modes: { - default: { enabled: false }, - agentless: { enabled: true }, - }, - }, - ], - } as PackageInfo; - - const { result } = renderHook(() => - useSetupTechnology({ - setNewAgentPolicy, - newAgentPolicy: newAgentPolicyMock, - updateAgentPolicies: updateAgentPoliciesMock, - setSelectedPolicyTab: setSelectedPolicyTabMock, - packageInfo: agentlessOnlyPackageInfoMock, - packagePolicy: packagePolicyMock, - }) - ); - - expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENTLESS); - }); - - it('should fetch agentless policy if agentless feature is enabled and isServerless is true', async () => { - renderHook(() => - useSetupTechnology({ - setNewAgentPolicy, - newAgentPolicy: newAgentPolicyMock, - updateAgentPolicies: updateAgentPoliciesMock, - setSelectedPolicyTab: setSelectedPolicyTabMock, - packagePolicy: packagePolicyMock, - }) - ); - - await waitFor(() => { - expect(sendGetOneAgentPolicy).toHaveBeenCalled(); - }); - }); - it('should set agentless setup technology if agent policy supports agentless in edit page', async () => { (useConfig as MockFn).mockReturnValue({ agentless: { @@ -338,7 +218,7 @@ describe('useSetupTechnology', () => { expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENTLESS); }); - it('should create agentless policy if agentless feature is enabled and isCloud is true and agentless.api.url', async () => { + it('should create agentless policy if isCloud and agentless.enabled', async () => { (useConfig as MockFn).mockReturnValue({ agentless: { enabled: true, @@ -437,7 +317,7 @@ describe('useSetupTechnology', () => { }); }); - it('should not create agentless policy if agentless feature is enabled and isCloud is true and agentless.api.url is not defined', async () => { + it('should not create agentless policy isCloud is true and agentless.api.url is not defined', async () => { (useConfig as MockFn).mockReturnValue({} as any); (useStartServices as MockFn).mockReturnValue({ cloud: { @@ -464,10 +344,18 @@ describe('useSetupTechnology', () => { await waitFor(() => expect(setNewAgentPolicy).toHaveBeenCalledTimes(0)); }); - it('should not fetch agentless policy if agentless is enabled but serverless is disabled', async () => { + it('should update new agent policy and selected policy tab when setup technology is agent-based', async () => { + (useConfig as MockFn).mockReturnValue({ + agentless: { + enabled: true, + api: { + url: 'https://agentless.api.url', + }, + }, + } as any); (useStartServices as MockFn).mockReturnValue({ cloud: { - isServerlessEnabled: false, + isCloudEnabled: true, }, }); @@ -481,48 +369,6 @@ describe('useSetupTechnology', () => { }) ); - expect(sendGetOneAgentPolicy).not.toHaveBeenCalled(); - expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); - }); - - it('should update agent policy and selected policy tab when setup technology is agentless', async () => { - const { result } = renderHook(() => - useSetupTechnology({ - setNewAgentPolicy, - newAgentPolicy: newAgentPolicyMock, - updateAgentPolicies: updateAgentPoliciesMock, - setSelectedPolicyTab: setSelectedPolicyTabMock, - packagePolicy: packagePolicyMock, - }) - ); - - act(() => { - result.current.handleSetupTechnologyChange(SetupTechnology.AGENTLESS); - }); - - await waitFor(() => { - expect(updateAgentPoliciesMock).toHaveBeenCalledWith([ - { - inactivity_timeout: 3600, - name: 'Agentless policy for endpoint-1', - supports_agentless: true, - }, - ]); - expect(setSelectedPolicyTabMock).toHaveBeenCalledWith(SelectedPolicyTab.EXISTING); - }); - }); - - it('should update new agent policy and selected policy tab when setup technology is agent-based', async () => { - const { result } = renderHook(() => - useSetupTechnology({ - setNewAgentPolicy, - newAgentPolicy: newAgentPolicyMock, - updateAgentPolicies: updateAgentPoliciesMock, - setSelectedPolicyTab: setSelectedPolicyTabMock, - packagePolicy: packagePolicyMock, - }) - ); - expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); act(() => { @@ -543,30 +389,6 @@ describe('useSetupTechnology', () => { }); }); - it('should not update agent policy and selected policy tab when agentless is disabled', async () => { - mockedExperimentalFeaturesService.get.mockReturnValue({ - agentless: false, - } as any); - - const { result } = renderHook(() => - useSetupTechnology({ - setNewAgentPolicy, - newAgentPolicy: newAgentPolicyMock, - updateAgentPolicies: updateAgentPoliciesMock, - setSelectedPolicyTab: setSelectedPolicyTabMock, - packagePolicy: packagePolicyMock, - }) - ); - - expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); - - act(() => { - result.current.handleSetupTechnologyChange(SetupTechnology.AGENTLESS); - }); - - expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); - }); - it('should not update agent policy and selected policy tab when setup technology matches the current one ', async () => { const { result } = renderHook(() => useSetupTechnology({ @@ -593,6 +415,19 @@ describe('useSetupTechnology', () => { }); it('should revert the agent policy name to the original value when switching from agentless back to agent-based', async () => { + (useConfig as MockFn).mockReturnValue({ + agentless: { + enabled: true, + api: { + url: 'https://agentless.api.url', + }, + }, + } as any); + (useStartServices as MockFn).mockReturnValue({ + cloud: { + isServerlessEnabled: true, + }, + }); const { result } = renderHook(() => useSetupTechnology({ setNewAgentPolicy, @@ -609,7 +444,9 @@ describe('useSetupTechnology', () => { result.current.handleSetupTechnologyChange(SetupTechnology.AGENTLESS); }); - expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENTLESS); + await waitFor(() => + expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENTLESS) + ); await waitFor(() => { expect(setNewAgentPolicy).toHaveBeenCalledWith({ @@ -623,8 +460,10 @@ describe('useSetupTechnology', () => { result.current.handleSetupTechnologyChange(SetupTechnology.AGENT_BASED); }); - expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); - expect(setNewAgentPolicy).toHaveBeenCalledWith(newAgentPolicyMock); + await waitFor(() => { + expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); + expect(setNewAgentPolicy).toHaveBeenCalledWith(newAgentPolicyMock); + }); }); it('should have global_data_tags with the integration team when creating agentless policy with global_data_tags', async () => { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts index 6bd3288af2e0d..d785dd988ba3a 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts @@ -8,7 +8,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useConfig } from '../../../../../hooks'; -import { ExperimentalFeaturesService } from '../../../../../services'; import { generateNewAgentPolicyWithDefaults } from '../../../../../../../../common/services/generate_new_agent_policy'; import type { AgentPolicy, @@ -17,10 +16,9 @@ import type { PackageInfo, } from '../../../../../types'; import { SetupTechnology } from '../../../../../types'; -import { sendGetOneAgentPolicy, useStartServices } from '../../../../../hooks'; +import { useStartServices } from '../../../../../hooks'; import { SelectedPolicyTab } from '../../components'; import { - AGENTLESS_POLICY_ID, AGENTLESS_GLOBAL_TAG_NAME_ORGANIZATION, AGENTLESS_GLOBAL_TAG_NAME_DIVISION, AGENTLESS_GLOBAL_TAG_NAME_TEAM, @@ -33,23 +31,15 @@ import { export const useAgentless = () => { const config = useConfig(); - const { agentless: agentlessExperimentalFeatureEnabled } = ExperimentalFeaturesService.get(); const { cloud } = useStartServices(); const isServerless = !!cloud?.isServerlessEnabled; const isCloud = !!cloud?.isCloudEnabled; - const isAgentlessApiEnabled = (isCloud || isServerless) && config.agentless?.enabled; - const isDefaultAgentlessPolicyEnabled = - !isAgentlessApiEnabled && isServerless && agentlessExperimentalFeatureEnabled; - - const isAgentlessEnabled = isAgentlessApiEnabled || isDefaultAgentlessPolicyEnabled; + const isAgentlessEnabled = (isCloud || isServerless) && config.agentless?.enabled === true; const isAgentlessAgentPolicy = (agentPolicy: AgentPolicy | undefined) => { if (!agentPolicy) return false; - return ( - isAgentlessEnabled && - (agentPolicy?.id === AGENTLESS_POLICY_ID || !!agentPolicy?.supports_agentless) - ); + return isAgentlessEnabled && !!agentPolicy?.supports_agentless; }; // When an integration has at least a policy template enabled for agentless @@ -60,17 +50,10 @@ export const useAgentless = () => { return false; }; - // TODO: remove this check when CSPM implements the above flag and rely only on `isAgentlessIntegration` - const isAgentlessPackagePolicy = (packagePolicy: NewPackagePolicy) => { - return isAgentlessEnabled && packagePolicy.policy_ids.includes(AGENTLESS_POLICY_ID); - }; return { - isAgentlessApiEnabled, - isDefaultAgentlessPolicyEnabled, isAgentlessEnabled, isAgentlessAgentPolicy, isAgentlessIntegration, - isAgentlessPackagePolicy, }; }; @@ -93,8 +76,7 @@ export function useSetupTechnology({ isEditPage?: boolean; agentPolicies?: AgentPolicy[]; }) { - const { isAgentlessEnabled, isAgentlessApiEnabled, isDefaultAgentlessPolicyEnabled } = - useAgentless(); + const { isAgentlessEnabled } = useAgentless(); // this is a placeholder for the new agent-BASED policy that will be used when the user switches from agentless to agent-based and back const newAgentBasedPolicy = useRef(newAgentPolicy); @@ -119,7 +101,7 @@ export function useSetupTechnology({ setSelectedSetupTechnology(SetupTechnology.AGENTLESS); return; } - if (isAgentlessApiEnabled && selectedSetupTechnology === SetupTechnology.AGENTLESS) { + if (isAgentlessEnabled && selectedSetupTechnology === SetupTechnology.AGENTLESS) { const nextNewAgentlessPolicy = { ...newAgentlessPolicy, name: getAgentlessAgentPolicyNameFromPackagePolicyName(packagePolicy.name), @@ -131,7 +113,7 @@ export function useSetupTechnology({ } } }, [ - isAgentlessApiEnabled, + isAgentlessEnabled, isEditPage, newAgentlessPolicy, packagePolicy.name, @@ -142,30 +124,6 @@ export function useSetupTechnology({ setSelectedSetupTechnology, ]); - // tech debt: remove this useEffect when Serverless uses the Agentless API - // https://github.com/elastic/security-team/issues/9781 - useEffect(() => { - const fetchAgentlessPolicy = async () => { - const { data, error } = await sendGetOneAgentPolicy(AGENTLESS_POLICY_ID); - const isAgentlessAvailable = !error && data && data.item; - - if (isAgentlessAvailable) { - setNewAgentlessPolicy(data.item); - } - }; - - if (isDefaultAgentlessPolicyEnabled) { - fetchAgentlessPolicy(); - } - }, [isDefaultAgentlessPolicyEnabled]); - - useEffect(() => { - if (isEditPage) { - return; - } - setSelectedSetupTechnology(defaultSetupTechnology); - }, [packageInfo, defaultSetupTechnology, isEditPage]); - const handleSetupTechnologyChange = useCallback( (setupTechnology: SetupTechnology, policyTemplateName?: string) => { if (!isAgentlessEnabled || setupTechnology === selectedSetupTechnology) { @@ -173,7 +131,7 @@ export function useSetupTechnology({ } if (setupTechnology === SetupTechnology.AGENTLESS) { - if (isAgentlessApiEnabled) { + if (isAgentlessEnabled) { const agentlessPolicy = { ...newAgentlessPolicy, ...getAdditionalAgentlessPolicyInfo(policyTemplateName, packageInfo), @@ -184,13 +142,6 @@ export function useSetupTechnology({ setSelectedPolicyTab(SelectedPolicyTab.NEW); updateAgentPolicies([agentlessPolicy] as AgentPolicy[]); } - // tech debt: remove this when Serverless uses the Agentless API - // https://github.com/elastic/security-team/issues/9781 - if (isDefaultAgentlessPolicyEnabled) { - setNewAgentPolicy(newAgentlessPolicy as AgentPolicy); - updateAgentPolicies([newAgentlessPolicy] as AgentPolicy[]); - setSelectedPolicyTab(SelectedPolicyTab.EXISTING); - } } else if (setupTechnology === SetupTechnology.AGENT_BASED) { setNewAgentPolicy({ ...newAgentBasedPolicy.current, @@ -204,8 +155,6 @@ export function useSetupTechnology({ [ isAgentlessEnabled, selectedSetupTechnology, - isAgentlessApiEnabled, - isDefaultAgentlessPolicyEnabled, setNewAgentPolicy, newAgentlessPolicy, setSelectedPolicyTab, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.test.tsx index e3b1959475649..a79db9ea1edda 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.test.tsx @@ -13,17 +13,12 @@ import type { MockedFleetStartServices, TestRenderer } from '../../../../../../m import { createFleetTestRendererMock } from '../../../../../../mock'; import { FLEET_ROUTING_PATHS, pagePathGetters, PLUGIN_ID } from '../../../../constants'; import type { CreatePackagePolicyRouteState } from '../../../../types'; - -import { ExperimentalFeaturesService } from '../../../../../../services'; - import { sendCreatePackagePolicy, sendCreateAgentPolicy, sendGetAgentStatus, - sendGetOneAgentPolicy, useIntraAppState, useStartServices, - useGetAgentPolicies, useGetPackageInfoByKeyQuery, useConfig, } from '../../../../hooks'; @@ -138,10 +133,6 @@ jest.mock('react-router-dom', () => ({ }), })); -import { AGENTLESS_POLICY_ID } from '../../../../../../../common/constants'; - -import { useAllNonManagedAgentPolicies } from '../components/steps/components/use_policies'; - import { CreatePackagePolicySinglePage } from '.'; import { SETUP_TECHNOLOGY_SELECTOR_TEST_SUBJ } from './components/setup_technology_selector'; @@ -692,108 +683,6 @@ describe('When on the package policy create page', () => { }); }); - describe('With agentless policy and Serverless available', () => { - beforeEach(async () => { - (useStartServices as jest.MockedFunction).mockReturnValue({ - ...useStartServices(), - cloud: { - ...useStartServices().cloud, - isServerlessEnabled: true, - }, - }); - jest.spyOn(ExperimentalFeaturesService, 'get').mockReturnValue({ agentless: true } as any); - (useGetPackageInfoByKeyQuery as jest.Mock).mockReturnValue( - getMockPackageInfo({ requiresRoot: false, dataStreamRequiresRoot: false }) - ); - - (sendGetOneAgentPolicy as jest.MockedFunction).mockResolvedValue({ - data: { item: { id: AGENTLESS_POLICY_ID, name: 'Agentless CSPM', namespace: 'default' } }, - }); - (useGetAgentPolicies as jest.MockedFunction).mockReturnValue({ - data: { - items: [{ id: AGENTLESS_POLICY_ID, name: 'Agentless CSPM', namespace: 'default' }], - }, - error: undefined, - isLoading: false, - resendRequest: jest.fn(), - }); - (useAllNonManagedAgentPolicies as jest.MockedFunction).mockReturnValue([ - { id: AGENTLESS_POLICY_ID, name: 'Agentless CSPM', namespace: 'default' }, - ]); - - await act(async () => { - render(); - }); - }); - - test('should not force create package policy when not in serverless', async () => { - jest.spyOn(ExperimentalFeaturesService, 'get').mockReturnValue({ agentless: false } as any); - (useStartServices as jest.MockedFunction).mockReturnValue({ - ...useStartServices(), - cloud: { - ...useStartServices().cloud, - isServerlessEnabled: false, - }, - }); - await act(async () => { - fireEvent.click(renderResult.getByText('Existing hosts')!); - }); - - await act(async () => { - fireEvent.click(renderResult.getByText(/Save and continue/).closest('button')!); - }); - - expect(sendCreateAgentPolicy as jest.MockedFunction).not.toHaveBeenCalled(); - expect(sendCreatePackagePolicy as jest.MockedFunction).toHaveBeenCalledWith({ - ...newPackagePolicy, - force: false, - policy_ids: [AGENTLESS_POLICY_ID], - }); - - await waitFor(() => { - expect(renderResult.getByText('Nginx integration added')).toBeInTheDocument(); - }); - }); - - test('should force create package policy', async () => { - await act(async () => { - fireEvent.click(renderResult.getByText('Existing hosts')!); - }); - - await act(async () => { - fireEvent.click(renderResult.getByText(/Save and continue/).closest('button')!); - }); - - expect(sendCreateAgentPolicy as jest.MockedFunction).not.toHaveBeenCalled(); - expect(sendCreatePackagePolicy as jest.MockedFunction).toHaveBeenCalledWith({ - ...newPackagePolicy, - force: true, - policy_ids: [AGENTLESS_POLICY_ID], - }); - - await waitFor(() => { - expect(renderResult.getByText('Nginx integration added')).toBeInTheDocument(); - }); - }); - - test('should not show confirmation modal', async () => { - (sendGetAgentStatus as jest.MockedFunction).mockResolvedValueOnce({ - data: { results: { active: 1 } }, - }); - - await act(async () => { - fireEvent.click(renderResult.getByText('Existing hosts')!); - }); - - await act(async () => { - fireEvent.click(renderResult.getByText(/Save and continue/).closest('button')!); - }); - - expect(sendCreateAgentPolicy as jest.MockedFunction).not.toHaveBeenCalled(); - expect(sendCreatePackagePolicy as jest.MockedFunction).toHaveBeenCalled(); - }); - }); - describe('With agentless Cloud available', () => { beforeEach(async () => { (useConfig as jest.MockedFunction).mockReturnValue({ @@ -819,10 +708,6 @@ describe('When on the package policy create page', () => { }, }); - (sendCreatePackagePolicy as jest.MockedFunction).mockResolvedValue({ - data: { item: { id: 'policy-1', inputs: [], policy_ids: ['agentless-policy-1'] } }, - }); - jest.spyOn(ExperimentalFeaturesService, 'get').mockReturnValue({ agentless: true } as any); (useGetPackageInfoByKeyQuery as jest.Mock).mockReturnValue( getMockPackageInfo({ requiresRoot: false, @@ -840,9 +725,6 @@ describe('When on the package policy create page', () => { fireEvent.click(renderResult.getByText(/Save and continue/).closest('button')!); }); - // tech debt: this should be converted to use MSW to mock the API calls - // https://github.com/elastic/security-team/issues/9816 - expect(sendGetOneAgentPolicy).not.toHaveBeenCalled(); expect(sendCreateAgentPolicy).toHaveBeenCalledWith( expect.objectContaining({ monitoring_enabled: ['logs', 'metrics'], diff --git a/x-pack/plugins/fleet/server/routes/package_policy/utils/index.ts b/x-pack/plugins/fleet/server/routes/package_policy/utils/index.ts index 518d8fc3f74c8..a174cb65fe3ce 100644 --- a/x-pack/plugins/fleet/server/routes/package_policy/utils/index.ts +++ b/x-pack/plugins/fleet/server/routes/package_policy/utils/index.ts @@ -11,7 +11,7 @@ import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-ser import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; -import { isAgentlessApiEnabled } from '../../../services/utils/agentless'; +import { isAgentlessEnabled } from '../../../services/utils/agentless'; import { getAgentlessAgentPolicyNameFromPackagePolicyName } from '../../../../common/services/agentless_policy_helper'; @@ -65,7 +65,7 @@ export async function renameAgentlessAgentPolicy( packagePolicy: PackagePolicy, name: string ) { - if (!isAgentlessApiEnabled()) { + if (!isAgentlessEnabled()) { return; } // If agentless is enabled for cloud, we need to rename the agent policy diff --git a/x-pack/plugins/fleet/server/services/agent_policy.test.ts b/x-pack/plugins/fleet/server/services/agent_policy.test.ts index fb3274b6eef77..76d2727b65e85 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.test.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.test.ts @@ -157,7 +157,7 @@ describe('Agent policy', () => { beforeEach(() => { mockedLogger = loggerMock.create(); mockedAppContextService.getLogger.mockReturnValue(mockedLogger); - mockedAppContextService.getExperimentalFeatures.mockReturnValue({ agentless: false } as any); + mockedAppContextService.getExperimentalFeatures.mockReturnValue({} as any); jest.mocked(isSpaceAwarenessEnabled).mockResolvedValue(false); jest .mocked(getPackagePolicySavedObjectType) @@ -315,10 +315,7 @@ describe('Agent policy', () => { ); }); - it('should throw AgentPolicyInvalidError if support_agentless is defined in stateful without agentless feature', async () => { - jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: false } as any); + it('should throw AgentPolicyInvalidError if support_agentless is defined in stateful without agentless enabled', async () => { jest .spyOn(appContextService, 'getCloud') .mockReturnValue({ isServerlessEnabled: false } as any); @@ -339,10 +336,7 @@ describe('Agent policy', () => { ); }); - it('should throw AgentPolicyInvalidError if agentless feature flag is disabled in serverless', async () => { - jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: false } as any); + it('should throw AgentPolicyInvalidError if agentless is disabled in serverless', async () => { jest .spyOn(appContextService, 'getCloud') .mockReturnValue({ isServerlessEnabled: true } as any); @@ -363,10 +357,10 @@ describe('Agent policy', () => { ); }); - it('should create a policy agentless feature flag is set and in serverless env', async () => { + it('should create an agentless policy when agentless config is set and in serverless env', async () => { jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: true } as any); + .spyOn(appContextService, 'getConfig') + .mockReturnValue({ agentless: { enabled: true } } as any); jest .spyOn(appContextService, 'getCloud') .mockReturnValue({ isServerlessEnabled: true } as any); @@ -1229,13 +1223,13 @@ describe('Agent policy', () => { ).resolves.not.toThrow(); }); - it('should throw AgentPolicyInvalidError if agentless flag is disabled in serverless', async () => { - jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: false } as any); + it('should not throw AgentPolicyInvalidError if support_agentless is defined in serverless', async () => { + jest.spyOn(appContextService, 'getConfig').mockReturnValue({ + agentless: { enabled: true }, + } as any); jest .spyOn(appContextService, 'getCloud') - .mockReturnValue({ isServerlessEnabled: true } as any); + .mockReturnValue({ isServerlessEnabled: true, isCloudEnabled: false } as any); const soClient = getAgentPolicyCreateMock(); const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser; @@ -1252,17 +1246,13 @@ describe('Agent policy', () => { namespace: 'default', supports_agentless: true, }) - ).rejects.toThrowError( - new AgentPolicyInvalidError( - 'supports_agentless is only allowed in serverless and cloud environments that support the agentless feature' - ) - ); + ).resolves.not.toThrow(); }); - it('should not throw in serverless if support_agentless is set and agentless feature flag is set', async () => { + it('should not throw in serverless if support_agentless and agentless config is set', async () => { jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: true } as any); + .spyOn(appContextService, 'getConfig') + .mockReturnValue({ agentless: { enabled: true } } as any); jest .spyOn(appContextService, 'getCloud') .mockReturnValue({ isServerlessEnabled: true } as any); diff --git a/x-pack/plugins/fleet/server/services/agents/agentless_agent.ts b/x-pack/plugins/fleet/server/services/agents/agentless_agent.ts index 314af0ada7bf4..6d1945fced809 100644 --- a/x-pack/plugins/fleet/server/services/agents/agentless_agent.ts +++ b/x-pack/plugins/fleet/server/services/agents/agentless_agent.ts @@ -35,7 +35,7 @@ import { appContextService } from '../app_context'; import { listEnrollmentApiKeys } from '../api_keys'; import { listFleetServerHosts } from '../fleet_server_host'; import type { AgentlessConfig } from '../utils/agentless'; -import { prependAgentlessApiBasePathToEndpoint, isAgentlessApiEnabled } from '../utils/agentless'; +import { prependAgentlessApiBasePathToEndpoint, isAgentlessEnabled } from '../utils/agentless'; class AgentlessAgentService { public async createAgentlessAgent( @@ -59,7 +59,7 @@ class AgentlessAgentService { throw new AgentlessAgentConfigError('missing Agentless API configuration in Kibana'); } - if (!isAgentlessApiEnabled()) { + if (!isAgentlessEnabled()) { logger.error( '[Agentless API] Agentless agents are only supported in cloud deployment and serverless projects' ); @@ -179,7 +179,7 @@ class AgentlessAgentService { `[Agentless API] Start deleting agentless agent for agent policy ${requestConfigDebugStatus}` ); - if (!isAgentlessApiEnabled) { + if (!isAgentlessEnabled) { logger.error( '[Agentless API] Agentless API is not supported. Deleting agentless agent is not supported in non-cloud or non-serverless environments' ); @@ -431,45 +431,38 @@ class AgentlessAgentService { 400: { create: { log: '[Agentless API] Creating the agentless agent failed with a status 400, bad request for agentless policy.', - message: - 'the Agentless API could not create the agentless agent. Please delete the agentless policy and try again or contact your administrator.', + message: `the Agentless API could not create the agentless agent. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, delete: { log: '[Agentless API] Deleting the agentless deployment failed with a status 400, bad request for agentless policy', - message: - 'the Agentless API could not create the agentless agent. Please delete the agentless policy try again or contact your administrator.', + message: `the Agentless API could not create the agentless agent. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, }, 401: { create: { log: '[Agentless API] Creating the agentless agent failed with a status 401 unauthorized for agentless policy.', - message: - 'the Agentless API could not create the agentless agent because an unauthorized request was sent. Please delete the agentless policy and try again or contact your administrator.', + message: `the Agentless API could not create the agentless agent because an unauthorized request was sent. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, delete: { log: '[Agentless API] Deleting the agentless deployment failed with a status 401 unauthorized for agentless policy. Check the Kibana Agentless API tls configuration', - message: - 'the Agentless API could not delete the agentless deployment because an unauthorized request was sent. Please try again or contact your administrator.', + message: `the Agentless API could not delete the agentless deployment because an unauthorized request was sent. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, }, 403: { create: { log: '[Agentless API] Creating the agentless agent failed with a status 403 forbidden for agentless policy. Check the Kibana Agentless API configuration and endpoints.', - message: - 'the Agentless API could not create the agentless agent because a forbidden request was sent. Please delete the agentless policy and try again or contact your administrator.', + message: `the Agentless API could not create the agentless agent because a forbidden request was sent. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, delete: { log: '[Agentless API] Deleting the agentless deployment failed with a status 403 forbidden for agentless policy. Check the Kibana Agentless API configuration and endpoints.', - message: - 'the Agentless API could not delete the agentless deployment because a forbidden request was sent. Please try again or contact your administrator.', + message: `the Agentless API could not delete the agentless deployment because a forbidden request was sent. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, }, 404: { // this is likely to happen when creating agentless agents, but covering it in case create: { log: '[Agentless API] Creating the agentless agent failed with a status 404 not found.', - message: - 'the Agentless API could not create the agentless agent because it returned a 404 error not found.', + message: `the Agentless API could not create the agentless agent because it returned a 404 error not found. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, delete: { log: '[Agentless API] Deleting the agentless deployment failed with a status 404 not found', @@ -479,12 +472,11 @@ class AgentlessAgentService { 408: { create: { log: '[Agentless API] Creating the agentless agent failed with a status 408, the request timed out', - message: - 'the Agentless API request timed out waiting for the agentless agent status to respond, please wait a few minutes for the agent to enroll with fleet. If agent fails to enroll with Fleet please delete the agentless policy try again or contact your administrator.', + message: `the Agentless API request timed out waiting for the agentless agent status to respond, please wait a few minutes for the agent to enroll with fleet. If agent fails to enroll with Fleet please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, delete: { log: '[Agentless API] Deleting the agentless deployment failed with a status 408, the request timed out', - message: `the Agentless API could not delete the agentless deployment ${agentlessPolicyId} because the request timed out, please wait a few minutes for the agentless agent deployment to be removed. If it continues to persist please try again or contact your administrator.`, + message: `the Agentless API could not delete the agentless deployment because the request timed out, please wait a few minutes for the agentless agent deployment to be removed. If it continues to persist please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, }, 429: { @@ -503,36 +495,31 @@ class AgentlessAgentService { 500: { create: { log: '[Agentless API] Creating the agentless agent failed with a status 500 internal service error.', - message: - 'the Agentless API could not create the agentless agent because it returned a 500 internal error. Please delete the agentless policy and try again later or contact your administrator.', + message: `the Agentless API could not create the agentless agent because it returned a 500 internal error. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, delete: { log: '[Agentless API] Deleting the agentless deployment failed with a status 500 internal service error.', - message: - 'the Agentless API could not delete the agentless deployment because it returned a 500 internal error. Please try again later or contact your administrator.', + message: `the Agentless API could not delete the agentless deployment because it returned a 500 internal error. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, }, unhandled_response: { create: { log: '[Agentless API] Creating agentless agent failed because the Agentless API responded with an unhandled status code that falls out of the range of 2xx:', - message: - 'the Agentless API could not create the agentless agent due to an unexpected error. Please delete the agentless policy and try again later or contact your administrator.', + message: `the Agentless API could not create the agentless agent due to an unexpected error. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, delete: { log: '[Agentless API] Deleting agentless deployment failed because the Agentless API responded with an unhandled status code that falls out of the range of 2xx:', - message: `the Agentless API could not delete the agentless deployment ${agentlessPolicyId}. Please try again later or contact your administrator.`, + message: `the Agentless API could not delete the agentless deployment. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, }, request_error: { create: { log: '[Agentless API] Creating agentless agent failed with a request error:', - message: - 'the Agentless API could not create the agentless agent due to a request error. Please delete the agentless policy and try again later or contact your administrator.', + message: `the Agentless API could not create the agentless agent due to a request error. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, delete: { log: '[Agentless API] Deleting agentless deployment failed with a request error:', - message: - 'the Agentless API could not delete the agentless deployment due to a request error. Please try again later or contact your administrator.', + message: `the Agentless API could not delete the agentless deployment due to a request error. Please delete the agentless policy ${agentlessPolicyId} and try again or contact your administrator.`, }, }, }; diff --git a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts index fb2153ff903f0..57621238d914f 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts @@ -306,10 +306,8 @@ jest.mock('./app_context', () => ({ }), getExternalCallbacks: jest.fn(), getCloud: jest.fn(), - getExperimentalFeatures: jest.fn().mockReturnValue({ - agentless: false, - }), getConfig: jest.fn(), + getExperimentalFeatures: jest.fn().mockReturnValue({}), getInternalUserSOClientForSpaceId: jest.fn(), }, })); @@ -1075,10 +1073,6 @@ describe('policy preconfiguration', () => { DEFAULT_SPACE_ID ); - jest.mocked(appContextService.getExperimentalFeatures).mockReturnValue({ - agentless: true, - } as any); - expect(appContextService.getInternalUserSOClientForSpaceId).toBeCalledTimes(1); expect(appContextService.getInternalUserSOClientForSpaceId).toBeCalledWith(TEST_NAMESPACE); diff --git a/x-pack/plugins/fleet/server/services/utils/agentless.test.ts b/x-pack/plugins/fleet/server/services/utils/agentless.test.ts index 5bf5116128d94..48f186fed553f 100644 --- a/x-pack/plugins/fleet/server/services/utils/agentless.test.ts +++ b/x-pack/plugins/fleet/server/services/utils/agentless.test.ts @@ -9,12 +9,7 @@ import { securityMock } from '@kbn/security-plugin/server/mocks'; import { appContextService } from '../app_context'; -import { - isAgentlessApiEnabled, - isAgentlessEnabled, - isDefaultAgentlessPolicyEnabled, - prependAgentlessApiBasePathToEndpoint, -} from './agentless'; +import { isAgentlessEnabled, prependAgentlessApiBasePathToEndpoint } from './agentless'; jest.mock('../app_context'); @@ -23,7 +18,7 @@ mockedAppContextService.getSecuritySetup.mockImplementation(() => ({ ...securityMock.createSetup(), })); -describe('isAgentlessApiEnabled', () => { +describe('isAgentlessEnabled', () => { afterEach(() => { jest.clearAllMocks(); mockedAppContextService.getConfig.mockReset(); @@ -36,7 +31,7 @@ describe('isAgentlessApiEnabled', () => { } as any); jest.spyOn(appContextService, 'getCloud').mockReturnValue({ isCloudEnabled: false } as any); - expect(isAgentlessApiEnabled()).toBe(false); + expect(isAgentlessEnabled()).toBe(false); }); it('should return false if cloud is enabled but agentless is not', () => { @@ -47,7 +42,7 @@ describe('isAgentlessApiEnabled', () => { } as any); jest.spyOn(appContextService, 'getCloud').mockReturnValue({ isCloudEnabled: true } as any); - expect(isAgentlessApiEnabled()).toBe(false); + expect(isAgentlessEnabled()).toBe(false); }); it('should return true if cloud is enabled and agentless is enabled', () => { @@ -58,109 +53,10 @@ describe('isAgentlessApiEnabled', () => { } as any); jest.spyOn(appContextService, 'getCloud').mockReturnValue({ isCloudEnabled: true } as any); - expect(isAgentlessApiEnabled()).toBe(true); - }); -}); - -describe('isDefaultAgentlessPolicyEnabled', () => { - afterEach(() => { - jest.clearAllMocks(); - mockedAppContextService.getConfig.mockReset(); - }); - - it('should return false if serverless is not enabled', () => { - jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: false } as any); - jest - .spyOn(appContextService, 'getCloud') - .mockReturnValue({ isServerlessEnabled: false } as any); - - expect(isDefaultAgentlessPolicyEnabled()).toBe(false); - }); - - it('should return false if serverless is enabled but agentless is not', () => { - jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: false } as any); - jest.spyOn(appContextService, 'getCloud').mockReturnValue({ isServerlessEnabled: true } as any); - - expect(isDefaultAgentlessPolicyEnabled()).toBe(false); - }); - - it('should return true if serverless is enabled and agentless is enabled', () => { - jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: true } as any); - jest.spyOn(appContextService, 'getCloud').mockReturnValue({ isServerlessEnabled: true } as any); - - expect(isDefaultAgentlessPolicyEnabled()).toBe(true); - }); -}); - -describe('isAgentlessEnabled', () => { - afterEach(() => { - jest.clearAllMocks(); - mockedAppContextService.getConfig.mockReset(); - }); - - it('should return false if cloud and serverless are not enabled', () => { - jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: false } as any); - jest.spyOn(appContextService, 'getCloud').mockReturnValue({ isCloudEnabled: false } as any); - jest - .spyOn(appContextService, 'getCloud') - .mockReturnValue({ isServerlessEnabled: false } as any); - - expect(isAgentlessEnabled()).toBe(false); - }); - - it('should return false if cloud is enabled but agentless is not', () => { - jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: false } as any); - jest.spyOn(appContextService, 'getCloud').mockReturnValue({ isCloudEnabled: true } as any); - jest - .spyOn(appContextService, 'getCloud') - .mockReturnValue({ isServerlessEnabled: false } as any); - - expect(isAgentlessEnabled()).toBe(false); - }); - - it('should return false if serverless is enabled but agentless is not', () => { - jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: false } as any); - jest - .spyOn(appContextService, 'getCloud') - .mockReturnValue({ isCloudEnabled: false, isServerlessEnabled: true } as any); - - expect(isAgentlessEnabled()).toBe(false); - }); - - it('should return true if cloud is enabled and agentless is enabled', () => { - jest - .spyOn(appContextService, 'getConfig') - .mockReturnValue({ agentless: { enabled: true } } as any); - jest - .spyOn(appContextService, 'getCloud') - .mockReturnValue({ isCloudEnabled: true, isServerlessEnabled: false } as any); - - expect(isAgentlessEnabled()).toBe(true); - }); - - it('should return true if serverless is enabled and agentless is enabled', () => { - jest - .spyOn(appContextService, 'getExperimentalFeatures') - .mockReturnValue({ agentless: true } as any); - jest - .spyOn(appContextService, 'getCloud') - .mockReturnValue({ isCloudEnabled: false, isServerlessEnabled: true } as any); - expect(isAgentlessEnabled()).toBe(true); }); }); + describe('prependAgentlessApiBasePathToEndpoint', () => { afterEach(() => { jest.clearAllMocks(); diff --git a/x-pack/plugins/fleet/server/services/utils/agentless.ts b/x-pack/plugins/fleet/server/services/utils/agentless.ts index 0f5d4e9d1de85..019c035d55e27 100644 --- a/x-pack/plugins/fleet/server/services/utils/agentless.ts +++ b/x-pack/plugins/fleet/server/services/utils/agentless.ts @@ -9,20 +9,11 @@ import { appContextService } from '..'; import type { FleetConfigType } from '../../config'; export { isOnlyAgentlessIntegration } from '../../../common/services/agentless_policy_helper'; -export const isAgentlessApiEnabled = () => { +export const isAgentlessEnabled = () => { const cloudSetup = appContextService.getCloud(); const isHosted = cloudSetup?.isCloudEnabled || cloudSetup?.isServerlessEnabled; return Boolean(isHosted && appContextService.getConfig()?.agentless?.enabled); }; -export const isDefaultAgentlessPolicyEnabled = () => { - const cloudSetup = appContextService.getCloud && appContextService.getCloud(); - return Boolean( - cloudSetup?.isServerlessEnabled && appContextService.getExperimentalFeatures().agentless - ); -}; -export const isAgentlessEnabled = () => { - return isAgentlessApiEnabled() || isDefaultAgentlessPolicyEnabled(); -}; const AGENTLESS_ESS_API_BASE_PATH = '/api/v1/ess'; const AGENTLESS_SERVERLESS_API_BASE_PATH = '/api/v1/serverless'; From 2e004f867f8bf5d1d1154f4e5aa6d97b55d0062e Mon Sep 17 00:00:00 2001 From: "Joey F. Poon" Date: Tue, 26 Nov 2024 04:04:06 +0900 Subject: [PATCH 53/71] [Security Solution] add initial workflow insights service (#199606) ## Summary Adds an SecurityWorkflowInsightsService that is setup during security solution plugin initialization. The service setup installs the component templates, index template, and datastream used by the service. Depends on: - https://github.com/elastic/elasticsearch/pull/116485 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels) Co-authored-by: Konrad Szwarc --- .../server/endpoint/services/index.ts | 1 + .../services/workflow_insights/constants.ts | 14 ++ .../services/workflow_insights/errors.ts | 14 ++ .../field_map_configurations.ts | 183 ++++++++++++++++++ .../workflow_insights/helpers.test.ts | 80 ++++++++ .../services/workflow_insights/helpers.ts | 62 ++++++ .../services/workflow_insights/index.test.ts | 163 ++++++++++++++++ .../services/workflow_insights/index.ts | 130 +++++++++++++ .../security_solution/server/plugin.ts | 19 +- 9 files changed, 665 insertions(+), 1 deletion(-) create mode 100644 x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/constants.ts create mode 100644 x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/errors.ts create mode 100644 x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/field_map_configurations.ts create mode 100644 x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.test.ts create mode 100644 x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.ts create mode 100644 x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.test.ts create mode 100644 x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.ts diff --git a/x-pack/plugins/security_solution/server/endpoint/services/index.ts b/x-pack/plugins/security_solution/server/endpoint/services/index.ts index 242639818566e..53c49d315ffac 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/index.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/index.ts @@ -9,4 +9,5 @@ export * from './artifacts'; export * from './actions'; export * from './agent'; export * from './artifacts_exception_list'; +export * from './workflow_insights'; export type { FeatureKeys } from './feature_usage'; diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/constants.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/constants.ts new file mode 100644 index 0000000000000..f0884f2214cb8 --- /dev/null +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/constants.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const DATA_STREAM_PREFIX = '.security-workflow-insights'; +export const COMPONENT_TEMPLATE_NAME = `${DATA_STREAM_PREFIX}-component-template`; +export const INDEX_TEMPLATE_NAME = `${DATA_STREAM_PREFIX}-index-template`; +export const INGEST_PIPELINE_NAME = `${DATA_STREAM_PREFIX}-ingest-pipeline`; +export const DATA_STREAM_NAME = `${DATA_STREAM_PREFIX}-default`; + +export const TOTAL_FIELDS_LIMIT = 2000; diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/errors.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/errors.ts new file mode 100644 index 0000000000000..fa2cba3a6cd75 --- /dev/null +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/errors.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EndpointError } from '../../../../common/endpoint/errors'; + +export class SecurityWorkflowInsightsFailedInitialized extends EndpointError { + constructor(msg: string) { + super(`security workflow insights service failed to initialize with error: ${msg}`); + } +} diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/field_map_configurations.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/field_map_configurations.ts new file mode 100644 index 0000000000000..32cc845ab00d2 --- /dev/null +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/field_map_configurations.ts @@ -0,0 +1,183 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import type { FieldMap } from '@kbn/data-stream-adapter'; + +export const securityWorkflowInsightsFieldMap: FieldMap = { + '@timestamp': { + type: 'date', + array: false, + required: true, + }, + message: { + type: 'text', + array: false, + required: true, + }, + // endpoint or other part of security + category: { + type: 'keyword', + array: false, + required: true, + }, + // incompatible_virus, noisy_process_tree, etc + type: { + type: 'keyword', + array: false, + required: true, + }, + // the creator of the insight + source: { + type: 'nested', + array: false, + required: true, + }, + // kibana-insight-task, llm-request-id, etc + 'source.id': { + type: 'keyword', + array: false, + required: true, + }, + // endpoint, kibana, llm, etc + 'source.type': { + type: 'keyword', + array: false, + required: true, + }, + // starting timestamp of the source data used to generate the insight + 'source.data_range_start': { + type: 'date', + array: false, + required: true, + }, + // ending timestamp of the source data used to generate the insight + 'source.data_range_end': { + type: 'date', + array: false, + required: true, + }, + // the target that this insight is created for + target: { + type: 'nested', + array: false, + required: true, + }, + // endpoint, policy, etc + 'target.id': { + type: 'keyword', + array: true, + required: true, + }, + // endpoint ids, policy ids, etc + 'target.type': { + type: 'keyword', + array: false, + required: true, + }, + // latest action taken on the insight + action: { + type: 'nested', + array: false, + required: true, + }, + // refreshed, remediated, suppressed, dismissed + 'action.type': { + type: 'keyword', + array: false, + required: true, + }, + 'action.timestamp': { + type: 'date', + array: false, + required: true, + }, + // unique key for this insight, used for deduplicating insights. + // ie. crowdstrike or windows_defender + value: { + type: 'keyword', + array: false, + required: true, + }, + // suggested remediation for insight + remediation: { + type: 'object', + array: false, + required: true, + }, + // if remediation includes exception list items + 'remediation.exception_list_items': { + type: 'object', + array: true, + required: false, + }, + 'remediation.exception_list_items.list_id': { + type: 'keyword', + array: false, + required: true, + }, + 'remediation.exception_list_items.name': { + type: 'text', + array: false, + required: true, + }, + 'remediation.exception_list_items.description': { + type: 'text', + array: false, + required: false, + }, + 'remediation.exception_list_items.entries': { + type: 'object', + array: true, + required: true, + }, + 'remediation.exception_list_items.entries.field': { + type: 'keyword', + array: false, + required: true, + }, + 'remediation.exception_list_items.entries.operator': { + type: 'keyword', + array: false, + required: true, + }, + 'remediation.exception_list_items.entries.type': { + type: 'keyword', + array: false, + required: true, + }, + 'remediation.exception_list_items.entries.value': { + type: 'text', + array: false, + required: true, + }, + 'remediation.exception_list_items.tags': { + type: 'keyword', + array: true, + required: true, + }, + 'remediation.exception_list_items.os_types': { + type: 'keyword', + array: true, + required: true, + }, + metadata: { + type: 'object', + array: false, + required: true, + }, + // optional KV for notes + 'metadata.notes': { + type: 'object', + array: false, + required: false, + }, + // optional i8n variables + 'metadata.message_variables': { + type: 'text', + array: true, + required: false, + }, +} as const; diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.test.ts new file mode 100644 index 0000000000000..33f1851091167 --- /dev/null +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.test.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { ElasticsearchClient } from '@kbn/core/server'; +import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; +import { DataStreamSpacesAdapter } from '@kbn/data-stream-adapter'; +import { kibanaPackageJson } from '@kbn/repo-info'; + +import { createDatastream, createPipeline } from './helpers'; +import { + DATA_STREAM_PREFIX, + COMPONENT_TEMPLATE_NAME, + INDEX_TEMPLATE_NAME, + INGEST_PIPELINE_NAME, + TOTAL_FIELDS_LIMIT, +} from './constants'; +import { securityWorkflowInsightsFieldMap } from './field_map_configurations'; + +jest.mock('@kbn/data-stream-adapter', () => ({ + DataStreamSpacesAdapter: jest.fn().mockImplementation(() => ({ + setComponentTemplate: jest.fn(), + setIndexTemplate: jest.fn(), + })), +})); + +describe('helpers', () => { + describe('createDatastream', () => { + it('should create a DataStreamSpacesAdapter with the correct configuration', () => { + const kibanaVersion = kibanaPackageJson.version; + const ds = createDatastream(kibanaVersion); + + expect(DataStreamSpacesAdapter).toHaveBeenCalledTimes(1); + expect(DataStreamSpacesAdapter).toHaveBeenCalledWith(DATA_STREAM_PREFIX, { + kibanaVersion, + totalFieldsLimit: TOTAL_FIELDS_LIMIT, + }); + expect(ds.setComponentTemplate).toHaveBeenCalledTimes(1); + expect(ds.setComponentTemplate).toHaveBeenCalledWith({ + name: COMPONENT_TEMPLATE_NAME, + fieldMap: securityWorkflowInsightsFieldMap, + }); + expect(ds.setIndexTemplate).toHaveBeenCalledTimes(1); + expect(ds.setIndexTemplate).toHaveBeenCalledWith({ + name: INDEX_TEMPLATE_NAME, + componentTemplateRefs: [COMPONENT_TEMPLATE_NAME], + template: { + settings: { + default_pipeline: INGEST_PIPELINE_NAME, + }, + }, + hidden: true, + }); + }); + }); + + describe('createPipeline', () => { + let esClient: ElasticsearchClient; + + beforeEach(() => { + esClient = elasticsearchServiceMock.createElasticsearchClient(); + }); + + it('should create an ingest pipeline with the correct configuration', async () => { + await createPipeline(esClient); + + expect(esClient.ingest.putPipeline).toHaveBeenCalledTimes(1); + expect(esClient.ingest.putPipeline).toHaveBeenCalledWith({ + id: INGEST_PIPELINE_NAME, + processors: [], + _meta: { + managed: true, + }, + }); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.ts new file mode 100644 index 0000000000000..54b449edf86ff --- /dev/null +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.ts @@ -0,0 +1,62 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { ElasticsearchClient } from '@kbn/core/server'; + +import { DataStreamSpacesAdapter } from '@kbn/data-stream-adapter'; + +import { + COMPONENT_TEMPLATE_NAME, + DATA_STREAM_PREFIX, + INDEX_TEMPLATE_NAME, + INGEST_PIPELINE_NAME, + TOTAL_FIELDS_LIMIT, +} from './constants'; +import { securityWorkflowInsightsFieldMap } from './field_map_configurations'; + +export function createDatastream(kibanaVersion: string): DataStreamSpacesAdapter { + const ds = new DataStreamSpacesAdapter(DATA_STREAM_PREFIX, { + kibanaVersion, + totalFieldsLimit: TOTAL_FIELDS_LIMIT, + }); + ds.setComponentTemplate({ + name: COMPONENT_TEMPLATE_NAME, + fieldMap: securityWorkflowInsightsFieldMap, + }); + ds.setIndexTemplate({ + name: INDEX_TEMPLATE_NAME, + componentTemplateRefs: [COMPONENT_TEMPLATE_NAME], + template: { + settings: { + default_pipeline: INGEST_PIPELINE_NAME, + }, + }, + hidden: true, + }); + return ds; +} + +export async function createPipeline(esClient: ElasticsearchClient): Promise { + const response = await esClient.ingest.putPipeline({ + id: INGEST_PIPELINE_NAME, + processors: [ + // requires @elastic/elasticsearch 8.16.0 + // { + // fingerprint: { + // fields: ['type', 'category', 'value', 'target.type', 'target.id'], + // target_field: '_id', + // method: 'SHA-256', + // if: 'ctx._id == null', + // }, + // }, + ], + _meta: { + managed: true, + }, + }); + return response.acknowledged; +} diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.test.ts new file mode 100644 index 0000000000000..6271bd780dedd --- /dev/null +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.test.ts @@ -0,0 +1,163 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ReplaySubject } from 'rxjs'; + +import type { ElasticsearchClient, Logger } from '@kbn/core/server'; +import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; +import { DataStreamSpacesAdapter } from '@kbn/data-stream-adapter'; +import { loggerMock } from '@kbn/logging-mocks'; +import { kibanaPackageJson } from '@kbn/repo-info'; + +import { createDatastream, createPipeline } from './helpers'; +import { securityWorkflowInsightsService } from '.'; +import { DATA_STREAM_NAME } from './constants'; + +jest.mock('./helpers', () => ({ + createDatastream: jest.fn(), + createPipeline: jest.fn(), +})); + +describe('SecurityWorkflowInsightsService', () => { + let logger: Logger; + let esClient: ElasticsearchClient; + + beforeEach(() => { + logger = loggerMock.create(); + esClient = elasticsearchServiceMock.createElasticsearchClient(); + }); + + afterEach(() => { + jest.clearAllMocks(); + }); + + describe('setup', () => { + it('should set up the data stream', () => { + const createDatastreamMock = createDatastream as jest.Mock; + createDatastreamMock.mockReturnValueOnce( + new DataStreamSpacesAdapter(DATA_STREAM_NAME, { + kibanaVersion: kibanaPackageJson.version, + }) + ); + + securityWorkflowInsightsService.setup({ + kibanaVersion: kibanaPackageJson.version, + logger, + isFeatureEnabled: true, + }); + + expect(createDatastreamMock).toHaveBeenCalledTimes(1); + expect(createDatastreamMock).toHaveBeenCalledWith(kibanaPackageJson.version); + }); + + it('should log a warning if createDatastream throws an error', () => { + const createDatastreamMock = createDatastream as jest.Mock; + createDatastreamMock.mockImplementation(() => { + throw new Error('test error'); + }); + + securityWorkflowInsightsService.setup({ + kibanaVersion: kibanaPackageJson.version, + logger, + isFeatureEnabled: true, + }); + + expect(logger.warn).toHaveBeenCalledTimes(1); + expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('test error')); + }); + }); + + describe('start', () => { + it('should start the service', async () => { + const createDatastreamMock = createDatastream as jest.Mock; + const ds = new DataStreamSpacesAdapter(DATA_STREAM_NAME, { + kibanaVersion: kibanaPackageJson.version, + }); + const dsInstallSpy = jest.spyOn(ds, 'install'); + dsInstallSpy.mockResolvedValueOnce(); + createDatastreamMock.mockReturnValueOnce(ds); + const createPipelineMock = createPipeline as jest.Mock; + createPipelineMock.mockResolvedValueOnce(true); + const createDataStreamMock = esClient.indices.createDataStream as jest.Mock; + + securityWorkflowInsightsService.setup({ + kibanaVersion: kibanaPackageJson.version, + logger, + isFeatureEnabled: true, + }); + expect(createDatastreamMock).toHaveBeenCalledTimes(1); + expect(createDatastreamMock).toHaveBeenCalledWith(kibanaPackageJson.version); + + await securityWorkflowInsightsService.start({ esClient }); + + expect(createPipelineMock).toHaveBeenCalledTimes(1); + expect(createPipelineMock).toHaveBeenCalledWith(esClient); + expect(dsInstallSpy).toHaveBeenCalledTimes(1); + expect(dsInstallSpy).toHaveBeenCalledWith({ + logger, + esClient, + pluginStop$: expect.any(ReplaySubject), + }); + expect(createDataStreamMock).toHaveBeenCalledTimes(1); + expect(createDataStreamMock).toHaveBeenCalledWith({ name: DATA_STREAM_NAME }); + }); + + it('should log a warning if createPipeline or ds.install throws an error', async () => { + securityWorkflowInsightsService.setup({ + kibanaVersion: kibanaPackageJson.version, + logger, + isFeatureEnabled: true, + }); + + const createPipelineMock = createPipeline as jest.Mock; + createPipelineMock.mockImplementationOnce(() => { + throw new Error('test error'); + }); + + await securityWorkflowInsightsService.start({ esClient }); + + expect(logger.warn).toHaveBeenCalledTimes(2); + expect(logger.warn).toHaveBeenNthCalledWith(1, expect.stringContaining('test error')); + }); + }); + + describe('create', () => { + it('should wait for initialization', async () => { + const isInitializedSpy = jest + .spyOn(securityWorkflowInsightsService, 'isInitialized', 'get') + .mockResolvedValueOnce([undefined, undefined]); + + await securityWorkflowInsightsService.create(); + + expect(isInitializedSpy).toHaveBeenCalledTimes(1); + }); + }); + + describe('update', () => { + it('should wait for initialization', async () => { + const isInitializedSpy = jest + .spyOn(securityWorkflowInsightsService, 'isInitialized', 'get') + .mockResolvedValueOnce([undefined, undefined]); + + await securityWorkflowInsightsService.update(); + + expect(isInitializedSpy).toHaveBeenCalledTimes(1); + }); + }); + + describe('fetch', () => { + it('should wait for initialization', async () => { + const isInitializedSpy = jest + .spyOn(securityWorkflowInsightsService, 'isInitialized', 'get') + .mockResolvedValueOnce([undefined, undefined]); + + await securityWorkflowInsightsService.fetch(); + + expect(isInitializedSpy).toHaveBeenCalledTimes(1); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.ts new file mode 100644 index 0000000000000..005be1b0398e1 --- /dev/null +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.ts @@ -0,0 +1,130 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ReplaySubject, firstValueFrom, combineLatest } from 'rxjs'; + +import type { ElasticsearchClient, Logger } from '@kbn/core/server'; + +import type { DataStreamSpacesAdapter } from '@kbn/data-stream-adapter'; + +import { SecurityWorkflowInsightsFailedInitialized } from './errors'; +import { createDatastream, createPipeline } from './helpers'; +import { DATA_STREAM_NAME } from './constants'; + +interface SetupInterface { + kibanaVersion: string; + logger: Logger; + isFeatureEnabled: boolean; +} + +interface StartInterface { + esClient: ElasticsearchClient; +} + +class SecurityWorkflowInsightsService { + private setup$ = new ReplaySubject(1); + private start$ = new ReplaySubject(1); + private stop$ = new ReplaySubject(1); + private ds: DataStreamSpacesAdapter | undefined; + // private _esClient: ElasticsearchClient | undefined; + private _logger: Logger | undefined; + private _isInitialized: Promise<[void, void]> = firstValueFrom( + combineLatest<[void, void]>([this.setup$, this.start$]) + ); + private isFeatureEnabled = false; + + public get isInitialized() { + return this._isInitialized; + } + + public setup({ kibanaVersion, logger, isFeatureEnabled }: SetupInterface) { + this.isFeatureEnabled = isFeatureEnabled; + if (!isFeatureEnabled) { + return; + } + + this._logger = logger; + + try { + this.ds = createDatastream(kibanaVersion); + } catch (err) { + this.logger.warn(new SecurityWorkflowInsightsFailedInitialized(err.message).message); + return; + } + + this.setup$.next(); + } + + public async start({ esClient }: StartInterface) { + if (!this.isFeatureEnabled) { + return; + } + + // this._esClient = esClient; + await firstValueFrom(this.setup$); + + try { + await createPipeline(esClient); + await this.ds?.install({ + logger: this.logger, + esClient, + pluginStop$: this.stop$, + }); + await esClient.indices.createDataStream({ name: DATA_STREAM_NAME }); + } catch (err) { + // ignore datastream already exists error + if (err?.body?.error?.type === 'resource_already_exists_exception') { + return; + } + + this.logger.warn(new SecurityWorkflowInsightsFailedInitialized(err.message).message); + return; + } + + this.start$.next(); + } + + public stop() { + this.setup$.next(); + this.setup$.complete(); + this.start$.next(); + this.start$.complete(); + this.stop$.next(); + this.stop$.complete(); + } + + public async create() { + await this.isInitialized; + } + + public async update() { + await this.isInitialized; + } + + public async fetch() { + await this.isInitialized; + } + + // to be used in create/update/fetch above + // private get esClient(): ElasticsearchClient { + // if (!this._esClient) { + // throw new SecurityWorkflowInsightsFailedInitialized('no elasticsearch client found'); + // } + + // return this._esClient; + // } + + private get logger(): Logger { + if (!this._logger) { + throw new SecurityWorkflowInsightsFailedInitialized('no logger found'); + } + + return this._logger; + } +} + +export const securityWorkflowInsightsService = new SecurityWorkflowInsightsService(); diff --git a/x-pack/plugins/security_solution/server/plugin.ts b/x-pack/plugins/security_solution/server/plugin.ts index e2ec9d0e1b535..98bbf3a80777f 100644 --- a/x-pack/plugins/security_solution/server/plugin.ts +++ b/x-pack/plugins/security_solution/server/plugin.ts @@ -56,7 +56,11 @@ import { registerEndpointRoutes } from './endpoint/routes/metadata'; import { registerPolicyRoutes } from './endpoint/routes/policy'; import { registerActionRoutes } from './endpoint/routes/actions'; import { registerEndpointSuggestionsRoutes } from './endpoint/routes/suggestions'; -import { EndpointArtifactClient, ManifestManager } from './endpoint/services'; +import { + EndpointArtifactClient, + ManifestManager, + securityWorkflowInsightsService, +} from './endpoint/services'; import { EndpointAppContextService } from './endpoint/endpoint_app_context_services'; import type { EndpointAppContext } from './endpoint/types'; import { initUsageCollectors } from './usage'; @@ -519,6 +523,12 @@ export class Plugin implements ISecuritySolutionPlugin { featureUsageService.setup(plugins.licensing); + securityWorkflowInsightsService.setup({ + kibanaVersion: pluginContext.env.packageInfo.version, + logger: this.logger, + isFeatureEnabled: config.experimentalFeatures.defendInsights, + }); + return { setProductFeaturesConfigurator: productFeaturesService.setProductFeaturesConfigurator.bind(productFeaturesService), @@ -672,6 +682,12 @@ export class Plugin implements ISecuritySolutionPlugin { this.telemetryReceiver ); + securityWorkflowInsightsService + .start({ + esClient: core.elasticsearch.client.asInternalUser, + }) + .catch(() => {}); + const endpointPkgInstallationPromise = this.endpointContext.service .getInternalFleetServices() .packages.getInstallation(FLEET_ENDPOINT_PACKAGE); @@ -727,6 +743,7 @@ export class Plugin implements ISecuritySolutionPlugin { this.policyWatcher?.stop(); this.completeExternalResponseActionsTask.stop().catch(() => {}); this.siemMigrationsService.stop(); + securityWorkflowInsightsService.stop(); licenseService.stop(); } } From d99431e51ea976baa69d51d4f7ba30592adecf7e Mon Sep 17 00:00:00 2001 From: Yan Savitski Date: Mon, 25 Nov 2024 22:06:54 +0100 Subject: [PATCH 54/71] [Search] [Playground] [Bug] Add playground index validation (#201032) Fix bug when localStorage has invalid index, then playground chat page opens with empty source. --- .../components/select_indices_flyout.test.tsx | 1 + .../components/select_indices_flyout.tsx | 2 +- .../public/hooks/use_indices_validation.ts | 27 ++++++++++++ .../public/hooks/use_query_indices.ts | 41 +++++++++++++------ .../public/providers/form_provider.test.tsx | 12 ++++-- .../public/providers/form_provider.tsx | 24 +++++++++-- .../server/lib/fetch_indices.ts | 5 ++- .../search_playground/server/routes.ts | 6 +-- .../search_playground/playground_overview.ts | 12 +++++- 9 files changed, 104 insertions(+), 26 deletions(-) create mode 100644 x-pack/plugins/search_playground/public/hooks/use_indices_validation.ts diff --git a/x-pack/plugins/search_playground/public/components/select_indices_flyout.test.tsx b/x-pack/plugins/search_playground/public/components/select_indices_flyout.test.tsx index 246d7b2ebf246..59a606fddafd5 100644 --- a/x-pack/plugins/search_playground/public/components/select_indices_flyout.test.tsx +++ b/x-pack/plugins/search_playground/public/components/select_indices_flyout.test.tsx @@ -49,6 +49,7 @@ describe('SelectIndicesFlyout', () => { mockedUseQueryIndices.mockReturnValue({ indices: ['index1', 'index2', 'index3'], isLoading: false, + isFetched: true, }); }); diff --git a/x-pack/plugins/search_playground/public/components/select_indices_flyout.tsx b/x-pack/plugins/search_playground/public/components/select_indices_flyout.tsx index d98a6fc9de8b7..fa3868cb392c8 100644 --- a/x-pack/plugins/search_playground/public/components/select_indices_flyout.tsx +++ b/x-pack/plugins/search_playground/public/components/select_indices_flyout.tsx @@ -35,7 +35,7 @@ interface SelectIndicesFlyout { export const SelectIndicesFlyout: React.FC = ({ onClose }) => { const [query, setQuery] = useState(''); - const { indices, isLoading: isIndicesLoading } = useQueryIndices(query); + const { indices, isLoading: isIndicesLoading } = useQueryIndices({ query }); const { indices: selectedIndices, setIndices: setSelectedIndices } = useSourceIndicesFields(); const [selectedTempIndices, setSelectedTempIndices] = useState(selectedIndices); const handleSelectOptions = (options: EuiSelectableOption[]) => { diff --git a/x-pack/plugins/search_playground/public/hooks/use_indices_validation.ts b/x-pack/plugins/search_playground/public/hooks/use_indices_validation.ts new file mode 100644 index 0000000000000..45b3848bb85e5 --- /dev/null +++ b/x-pack/plugins/search_playground/public/hooks/use_indices_validation.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useEffect, useState } from 'react'; +import { useQueryIndices } from './use_query_indices'; + +export const useIndicesValidation = (unvalidatedIndices: string[]) => { + const [isValidated, setIsValidated] = useState(false); + const [validIndices, setValidIndices] = useState([]); + const { indices, isFetched: isIndicesLoaded } = useQueryIndices({ + query: unvalidatedIndices.join(','), + exact: true, + }); + + useEffect(() => { + if (isIndicesLoaded) { + setValidIndices(indices.filter((index) => unvalidatedIndices.includes(index))); + setIsValidated(true); + } + }, [unvalidatedIndices, indices, isIndicesLoaded]); + + return { isValidated, validIndices }; +}; diff --git a/x-pack/plugins/search_playground/public/hooks/use_query_indices.ts b/x-pack/plugins/search_playground/public/hooks/use_query_indices.ts index d011b471a68d6..cc5812306097c 100644 --- a/x-pack/plugins/search_playground/public/hooks/use_query_indices.ts +++ b/x-pack/plugins/search_playground/public/hooks/use_query_indices.ts @@ -11,26 +11,41 @@ import { useKibana } from './use_kibana'; import { APIRoutes } from '../types'; export const useQueryIndices = ( - query: string = '' -): { indices: IndexName[]; isLoading: boolean } => { + { + query, + exact, + }: { + query?: string; + exact?: boolean; + } = { query: '', exact: false } +): { indices: IndexName[]; isLoading: boolean; isFetched: boolean } => { const { services } = useKibana(); - const { data, isLoading } = useQuery({ + const { data, isLoading, isFetched } = useQuery({ queryKey: ['indices', query], queryFn: async () => { - const response = await services.http.get<{ - indices: string[]; - }>(APIRoutes.GET_INDICES, { - query: { - search_query: query, - size: 10, - }, - }); + try { + const response = await services.http.get<{ + indices: string[]; + }>(APIRoutes.GET_INDICES, { + query: { + search_query: query, + exact, + size: 50, + }, + }); - return response.indices; + return response.indices; + } catch (err) { + if (err?.response?.status === 404) { + return []; + } + + throw err; + } }, initialData: [], }); - return { indices: data, isLoading }; + return { indices: data, isLoading, isFetched }; }; diff --git a/x-pack/plugins/search_playground/public/providers/form_provider.test.tsx b/x-pack/plugins/search_playground/public/providers/form_provider.test.tsx index 96c86ad184931..e0205f01f1e6a 100644 --- a/x-pack/plugins/search_playground/public/providers/form_provider.test.tsx +++ b/x-pack/plugins/search_playground/public/providers/form_provider.test.tsx @@ -19,6 +19,9 @@ jest.mock('../hooks/use_llms_models'); jest.mock('react-router-dom-v5-compat', () => ({ useSearchParams: jest.fn(() => [{ get: jest.fn() }]), })); +jest.mock('../hooks/use_indices_validation', () => ({ + useIndicesValidation: jest.fn((indices) => ({ isValidated: true, validIndices: indices })), +})); let formHookSpy: jest.SpyInstance; @@ -216,6 +219,7 @@ describe('FormProvider', () => { }); it('updates indices from search params', async () => { + expect.assertions(1); const mockSearchParams = new URLSearchParams(); mockSearchParams.get = jest.fn().mockReturnValue('new-index'); mockUseSearchParams.mockReturnValue([mockSearchParams]); @@ -237,10 +241,12 @@ describe('FormProvider', () => { ); - const { getValues } = formHookSpy.mock.results[0].value; + await act(async () => { + const { getValues } = formHookSpy.mock.results[0].value; - await waitFor(() => { - expect(getValues(ChatFormFields.indices)).toEqual(['new-index']); + await waitFor(() => { + expect(getValues(ChatFormFields.indices)).toEqual(['new-index']); + }); }); }); }); diff --git a/x-pack/plugins/search_playground/public/providers/form_provider.tsx b/x-pack/plugins/search_playground/public/providers/form_provider.tsx index f352688fe89f1..e1b27e66a98df 100644 --- a/x-pack/plugins/search_playground/public/providers/form_provider.tsx +++ b/x-pack/plugins/search_playground/public/providers/form_provider.tsx @@ -7,6 +7,7 @@ import { FormProvider as ReactHookFormProvider, useForm } from 'react-hook-form'; import React, { useEffect, useMemo } from 'react'; import { useSearchParams } from 'react-router-dom-v5-compat'; +import { useIndicesValidation } from '../hooks/use_indices_validation'; import { useLoadFieldsByIndices } from '../hooks/use_load_fields_by_indices'; import { ChatForm, ChatFormFields } from '../types'; import { useLLMsModels } from '../hooks/use_llms_models'; @@ -53,16 +54,27 @@ export const FormProvider: React.FC> }) => { const models = useLLMsModels(); const [searchParams] = useSearchParams(); - const index = useMemo(() => searchParams.get('default-index'), [searchParams]); + const defaultIndex = useMemo(() => { + const index = searchParams.get('default-index'); + + return index ? [index] : null; + }, [searchParams]); const sessionState = useMemo(() => getLocalSession(storage), [storage]); const form = useForm({ defaultValues: { ...sessionState, - indices: index ? [index] : sessionState.indices, + indices: [], search_query: '', }, }); - useLoadFieldsByIndices({ watch: form.watch, setValue: form.setValue, getValues: form.getValues }); + const { isValidated: isValidatedIndices, validIndices } = useIndicesValidation( + defaultIndex || sessionState.indices || [] + ); + useLoadFieldsByIndices({ + watch: form.watch, + setValue: form.setValue, + getValues: form.getValues, + }); useEffect(() => { const subscription = form.watch((values) => @@ -80,5 +92,11 @@ export const FormProvider: React.FC> } }, [form, models]); + useEffect(() => { + if (isValidatedIndices) { + form.setValue(ChatFormFields.indices, validIndices); + } + }, [form, isValidatedIndices, validIndices]); + return {children}; }; diff --git a/x-pack/plugins/search_playground/server/lib/fetch_indices.ts b/x-pack/plugins/search_playground/server/lib/fetch_indices.ts index 51b72790028c2..c60e6b5082610 100644 --- a/x-pack/plugins/search_playground/server/lib/fetch_indices.ts +++ b/x-pack/plugins/search_playground/server/lib/fetch_indices.ts @@ -21,11 +21,12 @@ function isClosed(index: IndicesIndexState): boolean { export const fetchIndices = async ( client: ElasticsearchClient, - searchQuery: string | undefined + searchQuery: string | undefined, + { exact }: { exact?: boolean } = { exact: false } ): Promise<{ indexNames: string[]; }> => { - const indexPattern = searchQuery ? `*${searchQuery}*` : '*'; + const indexPattern = exact && searchQuery ? searchQuery : searchQuery ? `*${searchQuery}*` : '*'; const allIndexMatches = await client.indices.get({ expand_wildcards: ['open'], // for better performance only compute aliases and settings of indices but not mappings diff --git a/x-pack/plugins/search_playground/server/routes.ts b/x-pack/plugins/search_playground/server/routes.ts index 3cdebe11c02c2..115b55d34146a 100644 --- a/x-pack/plugins/search_playground/server/routes.ts +++ b/x-pack/plugins/search_playground/server/routes.ts @@ -198,17 +198,17 @@ export function defineRoutes({ query: schema.object({ search_query: schema.maybe(schema.string()), size: schema.number({ defaultValue: 10, min: 0 }), + exact: schema.maybe(schema.boolean({ defaultValue: false })), }), }, }, errorHandler(logger)(async (context, request, response) => { - const { search_query: searchQuery, size } = request.query; + const { search_query: searchQuery, exact, size } = request.query; const { client: { asCurrentUser }, } = (await context.core).elasticsearch; - const { indexNames } = await fetchIndices(asCurrentUser, searchQuery); - + const { indexNames } = await fetchIndices(asCurrentUser, searchQuery, { exact }); const indexNameSlice = indexNames.slice(0, size).filter(isNotNullish); return response.ok({ diff --git a/x-pack/test_serverless/functional/test_suites/search/search_playground/playground_overview.ts b/x-pack/test_serverless/functional/test_suites/search/search_playground/playground_overview.ts index 946afe08a0b73..9e1e36d10b176 100644 --- a/x-pack/test_serverless/functional/test_suites/search/search_playground/playground_overview.ts +++ b/x-pack/test_serverless/functional/test_suites/search/search_playground/playground_overview.ts @@ -106,7 +106,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); describe('without any indices', () => { - it('hide no create index button when index added', async () => { + it('hide create index button when index added', async () => { await createIndex(); await pageObjects.searchPlayground.PlaygroundStartChatPage.expectOpenFlyoutAndSelectIndex(); }); @@ -121,6 +121,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { before(async () => { await createConnector(); await createIndex(); + }); + + beforeEach(async () => { await pageObjects.searchPlayground.session.setSession(); await browser.refresh(); }); @@ -129,6 +132,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.searchPlayground.PlaygroundStartChatPage.expectToSelectIndicesAndLoadChat(); }); + it('load start page after removing selected index', async () => { + await pageObjects.searchPlayground.PlaygroundStartChatPage.expectToSelectIndicesAndLoadChat(); + await esArchiver.unload(esArchiveIndex); + await browser.refresh(); + await pageObjects.searchPlayground.PlaygroundStartChatPage.expectCreateIndexButtonToExists(); + }); + after(async () => { await removeOpenAIConnector?.(); await esArchiver.unload(esArchiveIndex); From 043149b356c212f472eb2397bd009c9cade06c70 Mon Sep 17 00:00:00 2001 From: "elastic-renovate-prod[bot]" <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:57:12 -0600 Subject: [PATCH 55/71] Update dependency chromedriver to v131 (main) (#201053) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | Pending | |---|---|---|---|---| | [chromedriver](https://togithub.com/giggio/node-chromedriver) | devDependencies | major | [`^130.0.4` -> `^131.0.0`](https://renovatebot.com/diffs/npm/chromedriver/130.0.4/131.0.0) | `131.0.1` | --- ### Release Notes
giggio/node-chromedriver (chromedriver) ### [`v131.0.0`](https://togithub.com/giggio/node-chromedriver/compare/130.0.4...131.0.0) [Compare Source](https://togithub.com/giggio/node-chromedriver/compare/130.0.4...131.0.0)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> Co-authored-by: Brad White Co-authored-by: Jon --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a36f44f300866..8522a1c27de46 100644 --- a/package.json +++ b/package.json @@ -1690,7 +1690,7 @@ "buildkite-test-collector": "^1.7.0", "callsites": "^3.1.0", "chance": "1.0.18", - "chromedriver": "^130.0.4", + "chromedriver": "^131.0.0", "clarify": "^2.2.0", "clean-webpack-plugin": "^3.0.0", "cli-progress": "^3.12.0", diff --git a/yarn.lock b/yarn.lock index 58264896a8260..61c6e6098f1cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15120,10 +15120,10 @@ chrome-trace-event@^1.0.2: dependencies: tslib "^1.9.0" -chromedriver@^130.0.4: - version "130.0.4" - resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-130.0.4.tgz#55225ddfec428e306116507651f5a24fdb299bd6" - integrity sha512-lpR+PWXszij1k4Ig3t338Zvll9HtCTiwoLM7n4pCCswALHxzmgwaaIFBh3rt9+5wRk9D07oFblrazrBxwaYYAQ== +chromedriver@^131.0.0: + version "131.0.1" + resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-131.0.1.tgz#bfbf47f6c2ad7a65c154ff47d321bd8c33b52a77" + integrity sha512-LHRh+oaNU1WowJjAkWsviN8pTzQYJDbv/FvJyrQ7XhjKdIzVh/s3GV1iU7IjMTsxIQnBsTjx+9jWjzCWIXC7ug== dependencies: "@testim/chrome-version" "^1.1.4" axios "^1.7.4" From f7a274a4d6e14d4ef6708071b93086e7604934dc Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Mon, 25 Nov 2024 23:19:05 +0100 Subject: [PATCH 56/71] [Console] Bootstrap kibana before running generator script (#201662) --- .buildkite/scripts/steps/console_definitions_sync.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/steps/console_definitions_sync.sh b/.buildkite/scripts/steps/console_definitions_sync.sh index 55719292959e8..7dc565e0b9642 100755 --- a/.buildkite/scripts/steps/console_definitions_sync.sh +++ b/.buildkite/scripts/steps/console_definitions_sync.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -euo pipefail +GIT_SCOPE="src/plugins/console/server/lib/spec_definitions" + report_main_step () { echo "--- $1" } @@ -16,14 +18,16 @@ main () { exit 1 fi + report_main_step "Bootstrapping Kibana" cd "$KIBANA_DIR" + .buildkite/scripts/bootstrap.sh report_main_step "Generating console definitions" node scripts/generate_console_definitions.js --source "$PARENT_DIR/elasticsearch-specification" --emptyDest # Check if there are any differences set +e - git diff --exit-code --quiet "$destination_file" + git diff --exit-code --quiet "$GIT_SCOPE" if [ $? -eq 0 ]; then echo "No differences found. Exiting.." exit @@ -54,7 +58,7 @@ main () { git checkout -b "$BRANCH_NAME" - git add src/plugins/console/server/lib/spec_definitions/json/generated/* + git add $GIT_SCOPE git commit -m "Update console definitions" report_main_step "Changes committed. Creating pull request." From 6d91a7c0659c2a9e65bc963d193e81eb357b669c Mon Sep 17 00:00:00 2001 From: Rickyanto Ang Date: Mon, 25 Nov 2024 15:24:17 -0800 Subject: [PATCH 57/71] [Cloud Security][D4C] Hide K8S (#201062) ## Summary This PR is to hide K8S so User won't be able to access K8S Dashboard via navigating to it from the page or by direct URL, also deleting Cypress tests related to this --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../common/experimental_features.ts | 2 +- .../security_solution/public/kubernetes/routes.tsx | 3 ++- .../cypress/e2e/explore/navigation/navigation.cy.ts | 12 ------------ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/security_solution/common/experimental_features.ts b/x-pack/plugins/security_solution/common/experimental_features.ts index 7fcdabad3b36c..3697359365619 100644 --- a/x-pack/plugins/security_solution/common/experimental_features.ts +++ b/x-pack/plugins/security_solution/common/experimental_features.ts @@ -15,7 +15,7 @@ export const allowedExperimentalValues = Object.freeze({ // FIXME:PT delete? excludePoliciesInFilterEnabled: false, - kubernetesEnabled: true, + kubernetesEnabled: false, donutChartEmbeddablesEnabled: false, // Depends on https://github.com/elastic/kibana/issues/136409 item 2 - 6 /** diff --git a/x-pack/plugins/security_solution/public/kubernetes/routes.tsx b/x-pack/plugins/security_solution/public/kubernetes/routes.tsx index 67bd4a9fcad85..7520de8cffa5a 100644 --- a/x-pack/plugins/security_solution/public/kubernetes/routes.tsx +++ b/x-pack/plugins/security_solution/public/kubernetes/routes.tsx @@ -7,6 +7,7 @@ import React from 'react'; import { TrackApplicationView } from '@kbn/usage-collection-plugin/public'; +import { allowedExperimentalValues } from '../../common'; import { KubernetesContainer } from './pages'; import type { SecuritySubPluginRoutes } from '../app/types'; @@ -24,7 +25,7 @@ export const KubernetesRoutes = () => ( export const routes: SecuritySubPluginRoutes = [ { - path: KUBERNETES_PATH, + path: allowedExperimentalValues.kubernetesEnabled ? KUBERNETES_PATH : [], component: KubernetesRoutes, }, ]; diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/navigation/navigation.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/navigation/navigation.cy.ts index 1920bd01668f6..eba2dbe770e48 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/navigation/navigation.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/navigation/navigation.cy.ts @@ -21,7 +21,6 @@ import { DETECTION_RESPONSE, DASHBOARDS, CSP_DASHBOARD, - KUBERNETES, INDICATORS, BLOCKLIST, CSP_BENCHMARKS, @@ -54,7 +53,6 @@ import { EXPLORE_URL, MANAGE_URL, CSP_DASHBOARD_URL, - KUBERNETES_URL, BLOCKLIST_URL, CSP_BENCHMARKS_URL, CSP_FINDINGS_URL, @@ -114,11 +112,6 @@ describe('top-level navigation common to all pages in the Security app', { tags: cy.url().should('include', ENTITY_ANALYTICS_URL); }); - it('navigates to the Kubernetes page', () => { - navigateFromHeaderTo(KUBERNETES); - cy.url().should('include', KUBERNETES_URL); - }); - it('navigates to the CSP dashboard page', () => { navigateFromHeaderTo(CSP_DASHBOARD); cy.url().should('include', CSP_DASHBOARD_URL); @@ -289,11 +282,6 @@ describe('Serverless side navigation links', { tags: '@serverless' }, () => { cy.url().should('include', ENTITY_ANALYTICS_URL); }); - it('navigates to the Kubernetes page', () => { - navigateFromHeaderTo(ServerlessHeaders.KUBERNETES, true); - cy.url().should('include', KUBERNETES_URL); - }); - it('navigates to the CSP dashboard page', () => { navigateFromHeaderTo(ServerlessHeaders.CSP_DASHBOARD, true); cy.url().should('include', CSP_DASHBOARD_URL); From ef975b2b13f42382f2f5fe8c5b810c0ceba0342b Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Mon, 25 Nov 2024 17:18:50 -0800 Subject: [PATCH 58/71] [DOCS] Add more examples for generating openAPI documents (#200262) ## Summary Relates to https://github.com/elastic/kibana/issues/181995 This PR updates the examples to include availability information and another description. Co-authored-by: Jean-Louis Leysens --- .../tutorials/generating_oas_for_http_apis.mdx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dev_docs/tutorials/generating_oas_for_http_apis.mdx b/dev_docs/tutorials/generating_oas_for_http_apis.mdx index 19852206f8006..f0f497c4286f1 100644 --- a/dev_docs/tutorials/generating_oas_for_http_apis.mdx +++ b/dev_docs/tutorials/generating_oas_for_http_apis.mdx @@ -57,7 +57,9 @@ Other useful query parameters for filtering are: import { schema, TypeOf } from '@kbn/config-schema'; export const fooResource = schema.object({ - name: schema.string() + name: schema.string({ + meta: { description: 'A unique identifier for...' }, + }), // ...and any other fields you may need }); @@ -114,8 +116,14 @@ function registerFooRoute(router: IRouter, docLinks: DoclinksStart) { access: 'public', summary: 'Create a foo resource' description: `A foo resource enables baz. See the following [documentation](${docLinks.links.fooResource}).`, - tags: ['oas-tag:my tag'], // Each operation must have a tag that's used to group similar endpoints in the docs - deprecated: true // An indicator that the operation is deprecated + deprecated: true, // An indicator that the operation is deprecated + options: { + tags: ['oas-tag:my tag'], // Each operation must have a tag that's used to group similar endpoints in the docs + availability: { + since: '1.0.0', + stability: 'experimental', + }, + }, }) .addVersion({ version: '2023-10-31', From 8e671728614012a5f5c5efc68975d9c0139ccfb7 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Tue, 26 Nov 2024 07:46:36 +0100 Subject: [PATCH 59/71] =?UTF-8?q?=F0=9F=8C=8A=20Play=20nice=20with=20ES=20?= =?UTF-8?q?(#200253)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR implements two changes: * When syncing a stream, try to PUT the current mappings to the data stream - if this fails with `illegal_argument_exception`, do a rollover instead. This is similar to how fleet handles this situation * Before accessing streams, check whether the current user can read the current data stream and only return it if this is the case. Users with partial read access will only see a partial tree. This doesn't apply to writing changes as the user needs to be able to change index templates, pipelines and so on which requires admin privileges anyway --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../data_streams/manage_data_streams.ts | 51 ++++++++++--------- .../streams/server/lib/streams/stream_crud.ts | 27 +++++++++- .../streams/server/routes/streams/list.ts | 37 ++++++-------- 3 files changed, 67 insertions(+), 48 deletions(-) diff --git a/x-pack/plugins/streams/server/lib/streams/data_streams/manage_data_streams.ts b/x-pack/plugins/streams/server/lib/streams/data_streams/manage_data_streams.ts index 812739db56c73..a9b667906fdf3 100644 --- a/x-pack/plugins/streams/server/lib/streams/data_streams/manage_data_streams.ts +++ b/x-pack/plugins/streams/server/lib/streams/data_streams/manage_data_streams.ts @@ -6,6 +6,7 @@ */ import { ElasticsearchClient, Logger } from '@kbn/core/server'; +import { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/types'; import { retryTransientEsErrors } from '../helpers/retry'; interface DataStreamManagementOptions { @@ -23,6 +24,7 @@ interface DeleteDataStreamOptions { interface RolloverDataStreamOptions { esClient: ElasticsearchClient; name: string; + mappings: MappingTypeMapping['properties'] | undefined; logger: Logger; } @@ -56,38 +58,37 @@ export async function rolloverDataStreamIfNecessary({ esClient, name, logger, + mappings, }: RolloverDataStreamOptions) { const dataStreams = await esClient.indices.getDataStream({ name: `${name},${name}.*` }); for (const dataStream of dataStreams.data_streams) { - const currentMappings = - Object.values( - await esClient.indices.getMapping({ - index: dataStream.indices.at(-1)?.index_name, - }) - )[0].mappings.properties || {}; - const simulatedIndex = await esClient.indices.simulateIndexTemplate({ name: dataStream.name }); - const simulatedMappings = simulatedIndex.template.mappings.properties || {}; - - // check whether the same fields and same types are listed (don't check for other mapping attributes) - const isDifferent = - Object.values(simulatedMappings).length !== Object.values(currentMappings).length || - Object.entries(simulatedMappings || {}).some(([fieldName, { type }]) => { - const currentType = currentMappings[fieldName]?.type; - return currentType !== type; - }); - - if (!isDifferent) { + const writeIndex = dataStream.indices.at(-1); + if (!writeIndex) { continue; } - try { - await retryTransientEsErrors(() => esClient.indices.rollover({ alias: dataStream.name }), { - logger, - }); - logger.debug(() => `Rolled over data stream: ${dataStream.name}`); + await retryTransientEsErrors( + () => esClient.indices.putMapping({ index: writeIndex.index_name, properties: mappings }), + { + logger, + } + ); } catch (error: any) { - logger.error(`Error rolling over data stream: ${error.message}`); - throw error; + if ( + typeof error.message !== 'string' || + !error.message.includes('illegal_argument_exception') + ) { + throw error; + } + try { + await retryTransientEsErrors(() => esClient.indices.rollover({ alias: dataStream.name }), { + logger, + }); + logger.debug(() => `Rolled over data stream: ${dataStream.name}`); + } catch (rolloverError: any) { + logger.error(`Error rolling over data stream: ${error.message}`); + throw error; + } } } } diff --git a/x-pack/plugins/streams/server/lib/streams/stream_crud.ts b/x-pack/plugins/streams/server/lib/streams/stream_crud.ts index a74540cdcc62a..da5f74d3e69ed 100644 --- a/x-pack/plugins/streams/server/lib/streams/stream_crud.ts +++ b/x-pack/plugins/streams/server/lib/streams/stream_crud.ts @@ -112,6 +112,7 @@ export async function listStreams({ interface ReadStreamParams extends BaseParams { id: string; + skipAccessCheck?: boolean; } export interface ReadStreamResponse { @@ -121,6 +122,7 @@ export interface ReadStreamResponse { export async function readStream({ id, scopedClusterClient, + skipAccessCheck, }: ReadStreamParams): Promise { try { const response = await scopedClusterClient.asInternalUser.get({ @@ -128,6 +130,12 @@ export async function readStream({ index: STREAMS_INDEX, }); const definition = response._source as StreamDefinition; + if (!skipAccessCheck) { + const hasAccess = await checkReadAccess({ id, scopedClusterClient }); + if (!hasAccess) { + throw new DefinitionNotFound(`Stream definition for ${id} not found.`); + } + } return { definition, }; @@ -249,6 +257,21 @@ export async function checkStreamExists({ id, scopedClusterClient }: ReadStreamP } } +interface CheckReadAccessParams extends BaseParams { + id: string; +} + +export async function checkReadAccess({ + id, + scopedClusterClient, +}: CheckReadAccessParams): Promise { + try { + return await scopedClusterClient.asCurrentUser.indices.exists({ index: id }); + } catch (e) { + return false; + } +} + interface SyncStreamParams { scopedClusterClient: IScopedClusterClient; definition: StreamDefinition; @@ -262,10 +285,11 @@ export async function syncStream({ rootDefinition, logger, }: SyncStreamParams) { + const componentTemplate = generateLayer(definition.id, definition); await upsertComponent({ esClient: scopedClusterClient.asCurrentUser, logger, - component: generateLayer(definition.id, definition), + component: componentTemplate, }); await upsertIngestPipeline({ esClient: scopedClusterClient.asCurrentUser, @@ -308,5 +332,6 @@ export async function syncStream({ esClient: scopedClusterClient.asCurrentUser, name: definition.id, logger, + mappings: componentTemplate.template.mappings?.properties, }); } diff --git a/x-pack/plugins/streams/server/routes/streams/list.ts b/x-pack/plugins/streams/server/routes/streams/list.ts index bd6a5200fe9ba..d3b88ffc36a45 100644 --- a/x-pack/plugins/streams/server/routes/streams/list.ts +++ b/x-pack/plugins/streams/server/routes/streams/list.ts @@ -52,32 +52,25 @@ export interface StreamTree { children: StreamTree[]; } -function asTrees(definitions: StreamDefinition[]): StreamTree[] { - const nodes = new Map(); +function asTrees(definitions: Array<{ id: string }>) { + const trees: StreamTree[] = []; + const ids = definitions.map((definition) => definition.id); - const rootNodes = new Set(); + ids.sort((a, b) => a.split('.').length - b.split('.').length); - function getNode(id: string) { - let node = nodes.get(id); - if (!node) { - node = { id, children: [] }; - nodes.set(id, node); + ids.forEach((id) => { + let currentTree = trees; + let existingNode: StreamTree | undefined; + // traverse the tree following the prefix of the current id. + // once we reach the leaf, the current id is added as child - this works because the ids are sorted by depth + while ((existingNode = currentTree.find((node) => id.startsWith(node.id)))) { + currentTree = existingNode.children; } - return node; - } - - definitions.forEach((definition) => { - const path = definition.id.split('.'); - const parentId = path.slice(0, path.length - 1).join('.'); - const parentNode = parentId.length ? getNode(parentId) : undefined; - const selfNode = getNode(definition.id); - - if (parentNode) { - parentNode.children.push(selfNode); - } else { - rootNodes.add(selfNode); + if (!existingNode) { + const newNode = { id, children: [] }; + currentTree.push(newNode); } }); - return Array.from(rootNodes.values()); + return trees; } From f2da55a5f470086411321b6543add739d98f1285 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 26 Nov 2024 18:38:43 +1100 Subject: [PATCH 60/71] [api-docs] 2024-11-26 Daily api_docs build (#201718) Generated by https://buildkite.com/elastic/kibana-api-docs-daily/builds/903 --- api_docs/actions.mdx | 2 +- api_docs/advanced_settings.mdx | 2 +- .../ai_assistant_management_selection.mdx | 2 +- api_docs/aiops.mdx | 2 +- api_docs/alerting.mdx | 2 +- api_docs/apm.devdocs.json | 4 +- api_docs/apm.mdx | 2 +- api_docs/apm_data_access.mdx | 2 +- api_docs/banners.mdx | 2 +- api_docs/bfetch.mdx | 2 +- api_docs/canvas.mdx | 2 +- api_docs/cases.mdx | 2 +- api_docs/charts.mdx | 2 +- api_docs/cloud.mdx | 2 +- api_docs/cloud_data_migration.mdx | 2 +- api_docs/cloud_defend.mdx | 2 +- api_docs/cloud_security_posture.mdx | 2 +- api_docs/console.mdx | 2 +- api_docs/content_management.mdx | 2 +- api_docs/controls.mdx | 2 +- api_docs/custom_integrations.mdx | 2 +- api_docs/dashboard.mdx | 2 +- api_docs/dashboard_enhanced.mdx | 2 +- api_docs/data.mdx | 2 +- api_docs/data_quality.mdx | 2 +- api_docs/data_query.mdx | 2 +- api_docs/data_search.mdx | 2 +- api_docs/data_usage.mdx | 2 +- api_docs/data_view_editor.mdx | 2 +- api_docs/data_view_field_editor.mdx | 2 +- api_docs/data_view_management.mdx | 2 +- api_docs/data_views.mdx | 2 +- api_docs/data_visualizer.mdx | 2 +- api_docs/dataset_quality.devdocs.json | 12 +- api_docs/dataset_quality.mdx | 2 +- api_docs/deprecations_by_api.mdx | 2 +- api_docs/deprecations_by_plugin.mdx | 2 +- api_docs/deprecations_by_team.mdx | 2 +- api_docs/dev_tools.mdx | 2 +- api_docs/discover.mdx | 2 +- api_docs/discover_enhanced.mdx | 2 +- api_docs/discover_shared.mdx | 2 +- api_docs/ecs_data_quality_dashboard.mdx | 2 +- api_docs/elastic_assistant.mdx | 2 +- api_docs/embeddable.mdx | 2 +- api_docs/embeddable_enhanced.mdx | 2 +- api_docs/encrypted_saved_objects.mdx | 2 +- api_docs/enterprise_search.mdx | 2 +- api_docs/entities_data_access.mdx | 2 +- api_docs/entity_manager.devdocs.json | 380 ++------ api_docs/entity_manager.mdx | 2 +- api_docs/es_ui_shared.mdx | 2 +- api_docs/esql.mdx | 2 +- api_docs/esql_data_grid.mdx | 2 +- api_docs/event_annotation.mdx | 2 +- api_docs/event_annotation_listing.mdx | 2 +- api_docs/event_log.mdx | 2 +- api_docs/exploratory_view.mdx | 2 +- api_docs/expression_error.mdx | 2 +- api_docs/expression_gauge.mdx | 2 +- api_docs/expression_heatmap.mdx | 2 +- api_docs/expression_image.mdx | 2 +- api_docs/expression_legacy_metric_vis.mdx | 2 +- api_docs/expression_metric.mdx | 2 +- api_docs/expression_metric_vis.mdx | 2 +- api_docs/expression_partition_vis.mdx | 2 +- api_docs/expression_repeat_image.mdx | 2 +- api_docs/expression_reveal_image.mdx | 2 +- api_docs/expression_shape.mdx | 2 +- api_docs/expression_tagcloud.mdx | 2 +- api_docs/expression_x_y.mdx | 2 +- api_docs/expressions.mdx | 2 +- api_docs/features.mdx | 2 +- api_docs/field_formats.mdx | 2 +- api_docs/fields_metadata.mdx | 2 +- api_docs/file_upload.mdx | 2 +- api_docs/files.mdx | 2 +- api_docs/files_management.mdx | 2 +- api_docs/fleet.devdocs.json | 51 ++ api_docs/fleet.mdx | 4 +- api_docs/global_search.mdx | 2 +- api_docs/guided_onboarding.mdx | 2 +- api_docs/home.mdx | 2 +- api_docs/image_embeddable.mdx | 2 +- api_docs/index_lifecycle_management.mdx | 2 +- api_docs/index_management.mdx | 2 +- api_docs/inference.mdx | 2 +- api_docs/infra.mdx | 2 +- api_docs/ingest_pipelines.mdx | 2 +- api_docs/inspector.mdx | 2 +- api_docs/integration_assistant.mdx | 2 +- api_docs/interactive_setup.mdx | 2 +- api_docs/inventory.mdx | 2 +- api_docs/investigate.mdx | 2 +- api_docs/investigate_app.mdx | 2 +- api_docs/kbn_actions_types.mdx | 2 +- api_docs/kbn_ai_assistant.mdx | 2 +- api_docs/kbn_ai_assistant_common.mdx | 2 +- api_docs/kbn_aiops_components.mdx | 2 +- api_docs/kbn_aiops_log_pattern_analysis.mdx | 2 +- api_docs/kbn_aiops_log_rate_analysis.mdx | 2 +- .../kbn_alerting_api_integration_helpers.mdx | 2 +- api_docs/kbn_alerting_comparators.mdx | 2 +- api_docs/kbn_alerting_state_types.mdx | 2 +- api_docs/kbn_alerting_types.mdx | 2 +- api_docs/kbn_alerts_as_data_utils.mdx | 2 +- api_docs/kbn_alerts_grouping.mdx | 2 +- api_docs/kbn_alerts_ui_shared.mdx | 2 +- api_docs/kbn_analytics.mdx | 2 +- api_docs/kbn_analytics_collection_utils.mdx | 2 +- api_docs/kbn_apm_config_loader.mdx | 2 +- api_docs/kbn_apm_data_view.mdx | 2 +- api_docs/kbn_apm_synthtrace.mdx | 2 +- .../kbn_apm_synthtrace_client.devdocs.json | 30 +- api_docs/kbn_apm_synthtrace_client.mdx | 4 +- api_docs/kbn_apm_types.mdx | 2 +- api_docs/kbn_apm_utils.mdx | 2 +- api_docs/kbn_avc_banner.mdx | 2 +- api_docs/kbn_axe_config.mdx | 2 +- api_docs/kbn_bfetch_error.mdx | 2 +- api_docs/kbn_calculate_auto.mdx | 2 +- .../kbn_calculate_width_from_char_count.mdx | 2 +- api_docs/kbn_cases_components.mdx | 2 +- api_docs/kbn_cbor.mdx | 2 +- api_docs/kbn_cell_actions.mdx | 2 +- api_docs/kbn_chart_expressions_common.mdx | 2 +- api_docs/kbn_chart_icons.mdx | 2 +- api_docs/kbn_ci_stats_core.mdx | 2 +- api_docs/kbn_ci_stats_performance_metrics.mdx | 2 +- api_docs/kbn_ci_stats_reporter.mdx | 2 +- api_docs/kbn_cli_dev_mode.mdx | 2 +- api_docs/kbn_cloud_security_posture.mdx | 2 +- .../kbn_cloud_security_posture_common.mdx | 2 +- api_docs/kbn_cloud_security_posture_graph.mdx | 2 +- api_docs/kbn_code_editor.mdx | 2 +- api_docs/kbn_code_editor_mock.mdx | 2 +- api_docs/kbn_code_owners.mdx | 2 +- api_docs/kbn_coloring.mdx | 2 +- api_docs/kbn_config.mdx | 2 +- api_docs/kbn_config_mocks.mdx | 2 +- api_docs/kbn_config_schema.mdx | 2 +- .../kbn_content_management_content_editor.mdx | 2 +- ...ent_management_content_insights_public.mdx | 2 +- ...ent_management_content_insights_server.mdx | 2 +- ...bn_content_management_favorites_common.mdx | 2 +- ...bn_content_management_favorites_public.mdx | 2 +- ...bn_content_management_favorites_server.mdx | 2 +- ...tent_management_tabbed_table_list_view.mdx | 2 +- ...kbn_content_management_table_list_view.mdx | 2 +- ...tent_management_table_list_view_common.mdx | 2 +- ...ntent_management_table_list_view_table.mdx | 2 +- .../kbn_content_management_user_profiles.mdx | 2 +- api_docs/kbn_content_management_utils.mdx | 2 +- api_docs/kbn_core_analytics_browser.mdx | 2 +- .../kbn_core_analytics_browser_internal.mdx | 2 +- api_docs/kbn_core_analytics_browser_mocks.mdx | 2 +- api_docs/kbn_core_analytics_server.mdx | 2 +- .../kbn_core_analytics_server_internal.mdx | 2 +- api_docs/kbn_core_analytics_server_mocks.mdx | 2 +- api_docs/kbn_core_application_browser.mdx | 2 +- .../kbn_core_application_browser_internal.mdx | 2 +- .../kbn_core_application_browser_mocks.mdx | 2 +- api_docs/kbn_core_application_common.mdx | 2 +- api_docs/kbn_core_apps_browser_internal.mdx | 2 +- api_docs/kbn_core_apps_browser_mocks.mdx | 2 +- api_docs/kbn_core_apps_server_internal.mdx | 2 +- api_docs/kbn_core_base_browser_mocks.mdx | 2 +- api_docs/kbn_core_base_common.mdx | 2 +- api_docs/kbn_core_base_server_internal.mdx | 2 +- api_docs/kbn_core_base_server_mocks.mdx | 2 +- .../kbn_core_capabilities_browser_mocks.mdx | 2 +- api_docs/kbn_core_capabilities_common.mdx | 2 +- api_docs/kbn_core_capabilities_server.mdx | 2 +- .../kbn_core_capabilities_server_mocks.mdx | 2 +- api_docs/kbn_core_chrome_browser.devdocs.json | 2 +- api_docs/kbn_core_chrome_browser.mdx | 2 +- api_docs/kbn_core_chrome_browser_mocks.mdx | 2 +- api_docs/kbn_core_config_server_internal.mdx | 2 +- api_docs/kbn_core_custom_branding_browser.mdx | 2 +- ..._core_custom_branding_browser_internal.mdx | 2 +- ...kbn_core_custom_branding_browser_mocks.mdx | 2 +- api_docs/kbn_core_custom_branding_common.mdx | 2 +- api_docs/kbn_core_custom_branding_server.mdx | 2 +- ...n_core_custom_branding_server_internal.mdx | 2 +- .../kbn_core_custom_branding_server_mocks.mdx | 2 +- api_docs/kbn_core_deprecations_browser.mdx | 2 +- ...kbn_core_deprecations_browser_internal.mdx | 2 +- .../kbn_core_deprecations_browser_mocks.mdx | 2 +- api_docs/kbn_core_deprecations_common.mdx | 2 +- api_docs/kbn_core_deprecations_server.mdx | 2 +- .../kbn_core_deprecations_server_internal.mdx | 2 +- .../kbn_core_deprecations_server_mocks.mdx | 2 +- api_docs/kbn_core_doc_links_browser.mdx | 2 +- api_docs/kbn_core_doc_links_browser_mocks.mdx | 2 +- api_docs/kbn_core_doc_links_server.mdx | 2 +- api_docs/kbn_core_doc_links_server_mocks.mdx | 2 +- ...e_elasticsearch_client_server_internal.mdx | 2 +- ...core_elasticsearch_client_server_mocks.mdx | 2 +- api_docs/kbn_core_elasticsearch_server.mdx | 2 +- ...kbn_core_elasticsearch_server_internal.mdx | 2 +- .../kbn_core_elasticsearch_server_mocks.mdx | 2 +- .../kbn_core_environment_server_internal.mdx | 2 +- .../kbn_core_environment_server_mocks.mdx | 2 +- .../kbn_core_execution_context_browser.mdx | 2 +- ...ore_execution_context_browser_internal.mdx | 2 +- ...n_core_execution_context_browser_mocks.mdx | 2 +- .../kbn_core_execution_context_common.mdx | 2 +- .../kbn_core_execution_context_server.mdx | 2 +- ...core_execution_context_server_internal.mdx | 2 +- ...bn_core_execution_context_server_mocks.mdx | 2 +- api_docs/kbn_core_fatal_errors_browser.mdx | 2 +- .../kbn_core_fatal_errors_browser_mocks.mdx | 2 +- api_docs/kbn_core_feature_flags_browser.mdx | 2 +- ...bn_core_feature_flags_browser_internal.mdx | 2 +- .../kbn_core_feature_flags_browser_mocks.mdx | 2 +- api_docs/kbn_core_feature_flags_server.mdx | 2 +- ...kbn_core_feature_flags_server_internal.mdx | 2 +- .../kbn_core_feature_flags_server_mocks.mdx | 2 +- api_docs/kbn_core_http_browser.mdx | 2 +- api_docs/kbn_core_http_browser_internal.mdx | 2 +- api_docs/kbn_core_http_browser_mocks.mdx | 2 +- api_docs/kbn_core_http_common.mdx | 2 +- .../kbn_core_http_context_server_mocks.mdx | 2 +- ...re_http_request_handler_context_server.mdx | 2 +- api_docs/kbn_core_http_resources_server.mdx | 2 +- ...bn_core_http_resources_server_internal.mdx | 2 +- .../kbn_core_http_resources_server_mocks.mdx | 2 +- .../kbn_core_http_router_server_internal.mdx | 2 +- .../kbn_core_http_router_server_mocks.mdx | 2 +- api_docs/kbn_core_http_server.devdocs.json | 2 +- api_docs/kbn_core_http_server.mdx | 2 +- api_docs/kbn_core_http_server_internal.mdx | 2 +- api_docs/kbn_core_http_server_mocks.mdx | 2 +- api_docs/kbn_core_http_server_utils.mdx | 2 +- api_docs/kbn_core_i18n_browser.mdx | 2 +- api_docs/kbn_core_i18n_browser_mocks.mdx | 2 +- api_docs/kbn_core_i18n_server.mdx | 2 +- api_docs/kbn_core_i18n_server_internal.mdx | 2 +- api_docs/kbn_core_i18n_server_mocks.mdx | 2 +- ...n_core_injected_metadata_browser_mocks.mdx | 2 +- ...kbn_core_integrations_browser_internal.mdx | 2 +- .../kbn_core_integrations_browser_mocks.mdx | 2 +- api_docs/kbn_core_lifecycle_browser.mdx | 2 +- api_docs/kbn_core_lifecycle_browser_mocks.mdx | 2 +- api_docs/kbn_core_lifecycle_server.mdx | 2 +- api_docs/kbn_core_lifecycle_server_mocks.mdx | 2 +- api_docs/kbn_core_logging_browser_mocks.mdx | 2 +- api_docs/kbn_core_logging_common_internal.mdx | 2 +- api_docs/kbn_core_logging_server.mdx | 2 +- api_docs/kbn_core_logging_server_internal.mdx | 2 +- api_docs/kbn_core_logging_server_mocks.mdx | 2 +- ...ore_metrics_collectors_server_internal.mdx | 2 +- ...n_core_metrics_collectors_server_mocks.mdx | 2 +- api_docs/kbn_core_metrics_server.mdx | 2 +- api_docs/kbn_core_metrics_server_internal.mdx | 2 +- api_docs/kbn_core_metrics_server_mocks.mdx | 2 +- api_docs/kbn_core_mount_utils_browser.mdx | 2 +- api_docs/kbn_core_node_server.mdx | 2 +- api_docs/kbn_core_node_server_internal.mdx | 2 +- api_docs/kbn_core_node_server_mocks.mdx | 2 +- api_docs/kbn_core_notifications_browser.mdx | 2 +- ...bn_core_notifications_browser_internal.mdx | 2 +- .../kbn_core_notifications_browser_mocks.mdx | 2 +- api_docs/kbn_core_overlays_browser.mdx | 2 +- .../kbn_core_overlays_browser_internal.mdx | 2 +- api_docs/kbn_core_overlays_browser_mocks.mdx | 2 +- api_docs/kbn_core_plugins_browser.mdx | 2 +- api_docs/kbn_core_plugins_browser_mocks.mdx | 2 +- .../kbn_core_plugins_contracts_browser.mdx | 2 +- .../kbn_core_plugins_contracts_server.mdx | 2 +- api_docs/kbn_core_plugins_server.mdx | 2 +- api_docs/kbn_core_plugins_server_mocks.mdx | 2 +- api_docs/kbn_core_preboot_server.mdx | 2 +- api_docs/kbn_core_preboot_server_mocks.mdx | 2 +- api_docs/kbn_core_rendering_browser.mdx | 2 +- api_docs/kbn_core_rendering_browser_mocks.mdx | 2 +- .../kbn_core_rendering_server_internal.mdx | 2 +- api_docs/kbn_core_rendering_server_mocks.mdx | 2 +- api_docs/kbn_core_root_server_internal.mdx | 2 +- .../kbn_core_saved_objects_api_browser.mdx | 2 +- .../kbn_core_saved_objects_api_server.mdx | 2 +- ...bn_core_saved_objects_api_server_mocks.mdx | 2 +- ...ore_saved_objects_base_server_internal.mdx | 2 +- ...n_core_saved_objects_base_server_mocks.mdx | 2 +- api_docs/kbn_core_saved_objects_browser.mdx | 2 +- ...bn_core_saved_objects_browser_internal.mdx | 2 +- .../kbn_core_saved_objects_browser_mocks.mdx | 2 +- api_docs/kbn_core_saved_objects_common.mdx | 2 +- ..._objects_import_export_server_internal.mdx | 2 +- ...ved_objects_import_export_server_mocks.mdx | 2 +- ...aved_objects_migration_server_internal.mdx | 2 +- ...e_saved_objects_migration_server_mocks.mdx | 2 +- api_docs/kbn_core_saved_objects_server.mdx | 2 +- ...kbn_core_saved_objects_server_internal.mdx | 2 +- .../kbn_core_saved_objects_server_mocks.mdx | 2 +- .../kbn_core_saved_objects_utils_server.mdx | 2 +- api_docs/kbn_core_security_browser.mdx | 2 +- .../kbn_core_security_browser_internal.mdx | 2 +- api_docs/kbn_core_security_browser_mocks.mdx | 2 +- api_docs/kbn_core_security_common.mdx | 2 +- api_docs/kbn_core_security_server.mdx | 2 +- .../kbn_core_security_server_internal.mdx | 2 +- api_docs/kbn_core_security_server_mocks.mdx | 2 +- api_docs/kbn_core_status_common.mdx | 2 +- api_docs/kbn_core_status_server.mdx | 2 +- api_docs/kbn_core_status_server_internal.mdx | 2 +- api_docs/kbn_core_status_server_mocks.mdx | 2 +- ...core_test_helpers_deprecations_getters.mdx | 2 +- ...n_core_test_helpers_http_setup_browser.mdx | 2 +- api_docs/kbn_core_test_helpers_kbn_server.mdx | 2 +- .../kbn_core_test_helpers_model_versions.mdx | 2 +- ...n_core_test_helpers_so_type_serializer.mdx | 2 +- api_docs/kbn_core_test_helpers_test_utils.mdx | 2 +- api_docs/kbn_core_theme_browser.mdx | 2 +- api_docs/kbn_core_theme_browser_mocks.mdx | 2 +- api_docs/kbn_core_ui_settings_browser.mdx | 2 +- .../kbn_core_ui_settings_browser_internal.mdx | 2 +- .../kbn_core_ui_settings_browser_mocks.mdx | 2 +- api_docs/kbn_core_ui_settings_common.mdx | 2 +- api_docs/kbn_core_ui_settings_server.mdx | 2 +- .../kbn_core_ui_settings_server_internal.mdx | 2 +- .../kbn_core_ui_settings_server_mocks.mdx | 2 +- api_docs/kbn_core_usage_data_server.mdx | 2 +- .../kbn_core_usage_data_server_internal.mdx | 2 +- api_docs/kbn_core_usage_data_server_mocks.mdx | 2 +- api_docs/kbn_core_user_profile_browser.mdx | 2 +- ...kbn_core_user_profile_browser_internal.mdx | 2 +- .../kbn_core_user_profile_browser_mocks.mdx | 2 +- api_docs/kbn_core_user_profile_common.mdx | 2 +- api_docs/kbn_core_user_profile_server.mdx | 2 +- .../kbn_core_user_profile_server_internal.mdx | 2 +- .../kbn_core_user_profile_server_mocks.mdx | 2 +- api_docs/kbn_core_user_settings_server.mdx | 2 +- .../kbn_core_user_settings_server_mocks.mdx | 2 +- api_docs/kbn_crypto.mdx | 2 +- api_docs/kbn_crypto_browser.mdx | 2 +- api_docs/kbn_custom_icons.mdx | 2 +- api_docs/kbn_custom_integrations.mdx | 2 +- api_docs/kbn_cypress_config.mdx | 2 +- api_docs/kbn_data_forge.mdx | 2 +- api_docs/kbn_data_service.mdx | 2 +- api_docs/kbn_data_stream_adapter.mdx | 2 +- api_docs/kbn_data_view_utils.mdx | 2 +- api_docs/kbn_datemath.mdx | 2 +- api_docs/kbn_deeplinks_analytics.mdx | 2 +- api_docs/kbn_deeplinks_devtools.mdx | 2 +- api_docs/kbn_deeplinks_fleet.mdx | 2 +- api_docs/kbn_deeplinks_management.mdx | 2 +- api_docs/kbn_deeplinks_ml.mdx | 2 +- .../kbn_deeplinks_observability.devdocs.json | 4 +- api_docs/kbn_deeplinks_observability.mdx | 2 +- api_docs/kbn_deeplinks_search.mdx | 2 +- api_docs/kbn_deeplinks_security.mdx | 2 +- api_docs/kbn_deeplinks_shared.mdx | 2 +- api_docs/kbn_default_nav_analytics.mdx | 2 +- api_docs/kbn_default_nav_devtools.mdx | 2 +- api_docs/kbn_default_nav_management.mdx | 2 +- api_docs/kbn_default_nav_ml.mdx | 2 +- api_docs/kbn_dev_cli_errors.mdx | 2 +- api_docs/kbn_dev_cli_runner.mdx | 2 +- api_docs/kbn_dev_proc_runner.mdx | 2 +- api_docs/kbn_dev_utils.mdx | 2 +- .../kbn_discover_contextual_components.mdx | 2 +- api_docs/kbn_discover_utils.mdx | 2 +- api_docs/kbn_doc_links.mdx | 2 +- api_docs/kbn_docs_utils.mdx | 2 +- api_docs/kbn_dom_drag_drop.mdx | 2 +- api_docs/kbn_ebt_tools.mdx | 2 +- api_docs/kbn_ecs_data_quality_dashboard.mdx | 2 +- api_docs/kbn_elastic_agent_utils.mdx | 2 +- api_docs/kbn_elastic_assistant.mdx | 2 +- api_docs/kbn_elastic_assistant_common.mdx | 2 +- api_docs/kbn_entities_schema.mdx | 2 +- api_docs/kbn_es.mdx | 2 +- api_docs/kbn_es_archiver.mdx | 2 +- api_docs/kbn_es_errors.mdx | 2 +- api_docs/kbn_es_query.mdx | 2 +- api_docs/kbn_es_types.devdocs.json | 5 +- api_docs/kbn_es_types.mdx | 2 +- api_docs/kbn_eslint_plugin_imports.mdx | 2 +- api_docs/kbn_esql_ast.mdx | 2 +- api_docs/kbn_esql_editor.mdx | 2 +- api_docs/kbn_esql_utils.mdx | 2 +- api_docs/kbn_esql_validation_autocomplete.mdx | 2 +- api_docs/kbn_event_annotation_common.mdx | 2 +- api_docs/kbn_event_annotation_components.mdx | 2 +- api_docs/kbn_expandable_flyout.mdx | 2 +- api_docs/kbn_field_types.mdx | 2 +- api_docs/kbn_field_utils.mdx | 2 +- api_docs/kbn_find_used_node_modules.mdx | 2 +- api_docs/kbn_formatters.mdx | 2 +- .../kbn_ftr_common_functional_services.mdx | 2 +- .../kbn_ftr_common_functional_ui_services.mdx | 2 +- api_docs/kbn_generate.mdx | 2 +- api_docs/kbn_generate_console_definitions.mdx | 2 +- api_docs/kbn_generate_csv.mdx | 2 +- api_docs/kbn_grid_layout.mdx | 2 +- api_docs/kbn_grouping.mdx | 2 +- api_docs/kbn_guided_onboarding.mdx | 2 +- api_docs/kbn_handlebars.mdx | 2 +- api_docs/kbn_hapi_mocks.mdx | 2 +- api_docs/kbn_health_gateway_server.mdx | 2 +- api_docs/kbn_home_sample_data_card.mdx | 2 +- api_docs/kbn_home_sample_data_tab.mdx | 2 +- api_docs/kbn_i18n.mdx | 2 +- api_docs/kbn_i18n_react.mdx | 2 +- api_docs/kbn_import_resolver.mdx | 2 +- api_docs/kbn_index_adapter.mdx | 2 +- ...dex_lifecycle_management_common_shared.mdx | 2 +- .../kbn_index_management_shared_types.mdx | 2 +- api_docs/kbn_inference_common.mdx | 2 +- api_docs/kbn_inference_integration_flyout.mdx | 2 +- api_docs/kbn_infra_forge.mdx | 2 +- api_docs/kbn_interpreter.mdx | 2 +- api_docs/kbn_investigation_shared.mdx | 2 +- api_docs/kbn_io_ts_utils.mdx | 2 +- api_docs/kbn_ipynb.mdx | 2 +- api_docs/kbn_item_buffer.mdx | 2 +- api_docs/kbn_jest_serializers.mdx | 2 +- api_docs/kbn_journeys.mdx | 2 +- api_docs/kbn_json_ast.mdx | 2 +- api_docs/kbn_json_schemas.mdx | 2 +- api_docs/kbn_kibana_manifest_schema.mdx | 2 +- api_docs/kbn_language_documentation.mdx | 2 +- api_docs/kbn_lens_embeddable_utils.mdx | 2 +- api_docs/kbn_lens_formula_docs.mdx | 2 +- api_docs/kbn_logging.mdx | 2 +- api_docs/kbn_logging_mocks.mdx | 2 +- api_docs/kbn_managed_content_badge.mdx | 2 +- api_docs/kbn_managed_vscode_config.mdx | 2 +- api_docs/kbn_management_cards_navigation.mdx | 2 +- .../kbn_management_settings_application.mdx | 2 +- ...ent_settings_components_field_category.mdx | 2 +- ...gement_settings_components_field_input.mdx | 2 +- ...nagement_settings_components_field_row.mdx | 2 +- ...bn_management_settings_components_form.mdx | 2 +- ...n_management_settings_field_definition.mdx | 2 +- api_docs/kbn_management_settings_ids.mdx | 2 +- ...n_management_settings_section_registry.mdx | 2 +- api_docs/kbn_management_settings_types.mdx | 2 +- .../kbn_management_settings_utilities.mdx | 2 +- api_docs/kbn_management_storybook_config.mdx | 2 +- api_docs/kbn_manifest.mdx | 2 +- api_docs/kbn_mapbox_gl.mdx | 2 +- api_docs/kbn_maps_vector_tile_utils.mdx | 2 +- api_docs/kbn_ml_agg_utils.mdx | 2 +- api_docs/kbn_ml_anomaly_utils.mdx | 2 +- api_docs/kbn_ml_cancellable_search.mdx | 2 +- api_docs/kbn_ml_category_validator.mdx | 2 +- api_docs/kbn_ml_chi2test.mdx | 2 +- .../kbn_ml_data_frame_analytics_utils.mdx | 2 +- api_docs/kbn_ml_data_grid.mdx | 2 +- api_docs/kbn_ml_date_picker.mdx | 2 +- api_docs/kbn_ml_date_utils.mdx | 2 +- api_docs/kbn_ml_error_utils.mdx | 2 +- api_docs/kbn_ml_field_stats_flyout.mdx | 2 +- api_docs/kbn_ml_in_memory_table.mdx | 2 +- api_docs/kbn_ml_is_defined.mdx | 2 +- api_docs/kbn_ml_is_populated_object.mdx | 2 +- api_docs/kbn_ml_kibana_theme.mdx | 2 +- api_docs/kbn_ml_local_storage.mdx | 2 +- api_docs/kbn_ml_nested_property.mdx | 2 +- api_docs/kbn_ml_number_utils.mdx | 2 +- api_docs/kbn_ml_parse_interval.mdx | 2 +- api_docs/kbn_ml_query_utils.mdx | 2 +- api_docs/kbn_ml_random_sampler_utils.mdx | 2 +- api_docs/kbn_ml_route_utils.mdx | 2 +- api_docs/kbn_ml_runtime_field_utils.mdx | 2 +- api_docs/kbn_ml_string_hash.mdx | 2 +- api_docs/kbn_ml_time_buckets.mdx | 2 +- api_docs/kbn_ml_trained_models_utils.mdx | 2 +- api_docs/kbn_ml_ui_actions.mdx | 2 +- api_docs/kbn_ml_url_state.mdx | 2 +- api_docs/kbn_ml_validators.mdx | 2 +- api_docs/kbn_mock_idp_utils.mdx | 2 +- api_docs/kbn_monaco.mdx | 2 +- api_docs/kbn_object_versioning.mdx | 2 +- api_docs/kbn_object_versioning_utils.mdx | 2 +- api_docs/kbn_observability_alert_details.mdx | 2 +- .../kbn_observability_alerting_rule_utils.mdx | 2 +- .../kbn_observability_alerting_test_data.mdx | 2 +- ...ility_get_padded_alert_time_range_util.mdx | 2 +- api_docs/kbn_observability_logs_overview.mdx | 2 +- ...kbn_observability_synthetics_test_data.mdx | 2 +- api_docs/kbn_openapi_bundler.mdx | 2 +- api_docs/kbn_openapi_generator.mdx | 2 +- api_docs/kbn_optimizer.mdx | 2 +- api_docs/kbn_optimizer_webpack_helpers.mdx | 2 +- api_docs/kbn_osquery_io_ts_types.mdx | 2 +- api_docs/kbn_panel_loader.mdx | 2 +- ..._performance_testing_dataset_extractor.mdx | 2 +- api_docs/kbn_plugin_check.mdx | 2 +- api_docs/kbn_plugin_generator.mdx | 2 +- api_docs/kbn_plugin_helpers.mdx | 2 +- api_docs/kbn_presentation_containers.mdx | 2 +- .../kbn_presentation_publishing.devdocs.json | 218 +++++ api_docs/kbn_presentation_publishing.mdx | 4 +- api_docs/kbn_product_doc_artifact_builder.mdx | 2 +- api_docs/kbn_product_doc_common.mdx | 2 +- api_docs/kbn_profiling_utils.mdx | 2 +- api_docs/kbn_random_sampling.mdx | 2 +- api_docs/kbn_react_field.mdx | 2 +- api_docs/kbn_react_hooks.mdx | 2 +- api_docs/kbn_react_kibana_context_common.mdx | 2 +- api_docs/kbn_react_kibana_context_render.mdx | 2 +- api_docs/kbn_react_kibana_context_root.mdx | 2 +- api_docs/kbn_react_kibana_context_styled.mdx | 2 +- api_docs/kbn_react_kibana_context_theme.mdx | 2 +- api_docs/kbn_react_kibana_mount.mdx | 2 +- api_docs/kbn_recently_accessed.mdx | 2 +- api_docs/kbn_repo_file_maps.mdx | 2 +- api_docs/kbn_repo_linter.mdx | 2 +- api_docs/kbn_repo_path.mdx | 2 +- api_docs/kbn_repo_source_classifier.mdx | 2 +- api_docs/kbn_reporting_common.mdx | 2 +- api_docs/kbn_reporting_csv_share_panel.mdx | 2 +- api_docs/kbn_reporting_export_types_csv.mdx | 2 +- .../kbn_reporting_export_types_csv_common.mdx | 2 +- api_docs/kbn_reporting_export_types_pdf.mdx | 2 +- .../kbn_reporting_export_types_pdf_common.mdx | 2 +- api_docs/kbn_reporting_export_types_png.mdx | 2 +- .../kbn_reporting_export_types_png_common.mdx | 2 +- api_docs/kbn_reporting_mocks_server.mdx | 2 +- api_docs/kbn_reporting_public.mdx | 2 +- api_docs/kbn_reporting_server.mdx | 2 +- api_docs/kbn_resizable_layout.mdx | 2 +- .../kbn_response_ops_feature_flag_service.mdx | 2 +- api_docs/kbn_response_ops_rule_params.mdx | 2 +- api_docs/kbn_rison.mdx | 2 +- api_docs/kbn_rollup.mdx | 2 +- api_docs/kbn_router_to_openapispec.mdx | 2 +- api_docs/kbn_router_utils.mdx | 2 +- api_docs/kbn_rrule.mdx | 2 +- api_docs/kbn_rule_data_utils.mdx | 2 +- api_docs/kbn_saved_objects_settings.mdx | 2 +- api_docs/kbn_screenshotting_server.mdx | 2 +- api_docs/kbn_search_api_keys_components.mdx | 2 +- api_docs/kbn_search_api_keys_server.mdx | 2 +- api_docs/kbn_search_api_panels.mdx | 2 +- api_docs/kbn_search_connectors.mdx | 2 +- api_docs/kbn_search_errors.mdx | 2 +- api_docs/kbn_search_index_documents.mdx | 2 +- api_docs/kbn_search_response_warnings.mdx | 2 +- api_docs/kbn_search_shared_ui.mdx | 2 +- api_docs/kbn_search_types.mdx | 2 +- api_docs/kbn_security_api_key_management.mdx | 2 +- api_docs/kbn_security_authorization_core.mdx | 2 +- ...kbn_security_authorization_core_common.mdx | 2 +- api_docs/kbn_security_form_components.mdx | 2 +- api_docs/kbn_security_hardening.mdx | 2 +- api_docs/kbn_security_plugin_types_common.mdx | 2 +- api_docs/kbn_security_plugin_types_public.mdx | 2 +- api_docs/kbn_security_plugin_types_server.mdx | 2 +- .../kbn_security_role_management_model.mdx | 2 +- ...kbn_security_solution_distribution_bar.mdx | 2 +- api_docs/kbn_security_solution_features.mdx | 2 +- api_docs/kbn_security_solution_navigation.mdx | 2 +- api_docs/kbn_security_solution_side_nav.mdx | 2 +- ...kbn_security_solution_storybook_config.mdx | 2 +- api_docs/kbn_security_ui_components.mdx | 2 +- .../kbn_securitysolution_autocomplete.mdx | 2 +- api_docs/kbn_securitysolution_data_table.mdx | 2 +- api_docs/kbn_securitysolution_ecs.mdx | 2 +- api_docs/kbn_securitysolution_es_utils.mdx | 2 +- ...ritysolution_exception_list_components.mdx | 2 +- api_docs/kbn_securitysolution_hook_utils.mdx | 2 +- ..._securitysolution_io_ts_alerting_types.mdx | 2 +- .../kbn_securitysolution_io_ts_list_types.mdx | 2 +- api_docs/kbn_securitysolution_io_ts_types.mdx | 2 +- api_docs/kbn_securitysolution_io_ts_utils.mdx | 2 +- api_docs/kbn_securitysolution_list_api.mdx | 2 +- .../kbn_securitysolution_list_constants.mdx | 2 +- api_docs/kbn_securitysolution_list_hooks.mdx | 2 +- api_docs/kbn_securitysolution_list_utils.mdx | 2 +- api_docs/kbn_securitysolution_rules.mdx | 2 +- api_docs/kbn_securitysolution_t_grid.mdx | 2 +- api_docs/kbn_securitysolution_utils.mdx | 2 +- api_docs/kbn_server_http_tools.mdx | 2 +- .../kbn_server_route_repository.devdocs.json | 238 ++--- api_docs/kbn_server_route_repository.mdx | 4 +- ...erver_route_repository_client.devdocs.json | 42 +- .../kbn_server_route_repository_client.mdx | 2 +- ...server_route_repository_utils.devdocs.json | 219 +++-- .../kbn_server_route_repository_utils.mdx | 4 +- api_docs/kbn_serverless_common_settings.mdx | 2 +- .../kbn_serverless_observability_settings.mdx | 2 +- api_docs/kbn_serverless_project_switcher.mdx | 2 +- api_docs/kbn_serverless_search_settings.mdx | 2 +- api_docs/kbn_serverless_security_settings.mdx | 2 +- api_docs/kbn_serverless_storybook_config.mdx | 2 +- api_docs/kbn_shared_svg.mdx | 2 +- api_docs/kbn_shared_ux_avatar_solution.mdx | 2 +- .../kbn_shared_ux_button_exit_full_screen.mdx | 2 +- api_docs/kbn_shared_ux_button_toolbar.mdx | 2 +- api_docs/kbn_shared_ux_card_no_data.mdx | 2 +- api_docs/kbn_shared_ux_card_no_data_mocks.mdx | 2 +- api_docs/kbn_shared_ux_chrome_navigation.mdx | 2 +- api_docs/kbn_shared_ux_error_boundary.mdx | 2 +- api_docs/kbn_shared_ux_file_context.mdx | 2 +- api_docs/kbn_shared_ux_file_image.mdx | 2 +- api_docs/kbn_shared_ux_file_image_mocks.mdx | 2 +- api_docs/kbn_shared_ux_file_mocks.mdx | 2 +- api_docs/kbn_shared_ux_file_picker.mdx | 2 +- api_docs/kbn_shared_ux_file_types.mdx | 2 +- api_docs/kbn_shared_ux_file_upload.mdx | 2 +- api_docs/kbn_shared_ux_file_util.mdx | 2 +- api_docs/kbn_shared_ux_link_redirect_app.mdx | 2 +- .../kbn_shared_ux_link_redirect_app_mocks.mdx | 2 +- api_docs/kbn_shared_ux_markdown.mdx | 2 +- api_docs/kbn_shared_ux_markdown_mocks.mdx | 2 +- .../kbn_shared_ux_page_analytics_no_data.mdx | 2 +- ...shared_ux_page_analytics_no_data_mocks.mdx | 2 +- .../kbn_shared_ux_page_kibana_no_data.mdx | 2 +- ...bn_shared_ux_page_kibana_no_data_mocks.mdx | 2 +- .../kbn_shared_ux_page_kibana_template.mdx | 2 +- ...n_shared_ux_page_kibana_template_mocks.mdx | 2 +- api_docs/kbn_shared_ux_page_no_data.mdx | 2 +- .../kbn_shared_ux_page_no_data_config.mdx | 2 +- ...bn_shared_ux_page_no_data_config_mocks.mdx | 2 +- api_docs/kbn_shared_ux_page_no_data_mocks.mdx | 2 +- api_docs/kbn_shared_ux_page_solution_nav.mdx | 2 +- .../kbn_shared_ux_prompt_no_data_views.mdx | 2 +- ...n_shared_ux_prompt_no_data_views_mocks.mdx | 2 +- api_docs/kbn_shared_ux_prompt_not_found.mdx | 2 +- api_docs/kbn_shared_ux_router.mdx | 2 +- api_docs/kbn_shared_ux_router_mocks.mdx | 2 +- api_docs/kbn_shared_ux_storybook_config.mdx | 2 +- api_docs/kbn_shared_ux_storybook_mock.mdx | 2 +- api_docs/kbn_shared_ux_tabbed_modal.mdx | 2 +- api_docs/kbn_shared_ux_table_persist.mdx | 2 +- api_docs/kbn_shared_ux_utility.mdx | 2 +- api_docs/kbn_slo_schema.mdx | 2 +- api_docs/kbn_some_dev_log.mdx | 2 +- api_docs/kbn_sort_predicates.mdx | 2 +- api_docs/kbn_sse_utils.mdx | 2 +- api_docs/kbn_sse_utils_client.mdx | 2 +- api_docs/kbn_sse_utils_server.mdx | 2 +- api_docs/kbn_std.mdx | 2 +- api_docs/kbn_stdio_dev_helpers.mdx | 2 +- api_docs/kbn_storybook.mdx | 2 +- api_docs/kbn_synthetics_e2e.mdx | 2 +- api_docs/kbn_synthetics_private_location.mdx | 2 +- api_docs/kbn_telemetry_tools.mdx | 2 +- api_docs/kbn_test.mdx | 2 +- api_docs/kbn_test_eui_helpers.mdx | 2 +- api_docs/kbn_test_jest_helpers.mdx | 2 +- api_docs/kbn_test_subj_selector.mdx | 2 +- api_docs/kbn_timerange.mdx | 2 +- api_docs/kbn_tooling_log.mdx | 2 +- api_docs/kbn_transpose_utils.mdx | 2 +- api_docs/kbn_triggers_actions_ui_types.mdx | 2 +- api_docs/kbn_try_in_console.mdx | 2 +- api_docs/kbn_ts_projects.devdocs.json | 16 + api_docs/kbn_ts_projects.mdx | 4 +- ...kbn_typed_react_router_config.devdocs.json | 864 ++++++++++-------- api_docs/kbn_typed_react_router_config.mdx | 14 +- api_docs/kbn_ui_actions_browser.mdx | 2 +- api_docs/kbn_ui_shared_deps_src.mdx | 2 +- api_docs/kbn_ui_theme.mdx | 2 +- api_docs/kbn_unified_data_table.mdx | 2 +- api_docs/kbn_unified_doc_viewer.mdx | 2 +- api_docs/kbn_unified_field_list.mdx | 2 +- api_docs/kbn_unsaved_changes_badge.mdx | 2 +- api_docs/kbn_unsaved_changes_prompt.mdx | 2 +- api_docs/kbn_use_tracked_promise.mdx | 2 +- api_docs/kbn_user_profile_components.mdx | 2 +- api_docs/kbn_utility_types.devdocs.json | 4 +- api_docs/kbn_utility_types.mdx | 2 +- api_docs/kbn_utility_types_jest.mdx | 2 +- api_docs/kbn_utils.mdx | 2 +- api_docs/kbn_visualization_ui_components.mdx | 2 +- api_docs/kbn_visualization_utils.mdx | 2 +- api_docs/kbn_xstate_utils.mdx | 2 +- api_docs/kbn_yarn_lock_validator.mdx | 2 +- api_docs/kbn_zod.mdx | 2 +- api_docs/kbn_zod_helpers.mdx | 2 +- api_docs/kibana_overview.mdx | 2 +- api_docs/kibana_react.mdx | 2 +- api_docs/kibana_utils.mdx | 2 +- api_docs/kubernetes_security.mdx | 2 +- api_docs/lens.mdx | 2 +- api_docs/license_api_guard.mdx | 2 +- api_docs/license_management.mdx | 2 +- api_docs/licensing.mdx | 2 +- api_docs/links.mdx | 2 +- api_docs/lists.mdx | 2 +- api_docs/llm_tasks.mdx | 2 +- api_docs/logs_data_access.mdx | 2 +- api_docs/logs_explorer.mdx | 2 +- api_docs/logs_shared.mdx | 2 +- api_docs/management.mdx | 2 +- api_docs/maps.mdx | 2 +- api_docs/maps_ems.mdx | 2 +- api_docs/metrics_data_access.mdx | 2 +- api_docs/ml.mdx | 2 +- api_docs/mock_idp_plugin.mdx | 2 +- api_docs/monitoring.mdx | 2 +- api_docs/monitoring_collection.mdx | 2 +- api_docs/navigation.mdx | 2 +- api_docs/newsfeed.mdx | 2 +- api_docs/no_data_page.mdx | 2 +- api_docs/notifications.mdx | 2 +- api_docs/observability.devdocs.json | 98 +- api_docs/observability.mdx | 4 +- .../observability_a_i_assistant.devdocs.json | 52 +- api_docs/observability_a_i_assistant.mdx | 2 +- api_docs/observability_a_i_assistant_app.mdx | 2 +- .../observability_ai_assistant_management.mdx | 2 +- api_docs/observability_logs_explorer.mdx | 2 +- api_docs/observability_onboarding.mdx | 2 +- api_docs/observability_shared.mdx | 2 +- api_docs/osquery.mdx | 2 +- api_docs/painless_lab.mdx | 2 +- api_docs/plugin_directory.mdx | 25 +- api_docs/presentation_panel.mdx | 2 +- api_docs/presentation_util.mdx | 2 +- api_docs/product_doc_base.mdx | 2 +- api_docs/profiling.mdx | 2 +- api_docs/profiling_data_access.mdx | 2 +- api_docs/remote_clusters.mdx | 2 +- api_docs/reporting.mdx | 2 +- api_docs/rollup.mdx | 2 +- api_docs/rule_registry.mdx | 2 +- api_docs/runtime_fields.mdx | 2 +- api_docs/saved_objects.mdx | 2 +- api_docs/saved_objects_finder.mdx | 2 +- api_docs/saved_objects_management.mdx | 2 +- api_docs/saved_objects_tagging.mdx | 2 +- api_docs/saved_objects_tagging_oss.mdx | 2 +- api_docs/saved_search.mdx | 2 +- api_docs/screenshot_mode.mdx | 2 +- api_docs/screenshotting.mdx | 2 +- api_docs/search_assistant.mdx | 2 +- api_docs/search_connectors.mdx | 2 +- api_docs/search_homepage.mdx | 2 +- api_docs/search_indices.devdocs.json | 2 +- api_docs/search_indices.mdx | 2 +- api_docs/search_inference_endpoints.mdx | 2 +- api_docs/search_navigation.devdocs.json | 2 +- api_docs/search_navigation.mdx | 2 +- api_docs/search_notebooks.mdx | 2 +- api_docs/search_playground.mdx | 2 +- api_docs/security.mdx | 2 +- api_docs/security_solution.devdocs.json | 2 +- api_docs/security_solution.mdx | 2 +- api_docs/security_solution_ess.mdx | 2 +- api_docs/security_solution_serverless.mdx | 2 +- api_docs/serverless.mdx | 2 +- api_docs/serverless_observability.mdx | 2 +- api_docs/serverless_search.mdx | 2 +- api_docs/session_view.mdx | 2 +- api_docs/share.mdx | 2 +- api_docs/slo.mdx | 2 +- api_docs/snapshot_restore.mdx | 2 +- api_docs/spaces.mdx | 2 +- api_docs/stack_alerts.mdx | 2 +- api_docs/stack_connectors.mdx | 2 +- api_docs/streams.devdocs.json | 622 ++++++++----- api_docs/streams.mdx | 21 +- api_docs/streams_app.devdocs.json | 148 +++ api_docs/streams_app.mdx | 49 + api_docs/task_manager.mdx | 2 +- api_docs/telemetry.mdx | 2 +- api_docs/telemetry_collection_manager.mdx | 2 +- api_docs/telemetry_management_section.mdx | 2 +- api_docs/threat_intelligence.mdx | 2 +- api_docs/timelines.mdx | 2 +- api_docs/transform.mdx | 2 +- api_docs/triggers_actions_ui.mdx | 2 +- api_docs/ui_actions.mdx | 2 +- api_docs/ui_actions_enhanced.mdx | 2 +- api_docs/unified_doc_viewer.mdx | 2 +- api_docs/unified_histogram.mdx | 2 +- api_docs/unified_search.mdx | 2 +- api_docs/unified_search_autocomplete.mdx | 2 +- api_docs/uptime.mdx | 2 +- api_docs/url_forwarding.mdx | 2 +- api_docs/usage_collection.mdx | 2 +- api_docs/ux.mdx | 2 +- api_docs/vis_default_editor.mdx | 2 +- api_docs/vis_type_gauge.mdx | 2 +- api_docs/vis_type_heatmap.mdx | 2 +- api_docs/vis_type_pie.mdx | 2 +- api_docs/vis_type_table.mdx | 2 +- api_docs/vis_type_timelion.mdx | 2 +- api_docs/vis_type_timeseries.mdx | 2 +- api_docs/vis_type_vega.mdx | 2 +- api_docs/vis_type_vislib.mdx | 2 +- api_docs/vis_type_xy.mdx | 2 +- api_docs/visualizations.mdx | 2 +- 790 files changed, 2668 insertions(+), 1998 deletions(-) create mode 100644 api_docs/streams_app.devdocs.json create mode 100644 api_docs/streams_app.mdx diff --git a/api_docs/actions.mdx b/api_docs/actions.mdx index f4cd71b1d2526..3f07bf7bdcb12 100644 --- a/api_docs/actions.mdx +++ b/api_docs/actions.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/actions title: "actions" image: https://source.unsplash.com/400x175/?github description: API docs for the actions plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'actions'] --- import actionsObj from './actions.devdocs.json'; diff --git a/api_docs/advanced_settings.mdx b/api_docs/advanced_settings.mdx index 6b9d4ce3067bb..88238206f2298 100644 --- a/api_docs/advanced_settings.mdx +++ b/api_docs/advanced_settings.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/advancedSettings title: "advancedSettings" image: https://source.unsplash.com/400x175/?github description: API docs for the advancedSettings plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'advancedSettings'] --- import advancedSettingsObj from './advanced_settings.devdocs.json'; diff --git a/api_docs/ai_assistant_management_selection.mdx b/api_docs/ai_assistant_management_selection.mdx index 52c8aac28073e..c90f024179352 100644 --- a/api_docs/ai_assistant_management_selection.mdx +++ b/api_docs/ai_assistant_management_selection.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/aiAssistantManagementSelection title: "aiAssistantManagementSelection" image: https://source.unsplash.com/400x175/?github description: API docs for the aiAssistantManagementSelection plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiAssistantManagementSelection'] --- import aiAssistantManagementSelectionObj from './ai_assistant_management_selection.devdocs.json'; diff --git a/api_docs/aiops.mdx b/api_docs/aiops.mdx index 47bd8648ff466..bcd45bce6e677 100644 --- a/api_docs/aiops.mdx +++ b/api_docs/aiops.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/aiops title: "aiops" image: https://source.unsplash.com/400x175/?github description: API docs for the aiops plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiops'] --- import aiopsObj from './aiops.devdocs.json'; diff --git a/api_docs/alerting.mdx b/api_docs/alerting.mdx index 168ee67909170..eecd6de841e70 100644 --- a/api_docs/alerting.mdx +++ b/api_docs/alerting.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/alerting title: "alerting" image: https://source.unsplash.com/400x175/?github description: API docs for the alerting plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'alerting'] --- import alertingObj from './alerting.devdocs.json'; diff --git a/api_docs/apm.devdocs.json b/api_docs/apm.devdocs.json index a288da3567466..d6b2c432c467d 100644 --- a/api_docs/apm.devdocs.json +++ b/api_docs/apm.devdocs.json @@ -695,7 +695,7 @@ "section": "def-common.TopNFunctions", "text": "TopNFunctions" }, - "; hostNames: string[]; } | undefined, ", + "; hostNames: string[]; containerIds: string[]; } | undefined, ", "APMRouteCreateOptions", ">; \"GET /internal/apm/services/{serviceName}/profiling/hosts/flamegraph\": ", { @@ -829,7 +829,7 @@ "section": "def-common.BaseFlameGraph", "text": "BaseFlameGraph" }, - "; hostNames: string[]; } | undefined, ", + "; hostNames: string[]; containerIds: string[]; } | undefined, ", "APMRouteCreateOptions", ">; \"GET /internal/apm/services/{serviceName}/profiling/functions\": ", { diff --git a/api_docs/apm.mdx b/api_docs/apm.mdx index a70074c03dd68..9eef86e08c262 100644 --- a/api_docs/apm.mdx +++ b/api_docs/apm.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/apm title: "apm" image: https://source.unsplash.com/400x175/?github description: API docs for the apm plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'apm'] --- import apmObj from './apm.devdocs.json'; diff --git a/api_docs/apm_data_access.mdx b/api_docs/apm_data_access.mdx index 879151c8e7824..b02711293b20a 100644 --- a/api_docs/apm_data_access.mdx +++ b/api_docs/apm_data_access.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/apmDataAccess title: "apmDataAccess" image: https://source.unsplash.com/400x175/?github description: API docs for the apmDataAccess plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'apmDataAccess'] --- import apmDataAccessObj from './apm_data_access.devdocs.json'; diff --git a/api_docs/banners.mdx b/api_docs/banners.mdx index f3a81a2be9d81..a1eca8cf25e6a 100644 --- a/api_docs/banners.mdx +++ b/api_docs/banners.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/banners title: "banners" image: https://source.unsplash.com/400x175/?github description: API docs for the banners plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'banners'] --- import bannersObj from './banners.devdocs.json'; diff --git a/api_docs/bfetch.mdx b/api_docs/bfetch.mdx index b990c0f88a729..ce14885554f36 100644 --- a/api_docs/bfetch.mdx +++ b/api_docs/bfetch.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/bfetch title: "bfetch" image: https://source.unsplash.com/400x175/?github description: API docs for the bfetch plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'bfetch'] --- import bfetchObj from './bfetch.devdocs.json'; diff --git a/api_docs/canvas.mdx b/api_docs/canvas.mdx index 6cdb5f7c194ff..dbc5d9250be32 100644 --- a/api_docs/canvas.mdx +++ b/api_docs/canvas.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/canvas title: "canvas" image: https://source.unsplash.com/400x175/?github description: API docs for the canvas plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'canvas'] --- import canvasObj from './canvas.devdocs.json'; diff --git a/api_docs/cases.mdx b/api_docs/cases.mdx index 52935f3f03c00..edf89128a5922 100644 --- a/api_docs/cases.mdx +++ b/api_docs/cases.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cases title: "cases" image: https://source.unsplash.com/400x175/?github description: API docs for the cases plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cases'] --- import casesObj from './cases.devdocs.json'; diff --git a/api_docs/charts.mdx b/api_docs/charts.mdx index dae6462b2dd5a..962acd458c4ec 100644 --- a/api_docs/charts.mdx +++ b/api_docs/charts.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/charts title: "charts" image: https://source.unsplash.com/400x175/?github description: API docs for the charts plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'charts'] --- import chartsObj from './charts.devdocs.json'; diff --git a/api_docs/cloud.mdx b/api_docs/cloud.mdx index 1450a0b9c05eb..19cc7327b4ae8 100644 --- a/api_docs/cloud.mdx +++ b/api_docs/cloud.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloud title: "cloud" image: https://source.unsplash.com/400x175/?github description: API docs for the cloud plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloud'] --- import cloudObj from './cloud.devdocs.json'; diff --git a/api_docs/cloud_data_migration.mdx b/api_docs/cloud_data_migration.mdx index ec6c14060a347..fef5a02c211d4 100644 --- a/api_docs/cloud_data_migration.mdx +++ b/api_docs/cloud_data_migration.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudDataMigration title: "cloudDataMigration" image: https://source.unsplash.com/400x175/?github description: API docs for the cloudDataMigration plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudDataMigration'] --- import cloudDataMigrationObj from './cloud_data_migration.devdocs.json'; diff --git a/api_docs/cloud_defend.mdx b/api_docs/cloud_defend.mdx index d0e8b18ad2c4a..0eb94ddf351b2 100644 --- a/api_docs/cloud_defend.mdx +++ b/api_docs/cloud_defend.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudDefend title: "cloudDefend" image: https://source.unsplash.com/400x175/?github description: API docs for the cloudDefend plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudDefend'] --- import cloudDefendObj from './cloud_defend.devdocs.json'; diff --git a/api_docs/cloud_security_posture.mdx b/api_docs/cloud_security_posture.mdx index 2645b43a2bcc3..c6f808809f4dc 100644 --- a/api_docs/cloud_security_posture.mdx +++ b/api_docs/cloud_security_posture.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudSecurityPosture title: "cloudSecurityPosture" image: https://source.unsplash.com/400x175/?github description: API docs for the cloudSecurityPosture plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudSecurityPosture'] --- import cloudSecurityPostureObj from './cloud_security_posture.devdocs.json'; diff --git a/api_docs/console.mdx b/api_docs/console.mdx index af9f5dc95c249..063f052714ecf 100644 --- a/api_docs/console.mdx +++ b/api_docs/console.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/console title: "console" image: https://source.unsplash.com/400x175/?github description: API docs for the console plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'console'] --- import consoleObj from './console.devdocs.json'; diff --git a/api_docs/content_management.mdx b/api_docs/content_management.mdx index 5ba53668750d4..af321e0558b6e 100644 --- a/api_docs/content_management.mdx +++ b/api_docs/content_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/contentManagement title: "contentManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the contentManagement plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'contentManagement'] --- import contentManagementObj from './content_management.devdocs.json'; diff --git a/api_docs/controls.mdx b/api_docs/controls.mdx index 44947135dd9a2..10201057da0db 100644 --- a/api_docs/controls.mdx +++ b/api_docs/controls.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/controls title: "controls" image: https://source.unsplash.com/400x175/?github description: API docs for the controls plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'controls'] --- import controlsObj from './controls.devdocs.json'; diff --git a/api_docs/custom_integrations.mdx b/api_docs/custom_integrations.mdx index a1c0cdf879ffa..b9a9aa508b0b1 100644 --- a/api_docs/custom_integrations.mdx +++ b/api_docs/custom_integrations.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/customIntegrations title: "customIntegrations" image: https://source.unsplash.com/400x175/?github description: API docs for the customIntegrations plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'customIntegrations'] --- import customIntegrationsObj from './custom_integrations.devdocs.json'; diff --git a/api_docs/dashboard.mdx b/api_docs/dashboard.mdx index d5eb334544934..ac9b56f9ed8a9 100644 --- a/api_docs/dashboard.mdx +++ b/api_docs/dashboard.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dashboard title: "dashboard" image: https://source.unsplash.com/400x175/?github description: API docs for the dashboard plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dashboard'] --- import dashboardObj from './dashboard.devdocs.json'; diff --git a/api_docs/dashboard_enhanced.mdx b/api_docs/dashboard_enhanced.mdx index a0aa7cf373ab1..60e0789235327 100644 --- a/api_docs/dashboard_enhanced.mdx +++ b/api_docs/dashboard_enhanced.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dashboardEnhanced title: "dashboardEnhanced" image: https://source.unsplash.com/400x175/?github description: API docs for the dashboardEnhanced plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dashboardEnhanced'] --- import dashboardEnhancedObj from './dashboard_enhanced.devdocs.json'; diff --git a/api_docs/data.mdx b/api_docs/data.mdx index c9436676536da..01dd0d4c50713 100644 --- a/api_docs/data.mdx +++ b/api_docs/data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/data title: "data" image: https://source.unsplash.com/400x175/?github description: API docs for the data plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data'] --- import dataObj from './data.devdocs.json'; diff --git a/api_docs/data_quality.mdx b/api_docs/data_quality.mdx index f82d6bac7fa67..7b2c076579299 100644 --- a/api_docs/data_quality.mdx +++ b/api_docs/data_quality.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataQuality title: "dataQuality" image: https://source.unsplash.com/400x175/?github description: API docs for the dataQuality plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataQuality'] --- import dataQualityObj from './data_quality.devdocs.json'; diff --git a/api_docs/data_query.mdx b/api_docs/data_query.mdx index 010baf73d8fe0..113c8c9356fbb 100644 --- a/api_docs/data_query.mdx +++ b/api_docs/data_query.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/data-query title: "data.query" image: https://source.unsplash.com/400x175/?github description: API docs for the data.query plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data.query'] --- import dataQueryObj from './data_query.devdocs.json'; diff --git a/api_docs/data_search.mdx b/api_docs/data_search.mdx index ede8736344481..57cd0c01eab73 100644 --- a/api_docs/data_search.mdx +++ b/api_docs/data_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/data-search title: "data.search" image: https://source.unsplash.com/400x175/?github description: API docs for the data.search plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data.search'] --- import dataSearchObj from './data_search.devdocs.json'; diff --git a/api_docs/data_usage.mdx b/api_docs/data_usage.mdx index 729b17c034eba..5632d8c4e7d3c 100644 --- a/api_docs/data_usage.mdx +++ b/api_docs/data_usage.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataUsage title: "dataUsage" image: https://source.unsplash.com/400x175/?github description: API docs for the dataUsage plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataUsage'] --- import dataUsageObj from './data_usage.devdocs.json'; diff --git a/api_docs/data_view_editor.mdx b/api_docs/data_view_editor.mdx index 3550bf56f8d9a..e2cc2fc3ff03e 100644 --- a/api_docs/data_view_editor.mdx +++ b/api_docs/data_view_editor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataViewEditor title: "dataViewEditor" image: https://source.unsplash.com/400x175/?github description: API docs for the dataViewEditor plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataViewEditor'] --- import dataViewEditorObj from './data_view_editor.devdocs.json'; diff --git a/api_docs/data_view_field_editor.mdx b/api_docs/data_view_field_editor.mdx index 12ca64a6579f4..81ae08552215b 100644 --- a/api_docs/data_view_field_editor.mdx +++ b/api_docs/data_view_field_editor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataViewFieldEditor title: "dataViewFieldEditor" image: https://source.unsplash.com/400x175/?github description: API docs for the dataViewFieldEditor plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataViewFieldEditor'] --- import dataViewFieldEditorObj from './data_view_field_editor.devdocs.json'; diff --git a/api_docs/data_view_management.mdx b/api_docs/data_view_management.mdx index a904ebcaef5b8..c6f99faaab2b9 100644 --- a/api_docs/data_view_management.mdx +++ b/api_docs/data_view_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataViewManagement title: "dataViewManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the dataViewManagement plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataViewManagement'] --- import dataViewManagementObj from './data_view_management.devdocs.json'; diff --git a/api_docs/data_views.mdx b/api_docs/data_views.mdx index 3ec6ada543067..3840c930093df 100644 --- a/api_docs/data_views.mdx +++ b/api_docs/data_views.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataViews title: "dataViews" image: https://source.unsplash.com/400x175/?github description: API docs for the dataViews plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataViews'] --- import dataViewsObj from './data_views.devdocs.json'; diff --git a/api_docs/data_visualizer.mdx b/api_docs/data_visualizer.mdx index 4e34b67e51eff..2a3a70d6c5cb9 100644 --- a/api_docs/data_visualizer.mdx +++ b/api_docs/data_visualizer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataVisualizer title: "dataVisualizer" image: https://source.unsplash.com/400x175/?github description: API docs for the dataVisualizer plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataVisualizer'] --- import dataVisualizerObj from './data_visualizer.devdocs.json'; diff --git a/api_docs/dataset_quality.devdocs.json b/api_docs/dataset_quality.devdocs.json index 0f42873f1c07f..f6d641e428113 100644 --- a/api_docs/dataset_quality.devdocs.json +++ b/api_docs/dataset_quality.devdocs.json @@ -561,7 +561,7 @@ "section": "def-common.ServerRouteCreateOptions", "text": "ServerRouteCreateOptions" }, - "> ? TRouteParamsRT extends ", + " | undefined> ? TRouteParamsRT extends ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -912,15 +912,7 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - " ? TReturnType extends ", + " ? TReturnType extends ", { "pluginId": "@kbn/core-http-server", "scope": "server", diff --git a/api_docs/dataset_quality.mdx b/api_docs/dataset_quality.mdx index 949338fdd1147..27735e46c00c2 100644 --- a/api_docs/dataset_quality.mdx +++ b/api_docs/dataset_quality.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/datasetQuality title: "datasetQuality" image: https://source.unsplash.com/400x175/?github description: API docs for the datasetQuality plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'datasetQuality'] --- import datasetQualityObj from './dataset_quality.devdocs.json'; diff --git a/api_docs/deprecations_by_api.mdx b/api_docs/deprecations_by_api.mdx index 53c6b8c8364b0..c3582dbe17f1f 100644 --- a/api_docs/deprecations_by_api.mdx +++ b/api_docs/deprecations_by_api.mdx @@ -7,7 +7,7 @@ id: kibDevDocsDeprecationsByApi slug: /kibana-dev-docs/api-meta/deprecated-api-list-by-api title: Deprecated API usage by API description: A list of deprecated APIs, which plugins are still referencing them, and when they need to be removed by. -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- diff --git a/api_docs/deprecations_by_plugin.mdx b/api_docs/deprecations_by_plugin.mdx index 04d19f89d36d7..be7588db27ddb 100644 --- a/api_docs/deprecations_by_plugin.mdx +++ b/api_docs/deprecations_by_plugin.mdx @@ -7,7 +7,7 @@ id: kibDevDocsDeprecationsByPlugin slug: /kibana-dev-docs/api-meta/deprecated-api-list-by-plugin title: Deprecated API usage by plugin description: A list of deprecated APIs, which plugins are still referencing them, and when they need to be removed by. -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- diff --git a/api_docs/deprecations_by_team.mdx b/api_docs/deprecations_by_team.mdx index 130be970c22f9..58fe13364fbbd 100644 --- a/api_docs/deprecations_by_team.mdx +++ b/api_docs/deprecations_by_team.mdx @@ -7,7 +7,7 @@ id: kibDevDocsDeprecationsDueByTeam slug: /kibana-dev-docs/api-meta/deprecations-due-by-team title: Deprecated APIs due to be removed, by team description: Lists the teams that are referencing deprecated APIs with a remove by date. -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- diff --git a/api_docs/dev_tools.mdx b/api_docs/dev_tools.mdx index 219b037c06ab9..82e50bc914279 100644 --- a/api_docs/dev_tools.mdx +++ b/api_docs/dev_tools.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/devTools title: "devTools" image: https://source.unsplash.com/400x175/?github description: API docs for the devTools plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'devTools'] --- import devToolsObj from './dev_tools.devdocs.json'; diff --git a/api_docs/discover.mdx b/api_docs/discover.mdx index 307c67ec72a23..339ab780f9c62 100644 --- a/api_docs/discover.mdx +++ b/api_docs/discover.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/discover title: "discover" image: https://source.unsplash.com/400x175/?github description: API docs for the discover plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'discover'] --- import discoverObj from './discover.devdocs.json'; diff --git a/api_docs/discover_enhanced.mdx b/api_docs/discover_enhanced.mdx index c79ca4997dcff..e565b8349addc 100644 --- a/api_docs/discover_enhanced.mdx +++ b/api_docs/discover_enhanced.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/discoverEnhanced title: "discoverEnhanced" image: https://source.unsplash.com/400x175/?github description: API docs for the discoverEnhanced plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'discoverEnhanced'] --- import discoverEnhancedObj from './discover_enhanced.devdocs.json'; diff --git a/api_docs/discover_shared.mdx b/api_docs/discover_shared.mdx index 8cdfe5675d4ff..3446bd7676e0d 100644 --- a/api_docs/discover_shared.mdx +++ b/api_docs/discover_shared.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/discoverShared title: "discoverShared" image: https://source.unsplash.com/400x175/?github description: API docs for the discoverShared plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'discoverShared'] --- import discoverSharedObj from './discover_shared.devdocs.json'; diff --git a/api_docs/ecs_data_quality_dashboard.mdx b/api_docs/ecs_data_quality_dashboard.mdx index f858b6cb7910a..d95004e7f4aca 100644 --- a/api_docs/ecs_data_quality_dashboard.mdx +++ b/api_docs/ecs_data_quality_dashboard.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/ecsDataQualityDashboard title: "ecsDataQualityDashboard" image: https://source.unsplash.com/400x175/?github description: API docs for the ecsDataQualityDashboard plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'ecsDataQualityDashboard'] --- import ecsDataQualityDashboardObj from './ecs_data_quality_dashboard.devdocs.json'; diff --git a/api_docs/elastic_assistant.mdx b/api_docs/elastic_assistant.mdx index a5824a8acbe62..54a208c08fb0c 100644 --- a/api_docs/elastic_assistant.mdx +++ b/api_docs/elastic_assistant.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/elasticAssistant title: "elasticAssistant" image: https://source.unsplash.com/400x175/?github description: API docs for the elasticAssistant plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'elasticAssistant'] --- import elasticAssistantObj from './elastic_assistant.devdocs.json'; diff --git a/api_docs/embeddable.mdx b/api_docs/embeddable.mdx index d10524384008f..3f410c13fc6eb 100644 --- a/api_docs/embeddable.mdx +++ b/api_docs/embeddable.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/embeddable title: "embeddable" image: https://source.unsplash.com/400x175/?github description: API docs for the embeddable plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'embeddable'] --- import embeddableObj from './embeddable.devdocs.json'; diff --git a/api_docs/embeddable_enhanced.mdx b/api_docs/embeddable_enhanced.mdx index 6e029464bb78b..5be5ced4c35aa 100644 --- a/api_docs/embeddable_enhanced.mdx +++ b/api_docs/embeddable_enhanced.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/embeddableEnhanced title: "embeddableEnhanced" image: https://source.unsplash.com/400x175/?github description: API docs for the embeddableEnhanced plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'embeddableEnhanced'] --- import embeddableEnhancedObj from './embeddable_enhanced.devdocs.json'; diff --git a/api_docs/encrypted_saved_objects.mdx b/api_docs/encrypted_saved_objects.mdx index a5afba3b20b90..ffcb619986b57 100644 --- a/api_docs/encrypted_saved_objects.mdx +++ b/api_docs/encrypted_saved_objects.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/encryptedSavedObjects title: "encryptedSavedObjects" image: https://source.unsplash.com/400x175/?github description: API docs for the encryptedSavedObjects plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'encryptedSavedObjects'] --- import encryptedSavedObjectsObj from './encrypted_saved_objects.devdocs.json'; diff --git a/api_docs/enterprise_search.mdx b/api_docs/enterprise_search.mdx index 2dd68a9301816..cce28be65864a 100644 --- a/api_docs/enterprise_search.mdx +++ b/api_docs/enterprise_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/enterpriseSearch title: "enterpriseSearch" image: https://source.unsplash.com/400x175/?github description: API docs for the enterpriseSearch plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'enterpriseSearch'] --- import enterpriseSearchObj from './enterprise_search.devdocs.json'; diff --git a/api_docs/entities_data_access.mdx b/api_docs/entities_data_access.mdx index 8b6c561caf798..82e53658be8c3 100644 --- a/api_docs/entities_data_access.mdx +++ b/api_docs/entities_data_access.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/entitiesDataAccess title: "entitiesDataAccess" image: https://source.unsplash.com/400x175/?github description: API docs for the entitiesDataAccess plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'entitiesDataAccess'] --- import entitiesDataAccessObj from './entities_data_access.devdocs.json'; diff --git a/api_docs/entity_manager.devdocs.json b/api_docs/entity_manager.devdocs.json index 7f11685ebce83..7895ae318fb61 100644 --- a/api_docs/entity_manager.devdocs.json +++ b/api_docs/entity_manager.devdocs.json @@ -55,15 +55,7 @@ "section": "def-common.EntityV2", "text": "EntityV2" }, - "[]; }>, ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /internal/entities/v2/_search\": ", + "[]; }>, undefined>; \"POST /internal/entities/v2/_search\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -81,15 +73,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"PATCH /internal/entities/definition/{id}\": ", + ", undefined>; \"PATCH /internal/entities/definition/{id}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -179,15 +163,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /internal/entities/definition/{id}/_reset\": ", + ", undefined>; \"POST /internal/entities/definition/{id}/_reset\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -205,15 +181,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"GET /internal/entities/definition/{id?}\": ", + ", undefined>; \"GET /internal/entities/definition/{id?}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -231,15 +199,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"DELETE /internal/entities/definition/{id}\": ", + ", undefined>; \"DELETE /internal/entities/definition/{id}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -257,15 +217,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /internal/entities/definition\": ", + ", undefined>; \"POST /internal/entities/definition\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -355,15 +307,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"DELETE /internal/entities/managed/enablement\": ", + ", undefined>; \"DELETE /internal/entities/managed/enablement\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -381,15 +325,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"PUT /internal/entities/managed/enablement\": ", + ", undefined>; \"PUT /internal/entities/managed/enablement\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -407,25 +343,9 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"GET /internal/entities/managed/enablement\": ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.ServerRoute", - "text": "ServerRoute" - }, - "<\"GET /internal/entities/managed/enablement\", undefined, ", + ", undefined>; \"GET /internal/entities/managed/enablement\": { endpoint: \"GET /internal/entities/managed/enablement\"; handler: ServerRouteHandler<", "EntityManagerRouteHandlerResources", - ", ", + ", undefined, ", { "pluginId": "@kbn/core-http-server", "scope": "server", @@ -433,15 +353,23 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", + ">; security?: ", { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.RouteSecurity", + "text": "RouteSecurity" }, - ">; }, TEndpoint> & {}>) => Promise<", + " | undefined; }; }, TEndpoint> & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">) => Promise<", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -475,15 +403,7 @@ "section": "def-common.EntityV2", "text": "EntityV2" }, - "[]; }>, ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /internal/entities/v2/_search\": ", + "[]; }>, undefined>; \"POST /internal/entities/v2/_search\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -501,15 +421,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"PATCH /internal/entities/definition/{id}\": ", + ", undefined>; \"PATCH /internal/entities/definition/{id}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -599,15 +511,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /internal/entities/definition/{id}/_reset\": ", + ", undefined>; \"POST /internal/entities/definition/{id}/_reset\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -625,15 +529,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"GET /internal/entities/definition/{id?}\": ", + ", undefined>; \"GET /internal/entities/definition/{id?}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -651,15 +547,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"DELETE /internal/entities/definition/{id}\": ", + ", undefined>; \"DELETE /internal/entities/definition/{id}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -677,15 +565,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /internal/entities/definition\": ", + ", undefined>; \"POST /internal/entities/definition\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -775,15 +655,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"DELETE /internal/entities/managed/enablement\": ", + ", undefined>; \"DELETE /internal/entities/managed/enablement\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -801,15 +673,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"PUT /internal/entities/managed/enablement\": ", + ", undefined>; \"PUT /internal/entities/managed/enablement\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -827,25 +691,9 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"GET /internal/entities/managed/enablement\": ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.ServerRoute", - "text": "ServerRoute" - }, - "<\"GET /internal/entities/managed/enablement\", undefined, ", + ", undefined>; \"GET /internal/entities/managed/enablement\": { endpoint: \"GET /internal/entities/managed/enablement\"; handler: ServerRouteHandler<", "EntityManagerRouteHandlerResources", - ", ", + ", undefined, ", { "pluginId": "@kbn/core-http-server", "scope": "server", @@ -853,15 +701,15 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", + ">; security?: ", { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.RouteSecurity", + "text": "RouteSecurity" }, - ">; }, TEndpoint>>" + " | undefined; }; }, TEndpoint>>" ], "path": "x-pack/plugins/entity_manager/public/lib/entity_client.ts", "deprecated": false, @@ -899,7 +747,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions> extends never ? [] | [", + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + "> extends never ? [] | [", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -907,7 +763,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions] : [", + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + "] : [", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -915,7 +779,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions]" + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + "]" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -1396,15 +1268,7 @@ "section": "def-common.EntityV2", "text": "EntityV2" }, - "[]; }>, ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /internal/entities/v2/_search\": ", + "[]; }>, undefined>; \"POST /internal/entities/v2/_search\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -1422,15 +1286,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"PATCH /internal/entities/definition/{id}\": ", + ", undefined>; \"PATCH /internal/entities/definition/{id}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -1520,15 +1376,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /internal/entities/definition/{id}/_reset\": ", + ", undefined>; \"POST /internal/entities/definition/{id}/_reset\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -1546,15 +1394,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"GET /internal/entities/definition/{id?}\": ", + ", undefined>; \"GET /internal/entities/definition/{id?}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -1572,15 +1412,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"DELETE /internal/entities/definition/{id}\": ", + ", undefined>; \"DELETE /internal/entities/definition/{id}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -1598,15 +1430,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /internal/entities/definition\": ", + ", undefined>; \"POST /internal/entities/definition\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -1696,15 +1520,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"DELETE /internal/entities/managed/enablement\": ", + ", undefined>; \"DELETE /internal/entities/managed/enablement\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -1722,15 +1538,7 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"PUT /internal/entities/managed/enablement\": ", + ", undefined>; \"PUT /internal/entities/managed/enablement\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -1748,25 +1556,9 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"GET /internal/entities/managed/enablement\": ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.ServerRoute", - "text": "ServerRoute" - }, - "<\"GET /internal/entities/managed/enablement\", undefined, ", + ", undefined>; \"GET /internal/entities/managed/enablement\": { endpoint: \"GET /internal/entities/managed/enablement\"; handler: ServerRouteHandler<", "EntityManagerRouteHandlerResources", - ", ", + ", undefined, ", { "pluginId": "@kbn/core-http-server", "scope": "server", @@ -1774,15 +1566,15 @@ "section": "def-server.IKibanaResponse", "text": "IKibanaResponse" }, - ", ", + ">; security?: ", { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.RouteSecurity", + "text": "RouteSecurity" }, - ">; }" + " | undefined; }; }" ], "path": "x-pack/plugins/entity_manager/server/routes/index.ts", "deprecated": false, diff --git a/api_docs/entity_manager.mdx b/api_docs/entity_manager.mdx index 4f9d5b171a6dd..11ded400d81ba 100644 --- a/api_docs/entity_manager.mdx +++ b/api_docs/entity_manager.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/entityManager title: "entityManager" image: https://source.unsplash.com/400x175/?github description: API docs for the entityManager plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'entityManager'] --- import entityManagerObj from './entity_manager.devdocs.json'; diff --git a/api_docs/es_ui_shared.mdx b/api_docs/es_ui_shared.mdx index 78e36dfe45c46..12256929bb526 100644 --- a/api_docs/es_ui_shared.mdx +++ b/api_docs/es_ui_shared.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/esUiShared title: "esUiShared" image: https://source.unsplash.com/400x175/?github description: API docs for the esUiShared plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'esUiShared'] --- import esUiSharedObj from './es_ui_shared.devdocs.json'; diff --git a/api_docs/esql.mdx b/api_docs/esql.mdx index 4c4f45d62c923..75071d6f03369 100644 --- a/api_docs/esql.mdx +++ b/api_docs/esql.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/esql title: "esql" image: https://source.unsplash.com/400x175/?github description: API docs for the esql plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'esql'] --- import esqlObj from './esql.devdocs.json'; diff --git a/api_docs/esql_data_grid.mdx b/api_docs/esql_data_grid.mdx index d433d5068ba23..b6d6fc96cb2a9 100644 --- a/api_docs/esql_data_grid.mdx +++ b/api_docs/esql_data_grid.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/esqlDataGrid title: "esqlDataGrid" image: https://source.unsplash.com/400x175/?github description: API docs for the esqlDataGrid plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'esqlDataGrid'] --- import esqlDataGridObj from './esql_data_grid.devdocs.json'; diff --git a/api_docs/event_annotation.mdx b/api_docs/event_annotation.mdx index cd8e2c14489a7..66adba7501c4c 100644 --- a/api_docs/event_annotation.mdx +++ b/api_docs/event_annotation.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/eventAnnotation title: "eventAnnotation" image: https://source.unsplash.com/400x175/?github description: API docs for the eventAnnotation plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'eventAnnotation'] --- import eventAnnotationObj from './event_annotation.devdocs.json'; diff --git a/api_docs/event_annotation_listing.mdx b/api_docs/event_annotation_listing.mdx index 8d36d9fd2d074..82ff1773c9132 100644 --- a/api_docs/event_annotation_listing.mdx +++ b/api_docs/event_annotation_listing.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/eventAnnotationListing title: "eventAnnotationListing" image: https://source.unsplash.com/400x175/?github description: API docs for the eventAnnotationListing plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'eventAnnotationListing'] --- import eventAnnotationListingObj from './event_annotation_listing.devdocs.json'; diff --git a/api_docs/event_log.mdx b/api_docs/event_log.mdx index 04d772fd02fe2..2cfb9a1865461 100644 --- a/api_docs/event_log.mdx +++ b/api_docs/event_log.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/eventLog title: "eventLog" image: https://source.unsplash.com/400x175/?github description: API docs for the eventLog plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'eventLog'] --- import eventLogObj from './event_log.devdocs.json'; diff --git a/api_docs/exploratory_view.mdx b/api_docs/exploratory_view.mdx index df875133f29ab..1ebb14f900e7a 100644 --- a/api_docs/exploratory_view.mdx +++ b/api_docs/exploratory_view.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/exploratoryView title: "exploratoryView" image: https://source.unsplash.com/400x175/?github description: API docs for the exploratoryView plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'exploratoryView'] --- import exploratoryViewObj from './exploratory_view.devdocs.json'; diff --git a/api_docs/expression_error.mdx b/api_docs/expression_error.mdx index e5e9fde305033..b69ddb7e91eff 100644 --- a/api_docs/expression_error.mdx +++ b/api_docs/expression_error.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionError title: "expressionError" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionError plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionError'] --- import expressionErrorObj from './expression_error.devdocs.json'; diff --git a/api_docs/expression_gauge.mdx b/api_docs/expression_gauge.mdx index ccda17d8436d8..383497073288f 100644 --- a/api_docs/expression_gauge.mdx +++ b/api_docs/expression_gauge.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionGauge title: "expressionGauge" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionGauge plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionGauge'] --- import expressionGaugeObj from './expression_gauge.devdocs.json'; diff --git a/api_docs/expression_heatmap.mdx b/api_docs/expression_heatmap.mdx index fdd14a0d77df8..80e5b8321c25d 100644 --- a/api_docs/expression_heatmap.mdx +++ b/api_docs/expression_heatmap.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionHeatmap title: "expressionHeatmap" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionHeatmap plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionHeatmap'] --- import expressionHeatmapObj from './expression_heatmap.devdocs.json'; diff --git a/api_docs/expression_image.mdx b/api_docs/expression_image.mdx index 619ac34f68ec1..ea30bfd79a70e 100644 --- a/api_docs/expression_image.mdx +++ b/api_docs/expression_image.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionImage title: "expressionImage" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionImage plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionImage'] --- import expressionImageObj from './expression_image.devdocs.json'; diff --git a/api_docs/expression_legacy_metric_vis.mdx b/api_docs/expression_legacy_metric_vis.mdx index f67556baacac5..6481f46f9c1da 100644 --- a/api_docs/expression_legacy_metric_vis.mdx +++ b/api_docs/expression_legacy_metric_vis.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionLegacyMetricVis title: "expressionLegacyMetricVis" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionLegacyMetricVis plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionLegacyMetricVis'] --- import expressionLegacyMetricVisObj from './expression_legacy_metric_vis.devdocs.json'; diff --git a/api_docs/expression_metric.mdx b/api_docs/expression_metric.mdx index dd9ed74e11b5b..47af3b8bd93ea 100644 --- a/api_docs/expression_metric.mdx +++ b/api_docs/expression_metric.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionMetric title: "expressionMetric" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionMetric plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionMetric'] --- import expressionMetricObj from './expression_metric.devdocs.json'; diff --git a/api_docs/expression_metric_vis.mdx b/api_docs/expression_metric_vis.mdx index f367fd1457adf..3bb05c0bb32e8 100644 --- a/api_docs/expression_metric_vis.mdx +++ b/api_docs/expression_metric_vis.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionMetricVis title: "expressionMetricVis" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionMetricVis plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionMetricVis'] --- import expressionMetricVisObj from './expression_metric_vis.devdocs.json'; diff --git a/api_docs/expression_partition_vis.mdx b/api_docs/expression_partition_vis.mdx index 347f0cfcece94..81cdc668f7df9 100644 --- a/api_docs/expression_partition_vis.mdx +++ b/api_docs/expression_partition_vis.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionPartitionVis title: "expressionPartitionVis" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionPartitionVis plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionPartitionVis'] --- import expressionPartitionVisObj from './expression_partition_vis.devdocs.json'; diff --git a/api_docs/expression_repeat_image.mdx b/api_docs/expression_repeat_image.mdx index 20ef618ca9109..ba0c4c3566baa 100644 --- a/api_docs/expression_repeat_image.mdx +++ b/api_docs/expression_repeat_image.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionRepeatImage title: "expressionRepeatImage" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionRepeatImage plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionRepeatImage'] --- import expressionRepeatImageObj from './expression_repeat_image.devdocs.json'; diff --git a/api_docs/expression_reveal_image.mdx b/api_docs/expression_reveal_image.mdx index f21033ae1993d..113d89ae93572 100644 --- a/api_docs/expression_reveal_image.mdx +++ b/api_docs/expression_reveal_image.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionRevealImage title: "expressionRevealImage" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionRevealImage plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionRevealImage'] --- import expressionRevealImageObj from './expression_reveal_image.devdocs.json'; diff --git a/api_docs/expression_shape.mdx b/api_docs/expression_shape.mdx index b1d275aaf0a94..07ae5d1173a1f 100644 --- a/api_docs/expression_shape.mdx +++ b/api_docs/expression_shape.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionShape title: "expressionShape" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionShape plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionShape'] --- import expressionShapeObj from './expression_shape.devdocs.json'; diff --git a/api_docs/expression_tagcloud.mdx b/api_docs/expression_tagcloud.mdx index 1d162f7f35a5c..d4f92e3f290e2 100644 --- a/api_docs/expression_tagcloud.mdx +++ b/api_docs/expression_tagcloud.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionTagcloud title: "expressionTagcloud" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionTagcloud plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionTagcloud'] --- import expressionTagcloudObj from './expression_tagcloud.devdocs.json'; diff --git a/api_docs/expression_x_y.mdx b/api_docs/expression_x_y.mdx index a641786c18cd0..fc1a34d457a4f 100644 --- a/api_docs/expression_x_y.mdx +++ b/api_docs/expression_x_y.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionXY title: "expressionXY" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionXY plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionXY'] --- import expressionXYObj from './expression_x_y.devdocs.json'; diff --git a/api_docs/expressions.mdx b/api_docs/expressions.mdx index 48bdba6d25c96..ce44d06397ca4 100644 --- a/api_docs/expressions.mdx +++ b/api_docs/expressions.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressions title: "expressions" image: https://source.unsplash.com/400x175/?github description: API docs for the expressions plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressions'] --- import expressionsObj from './expressions.devdocs.json'; diff --git a/api_docs/features.mdx b/api_docs/features.mdx index ee772ebf6014b..1136571cf2fbb 100644 --- a/api_docs/features.mdx +++ b/api_docs/features.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/features title: "features" image: https://source.unsplash.com/400x175/?github description: API docs for the features plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'features'] --- import featuresObj from './features.devdocs.json'; diff --git a/api_docs/field_formats.mdx b/api_docs/field_formats.mdx index 43791b69d36da..c11d90b1bb6f2 100644 --- a/api_docs/field_formats.mdx +++ b/api_docs/field_formats.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/fieldFormats title: "fieldFormats" image: https://source.unsplash.com/400x175/?github description: API docs for the fieldFormats plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'fieldFormats'] --- import fieldFormatsObj from './field_formats.devdocs.json'; diff --git a/api_docs/fields_metadata.mdx b/api_docs/fields_metadata.mdx index 6d78cb149dcc2..866ece3fdf83a 100644 --- a/api_docs/fields_metadata.mdx +++ b/api_docs/fields_metadata.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/fieldsMetadata title: "fieldsMetadata" image: https://source.unsplash.com/400x175/?github description: API docs for the fieldsMetadata plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'fieldsMetadata'] --- import fieldsMetadataObj from './fields_metadata.devdocs.json'; diff --git a/api_docs/file_upload.mdx b/api_docs/file_upload.mdx index ea6c51a67e38e..a49cc04b0f062 100644 --- a/api_docs/file_upload.mdx +++ b/api_docs/file_upload.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/fileUpload title: "fileUpload" image: https://source.unsplash.com/400x175/?github description: API docs for the fileUpload plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'fileUpload'] --- import fileUploadObj from './file_upload.devdocs.json'; diff --git a/api_docs/files.mdx b/api_docs/files.mdx index eeb4676d49103..b132ec182e288 100644 --- a/api_docs/files.mdx +++ b/api_docs/files.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/files title: "files" image: https://source.unsplash.com/400x175/?github description: API docs for the files plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'files'] --- import filesObj from './files.devdocs.json'; diff --git a/api_docs/files_management.mdx b/api_docs/files_management.mdx index ac25bc33a308d..bf58550b38582 100644 --- a/api_docs/files_management.mdx +++ b/api_docs/files_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/filesManagement title: "filesManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the filesManagement plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'filesManagement'] --- import filesManagementObj from './files_management.devdocs.json'; diff --git a/api_docs/fleet.devdocs.json b/api_docs/fleet.devdocs.json index 4d371badd779c..6af93b912833f 100644 --- a/api_docs/fleet.devdocs.json +++ b/api_docs/fleet.devdocs.json @@ -20134,6 +20134,57 @@ } ], "returnComment": [] + }, + { + "parentPluginId": "fleet", + "id": "def-server.FleetStartContract.createOutputClient", + "type": "Function", + "tags": [], + "label": "createOutputClient", + "description": [ + "\nCreate a Fleet Output Client instance" + ], + "signature": [ + "(request: ", + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + ") => Promise<", + "OutputClientInterface", + ">" + ], + "path": "x-pack/plugins/fleet/server/plugin.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "fleet", + "id": "def-server.FleetStartContract.createOutputClient.$1", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "x-pack/plugins/fleet/server/plugin.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [] } ], "lifecycle": "start", diff --git a/api_docs/fleet.mdx b/api_docs/fleet.mdx index 01da1928b12de..a2dd317945c53 100644 --- a/api_docs/fleet.mdx +++ b/api_docs/fleet.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/fleet title: "fleet" image: https://source.unsplash.com/400x175/?github description: API docs for the fleet plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'fleet'] --- import fleetObj from './fleet.devdocs.json'; @@ -21,7 +21,7 @@ Contact [@elastic/fleet](https://github.com/orgs/elastic/teams/fleet) for questi | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 1428 | 5 | 1303 | 81 | +| 1430 | 5 | 1304 | 82 | ## Client diff --git a/api_docs/global_search.mdx b/api_docs/global_search.mdx index d220503505c1b..684d940f8a9d6 100644 --- a/api_docs/global_search.mdx +++ b/api_docs/global_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/globalSearch title: "globalSearch" image: https://source.unsplash.com/400x175/?github description: API docs for the globalSearch plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'globalSearch'] --- import globalSearchObj from './global_search.devdocs.json'; diff --git a/api_docs/guided_onboarding.mdx b/api_docs/guided_onboarding.mdx index 8808f0a3e125c..761c1e9125300 100644 --- a/api_docs/guided_onboarding.mdx +++ b/api_docs/guided_onboarding.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/guidedOnboarding title: "guidedOnboarding" image: https://source.unsplash.com/400x175/?github description: API docs for the guidedOnboarding plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'guidedOnboarding'] --- import guidedOnboardingObj from './guided_onboarding.devdocs.json'; diff --git a/api_docs/home.mdx b/api_docs/home.mdx index c0d03af26628a..144234325c96a 100644 --- a/api_docs/home.mdx +++ b/api_docs/home.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/home title: "home" image: https://source.unsplash.com/400x175/?github description: API docs for the home plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'home'] --- import homeObj from './home.devdocs.json'; diff --git a/api_docs/image_embeddable.mdx b/api_docs/image_embeddable.mdx index 5279af95c40c0..dd6def7a1cf29 100644 --- a/api_docs/image_embeddable.mdx +++ b/api_docs/image_embeddable.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/imageEmbeddable title: "imageEmbeddable" image: https://source.unsplash.com/400x175/?github description: API docs for the imageEmbeddable plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'imageEmbeddable'] --- import imageEmbeddableObj from './image_embeddable.devdocs.json'; diff --git a/api_docs/index_lifecycle_management.mdx b/api_docs/index_lifecycle_management.mdx index 1d37abf7d4517..b05f09e3f517d 100644 --- a/api_docs/index_lifecycle_management.mdx +++ b/api_docs/index_lifecycle_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/indexLifecycleManagement title: "indexLifecycleManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the indexLifecycleManagement plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'indexLifecycleManagement'] --- import indexLifecycleManagementObj from './index_lifecycle_management.devdocs.json'; diff --git a/api_docs/index_management.mdx b/api_docs/index_management.mdx index b2427e387ec3f..a8cf21f9398e1 100644 --- a/api_docs/index_management.mdx +++ b/api_docs/index_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/indexManagement title: "indexManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the indexManagement plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'indexManagement'] --- import indexManagementObj from './index_management.devdocs.json'; diff --git a/api_docs/inference.mdx b/api_docs/inference.mdx index bc0a24c98f973..7d499e10dfc25 100644 --- a/api_docs/inference.mdx +++ b/api_docs/inference.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/inference title: "inference" image: https://source.unsplash.com/400x175/?github description: API docs for the inference plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'inference'] --- import inferenceObj from './inference.devdocs.json'; diff --git a/api_docs/infra.mdx b/api_docs/infra.mdx index 5866f1cf65a72..3c8931f37c186 100644 --- a/api_docs/infra.mdx +++ b/api_docs/infra.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/infra title: "infra" image: https://source.unsplash.com/400x175/?github description: API docs for the infra plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'infra'] --- import infraObj from './infra.devdocs.json'; diff --git a/api_docs/ingest_pipelines.mdx b/api_docs/ingest_pipelines.mdx index 3247f49c0ef50..f75d0dd39ca3e 100644 --- a/api_docs/ingest_pipelines.mdx +++ b/api_docs/ingest_pipelines.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/ingestPipelines title: "ingestPipelines" image: https://source.unsplash.com/400x175/?github description: API docs for the ingestPipelines plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'ingestPipelines'] --- import ingestPipelinesObj from './ingest_pipelines.devdocs.json'; diff --git a/api_docs/inspector.mdx b/api_docs/inspector.mdx index d25a768821068..327ee9d4b9458 100644 --- a/api_docs/inspector.mdx +++ b/api_docs/inspector.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/inspector title: "inspector" image: https://source.unsplash.com/400x175/?github description: API docs for the inspector plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'inspector'] --- import inspectorObj from './inspector.devdocs.json'; diff --git a/api_docs/integration_assistant.mdx b/api_docs/integration_assistant.mdx index b41e90032df38..43128fcd76713 100644 --- a/api_docs/integration_assistant.mdx +++ b/api_docs/integration_assistant.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/integrationAssistant title: "integrationAssistant" image: https://source.unsplash.com/400x175/?github description: API docs for the integrationAssistant plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'integrationAssistant'] --- import integrationAssistantObj from './integration_assistant.devdocs.json'; diff --git a/api_docs/interactive_setup.mdx b/api_docs/interactive_setup.mdx index 76a107d074941..0acb84296319f 100644 --- a/api_docs/interactive_setup.mdx +++ b/api_docs/interactive_setup.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/interactiveSetup title: "interactiveSetup" image: https://source.unsplash.com/400x175/?github description: API docs for the interactiveSetup plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'interactiveSetup'] --- import interactiveSetupObj from './interactive_setup.devdocs.json'; diff --git a/api_docs/inventory.mdx b/api_docs/inventory.mdx index c464b2ae9ccee..be53736459451 100644 --- a/api_docs/inventory.mdx +++ b/api_docs/inventory.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/inventory title: "inventory" image: https://source.unsplash.com/400x175/?github description: API docs for the inventory plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'inventory'] --- import inventoryObj from './inventory.devdocs.json'; diff --git a/api_docs/investigate.mdx b/api_docs/investigate.mdx index 87620ebf8f902..1da148497ed60 100644 --- a/api_docs/investigate.mdx +++ b/api_docs/investigate.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/investigate title: "investigate" image: https://source.unsplash.com/400x175/?github description: API docs for the investigate plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'investigate'] --- import investigateObj from './investigate.devdocs.json'; diff --git a/api_docs/investigate_app.mdx b/api_docs/investigate_app.mdx index 680f3bfbb5e33..8e368221f13ca 100644 --- a/api_docs/investigate_app.mdx +++ b/api_docs/investigate_app.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/investigateApp title: "investigateApp" image: https://source.unsplash.com/400x175/?github description: API docs for the investigateApp plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'investigateApp'] --- import investigateAppObj from './investigate_app.devdocs.json'; diff --git a/api_docs/kbn_actions_types.mdx b/api_docs/kbn_actions_types.mdx index 515f9d624aeb3..0976b60a54583 100644 --- a/api_docs/kbn_actions_types.mdx +++ b/api_docs/kbn_actions_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-actions-types title: "@kbn/actions-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/actions-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/actions-types'] --- import kbnActionsTypesObj from './kbn_actions_types.devdocs.json'; diff --git a/api_docs/kbn_ai_assistant.mdx b/api_docs/kbn_ai_assistant.mdx index f366ec37cfb84..8128e9639bc72 100644 --- a/api_docs/kbn_ai_assistant.mdx +++ b/api_docs/kbn_ai_assistant.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ai-assistant title: "@kbn/ai-assistant" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ai-assistant plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ai-assistant'] --- import kbnAiAssistantObj from './kbn_ai_assistant.devdocs.json'; diff --git a/api_docs/kbn_ai_assistant_common.mdx b/api_docs/kbn_ai_assistant_common.mdx index a841c4fc428d3..898d648ba9a28 100644 --- a/api_docs/kbn_ai_assistant_common.mdx +++ b/api_docs/kbn_ai_assistant_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ai-assistant-common title: "@kbn/ai-assistant-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ai-assistant-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ai-assistant-common'] --- import kbnAiAssistantCommonObj from './kbn_ai_assistant_common.devdocs.json'; diff --git a/api_docs/kbn_aiops_components.mdx b/api_docs/kbn_aiops_components.mdx index 39bb0ac002f3c..b21fb6d1244ec 100644 --- a/api_docs/kbn_aiops_components.mdx +++ b/api_docs/kbn_aiops_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-aiops-components title: "@kbn/aiops-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/aiops-components plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/aiops-components'] --- import kbnAiopsComponentsObj from './kbn_aiops_components.devdocs.json'; diff --git a/api_docs/kbn_aiops_log_pattern_analysis.mdx b/api_docs/kbn_aiops_log_pattern_analysis.mdx index d0982cb76d1f6..488f33b5013a6 100644 --- a/api_docs/kbn_aiops_log_pattern_analysis.mdx +++ b/api_docs/kbn_aiops_log_pattern_analysis.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-aiops-log-pattern-analysis title: "@kbn/aiops-log-pattern-analysis" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/aiops-log-pattern-analysis plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/aiops-log-pattern-analysis'] --- import kbnAiopsLogPatternAnalysisObj from './kbn_aiops_log_pattern_analysis.devdocs.json'; diff --git a/api_docs/kbn_aiops_log_rate_analysis.mdx b/api_docs/kbn_aiops_log_rate_analysis.mdx index eb973509e8589..a7a1a4fb3877f 100644 --- a/api_docs/kbn_aiops_log_rate_analysis.mdx +++ b/api_docs/kbn_aiops_log_rate_analysis.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-aiops-log-rate-analysis title: "@kbn/aiops-log-rate-analysis" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/aiops-log-rate-analysis plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/aiops-log-rate-analysis'] --- import kbnAiopsLogRateAnalysisObj from './kbn_aiops_log_rate_analysis.devdocs.json'; diff --git a/api_docs/kbn_alerting_api_integration_helpers.mdx b/api_docs/kbn_alerting_api_integration_helpers.mdx index e95cf4f35bb21..6b9f8bdad7912 100644 --- a/api_docs/kbn_alerting_api_integration_helpers.mdx +++ b/api_docs/kbn_alerting_api_integration_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-alerting-api-integration-helpers title: "@kbn/alerting-api-integration-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/alerting-api-integration-helpers plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/alerting-api-integration-helpers'] --- import kbnAlertingApiIntegrationHelpersObj from './kbn_alerting_api_integration_helpers.devdocs.json'; diff --git a/api_docs/kbn_alerting_comparators.mdx b/api_docs/kbn_alerting_comparators.mdx index 29c6b3696f7b3..23b2ce62abda5 100644 --- a/api_docs/kbn_alerting_comparators.mdx +++ b/api_docs/kbn_alerting_comparators.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-alerting-comparators title: "@kbn/alerting-comparators" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/alerting-comparators plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/alerting-comparators'] --- import kbnAlertingComparatorsObj from './kbn_alerting_comparators.devdocs.json'; diff --git a/api_docs/kbn_alerting_state_types.mdx b/api_docs/kbn_alerting_state_types.mdx index 31b6e78cf587d..c1fdcf7de1dc5 100644 --- a/api_docs/kbn_alerting_state_types.mdx +++ b/api_docs/kbn_alerting_state_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-alerting-state-types title: "@kbn/alerting-state-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/alerting-state-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/alerting-state-types'] --- import kbnAlertingStateTypesObj from './kbn_alerting_state_types.devdocs.json'; diff --git a/api_docs/kbn_alerting_types.mdx b/api_docs/kbn_alerting_types.mdx index 2d61a62d3bde7..be586d0ae4ffb 100644 --- a/api_docs/kbn_alerting_types.mdx +++ b/api_docs/kbn_alerting_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-alerting-types title: "@kbn/alerting-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/alerting-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/alerting-types'] --- import kbnAlertingTypesObj from './kbn_alerting_types.devdocs.json'; diff --git a/api_docs/kbn_alerts_as_data_utils.mdx b/api_docs/kbn_alerts_as_data_utils.mdx index e977d9c48b095..f9e83c23945b2 100644 --- a/api_docs/kbn_alerts_as_data_utils.mdx +++ b/api_docs/kbn_alerts_as_data_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-alerts-as-data-utils title: "@kbn/alerts-as-data-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/alerts-as-data-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/alerts-as-data-utils'] --- import kbnAlertsAsDataUtilsObj from './kbn_alerts_as_data_utils.devdocs.json'; diff --git a/api_docs/kbn_alerts_grouping.mdx b/api_docs/kbn_alerts_grouping.mdx index 4842590dbc502..63bc41eab7198 100644 --- a/api_docs/kbn_alerts_grouping.mdx +++ b/api_docs/kbn_alerts_grouping.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-alerts-grouping title: "@kbn/alerts-grouping" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/alerts-grouping plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/alerts-grouping'] --- import kbnAlertsGroupingObj from './kbn_alerts_grouping.devdocs.json'; diff --git a/api_docs/kbn_alerts_ui_shared.mdx b/api_docs/kbn_alerts_ui_shared.mdx index f9425b4ecffb2..e27bbc7f352fb 100644 --- a/api_docs/kbn_alerts_ui_shared.mdx +++ b/api_docs/kbn_alerts_ui_shared.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-alerts-ui-shared title: "@kbn/alerts-ui-shared" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/alerts-ui-shared plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/alerts-ui-shared'] --- import kbnAlertsUiSharedObj from './kbn_alerts_ui_shared.devdocs.json'; diff --git a/api_docs/kbn_analytics.mdx b/api_docs/kbn_analytics.mdx index 559553eddfb6d..493899de7549b 100644 --- a/api_docs/kbn_analytics.mdx +++ b/api_docs/kbn_analytics.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics title: "@kbn/analytics" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics'] --- import kbnAnalyticsObj from './kbn_analytics.devdocs.json'; diff --git a/api_docs/kbn_analytics_collection_utils.mdx b/api_docs/kbn_analytics_collection_utils.mdx index a7563004ed79b..6f18b63dec731 100644 --- a/api_docs/kbn_analytics_collection_utils.mdx +++ b/api_docs/kbn_analytics_collection_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-collection-utils title: "@kbn/analytics-collection-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-collection-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-collection-utils'] --- import kbnAnalyticsCollectionUtilsObj from './kbn_analytics_collection_utils.devdocs.json'; diff --git a/api_docs/kbn_apm_config_loader.mdx b/api_docs/kbn_apm_config_loader.mdx index a944ec2b9bb8f..4478066f05135 100644 --- a/api_docs/kbn_apm_config_loader.mdx +++ b/api_docs/kbn_apm_config_loader.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-apm-config-loader title: "@kbn/apm-config-loader" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/apm-config-loader plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-config-loader'] --- import kbnApmConfigLoaderObj from './kbn_apm_config_loader.devdocs.json'; diff --git a/api_docs/kbn_apm_data_view.mdx b/api_docs/kbn_apm_data_view.mdx index a522c47c655d2..a8f55d00181f1 100644 --- a/api_docs/kbn_apm_data_view.mdx +++ b/api_docs/kbn_apm_data_view.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-apm-data-view title: "@kbn/apm-data-view" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/apm-data-view plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-data-view'] --- import kbnApmDataViewObj from './kbn_apm_data_view.devdocs.json'; diff --git a/api_docs/kbn_apm_synthtrace.mdx b/api_docs/kbn_apm_synthtrace.mdx index d45eb5c96c103..c711daf49a1e5 100644 --- a/api_docs/kbn_apm_synthtrace.mdx +++ b/api_docs/kbn_apm_synthtrace.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-apm-synthtrace title: "@kbn/apm-synthtrace" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/apm-synthtrace plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-synthtrace'] --- import kbnApmSynthtraceObj from './kbn_apm_synthtrace.devdocs.json'; diff --git a/api_docs/kbn_apm_synthtrace_client.devdocs.json b/api_docs/kbn_apm_synthtrace_client.devdocs.json index 4f458c6eb82a9..5aa9b2ee2e090 100644 --- a/api_docs/kbn_apm_synthtrace_client.devdocs.json +++ b/api_docs/kbn_apm_synthtrace_client.devdocs.json @@ -3133,7 +3133,7 @@ "label": "LogDocument", "description": [], "signature": [ - "{ '@timestamp'?: number | undefined; } & Partial<{ 'input.type': string; 'log.file.path'?: string | undefined; 'service.name'?: string | undefined; 'service.environment'?: string | undefined; 'data_stream.namespace': string; 'data_stream.type': string; 'data_stream.dataset': string; message?: string | undefined; 'error.message'?: string | undefined; 'event.original'?: string | undefined; 'event.dataset': string; 'log.level'?: string | undefined; 'host.name'?: string | undefined; 'container.id'?: string | undefined; 'trace.id'?: string | undefined; 'transaction.id'?: string | undefined; 'agent.id'?: string | undefined; 'agent.name'?: string | undefined; 'orchestrator.cluster.name'?: string | undefined; 'orchestrator.cluster.id'?: string | undefined; 'orchestrator.resource.id'?: string | undefined; 'kubernetes.pod.uid'?: string | undefined; 'aws.s3.bucket.name'?: string | undefined; 'aws.kinesis.name'?: string | undefined; 'orchestrator.namespace'?: string | undefined; 'container.name'?: string | undefined; 'cloud.provider'?: string | undefined; 'cloud.region'?: string | undefined; 'cloud.availability_zone'?: string | undefined; 'cloud.project.id'?: string | undefined; 'cloud.instance.id'?: string | undefined; 'error.stack_trace'?: string | undefined; 'error.exception.stacktrace'?: string | undefined; 'error.log.stacktrace'?: string | undefined; 'log.custom': Record; 'host.geo.location': number[]; 'host.ip': string; 'network.bytes': number; 'tls.established': boolean; 'event.duration': number; 'event.start': Date; 'event.end': Date; labels?: Record | undefined; test_field: string | string[]; date: Date; severity: string; msg: string; svc: string; hostname: string; thisisaverylongfieldnamethatevendoesnotcontainanyspaceswhyitcouldpotentiallybreakouruiinseveralplaces: string; }>" + "{ '@timestamp'?: number | undefined; } & Partial<{ _index?: string | undefined; 'input.type': string; 'log.file.path'?: string | undefined; 'service.name'?: string | undefined; 'service.environment'?: string | undefined; 'data_stream.namespace': string; 'data_stream.type': string; 'data_stream.dataset': string; message?: string | undefined; 'error.message'?: string | undefined; 'event.original'?: string | undefined; 'event.dataset': string; 'log.level'?: string | undefined; 'host.name'?: string | undefined; 'container.id'?: string | undefined; 'trace.id'?: string | undefined; 'transaction.id'?: string | undefined; 'agent.id'?: string | undefined; 'agent.name'?: string | undefined; 'orchestrator.cluster.name'?: string | undefined; 'orchestrator.cluster.id'?: string | undefined; 'orchestrator.resource.id'?: string | undefined; 'kubernetes.pod.uid'?: string | undefined; 'aws.s3.bucket.name'?: string | undefined; 'aws.kinesis.name'?: string | undefined; 'orchestrator.namespace'?: string | undefined; 'container.name'?: string | undefined; 'cloud.provider'?: string | undefined; 'cloud.region'?: string | undefined; 'cloud.availability_zone'?: string | undefined; 'cloud.project.id'?: string | undefined; 'cloud.instance.id'?: string | undefined; 'error.stack_trace'?: string | undefined; 'error.exception.stacktrace'?: string | undefined; 'error.log.stacktrace'?: string | undefined; 'log.custom': Record; 'host.geo.location': number[]; 'host.ip': string; 'network.bytes': number; 'tls.established': boolean; 'event.duration': number; 'event.start': Date; 'event.end': Date; labels?: Record | undefined; test_field: string | string[]; date: Date; severity: string; msg: string; svc: string; hostname: string; 'http.status_code'?: number | undefined; 'http.request.method'?: string | undefined; 'url.path'?: string | undefined; 'process.name'?: string | undefined; 'kubernetes.namespace'?: string | undefined; 'kubernetes.pod.name'?: string | undefined; 'kubernetes.container.name'?: string | undefined; 'orchestrator.resource.name'?: string | undefined; thisisaverylongfieldnamethatevendoesnotcontainanyspaceswhyitcouldpotentiallybreakouruiinseveralplaces: string; }>" ], "path": "packages/kbn-apm-synthtrace-client/src/lib/logs/index.ts", "deprecated": false, @@ -4167,6 +4167,34 @@ } ] }, + { + "parentPluginId": "@kbn/apm-synthtrace-client", + "id": "def-common.log.createForIndex", + "type": "Function", + "tags": [], + "label": "createForIndex", + "description": [], + "signature": [ + "(index: string) => Log" + ], + "path": "packages/kbn-apm-synthtrace-client/src/lib/logs/index.ts", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "@kbn/apm-synthtrace-client", + "id": "def-common.log.createForIndex.$1", + "type": "string", + "tags": [], + "label": "index", + "description": [], + "path": "packages/kbn-apm-synthtrace-client/src/lib/logs/index.ts", + "deprecated": false, + "trackAdoption": false + } + ] + }, { "parentPluginId": "@kbn/apm-synthtrace-client", "id": "def-common.log.createMinimal", diff --git a/api_docs/kbn_apm_synthtrace_client.mdx b/api_docs/kbn_apm_synthtrace_client.mdx index f474c66189561..f3c18c109873a 100644 --- a/api_docs/kbn_apm_synthtrace_client.mdx +++ b/api_docs/kbn_apm_synthtrace_client.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-apm-synthtrace-client title: "@kbn/apm-synthtrace-client" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/apm-synthtrace-client plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-synthtrace-client'] --- import kbnApmSynthtraceClientObj from './kbn_apm_synthtrace_client.devdocs.json'; @@ -21,7 +21,7 @@ Contact [@elastic/obs-ux-infra_services-team](https://github.com/orgs/elastic/te | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 268 | 0 | 268 | 38 | +| 270 | 0 | 270 | 38 | ## Common diff --git a/api_docs/kbn_apm_types.mdx b/api_docs/kbn_apm_types.mdx index 57388f6f57269..142589a1c726d 100644 --- a/api_docs/kbn_apm_types.mdx +++ b/api_docs/kbn_apm_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-apm-types title: "@kbn/apm-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/apm-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-types'] --- import kbnApmTypesObj from './kbn_apm_types.devdocs.json'; diff --git a/api_docs/kbn_apm_utils.mdx b/api_docs/kbn_apm_utils.mdx index e003778c230d8..9561df4fa7811 100644 --- a/api_docs/kbn_apm_utils.mdx +++ b/api_docs/kbn_apm_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-apm-utils title: "@kbn/apm-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/apm-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-utils'] --- import kbnApmUtilsObj from './kbn_apm_utils.devdocs.json'; diff --git a/api_docs/kbn_avc_banner.mdx b/api_docs/kbn_avc_banner.mdx index 40a6d9fc97413..7f90f67755e6e 100644 --- a/api_docs/kbn_avc_banner.mdx +++ b/api_docs/kbn_avc_banner.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-avc-banner title: "@kbn/avc-banner" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/avc-banner plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/avc-banner'] --- import kbnAvcBannerObj from './kbn_avc_banner.devdocs.json'; diff --git a/api_docs/kbn_axe_config.mdx b/api_docs/kbn_axe_config.mdx index c56ffae7654f7..5e184651daec6 100644 --- a/api_docs/kbn_axe_config.mdx +++ b/api_docs/kbn_axe_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-axe-config title: "@kbn/axe-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/axe-config plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/axe-config'] --- import kbnAxeConfigObj from './kbn_axe_config.devdocs.json'; diff --git a/api_docs/kbn_bfetch_error.mdx b/api_docs/kbn_bfetch_error.mdx index e1eb04b9645c5..e40bd88901e95 100644 --- a/api_docs/kbn_bfetch_error.mdx +++ b/api_docs/kbn_bfetch_error.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-bfetch-error title: "@kbn/bfetch-error" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/bfetch-error plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/bfetch-error'] --- import kbnBfetchErrorObj from './kbn_bfetch_error.devdocs.json'; diff --git a/api_docs/kbn_calculate_auto.mdx b/api_docs/kbn_calculate_auto.mdx index 27028ff8920ce..4ea64480de7da 100644 --- a/api_docs/kbn_calculate_auto.mdx +++ b/api_docs/kbn_calculate_auto.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-calculate-auto title: "@kbn/calculate-auto" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/calculate-auto plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/calculate-auto'] --- import kbnCalculateAutoObj from './kbn_calculate_auto.devdocs.json'; diff --git a/api_docs/kbn_calculate_width_from_char_count.mdx b/api_docs/kbn_calculate_width_from_char_count.mdx index 6b26d458f8759..78f92d67a3a10 100644 --- a/api_docs/kbn_calculate_width_from_char_count.mdx +++ b/api_docs/kbn_calculate_width_from_char_count.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-calculate-width-from-char-count title: "@kbn/calculate-width-from-char-count" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/calculate-width-from-char-count plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/calculate-width-from-char-count'] --- import kbnCalculateWidthFromCharCountObj from './kbn_calculate_width_from_char_count.devdocs.json'; diff --git a/api_docs/kbn_cases_components.mdx b/api_docs/kbn_cases_components.mdx index bf93305c3d62f..b3d762f7f740d 100644 --- a/api_docs/kbn_cases_components.mdx +++ b/api_docs/kbn_cases_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-cases-components title: "@kbn/cases-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/cases-components plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/cases-components'] --- import kbnCasesComponentsObj from './kbn_cases_components.devdocs.json'; diff --git a/api_docs/kbn_cbor.mdx b/api_docs/kbn_cbor.mdx index c57397057c593..5221c426632b4 100644 --- a/api_docs/kbn_cbor.mdx +++ b/api_docs/kbn_cbor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-cbor title: "@kbn/cbor" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/cbor plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/cbor'] --- import kbnCborObj from './kbn_cbor.devdocs.json'; diff --git a/api_docs/kbn_cell_actions.mdx b/api_docs/kbn_cell_actions.mdx index 290b692f1c7d9..6e866f3409dad 100644 --- a/api_docs/kbn_cell_actions.mdx +++ b/api_docs/kbn_cell_actions.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-cell-actions title: "@kbn/cell-actions" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/cell-actions plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/cell-actions'] --- import kbnCellActionsObj from './kbn_cell_actions.devdocs.json'; diff --git a/api_docs/kbn_chart_expressions_common.mdx b/api_docs/kbn_chart_expressions_common.mdx index c1430ce7357fd..c5b22948264b2 100644 --- a/api_docs/kbn_chart_expressions_common.mdx +++ b/api_docs/kbn_chart_expressions_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-chart-expressions-common title: "@kbn/chart-expressions-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/chart-expressions-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/chart-expressions-common'] --- import kbnChartExpressionsCommonObj from './kbn_chart_expressions_common.devdocs.json'; diff --git a/api_docs/kbn_chart_icons.mdx b/api_docs/kbn_chart_icons.mdx index c9624b599d2dc..eca2073a78051 100644 --- a/api_docs/kbn_chart_icons.mdx +++ b/api_docs/kbn_chart_icons.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-chart-icons title: "@kbn/chart-icons" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/chart-icons plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/chart-icons'] --- import kbnChartIconsObj from './kbn_chart_icons.devdocs.json'; diff --git a/api_docs/kbn_ci_stats_core.mdx b/api_docs/kbn_ci_stats_core.mdx index c46fb1f96d79b..78ff8ac4bb780 100644 --- a/api_docs/kbn_ci_stats_core.mdx +++ b/api_docs/kbn_ci_stats_core.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ci-stats-core title: "@kbn/ci-stats-core" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ci-stats-core plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ci-stats-core'] --- import kbnCiStatsCoreObj from './kbn_ci_stats_core.devdocs.json'; diff --git a/api_docs/kbn_ci_stats_performance_metrics.mdx b/api_docs/kbn_ci_stats_performance_metrics.mdx index d1417d019e277..d2a4c39dc3d21 100644 --- a/api_docs/kbn_ci_stats_performance_metrics.mdx +++ b/api_docs/kbn_ci_stats_performance_metrics.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ci-stats-performance-metrics title: "@kbn/ci-stats-performance-metrics" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ci-stats-performance-metrics plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ci-stats-performance-metrics'] --- import kbnCiStatsPerformanceMetricsObj from './kbn_ci_stats_performance_metrics.devdocs.json'; diff --git a/api_docs/kbn_ci_stats_reporter.mdx b/api_docs/kbn_ci_stats_reporter.mdx index e4f81389ce729..b1afb22526d68 100644 --- a/api_docs/kbn_ci_stats_reporter.mdx +++ b/api_docs/kbn_ci_stats_reporter.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ci-stats-reporter title: "@kbn/ci-stats-reporter" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ci-stats-reporter plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ci-stats-reporter'] --- import kbnCiStatsReporterObj from './kbn_ci_stats_reporter.devdocs.json'; diff --git a/api_docs/kbn_cli_dev_mode.mdx b/api_docs/kbn_cli_dev_mode.mdx index 2372621be5758..15aa4c0da0c91 100644 --- a/api_docs/kbn_cli_dev_mode.mdx +++ b/api_docs/kbn_cli_dev_mode.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-cli-dev-mode title: "@kbn/cli-dev-mode" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/cli-dev-mode plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/cli-dev-mode'] --- import kbnCliDevModeObj from './kbn_cli_dev_mode.devdocs.json'; diff --git a/api_docs/kbn_cloud_security_posture.mdx b/api_docs/kbn_cloud_security_posture.mdx index 51d2e11bb1abd..29b13d0d8d621 100644 --- a/api_docs/kbn_cloud_security_posture.mdx +++ b/api_docs/kbn_cloud_security_posture.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-cloud-security-posture title: "@kbn/cloud-security-posture" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/cloud-security-posture plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/cloud-security-posture'] --- import kbnCloudSecurityPostureObj from './kbn_cloud_security_posture.devdocs.json'; diff --git a/api_docs/kbn_cloud_security_posture_common.mdx b/api_docs/kbn_cloud_security_posture_common.mdx index 72299e09db406..f542be543cf06 100644 --- a/api_docs/kbn_cloud_security_posture_common.mdx +++ b/api_docs/kbn_cloud_security_posture_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-cloud-security-posture-common title: "@kbn/cloud-security-posture-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/cloud-security-posture-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/cloud-security-posture-common'] --- import kbnCloudSecurityPostureCommonObj from './kbn_cloud_security_posture_common.devdocs.json'; diff --git a/api_docs/kbn_cloud_security_posture_graph.mdx b/api_docs/kbn_cloud_security_posture_graph.mdx index 52101088442c6..3c4d5b472e4ec 100644 --- a/api_docs/kbn_cloud_security_posture_graph.mdx +++ b/api_docs/kbn_cloud_security_posture_graph.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-cloud-security-posture-graph title: "@kbn/cloud-security-posture-graph" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/cloud-security-posture-graph plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/cloud-security-posture-graph'] --- import kbnCloudSecurityPostureGraphObj from './kbn_cloud_security_posture_graph.devdocs.json'; diff --git a/api_docs/kbn_code_editor.mdx b/api_docs/kbn_code_editor.mdx index f68972ddfa1a3..0f3d0be44c55b 100644 --- a/api_docs/kbn_code_editor.mdx +++ b/api_docs/kbn_code_editor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-code-editor title: "@kbn/code-editor" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/code-editor plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/code-editor'] --- import kbnCodeEditorObj from './kbn_code_editor.devdocs.json'; diff --git a/api_docs/kbn_code_editor_mock.mdx b/api_docs/kbn_code_editor_mock.mdx index 7d938867b5808..33ae03805b61a 100644 --- a/api_docs/kbn_code_editor_mock.mdx +++ b/api_docs/kbn_code_editor_mock.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-code-editor-mock title: "@kbn/code-editor-mock" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/code-editor-mock plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/code-editor-mock'] --- import kbnCodeEditorMockObj from './kbn_code_editor_mock.devdocs.json'; diff --git a/api_docs/kbn_code_owners.mdx b/api_docs/kbn_code_owners.mdx index 74a9310f86915..61b8f2569c39f 100644 --- a/api_docs/kbn_code_owners.mdx +++ b/api_docs/kbn_code_owners.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-code-owners title: "@kbn/code-owners" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/code-owners plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/code-owners'] --- import kbnCodeOwnersObj from './kbn_code_owners.devdocs.json'; diff --git a/api_docs/kbn_coloring.mdx b/api_docs/kbn_coloring.mdx index 70c84ece2bb5f..05b51dec1aa63 100644 --- a/api_docs/kbn_coloring.mdx +++ b/api_docs/kbn_coloring.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-coloring title: "@kbn/coloring" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/coloring plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/coloring'] --- import kbnColoringObj from './kbn_coloring.devdocs.json'; diff --git a/api_docs/kbn_config.mdx b/api_docs/kbn_config.mdx index 1ec7b038e871f..f2a5b134aa13a 100644 --- a/api_docs/kbn_config.mdx +++ b/api_docs/kbn_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-config title: "@kbn/config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/config plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/config'] --- import kbnConfigObj from './kbn_config.devdocs.json'; diff --git a/api_docs/kbn_config_mocks.mdx b/api_docs/kbn_config_mocks.mdx index 343aa83f01ec2..56e0b59367bed 100644 --- a/api_docs/kbn_config_mocks.mdx +++ b/api_docs/kbn_config_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-config-mocks title: "@kbn/config-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/config-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/config-mocks'] --- import kbnConfigMocksObj from './kbn_config_mocks.devdocs.json'; diff --git a/api_docs/kbn_config_schema.mdx b/api_docs/kbn_config_schema.mdx index 564c31863ab42..92b4ae88d8690 100644 --- a/api_docs/kbn_config_schema.mdx +++ b/api_docs/kbn_config_schema.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-config-schema title: "@kbn/config-schema" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/config-schema plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/config-schema'] --- import kbnConfigSchemaObj from './kbn_config_schema.devdocs.json'; diff --git a/api_docs/kbn_content_management_content_editor.mdx b/api_docs/kbn_content_management_content_editor.mdx index 0f94d9de6ed47..faf30dc214ea1 100644 --- a/api_docs/kbn_content_management_content_editor.mdx +++ b/api_docs/kbn_content_management_content_editor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-content-editor title: "@kbn/content-management-content-editor" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-content-editor plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-content-editor'] --- import kbnContentManagementContentEditorObj from './kbn_content_management_content_editor.devdocs.json'; diff --git a/api_docs/kbn_content_management_content_insights_public.mdx b/api_docs/kbn_content_management_content_insights_public.mdx index 0bee9406c7739..a665b0db08ec0 100644 --- a/api_docs/kbn_content_management_content_insights_public.mdx +++ b/api_docs/kbn_content_management_content_insights_public.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-content-insights-public title: "@kbn/content-management-content-insights-public" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-content-insights-public plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-content-insights-public'] --- import kbnContentManagementContentInsightsPublicObj from './kbn_content_management_content_insights_public.devdocs.json'; diff --git a/api_docs/kbn_content_management_content_insights_server.mdx b/api_docs/kbn_content_management_content_insights_server.mdx index ad24f4a1d1152..00ce49ef6ad9a 100644 --- a/api_docs/kbn_content_management_content_insights_server.mdx +++ b/api_docs/kbn_content_management_content_insights_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-content-insights-server title: "@kbn/content-management-content-insights-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-content-insights-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-content-insights-server'] --- import kbnContentManagementContentInsightsServerObj from './kbn_content_management_content_insights_server.devdocs.json'; diff --git a/api_docs/kbn_content_management_favorites_common.mdx b/api_docs/kbn_content_management_favorites_common.mdx index 3ad8181aa8703..2401c3a9eed87 100644 --- a/api_docs/kbn_content_management_favorites_common.mdx +++ b/api_docs/kbn_content_management_favorites_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-favorites-common title: "@kbn/content-management-favorites-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-favorites-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-favorites-common'] --- import kbnContentManagementFavoritesCommonObj from './kbn_content_management_favorites_common.devdocs.json'; diff --git a/api_docs/kbn_content_management_favorites_public.mdx b/api_docs/kbn_content_management_favorites_public.mdx index b98bff7fd2aef..7cd275df15c82 100644 --- a/api_docs/kbn_content_management_favorites_public.mdx +++ b/api_docs/kbn_content_management_favorites_public.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-favorites-public title: "@kbn/content-management-favorites-public" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-favorites-public plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-favorites-public'] --- import kbnContentManagementFavoritesPublicObj from './kbn_content_management_favorites_public.devdocs.json'; diff --git a/api_docs/kbn_content_management_favorites_server.mdx b/api_docs/kbn_content_management_favorites_server.mdx index a106b331717ba..a7b45b1118add 100644 --- a/api_docs/kbn_content_management_favorites_server.mdx +++ b/api_docs/kbn_content_management_favorites_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-favorites-server title: "@kbn/content-management-favorites-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-favorites-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-favorites-server'] --- import kbnContentManagementFavoritesServerObj from './kbn_content_management_favorites_server.devdocs.json'; diff --git a/api_docs/kbn_content_management_tabbed_table_list_view.mdx b/api_docs/kbn_content_management_tabbed_table_list_view.mdx index cd3630c821d74..d456cb698a011 100644 --- a/api_docs/kbn_content_management_tabbed_table_list_view.mdx +++ b/api_docs/kbn_content_management_tabbed_table_list_view.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-tabbed-table-list-view title: "@kbn/content-management-tabbed-table-list-view" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-tabbed-table-list-view plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-tabbed-table-list-view'] --- import kbnContentManagementTabbedTableListViewObj from './kbn_content_management_tabbed_table_list_view.devdocs.json'; diff --git a/api_docs/kbn_content_management_table_list_view.mdx b/api_docs/kbn_content_management_table_list_view.mdx index 17f5be2bb7b1d..88bf9b727d3e8 100644 --- a/api_docs/kbn_content_management_table_list_view.mdx +++ b/api_docs/kbn_content_management_table_list_view.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-table-list-view title: "@kbn/content-management-table-list-view" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-table-list-view plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-table-list-view'] --- import kbnContentManagementTableListViewObj from './kbn_content_management_table_list_view.devdocs.json'; diff --git a/api_docs/kbn_content_management_table_list_view_common.mdx b/api_docs/kbn_content_management_table_list_view_common.mdx index 81cb4e8d8d3e4..ef7fa599c1fc1 100644 --- a/api_docs/kbn_content_management_table_list_view_common.mdx +++ b/api_docs/kbn_content_management_table_list_view_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-table-list-view-common title: "@kbn/content-management-table-list-view-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-table-list-view-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-table-list-view-common'] --- import kbnContentManagementTableListViewCommonObj from './kbn_content_management_table_list_view_common.devdocs.json'; diff --git a/api_docs/kbn_content_management_table_list_view_table.mdx b/api_docs/kbn_content_management_table_list_view_table.mdx index ec16ad36d7c40..a03b070a94afc 100644 --- a/api_docs/kbn_content_management_table_list_view_table.mdx +++ b/api_docs/kbn_content_management_table_list_view_table.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-table-list-view-table title: "@kbn/content-management-table-list-view-table" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-table-list-view-table plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-table-list-view-table'] --- import kbnContentManagementTableListViewTableObj from './kbn_content_management_table_list_view_table.devdocs.json'; diff --git a/api_docs/kbn_content_management_user_profiles.mdx b/api_docs/kbn_content_management_user_profiles.mdx index d6542ef8b2ebc..eb76aa26d8544 100644 --- a/api_docs/kbn_content_management_user_profiles.mdx +++ b/api_docs/kbn_content_management_user_profiles.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-user-profiles title: "@kbn/content-management-user-profiles" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-user-profiles plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-user-profiles'] --- import kbnContentManagementUserProfilesObj from './kbn_content_management_user_profiles.devdocs.json'; diff --git a/api_docs/kbn_content_management_utils.mdx b/api_docs/kbn_content_management_utils.mdx index 92e4884ae383d..15e0ea70c321e 100644 --- a/api_docs/kbn_content_management_utils.mdx +++ b/api_docs/kbn_content_management_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-utils title: "@kbn/content-management-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-utils'] --- import kbnContentManagementUtilsObj from './kbn_content_management_utils.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_browser.mdx b/api_docs/kbn_core_analytics_browser.mdx index 2839cfd0d0779..267d867411fd6 100644 --- a/api_docs/kbn_core_analytics_browser.mdx +++ b/api_docs/kbn_core_analytics_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-browser title: "@kbn/core-analytics-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-browser'] --- import kbnCoreAnalyticsBrowserObj from './kbn_core_analytics_browser.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_browser_internal.mdx b/api_docs/kbn_core_analytics_browser_internal.mdx index dfb3dddafbd76..b352c238d7bd2 100644 --- a/api_docs/kbn_core_analytics_browser_internal.mdx +++ b/api_docs/kbn_core_analytics_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-browser-internal title: "@kbn/core-analytics-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-browser-internal'] --- import kbnCoreAnalyticsBrowserInternalObj from './kbn_core_analytics_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_browser_mocks.mdx b/api_docs/kbn_core_analytics_browser_mocks.mdx index d73fd6f772eb8..0fbce3beb1916 100644 --- a/api_docs/kbn_core_analytics_browser_mocks.mdx +++ b/api_docs/kbn_core_analytics_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-browser-mocks title: "@kbn/core-analytics-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-browser-mocks'] --- import kbnCoreAnalyticsBrowserMocksObj from './kbn_core_analytics_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_server.mdx b/api_docs/kbn_core_analytics_server.mdx index c1fda7a1fd232..38bf70ad35046 100644 --- a/api_docs/kbn_core_analytics_server.mdx +++ b/api_docs/kbn_core_analytics_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-server title: "@kbn/core-analytics-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-server'] --- import kbnCoreAnalyticsServerObj from './kbn_core_analytics_server.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_server_internal.mdx b/api_docs/kbn_core_analytics_server_internal.mdx index 1ec27c6d6da8b..9c2d9d85b6a6c 100644 --- a/api_docs/kbn_core_analytics_server_internal.mdx +++ b/api_docs/kbn_core_analytics_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-server-internal title: "@kbn/core-analytics-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-server-internal'] --- import kbnCoreAnalyticsServerInternalObj from './kbn_core_analytics_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_server_mocks.mdx b/api_docs/kbn_core_analytics_server_mocks.mdx index 95af442895713..7118db9267cac 100644 --- a/api_docs/kbn_core_analytics_server_mocks.mdx +++ b/api_docs/kbn_core_analytics_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-server-mocks title: "@kbn/core-analytics-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-server-mocks'] --- import kbnCoreAnalyticsServerMocksObj from './kbn_core_analytics_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_application_browser.mdx b/api_docs/kbn_core_application_browser.mdx index d64d45c21b493..0c5ca2917ab60 100644 --- a/api_docs/kbn_core_application_browser.mdx +++ b/api_docs/kbn_core_application_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-application-browser title: "@kbn/core-application-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-application-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-application-browser'] --- import kbnCoreApplicationBrowserObj from './kbn_core_application_browser.devdocs.json'; diff --git a/api_docs/kbn_core_application_browser_internal.mdx b/api_docs/kbn_core_application_browser_internal.mdx index 1d3c1810bb6cd..10a2c44231c45 100644 --- a/api_docs/kbn_core_application_browser_internal.mdx +++ b/api_docs/kbn_core_application_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-application-browser-internal title: "@kbn/core-application-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-application-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-application-browser-internal'] --- import kbnCoreApplicationBrowserInternalObj from './kbn_core_application_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_application_browser_mocks.mdx b/api_docs/kbn_core_application_browser_mocks.mdx index 27deb83d090d8..1f904828c895d 100644 --- a/api_docs/kbn_core_application_browser_mocks.mdx +++ b/api_docs/kbn_core_application_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-application-browser-mocks title: "@kbn/core-application-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-application-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-application-browser-mocks'] --- import kbnCoreApplicationBrowserMocksObj from './kbn_core_application_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_application_common.mdx b/api_docs/kbn_core_application_common.mdx index 11890025e6ffd..65edf8694b51f 100644 --- a/api_docs/kbn_core_application_common.mdx +++ b/api_docs/kbn_core_application_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-application-common title: "@kbn/core-application-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-application-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-application-common'] --- import kbnCoreApplicationCommonObj from './kbn_core_application_common.devdocs.json'; diff --git a/api_docs/kbn_core_apps_browser_internal.mdx b/api_docs/kbn_core_apps_browser_internal.mdx index c10d2453d44c7..d4666008af63f 100644 --- a/api_docs/kbn_core_apps_browser_internal.mdx +++ b/api_docs/kbn_core_apps_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-apps-browser-internal title: "@kbn/core-apps-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-apps-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-apps-browser-internal'] --- import kbnCoreAppsBrowserInternalObj from './kbn_core_apps_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_apps_browser_mocks.mdx b/api_docs/kbn_core_apps_browser_mocks.mdx index a851c9062f42a..ba029252262c4 100644 --- a/api_docs/kbn_core_apps_browser_mocks.mdx +++ b/api_docs/kbn_core_apps_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-apps-browser-mocks title: "@kbn/core-apps-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-apps-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-apps-browser-mocks'] --- import kbnCoreAppsBrowserMocksObj from './kbn_core_apps_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_apps_server_internal.mdx b/api_docs/kbn_core_apps_server_internal.mdx index 3ff3442fb0372..bdda7cc75c86c 100644 --- a/api_docs/kbn_core_apps_server_internal.mdx +++ b/api_docs/kbn_core_apps_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-apps-server-internal title: "@kbn/core-apps-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-apps-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-apps-server-internal'] --- import kbnCoreAppsServerInternalObj from './kbn_core_apps_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_base_browser_mocks.mdx b/api_docs/kbn_core_base_browser_mocks.mdx index 63b2d7e59f701..30a6893edfec0 100644 --- a/api_docs/kbn_core_base_browser_mocks.mdx +++ b/api_docs/kbn_core_base_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-base-browser-mocks title: "@kbn/core-base-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-base-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-base-browser-mocks'] --- import kbnCoreBaseBrowserMocksObj from './kbn_core_base_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_base_common.mdx b/api_docs/kbn_core_base_common.mdx index 5b246c2ae25d7..68b2f28c99568 100644 --- a/api_docs/kbn_core_base_common.mdx +++ b/api_docs/kbn_core_base_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-base-common title: "@kbn/core-base-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-base-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-base-common'] --- import kbnCoreBaseCommonObj from './kbn_core_base_common.devdocs.json'; diff --git a/api_docs/kbn_core_base_server_internal.mdx b/api_docs/kbn_core_base_server_internal.mdx index 9a9bed14bb120..0df60c14545e8 100644 --- a/api_docs/kbn_core_base_server_internal.mdx +++ b/api_docs/kbn_core_base_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-base-server-internal title: "@kbn/core-base-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-base-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-base-server-internal'] --- import kbnCoreBaseServerInternalObj from './kbn_core_base_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_base_server_mocks.mdx b/api_docs/kbn_core_base_server_mocks.mdx index 042bcc3b381c4..7f1444be35c48 100644 --- a/api_docs/kbn_core_base_server_mocks.mdx +++ b/api_docs/kbn_core_base_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-base-server-mocks title: "@kbn/core-base-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-base-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-base-server-mocks'] --- import kbnCoreBaseServerMocksObj from './kbn_core_base_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_capabilities_browser_mocks.mdx b/api_docs/kbn_core_capabilities_browser_mocks.mdx index 67d4c7b666486..b97dcc9c375c2 100644 --- a/api_docs/kbn_core_capabilities_browser_mocks.mdx +++ b/api_docs/kbn_core_capabilities_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-capabilities-browser-mocks title: "@kbn/core-capabilities-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-capabilities-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-capabilities-browser-mocks'] --- import kbnCoreCapabilitiesBrowserMocksObj from './kbn_core_capabilities_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_capabilities_common.mdx b/api_docs/kbn_core_capabilities_common.mdx index a051976dabd39..41a74ff222358 100644 --- a/api_docs/kbn_core_capabilities_common.mdx +++ b/api_docs/kbn_core_capabilities_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-capabilities-common title: "@kbn/core-capabilities-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-capabilities-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-capabilities-common'] --- import kbnCoreCapabilitiesCommonObj from './kbn_core_capabilities_common.devdocs.json'; diff --git a/api_docs/kbn_core_capabilities_server.mdx b/api_docs/kbn_core_capabilities_server.mdx index 6bc78dd460068..24707882c708b 100644 --- a/api_docs/kbn_core_capabilities_server.mdx +++ b/api_docs/kbn_core_capabilities_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-capabilities-server title: "@kbn/core-capabilities-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-capabilities-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-capabilities-server'] --- import kbnCoreCapabilitiesServerObj from './kbn_core_capabilities_server.devdocs.json'; diff --git a/api_docs/kbn_core_capabilities_server_mocks.mdx b/api_docs/kbn_core_capabilities_server_mocks.mdx index 2dcd5bd11e664..c7dd4f86977b1 100644 --- a/api_docs/kbn_core_capabilities_server_mocks.mdx +++ b/api_docs/kbn_core_capabilities_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-capabilities-server-mocks title: "@kbn/core-capabilities-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-capabilities-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-capabilities-server-mocks'] --- import kbnCoreCapabilitiesServerMocksObj from './kbn_core_capabilities_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_chrome_browser.devdocs.json b/api_docs/kbn_core_chrome_browser.devdocs.json index 02cbd5ada6d72..acc96d2631c68 100644 --- a/api_docs/kbn_core_chrome_browser.devdocs.json +++ b/api_docs/kbn_core_chrome_browser.devdocs.json @@ -3765,7 +3765,7 @@ "label": "AppDeepLinkId", "description": [], "signature": [ - "\"fleet\" | \"graph\" | \"ml\" | \"monitoring\" | \"profiling\" | \"metrics\" | \"management\" | \"apm\" | \"synthetics\" | \"ux\" | \"canvas\" | \"logs\" | \"dashboards\" | \"slo\" | \"observabilityAIAssistant\" | \"home\" | \"integrations\" | \"discover\" | \"observability-overview\" | \"appSearch\" | \"dev_tools\" | \"maps\" | \"visualize\" | \"dev_tools:console\" | \"dev_tools:searchprofiler\" | \"dev_tools:painless_lab\" | \"dev_tools:grokdebugger\" | \"ml:notifications\" | \"ml:nodes\" | \"ml:overview\" | \"ml:memoryUsage\" | \"ml:settings\" | \"ml:dataVisualizer\" | \"ml:logPatternAnalysis\" | \"ml:logRateAnalysis\" | \"ml:singleMetricViewer\" | \"ml:anomalyDetection\" | \"ml:anomalyExplorer\" | \"ml:dataDrift\" | \"ml:dataFrameAnalytics\" | \"ml:resultExplorer\" | \"ml:analyticsMap\" | \"ml:aiOps\" | \"ml:changePointDetections\" | \"ml:modelManagement\" | \"ml:nodesOverview\" | \"ml:esqlDataVisualizer\" | \"ml:fileUpload\" | \"ml:indexDataVisualizer\" | \"ml:calendarSettings\" | \"ml:filterListsSettings\" | \"ml:suppliedConfigurations\" | \"osquery\" | \"management:transform\" | \"management:watcher\" | \"management:cases\" | \"management:tags\" | \"management:maintenanceWindows\" | \"management:cross_cluster_replication\" | \"management:dataViews\" | \"management:spaces\" | \"management:settings\" | \"management:users\" | \"management:migrate_data\" | \"management:search_sessions\" | \"management:data_quality\" | \"management:filesManagement\" | \"management:roles\" | \"management:reporting\" | \"management:aiAssistantManagementSelection\" | \"management:securityAiAssistantManagement\" | \"management:observabilityAiAssistantManagement\" | \"management:api_keys\" | \"management:license_management\" | \"management:index_lifecycle_management\" | \"management:index_management\" | \"management:ingest_pipelines\" | \"management:jobsListLink\" | \"management:objects\" | \"management:pipelines\" | \"management:remote_clusters\" | \"management:role_mappings\" | \"management:rollup_jobs\" | \"management:snapshot_restore\" | \"management:triggersActions\" | \"management:triggersActionsConnectors\" | \"management:upgrade_assistant\" | \"enterpriseSearch\" | \"enterpriseSearchContent\" | \"enterpriseSearchApplications\" | \"searchInferenceEndpoints\" | \"enterpriseSearchAnalytics\" | \"workplaceSearch\" | \"serverlessElasticsearch\" | \"serverlessConnectors\" | \"serverlessWebCrawlers\" | \"searchPlayground\" | \"searchHomepage\" | \"enterpriseSearchContent:connectors\" | \"enterpriseSearchContent:searchIndices\" | \"enterpriseSearchContent:webCrawlers\" | \"enterpriseSearchApplications:searchApplications\" | \"enterpriseSearchApplications:playground\" | \"appSearch:engines\" | \"searchInferenceEndpoints:inferenceEndpoints\" | \"elasticsearchStart\" | \"elasticsearchIndices\" | \"enterpriseSearchElasticsearch\" | \"enterpriseSearchVectorSearch\" | \"enterpriseSearchSemanticSearch\" | \"enterpriseSearchAISearch\" | \"elasticsearchIndices:createIndex\" | \"observability-logs-explorer\" | \"last-used-logs-viewer\" | \"observabilityOnboarding\" | \"inventory\" | \"logs:settings\" | \"logs:stream\" | \"logs:log-categories\" | \"logs:anomalies\" | \"observability-overview:cases\" | \"observability-overview:alerts\" | \"observability-overview:rules\" | \"observability-overview:cases_create\" | \"observability-overview:cases_configure\" | \"metrics:settings\" | \"metrics:hosts\" | \"metrics:inventory\" | \"metrics:metrics-explorer\" | \"metrics:assetDetails\" | \"apm:services\" | \"apm:traces\" | \"apm:dependencies\" | \"apm:service-map\" | \"apm:settings\" | \"apm:service-groups-list\" | \"apm:storage-explorer\" | \"synthetics:overview\" | \"synthetics:certificates\" | \"profiling:functions\" | \"profiling:stacktraces\" | \"profiling:flamegraphs\" | \"inventory:datastreams\" | \"securitySolutionUI\" | \"securitySolutionUI:\" | \"securitySolutionUI:cases\" | \"securitySolutionUI:alerts\" | \"securitySolutionUI:rules\" | \"securitySolutionUI:policy\" | \"securitySolutionUI:overview\" | \"securitySolutionUI:dashboards\" | \"securitySolutionUI:kubernetes\" | \"securitySolutionUI:cases_create\" | \"securitySolutionUI:cases_configure\" | \"securitySolutionUI:hosts\" | \"securitySolutionUI:users\" | \"securitySolutionUI:cloud_defend-policies\" | \"securitySolutionUI:cloud_security_posture-dashboard\" | \"securitySolutionUI:cloud_security_posture-findings\" | \"securitySolutionUI:cloud_security_posture-benchmarks\" | \"securitySolutionUI:network\" | \"securitySolutionUI:data_quality\" | \"securitySolutionUI:explore\" | \"securitySolutionUI:assets\" | \"securitySolutionUI:cloud_defend\" | \"securitySolutionUI:notes\" | \"securitySolutionUI:administration\" | \"securitySolutionUI:attack_discovery\" | \"securitySolutionUI:blocklist\" | \"securitySolutionUI:cloud_security_posture-rules\" | \"securitySolutionUI:detections\" | \"securitySolutionUI:detection_response\" | \"securitySolutionUI:endpoints\" | \"securitySolutionUI:event_filters\" | \"securitySolutionUI:exceptions\" | \"securitySolutionUI:host_isolation_exceptions\" | \"securitySolutionUI:hosts-all\" | \"securitySolutionUI:hosts-anomalies\" | \"securitySolutionUI:hosts-risk\" | \"securitySolutionUI:hosts-events\" | \"securitySolutionUI:hosts-sessions\" | \"securitySolutionUI:hosts-uncommon_processes\" | \"securitySolutionUI:investigations\" | \"securitySolutionUI:get_started\" | \"securitySolutionUI:machine_learning-landing\" | \"securitySolutionUI:network-anomalies\" | \"securitySolutionUI:network-dns\" | \"securitySolutionUI:network-events\" | \"securitySolutionUI:network-flows\" | \"securitySolutionUI:network-http\" | \"securitySolutionUI:network-tls\" | \"securitySolutionUI:response_actions_history\" | \"securitySolutionUI:rules-add\" | \"securitySolutionUI:rules-create\" | \"securitySolutionUI:rules-landing\" | \"securitySolutionUI:siem_migrations-rules\" | \"securitySolutionUI:threat_intelligence\" | \"securitySolutionUI:timelines\" | \"securitySolutionUI:timelines-templates\" | \"securitySolutionUI:trusted_apps\" | \"securitySolutionUI:users-all\" | \"securitySolutionUI:users-anomalies\" | \"securitySolutionUI:users-authentications\" | \"securitySolutionUI:users-events\" | \"securitySolutionUI:users-risk\" | \"securitySolutionUI:entity_analytics\" | \"securitySolutionUI:entity_analytics-management\" | \"securitySolutionUI:entity_analytics-asset-classification\" | \"securitySolutionUI:entity_analytics-entity_store_management\" | \"securitySolutionUI:coverage-overview\" | \"fleet:settings\" | \"fleet:agents\" | \"fleet:policies\" | \"fleet:data_streams\" | \"fleet:enrollment_tokens\" | \"fleet:uninstall_tokens\"" + "\"fleet\" | \"graph\" | \"ml\" | \"monitoring\" | \"profiling\" | \"metrics\" | \"management\" | \"apm\" | \"synthetics\" | \"ux\" | \"canvas\" | \"logs\" | \"dashboards\" | \"slo\" | \"observabilityAIAssistant\" | \"home\" | \"integrations\" | \"discover\" | \"observability-overview\" | \"streams\" | \"appSearch\" | \"dev_tools\" | \"maps\" | \"visualize\" | \"dev_tools:console\" | \"dev_tools:searchprofiler\" | \"dev_tools:painless_lab\" | \"dev_tools:grokdebugger\" | \"ml:notifications\" | \"ml:nodes\" | \"ml:overview\" | \"ml:memoryUsage\" | \"ml:settings\" | \"ml:dataVisualizer\" | \"ml:logPatternAnalysis\" | \"ml:logRateAnalysis\" | \"ml:singleMetricViewer\" | \"ml:anomalyDetection\" | \"ml:anomalyExplorer\" | \"ml:dataDrift\" | \"ml:dataFrameAnalytics\" | \"ml:resultExplorer\" | \"ml:analyticsMap\" | \"ml:aiOps\" | \"ml:changePointDetections\" | \"ml:modelManagement\" | \"ml:nodesOverview\" | \"ml:esqlDataVisualizer\" | \"ml:fileUpload\" | \"ml:indexDataVisualizer\" | \"ml:calendarSettings\" | \"ml:filterListsSettings\" | \"ml:suppliedConfigurations\" | \"osquery\" | \"management:transform\" | \"management:watcher\" | \"management:cases\" | \"management:tags\" | \"management:maintenanceWindows\" | \"management:cross_cluster_replication\" | \"management:dataViews\" | \"management:spaces\" | \"management:settings\" | \"management:users\" | \"management:migrate_data\" | \"management:search_sessions\" | \"management:data_quality\" | \"management:filesManagement\" | \"management:roles\" | \"management:reporting\" | \"management:aiAssistantManagementSelection\" | \"management:securityAiAssistantManagement\" | \"management:observabilityAiAssistantManagement\" | \"management:api_keys\" | \"management:license_management\" | \"management:index_lifecycle_management\" | \"management:index_management\" | \"management:ingest_pipelines\" | \"management:jobsListLink\" | \"management:objects\" | \"management:pipelines\" | \"management:remote_clusters\" | \"management:role_mappings\" | \"management:rollup_jobs\" | \"management:snapshot_restore\" | \"management:triggersActions\" | \"management:triggersActionsConnectors\" | \"management:upgrade_assistant\" | \"enterpriseSearch\" | \"enterpriseSearchContent\" | \"enterpriseSearchApplications\" | \"searchInferenceEndpoints\" | \"enterpriseSearchAnalytics\" | \"workplaceSearch\" | \"serverlessElasticsearch\" | \"serverlessConnectors\" | \"serverlessWebCrawlers\" | \"searchPlayground\" | \"searchHomepage\" | \"enterpriseSearchContent:connectors\" | \"enterpriseSearchContent:searchIndices\" | \"enterpriseSearchContent:webCrawlers\" | \"enterpriseSearchApplications:searchApplications\" | \"enterpriseSearchApplications:playground\" | \"appSearch:engines\" | \"searchInferenceEndpoints:inferenceEndpoints\" | \"elasticsearchStart\" | \"elasticsearchIndices\" | \"enterpriseSearchElasticsearch\" | \"enterpriseSearchVectorSearch\" | \"enterpriseSearchSemanticSearch\" | \"enterpriseSearchAISearch\" | \"elasticsearchIndices:createIndex\" | \"observability-logs-explorer\" | \"last-used-logs-viewer\" | \"observabilityOnboarding\" | \"inventory\" | \"logs:settings\" | \"logs:stream\" | \"logs:log-categories\" | \"logs:anomalies\" | \"observability-overview:cases\" | \"observability-overview:alerts\" | \"observability-overview:rules\" | \"observability-overview:cases_create\" | \"observability-overview:cases_configure\" | \"metrics:settings\" | \"metrics:hosts\" | \"metrics:inventory\" | \"metrics:metrics-explorer\" | \"metrics:assetDetails\" | \"apm:services\" | \"apm:traces\" | \"apm:dependencies\" | \"apm:service-map\" | \"apm:settings\" | \"apm:service-groups-list\" | \"apm:storage-explorer\" | \"synthetics:overview\" | \"synthetics:certificates\" | \"profiling:functions\" | \"profiling:stacktraces\" | \"profiling:flamegraphs\" | \"inventory:datastreams\" | \"streams:overview\" | \"securitySolutionUI\" | \"securitySolutionUI:\" | \"securitySolutionUI:cases\" | \"securitySolutionUI:alerts\" | \"securitySolutionUI:rules\" | \"securitySolutionUI:policy\" | \"securitySolutionUI:overview\" | \"securitySolutionUI:dashboards\" | \"securitySolutionUI:kubernetes\" | \"securitySolutionUI:cases_create\" | \"securitySolutionUI:cases_configure\" | \"securitySolutionUI:hosts\" | \"securitySolutionUI:users\" | \"securitySolutionUI:cloud_defend-policies\" | \"securitySolutionUI:cloud_security_posture-dashboard\" | \"securitySolutionUI:cloud_security_posture-findings\" | \"securitySolutionUI:cloud_security_posture-benchmarks\" | \"securitySolutionUI:network\" | \"securitySolutionUI:data_quality\" | \"securitySolutionUI:explore\" | \"securitySolutionUI:assets\" | \"securitySolutionUI:cloud_defend\" | \"securitySolutionUI:notes\" | \"securitySolutionUI:administration\" | \"securitySolutionUI:attack_discovery\" | \"securitySolutionUI:blocklist\" | \"securitySolutionUI:cloud_security_posture-rules\" | \"securitySolutionUI:detections\" | \"securitySolutionUI:detection_response\" | \"securitySolutionUI:endpoints\" | \"securitySolutionUI:event_filters\" | \"securitySolutionUI:exceptions\" | \"securitySolutionUI:host_isolation_exceptions\" | \"securitySolutionUI:hosts-all\" | \"securitySolutionUI:hosts-anomalies\" | \"securitySolutionUI:hosts-risk\" | \"securitySolutionUI:hosts-events\" | \"securitySolutionUI:hosts-sessions\" | \"securitySolutionUI:hosts-uncommon_processes\" | \"securitySolutionUI:investigations\" | \"securitySolutionUI:get_started\" | \"securitySolutionUI:machine_learning-landing\" | \"securitySolutionUI:network-anomalies\" | \"securitySolutionUI:network-dns\" | \"securitySolutionUI:network-events\" | \"securitySolutionUI:network-flows\" | \"securitySolutionUI:network-http\" | \"securitySolutionUI:network-tls\" | \"securitySolutionUI:response_actions_history\" | \"securitySolutionUI:rules-add\" | \"securitySolutionUI:rules-create\" | \"securitySolutionUI:rules-landing\" | \"securitySolutionUI:siem_migrations-rules\" | \"securitySolutionUI:threat_intelligence\" | \"securitySolutionUI:timelines\" | \"securitySolutionUI:timelines-templates\" | \"securitySolutionUI:trusted_apps\" | \"securitySolutionUI:users-all\" | \"securitySolutionUI:users-anomalies\" | \"securitySolutionUI:users-authentications\" | \"securitySolutionUI:users-events\" | \"securitySolutionUI:users-risk\" | \"securitySolutionUI:entity_analytics\" | \"securitySolutionUI:entity_analytics-management\" | \"securitySolutionUI:entity_analytics-asset-classification\" | \"securitySolutionUI:entity_analytics-entity_store_management\" | \"securitySolutionUI:coverage-overview\" | \"fleet:settings\" | \"fleet:agents\" | \"fleet:policies\" | \"fleet:data_streams\" | \"fleet:enrollment_tokens\" | \"fleet:uninstall_tokens\"" ], "path": "packages/core/chrome/core-chrome-browser/src/project_navigation.ts", "deprecated": false, diff --git a/api_docs/kbn_core_chrome_browser.mdx b/api_docs/kbn_core_chrome_browser.mdx index 81746f238a9b4..fa7a8a730abda 100644 --- a/api_docs/kbn_core_chrome_browser.mdx +++ b/api_docs/kbn_core_chrome_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-chrome-browser title: "@kbn/core-chrome-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-chrome-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-chrome-browser'] --- import kbnCoreChromeBrowserObj from './kbn_core_chrome_browser.devdocs.json'; diff --git a/api_docs/kbn_core_chrome_browser_mocks.mdx b/api_docs/kbn_core_chrome_browser_mocks.mdx index c909b37fe1d47..bb08e7f0eda10 100644 --- a/api_docs/kbn_core_chrome_browser_mocks.mdx +++ b/api_docs/kbn_core_chrome_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-chrome-browser-mocks title: "@kbn/core-chrome-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-chrome-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-chrome-browser-mocks'] --- import kbnCoreChromeBrowserMocksObj from './kbn_core_chrome_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_config_server_internal.mdx b/api_docs/kbn_core_config_server_internal.mdx index 379fbc08cf12a..32b03b52c9bbe 100644 --- a/api_docs/kbn_core_config_server_internal.mdx +++ b/api_docs/kbn_core_config_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-config-server-internal title: "@kbn/core-config-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-config-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-config-server-internal'] --- import kbnCoreConfigServerInternalObj from './kbn_core_config_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_custom_branding_browser.mdx b/api_docs/kbn_core_custom_branding_browser.mdx index 0bc7e847e342f..3e3b48ddedc08 100644 --- a/api_docs/kbn_core_custom_branding_browser.mdx +++ b/api_docs/kbn_core_custom_branding_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-custom-branding-browser title: "@kbn/core-custom-branding-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-custom-branding-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-custom-branding-browser'] --- import kbnCoreCustomBrandingBrowserObj from './kbn_core_custom_branding_browser.devdocs.json'; diff --git a/api_docs/kbn_core_custom_branding_browser_internal.mdx b/api_docs/kbn_core_custom_branding_browser_internal.mdx index bf0e832e9d981..24be7286254c0 100644 --- a/api_docs/kbn_core_custom_branding_browser_internal.mdx +++ b/api_docs/kbn_core_custom_branding_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-custom-branding-browser-internal title: "@kbn/core-custom-branding-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-custom-branding-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-custom-branding-browser-internal'] --- import kbnCoreCustomBrandingBrowserInternalObj from './kbn_core_custom_branding_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_custom_branding_browser_mocks.mdx b/api_docs/kbn_core_custom_branding_browser_mocks.mdx index 6b9603bd7b1a0..111cac56cacc7 100644 --- a/api_docs/kbn_core_custom_branding_browser_mocks.mdx +++ b/api_docs/kbn_core_custom_branding_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-custom-branding-browser-mocks title: "@kbn/core-custom-branding-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-custom-branding-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-custom-branding-browser-mocks'] --- import kbnCoreCustomBrandingBrowserMocksObj from './kbn_core_custom_branding_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_custom_branding_common.mdx b/api_docs/kbn_core_custom_branding_common.mdx index 8f4b4575eebde..6dd2817d6374a 100644 --- a/api_docs/kbn_core_custom_branding_common.mdx +++ b/api_docs/kbn_core_custom_branding_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-custom-branding-common title: "@kbn/core-custom-branding-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-custom-branding-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-custom-branding-common'] --- import kbnCoreCustomBrandingCommonObj from './kbn_core_custom_branding_common.devdocs.json'; diff --git a/api_docs/kbn_core_custom_branding_server.mdx b/api_docs/kbn_core_custom_branding_server.mdx index 3b2316c3d9dc6..b715a4d982d52 100644 --- a/api_docs/kbn_core_custom_branding_server.mdx +++ b/api_docs/kbn_core_custom_branding_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-custom-branding-server title: "@kbn/core-custom-branding-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-custom-branding-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-custom-branding-server'] --- import kbnCoreCustomBrandingServerObj from './kbn_core_custom_branding_server.devdocs.json'; diff --git a/api_docs/kbn_core_custom_branding_server_internal.mdx b/api_docs/kbn_core_custom_branding_server_internal.mdx index 99e257d7ae304..3dda0b58ca347 100644 --- a/api_docs/kbn_core_custom_branding_server_internal.mdx +++ b/api_docs/kbn_core_custom_branding_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-custom-branding-server-internal title: "@kbn/core-custom-branding-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-custom-branding-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-custom-branding-server-internal'] --- import kbnCoreCustomBrandingServerInternalObj from './kbn_core_custom_branding_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_custom_branding_server_mocks.mdx b/api_docs/kbn_core_custom_branding_server_mocks.mdx index 5109539fcc836..c1e766b0727ee 100644 --- a/api_docs/kbn_core_custom_branding_server_mocks.mdx +++ b/api_docs/kbn_core_custom_branding_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-custom-branding-server-mocks title: "@kbn/core-custom-branding-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-custom-branding-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-custom-branding-server-mocks'] --- import kbnCoreCustomBrandingServerMocksObj from './kbn_core_custom_branding_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_browser.mdx b/api_docs/kbn_core_deprecations_browser.mdx index 3901e4a6b7578..e02b162eeca9e 100644 --- a/api_docs/kbn_core_deprecations_browser.mdx +++ b/api_docs/kbn_core_deprecations_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-browser title: "@kbn/core-deprecations-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-browser'] --- import kbnCoreDeprecationsBrowserObj from './kbn_core_deprecations_browser.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_browser_internal.mdx b/api_docs/kbn_core_deprecations_browser_internal.mdx index 419d1bc134ef2..f3c0c714f7e89 100644 --- a/api_docs/kbn_core_deprecations_browser_internal.mdx +++ b/api_docs/kbn_core_deprecations_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-browser-internal title: "@kbn/core-deprecations-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-browser-internal'] --- import kbnCoreDeprecationsBrowserInternalObj from './kbn_core_deprecations_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_browser_mocks.mdx b/api_docs/kbn_core_deprecations_browser_mocks.mdx index 53aeb50cd5839..a97b31689f76e 100644 --- a/api_docs/kbn_core_deprecations_browser_mocks.mdx +++ b/api_docs/kbn_core_deprecations_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-browser-mocks title: "@kbn/core-deprecations-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-browser-mocks'] --- import kbnCoreDeprecationsBrowserMocksObj from './kbn_core_deprecations_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_common.mdx b/api_docs/kbn_core_deprecations_common.mdx index e42da1a79de07..b81a1e4e62b02 100644 --- a/api_docs/kbn_core_deprecations_common.mdx +++ b/api_docs/kbn_core_deprecations_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-common title: "@kbn/core-deprecations-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-common'] --- import kbnCoreDeprecationsCommonObj from './kbn_core_deprecations_common.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_server.mdx b/api_docs/kbn_core_deprecations_server.mdx index 29a0905b7148e..611fbd7a8cb7c 100644 --- a/api_docs/kbn_core_deprecations_server.mdx +++ b/api_docs/kbn_core_deprecations_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-server title: "@kbn/core-deprecations-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-server'] --- import kbnCoreDeprecationsServerObj from './kbn_core_deprecations_server.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_server_internal.mdx b/api_docs/kbn_core_deprecations_server_internal.mdx index 4185b3635a754..b6f0f5d4fcf79 100644 --- a/api_docs/kbn_core_deprecations_server_internal.mdx +++ b/api_docs/kbn_core_deprecations_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-server-internal title: "@kbn/core-deprecations-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-server-internal'] --- import kbnCoreDeprecationsServerInternalObj from './kbn_core_deprecations_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_server_mocks.mdx b/api_docs/kbn_core_deprecations_server_mocks.mdx index a08c9ca02ec26..25e8f688c005f 100644 --- a/api_docs/kbn_core_deprecations_server_mocks.mdx +++ b/api_docs/kbn_core_deprecations_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-server-mocks title: "@kbn/core-deprecations-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-server-mocks'] --- import kbnCoreDeprecationsServerMocksObj from './kbn_core_deprecations_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_doc_links_browser.mdx b/api_docs/kbn_core_doc_links_browser.mdx index 15c5e5cfe920b..104ea341c319d 100644 --- a/api_docs/kbn_core_doc_links_browser.mdx +++ b/api_docs/kbn_core_doc_links_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-doc-links-browser title: "@kbn/core-doc-links-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-doc-links-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-doc-links-browser'] --- import kbnCoreDocLinksBrowserObj from './kbn_core_doc_links_browser.devdocs.json'; diff --git a/api_docs/kbn_core_doc_links_browser_mocks.mdx b/api_docs/kbn_core_doc_links_browser_mocks.mdx index 2d78ea33f4788..53b3b839bd218 100644 --- a/api_docs/kbn_core_doc_links_browser_mocks.mdx +++ b/api_docs/kbn_core_doc_links_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-doc-links-browser-mocks title: "@kbn/core-doc-links-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-doc-links-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-doc-links-browser-mocks'] --- import kbnCoreDocLinksBrowserMocksObj from './kbn_core_doc_links_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_doc_links_server.mdx b/api_docs/kbn_core_doc_links_server.mdx index 3d179756dff40..4966775844453 100644 --- a/api_docs/kbn_core_doc_links_server.mdx +++ b/api_docs/kbn_core_doc_links_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-doc-links-server title: "@kbn/core-doc-links-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-doc-links-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-doc-links-server'] --- import kbnCoreDocLinksServerObj from './kbn_core_doc_links_server.devdocs.json'; diff --git a/api_docs/kbn_core_doc_links_server_mocks.mdx b/api_docs/kbn_core_doc_links_server_mocks.mdx index bb74606983073..d5cef304bdfe5 100644 --- a/api_docs/kbn_core_doc_links_server_mocks.mdx +++ b/api_docs/kbn_core_doc_links_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-doc-links-server-mocks title: "@kbn/core-doc-links-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-doc-links-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-doc-links-server-mocks'] --- import kbnCoreDocLinksServerMocksObj from './kbn_core_doc_links_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_elasticsearch_client_server_internal.mdx b/api_docs/kbn_core_elasticsearch_client_server_internal.mdx index 9bc8f820f63b8..cbd6cb06bb6a3 100644 --- a/api_docs/kbn_core_elasticsearch_client_server_internal.mdx +++ b/api_docs/kbn_core_elasticsearch_client_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-elasticsearch-client-server-internal title: "@kbn/core-elasticsearch-client-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-elasticsearch-client-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-elasticsearch-client-server-internal'] --- import kbnCoreElasticsearchClientServerInternalObj from './kbn_core_elasticsearch_client_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_elasticsearch_client_server_mocks.mdx b/api_docs/kbn_core_elasticsearch_client_server_mocks.mdx index 30c14a39bd7e7..ee42aa49459ea 100644 --- a/api_docs/kbn_core_elasticsearch_client_server_mocks.mdx +++ b/api_docs/kbn_core_elasticsearch_client_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-elasticsearch-client-server-mocks title: "@kbn/core-elasticsearch-client-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-elasticsearch-client-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-elasticsearch-client-server-mocks'] --- import kbnCoreElasticsearchClientServerMocksObj from './kbn_core_elasticsearch_client_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_elasticsearch_server.mdx b/api_docs/kbn_core_elasticsearch_server.mdx index 3d7d404f559bc..3d6201efba210 100644 --- a/api_docs/kbn_core_elasticsearch_server.mdx +++ b/api_docs/kbn_core_elasticsearch_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-elasticsearch-server title: "@kbn/core-elasticsearch-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-elasticsearch-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-elasticsearch-server'] --- import kbnCoreElasticsearchServerObj from './kbn_core_elasticsearch_server.devdocs.json'; diff --git a/api_docs/kbn_core_elasticsearch_server_internal.mdx b/api_docs/kbn_core_elasticsearch_server_internal.mdx index 2b5713825912b..79f41d1118a0b 100644 --- a/api_docs/kbn_core_elasticsearch_server_internal.mdx +++ b/api_docs/kbn_core_elasticsearch_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-elasticsearch-server-internal title: "@kbn/core-elasticsearch-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-elasticsearch-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-elasticsearch-server-internal'] --- import kbnCoreElasticsearchServerInternalObj from './kbn_core_elasticsearch_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_elasticsearch_server_mocks.mdx b/api_docs/kbn_core_elasticsearch_server_mocks.mdx index f38af394b8770..7af806feed6b3 100644 --- a/api_docs/kbn_core_elasticsearch_server_mocks.mdx +++ b/api_docs/kbn_core_elasticsearch_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-elasticsearch-server-mocks title: "@kbn/core-elasticsearch-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-elasticsearch-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-elasticsearch-server-mocks'] --- import kbnCoreElasticsearchServerMocksObj from './kbn_core_elasticsearch_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_environment_server_internal.mdx b/api_docs/kbn_core_environment_server_internal.mdx index 7ad7f1a40d8d6..edc8af60646ca 100644 --- a/api_docs/kbn_core_environment_server_internal.mdx +++ b/api_docs/kbn_core_environment_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-environment-server-internal title: "@kbn/core-environment-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-environment-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-environment-server-internal'] --- import kbnCoreEnvironmentServerInternalObj from './kbn_core_environment_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_environment_server_mocks.mdx b/api_docs/kbn_core_environment_server_mocks.mdx index 9fbc81ac15739..7fd2356dbd868 100644 --- a/api_docs/kbn_core_environment_server_mocks.mdx +++ b/api_docs/kbn_core_environment_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-environment-server-mocks title: "@kbn/core-environment-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-environment-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-environment-server-mocks'] --- import kbnCoreEnvironmentServerMocksObj from './kbn_core_environment_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_browser.mdx b/api_docs/kbn_core_execution_context_browser.mdx index 46d33f7b4825d..9512ae2112ef9 100644 --- a/api_docs/kbn_core_execution_context_browser.mdx +++ b/api_docs/kbn_core_execution_context_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-browser title: "@kbn/core-execution-context-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-browser'] --- import kbnCoreExecutionContextBrowserObj from './kbn_core_execution_context_browser.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_browser_internal.mdx b/api_docs/kbn_core_execution_context_browser_internal.mdx index 6aa9f375d8f09..62d94a3457f87 100644 --- a/api_docs/kbn_core_execution_context_browser_internal.mdx +++ b/api_docs/kbn_core_execution_context_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-browser-internal title: "@kbn/core-execution-context-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-browser-internal'] --- import kbnCoreExecutionContextBrowserInternalObj from './kbn_core_execution_context_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_browser_mocks.mdx b/api_docs/kbn_core_execution_context_browser_mocks.mdx index cdea7effe7de4..54e8db8790974 100644 --- a/api_docs/kbn_core_execution_context_browser_mocks.mdx +++ b/api_docs/kbn_core_execution_context_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-browser-mocks title: "@kbn/core-execution-context-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-browser-mocks'] --- import kbnCoreExecutionContextBrowserMocksObj from './kbn_core_execution_context_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_common.mdx b/api_docs/kbn_core_execution_context_common.mdx index a1501ef397c8b..bcfe3d579e30d 100644 --- a/api_docs/kbn_core_execution_context_common.mdx +++ b/api_docs/kbn_core_execution_context_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-common title: "@kbn/core-execution-context-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-common'] --- import kbnCoreExecutionContextCommonObj from './kbn_core_execution_context_common.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_server.mdx b/api_docs/kbn_core_execution_context_server.mdx index 88dbae533aaa0..df26399174491 100644 --- a/api_docs/kbn_core_execution_context_server.mdx +++ b/api_docs/kbn_core_execution_context_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-server title: "@kbn/core-execution-context-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-server'] --- import kbnCoreExecutionContextServerObj from './kbn_core_execution_context_server.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_server_internal.mdx b/api_docs/kbn_core_execution_context_server_internal.mdx index 73e72761eb246..a76c0b3b7123d 100644 --- a/api_docs/kbn_core_execution_context_server_internal.mdx +++ b/api_docs/kbn_core_execution_context_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-server-internal title: "@kbn/core-execution-context-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-server-internal'] --- import kbnCoreExecutionContextServerInternalObj from './kbn_core_execution_context_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_server_mocks.mdx b/api_docs/kbn_core_execution_context_server_mocks.mdx index 3e56fc392e4b8..c0e457ff10f3a 100644 --- a/api_docs/kbn_core_execution_context_server_mocks.mdx +++ b/api_docs/kbn_core_execution_context_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-server-mocks title: "@kbn/core-execution-context-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-server-mocks'] --- import kbnCoreExecutionContextServerMocksObj from './kbn_core_execution_context_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_fatal_errors_browser.mdx b/api_docs/kbn_core_fatal_errors_browser.mdx index fafb9b6c6cf7f..411a43b275fe8 100644 --- a/api_docs/kbn_core_fatal_errors_browser.mdx +++ b/api_docs/kbn_core_fatal_errors_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-fatal-errors-browser title: "@kbn/core-fatal-errors-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-fatal-errors-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-fatal-errors-browser'] --- import kbnCoreFatalErrorsBrowserObj from './kbn_core_fatal_errors_browser.devdocs.json'; diff --git a/api_docs/kbn_core_fatal_errors_browser_mocks.mdx b/api_docs/kbn_core_fatal_errors_browser_mocks.mdx index b81d064ce2569..3384e5544bd4e 100644 --- a/api_docs/kbn_core_fatal_errors_browser_mocks.mdx +++ b/api_docs/kbn_core_fatal_errors_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-fatal-errors-browser-mocks title: "@kbn/core-fatal-errors-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-fatal-errors-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-fatal-errors-browser-mocks'] --- import kbnCoreFatalErrorsBrowserMocksObj from './kbn_core_fatal_errors_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_feature_flags_browser.mdx b/api_docs/kbn_core_feature_flags_browser.mdx index 9c03dcfca9c87..7ce942930de06 100644 --- a/api_docs/kbn_core_feature_flags_browser.mdx +++ b/api_docs/kbn_core_feature_flags_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-feature-flags-browser title: "@kbn/core-feature-flags-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-feature-flags-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-feature-flags-browser'] --- import kbnCoreFeatureFlagsBrowserObj from './kbn_core_feature_flags_browser.devdocs.json'; diff --git a/api_docs/kbn_core_feature_flags_browser_internal.mdx b/api_docs/kbn_core_feature_flags_browser_internal.mdx index 8e687c2b34353..76cb37d555581 100644 --- a/api_docs/kbn_core_feature_flags_browser_internal.mdx +++ b/api_docs/kbn_core_feature_flags_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-feature-flags-browser-internal title: "@kbn/core-feature-flags-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-feature-flags-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-feature-flags-browser-internal'] --- import kbnCoreFeatureFlagsBrowserInternalObj from './kbn_core_feature_flags_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_feature_flags_browser_mocks.mdx b/api_docs/kbn_core_feature_flags_browser_mocks.mdx index 1d5ed477d7dfd..2bc580208430e 100644 --- a/api_docs/kbn_core_feature_flags_browser_mocks.mdx +++ b/api_docs/kbn_core_feature_flags_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-feature-flags-browser-mocks title: "@kbn/core-feature-flags-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-feature-flags-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-feature-flags-browser-mocks'] --- import kbnCoreFeatureFlagsBrowserMocksObj from './kbn_core_feature_flags_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_feature_flags_server.mdx b/api_docs/kbn_core_feature_flags_server.mdx index b3807140c35e9..103fbf14a6fea 100644 --- a/api_docs/kbn_core_feature_flags_server.mdx +++ b/api_docs/kbn_core_feature_flags_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-feature-flags-server title: "@kbn/core-feature-flags-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-feature-flags-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-feature-flags-server'] --- import kbnCoreFeatureFlagsServerObj from './kbn_core_feature_flags_server.devdocs.json'; diff --git a/api_docs/kbn_core_feature_flags_server_internal.mdx b/api_docs/kbn_core_feature_flags_server_internal.mdx index 5da2fdfb40ec6..143f2d75eda6d 100644 --- a/api_docs/kbn_core_feature_flags_server_internal.mdx +++ b/api_docs/kbn_core_feature_flags_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-feature-flags-server-internal title: "@kbn/core-feature-flags-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-feature-flags-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-feature-flags-server-internal'] --- import kbnCoreFeatureFlagsServerInternalObj from './kbn_core_feature_flags_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_feature_flags_server_mocks.mdx b/api_docs/kbn_core_feature_flags_server_mocks.mdx index 7138bacb03e46..592be7bdddec3 100644 --- a/api_docs/kbn_core_feature_flags_server_mocks.mdx +++ b/api_docs/kbn_core_feature_flags_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-feature-flags-server-mocks title: "@kbn/core-feature-flags-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-feature-flags-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-feature-flags-server-mocks'] --- import kbnCoreFeatureFlagsServerMocksObj from './kbn_core_feature_flags_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_http_browser.mdx b/api_docs/kbn_core_http_browser.mdx index 9a05e85d07556..7efd3ed4eac80 100644 --- a/api_docs/kbn_core_http_browser.mdx +++ b/api_docs/kbn_core_http_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-browser title: "@kbn/core-http-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-browser'] --- import kbnCoreHttpBrowserObj from './kbn_core_http_browser.devdocs.json'; diff --git a/api_docs/kbn_core_http_browser_internal.mdx b/api_docs/kbn_core_http_browser_internal.mdx index d5362f053f0c3..1900eca1e512d 100644 --- a/api_docs/kbn_core_http_browser_internal.mdx +++ b/api_docs/kbn_core_http_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-browser-internal title: "@kbn/core-http-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-browser-internal'] --- import kbnCoreHttpBrowserInternalObj from './kbn_core_http_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_http_browser_mocks.mdx b/api_docs/kbn_core_http_browser_mocks.mdx index e5e8895b1346c..62f92f93e281a 100644 --- a/api_docs/kbn_core_http_browser_mocks.mdx +++ b/api_docs/kbn_core_http_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-browser-mocks title: "@kbn/core-http-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-browser-mocks'] --- import kbnCoreHttpBrowserMocksObj from './kbn_core_http_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_http_common.mdx b/api_docs/kbn_core_http_common.mdx index 5067962e7c12a..bdd589093c404 100644 --- a/api_docs/kbn_core_http_common.mdx +++ b/api_docs/kbn_core_http_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-common title: "@kbn/core-http-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-common'] --- import kbnCoreHttpCommonObj from './kbn_core_http_common.devdocs.json'; diff --git a/api_docs/kbn_core_http_context_server_mocks.mdx b/api_docs/kbn_core_http_context_server_mocks.mdx index b55b0e02d7a9a..3c72d4e264185 100644 --- a/api_docs/kbn_core_http_context_server_mocks.mdx +++ b/api_docs/kbn_core_http_context_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-context-server-mocks title: "@kbn/core-http-context-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-context-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-context-server-mocks'] --- import kbnCoreHttpContextServerMocksObj from './kbn_core_http_context_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_http_request_handler_context_server.mdx b/api_docs/kbn_core_http_request_handler_context_server.mdx index 7c833328b4a20..5abd44d15588a 100644 --- a/api_docs/kbn_core_http_request_handler_context_server.mdx +++ b/api_docs/kbn_core_http_request_handler_context_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-request-handler-context-server title: "@kbn/core-http-request-handler-context-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-request-handler-context-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-request-handler-context-server'] --- import kbnCoreHttpRequestHandlerContextServerObj from './kbn_core_http_request_handler_context_server.devdocs.json'; diff --git a/api_docs/kbn_core_http_resources_server.mdx b/api_docs/kbn_core_http_resources_server.mdx index 996553aab6657..346632ac28f25 100644 --- a/api_docs/kbn_core_http_resources_server.mdx +++ b/api_docs/kbn_core_http_resources_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-resources-server title: "@kbn/core-http-resources-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-resources-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-resources-server'] --- import kbnCoreHttpResourcesServerObj from './kbn_core_http_resources_server.devdocs.json'; diff --git a/api_docs/kbn_core_http_resources_server_internal.mdx b/api_docs/kbn_core_http_resources_server_internal.mdx index 2b988892d724e..d0e27729be146 100644 --- a/api_docs/kbn_core_http_resources_server_internal.mdx +++ b/api_docs/kbn_core_http_resources_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-resources-server-internal title: "@kbn/core-http-resources-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-resources-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-resources-server-internal'] --- import kbnCoreHttpResourcesServerInternalObj from './kbn_core_http_resources_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_http_resources_server_mocks.mdx b/api_docs/kbn_core_http_resources_server_mocks.mdx index 500094e0e8369..77008db007bff 100644 --- a/api_docs/kbn_core_http_resources_server_mocks.mdx +++ b/api_docs/kbn_core_http_resources_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-resources-server-mocks title: "@kbn/core-http-resources-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-resources-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-resources-server-mocks'] --- import kbnCoreHttpResourcesServerMocksObj from './kbn_core_http_resources_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_http_router_server_internal.mdx b/api_docs/kbn_core_http_router_server_internal.mdx index 43676ee8ac2af..5c60a6ba6a416 100644 --- a/api_docs/kbn_core_http_router_server_internal.mdx +++ b/api_docs/kbn_core_http_router_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-router-server-internal title: "@kbn/core-http-router-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-router-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-router-server-internal'] --- import kbnCoreHttpRouterServerInternalObj from './kbn_core_http_router_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_http_router_server_mocks.mdx b/api_docs/kbn_core_http_router_server_mocks.mdx index 70ffa03a65abf..8ca9a349bea6f 100644 --- a/api_docs/kbn_core_http_router_server_mocks.mdx +++ b/api_docs/kbn_core_http_router_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-router-server-mocks title: "@kbn/core-http-router-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-router-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-router-server-mocks'] --- import kbnCoreHttpRouterServerMocksObj from './kbn_core_http_router_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_http_server.devdocs.json b/api_docs/kbn_core_http_server.devdocs.json index 0ecd8db23a069..9516368c46188 100644 --- a/api_docs/kbn_core_http_server.devdocs.json +++ b/api_docs/kbn_core_http_server.devdocs.json @@ -20759,7 +20759,7 @@ "\nThe set of supported parseable Content-Types" ], "signature": [ - "\"application/json\" | \"multipart/form-data\" | \"application/*+json\" | \"application/octet-stream\" | \"application/x-www-form-urlencoded\" | \"text/*\"" + "\"application/json\" | \"application/*+json\" | \"application/octet-stream\" | \"application/x-www-form-urlencoded\" | \"multipart/form-data\" | \"text/*\"" ], "path": "packages/core/http/core-http-server/src/router/route.ts", "deprecated": false, diff --git a/api_docs/kbn_core_http_server.mdx b/api_docs/kbn_core_http_server.mdx index d46a56796616b..8a562a43d39fb 100644 --- a/api_docs/kbn_core_http_server.mdx +++ b/api_docs/kbn_core_http_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-server title: "@kbn/core-http-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-server'] --- import kbnCoreHttpServerObj from './kbn_core_http_server.devdocs.json'; diff --git a/api_docs/kbn_core_http_server_internal.mdx b/api_docs/kbn_core_http_server_internal.mdx index 9bdd1797435f0..f6ce2b23f50d0 100644 --- a/api_docs/kbn_core_http_server_internal.mdx +++ b/api_docs/kbn_core_http_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-server-internal title: "@kbn/core-http-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-server-internal'] --- import kbnCoreHttpServerInternalObj from './kbn_core_http_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_http_server_mocks.mdx b/api_docs/kbn_core_http_server_mocks.mdx index 4ca98f4580896..ec4a5314bb22c 100644 --- a/api_docs/kbn_core_http_server_mocks.mdx +++ b/api_docs/kbn_core_http_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-server-mocks title: "@kbn/core-http-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-server-mocks'] --- import kbnCoreHttpServerMocksObj from './kbn_core_http_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_http_server_utils.mdx b/api_docs/kbn_core_http_server_utils.mdx index e0f0f54ca492b..4977a0fc367a7 100644 --- a/api_docs/kbn_core_http_server_utils.mdx +++ b/api_docs/kbn_core_http_server_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-server-utils title: "@kbn/core-http-server-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-server-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-server-utils'] --- import kbnCoreHttpServerUtilsObj from './kbn_core_http_server_utils.devdocs.json'; diff --git a/api_docs/kbn_core_i18n_browser.mdx b/api_docs/kbn_core_i18n_browser.mdx index f0fd12ef06a81..480691d703715 100644 --- a/api_docs/kbn_core_i18n_browser.mdx +++ b/api_docs/kbn_core_i18n_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-i18n-browser title: "@kbn/core-i18n-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-i18n-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-i18n-browser'] --- import kbnCoreI18nBrowserObj from './kbn_core_i18n_browser.devdocs.json'; diff --git a/api_docs/kbn_core_i18n_browser_mocks.mdx b/api_docs/kbn_core_i18n_browser_mocks.mdx index 6b6b20249a238..21782eb5714fa 100644 --- a/api_docs/kbn_core_i18n_browser_mocks.mdx +++ b/api_docs/kbn_core_i18n_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-i18n-browser-mocks title: "@kbn/core-i18n-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-i18n-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-i18n-browser-mocks'] --- import kbnCoreI18nBrowserMocksObj from './kbn_core_i18n_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_i18n_server.mdx b/api_docs/kbn_core_i18n_server.mdx index 267df60b2f9b7..d4e3eaec74789 100644 --- a/api_docs/kbn_core_i18n_server.mdx +++ b/api_docs/kbn_core_i18n_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-i18n-server title: "@kbn/core-i18n-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-i18n-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-i18n-server'] --- import kbnCoreI18nServerObj from './kbn_core_i18n_server.devdocs.json'; diff --git a/api_docs/kbn_core_i18n_server_internal.mdx b/api_docs/kbn_core_i18n_server_internal.mdx index 0bc18ad909946..c9b9678768e34 100644 --- a/api_docs/kbn_core_i18n_server_internal.mdx +++ b/api_docs/kbn_core_i18n_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-i18n-server-internal title: "@kbn/core-i18n-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-i18n-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-i18n-server-internal'] --- import kbnCoreI18nServerInternalObj from './kbn_core_i18n_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_i18n_server_mocks.mdx b/api_docs/kbn_core_i18n_server_mocks.mdx index bebe90526533e..39223f647df62 100644 --- a/api_docs/kbn_core_i18n_server_mocks.mdx +++ b/api_docs/kbn_core_i18n_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-i18n-server-mocks title: "@kbn/core-i18n-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-i18n-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-i18n-server-mocks'] --- import kbnCoreI18nServerMocksObj from './kbn_core_i18n_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_injected_metadata_browser_mocks.mdx b/api_docs/kbn_core_injected_metadata_browser_mocks.mdx index f6a8066a92aa4..8fd89cfd2324a 100644 --- a/api_docs/kbn_core_injected_metadata_browser_mocks.mdx +++ b/api_docs/kbn_core_injected_metadata_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-injected-metadata-browser-mocks title: "@kbn/core-injected-metadata-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-injected-metadata-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-injected-metadata-browser-mocks'] --- import kbnCoreInjectedMetadataBrowserMocksObj from './kbn_core_injected_metadata_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_integrations_browser_internal.mdx b/api_docs/kbn_core_integrations_browser_internal.mdx index 8e482025afdd4..bca0835f19cc7 100644 --- a/api_docs/kbn_core_integrations_browser_internal.mdx +++ b/api_docs/kbn_core_integrations_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-integrations-browser-internal title: "@kbn/core-integrations-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-integrations-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-integrations-browser-internal'] --- import kbnCoreIntegrationsBrowserInternalObj from './kbn_core_integrations_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_integrations_browser_mocks.mdx b/api_docs/kbn_core_integrations_browser_mocks.mdx index c23da05d126f6..5969ee376fe37 100644 --- a/api_docs/kbn_core_integrations_browser_mocks.mdx +++ b/api_docs/kbn_core_integrations_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-integrations-browser-mocks title: "@kbn/core-integrations-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-integrations-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-integrations-browser-mocks'] --- import kbnCoreIntegrationsBrowserMocksObj from './kbn_core_integrations_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_lifecycle_browser.mdx b/api_docs/kbn_core_lifecycle_browser.mdx index 0c04d22061efa..5ddd5cb62d26e 100644 --- a/api_docs/kbn_core_lifecycle_browser.mdx +++ b/api_docs/kbn_core_lifecycle_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-lifecycle-browser title: "@kbn/core-lifecycle-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-lifecycle-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-lifecycle-browser'] --- import kbnCoreLifecycleBrowserObj from './kbn_core_lifecycle_browser.devdocs.json'; diff --git a/api_docs/kbn_core_lifecycle_browser_mocks.mdx b/api_docs/kbn_core_lifecycle_browser_mocks.mdx index 7d83d94d2762a..2ec7058015137 100644 --- a/api_docs/kbn_core_lifecycle_browser_mocks.mdx +++ b/api_docs/kbn_core_lifecycle_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-lifecycle-browser-mocks title: "@kbn/core-lifecycle-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-lifecycle-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-lifecycle-browser-mocks'] --- import kbnCoreLifecycleBrowserMocksObj from './kbn_core_lifecycle_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_lifecycle_server.mdx b/api_docs/kbn_core_lifecycle_server.mdx index 1bcd9fe63f72e..f116b7bc79905 100644 --- a/api_docs/kbn_core_lifecycle_server.mdx +++ b/api_docs/kbn_core_lifecycle_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-lifecycle-server title: "@kbn/core-lifecycle-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-lifecycle-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-lifecycle-server'] --- import kbnCoreLifecycleServerObj from './kbn_core_lifecycle_server.devdocs.json'; diff --git a/api_docs/kbn_core_lifecycle_server_mocks.mdx b/api_docs/kbn_core_lifecycle_server_mocks.mdx index 35ee055e7788f..35c5cca2f2afc 100644 --- a/api_docs/kbn_core_lifecycle_server_mocks.mdx +++ b/api_docs/kbn_core_lifecycle_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-lifecycle-server-mocks title: "@kbn/core-lifecycle-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-lifecycle-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-lifecycle-server-mocks'] --- import kbnCoreLifecycleServerMocksObj from './kbn_core_lifecycle_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_logging_browser_mocks.mdx b/api_docs/kbn_core_logging_browser_mocks.mdx index 98ee9576d2ea3..2840db365ccb1 100644 --- a/api_docs/kbn_core_logging_browser_mocks.mdx +++ b/api_docs/kbn_core_logging_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-logging-browser-mocks title: "@kbn/core-logging-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-logging-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-logging-browser-mocks'] --- import kbnCoreLoggingBrowserMocksObj from './kbn_core_logging_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_logging_common_internal.mdx b/api_docs/kbn_core_logging_common_internal.mdx index a5a96287e39b1..3db0ca776e6ee 100644 --- a/api_docs/kbn_core_logging_common_internal.mdx +++ b/api_docs/kbn_core_logging_common_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-logging-common-internal title: "@kbn/core-logging-common-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-logging-common-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-logging-common-internal'] --- import kbnCoreLoggingCommonInternalObj from './kbn_core_logging_common_internal.devdocs.json'; diff --git a/api_docs/kbn_core_logging_server.mdx b/api_docs/kbn_core_logging_server.mdx index 53cd624e9d14c..221e308ce39fd 100644 --- a/api_docs/kbn_core_logging_server.mdx +++ b/api_docs/kbn_core_logging_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-logging-server title: "@kbn/core-logging-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-logging-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-logging-server'] --- import kbnCoreLoggingServerObj from './kbn_core_logging_server.devdocs.json'; diff --git a/api_docs/kbn_core_logging_server_internal.mdx b/api_docs/kbn_core_logging_server_internal.mdx index 2c64757c53277..5c1c51cbe9faf 100644 --- a/api_docs/kbn_core_logging_server_internal.mdx +++ b/api_docs/kbn_core_logging_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-logging-server-internal title: "@kbn/core-logging-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-logging-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-logging-server-internal'] --- import kbnCoreLoggingServerInternalObj from './kbn_core_logging_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_logging_server_mocks.mdx b/api_docs/kbn_core_logging_server_mocks.mdx index 8460b99be513c..94701be651f7c 100644 --- a/api_docs/kbn_core_logging_server_mocks.mdx +++ b/api_docs/kbn_core_logging_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-logging-server-mocks title: "@kbn/core-logging-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-logging-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-logging-server-mocks'] --- import kbnCoreLoggingServerMocksObj from './kbn_core_logging_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_metrics_collectors_server_internal.mdx b/api_docs/kbn_core_metrics_collectors_server_internal.mdx index 0a1aea0baa837..2d03056387e61 100644 --- a/api_docs/kbn_core_metrics_collectors_server_internal.mdx +++ b/api_docs/kbn_core_metrics_collectors_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-metrics-collectors-server-internal title: "@kbn/core-metrics-collectors-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-metrics-collectors-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-metrics-collectors-server-internal'] --- import kbnCoreMetricsCollectorsServerInternalObj from './kbn_core_metrics_collectors_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_metrics_collectors_server_mocks.mdx b/api_docs/kbn_core_metrics_collectors_server_mocks.mdx index 8626e4a71cb60..6e65f11fece1b 100644 --- a/api_docs/kbn_core_metrics_collectors_server_mocks.mdx +++ b/api_docs/kbn_core_metrics_collectors_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-metrics-collectors-server-mocks title: "@kbn/core-metrics-collectors-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-metrics-collectors-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-metrics-collectors-server-mocks'] --- import kbnCoreMetricsCollectorsServerMocksObj from './kbn_core_metrics_collectors_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_metrics_server.mdx b/api_docs/kbn_core_metrics_server.mdx index 780a97c78c5c6..0602832c594aa 100644 --- a/api_docs/kbn_core_metrics_server.mdx +++ b/api_docs/kbn_core_metrics_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-metrics-server title: "@kbn/core-metrics-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-metrics-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-metrics-server'] --- import kbnCoreMetricsServerObj from './kbn_core_metrics_server.devdocs.json'; diff --git a/api_docs/kbn_core_metrics_server_internal.mdx b/api_docs/kbn_core_metrics_server_internal.mdx index 6aa547c744c9d..dc5b585178b32 100644 --- a/api_docs/kbn_core_metrics_server_internal.mdx +++ b/api_docs/kbn_core_metrics_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-metrics-server-internal title: "@kbn/core-metrics-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-metrics-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-metrics-server-internal'] --- import kbnCoreMetricsServerInternalObj from './kbn_core_metrics_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_metrics_server_mocks.mdx b/api_docs/kbn_core_metrics_server_mocks.mdx index 6ddbaf2d669ba..5f3b2f92cc841 100644 --- a/api_docs/kbn_core_metrics_server_mocks.mdx +++ b/api_docs/kbn_core_metrics_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-metrics-server-mocks title: "@kbn/core-metrics-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-metrics-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-metrics-server-mocks'] --- import kbnCoreMetricsServerMocksObj from './kbn_core_metrics_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_mount_utils_browser.mdx b/api_docs/kbn_core_mount_utils_browser.mdx index 2e03d58cec760..cf4d949c30c18 100644 --- a/api_docs/kbn_core_mount_utils_browser.mdx +++ b/api_docs/kbn_core_mount_utils_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-mount-utils-browser title: "@kbn/core-mount-utils-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-mount-utils-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-mount-utils-browser'] --- import kbnCoreMountUtilsBrowserObj from './kbn_core_mount_utils_browser.devdocs.json'; diff --git a/api_docs/kbn_core_node_server.mdx b/api_docs/kbn_core_node_server.mdx index c5820d75312ce..eb566cc508caf 100644 --- a/api_docs/kbn_core_node_server.mdx +++ b/api_docs/kbn_core_node_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-node-server title: "@kbn/core-node-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-node-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-node-server'] --- import kbnCoreNodeServerObj from './kbn_core_node_server.devdocs.json'; diff --git a/api_docs/kbn_core_node_server_internal.mdx b/api_docs/kbn_core_node_server_internal.mdx index 0bc3fb266daec..6b22020a4e72c 100644 --- a/api_docs/kbn_core_node_server_internal.mdx +++ b/api_docs/kbn_core_node_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-node-server-internal title: "@kbn/core-node-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-node-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-node-server-internal'] --- import kbnCoreNodeServerInternalObj from './kbn_core_node_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_node_server_mocks.mdx b/api_docs/kbn_core_node_server_mocks.mdx index 4f98be28fc379..bae877402fbbb 100644 --- a/api_docs/kbn_core_node_server_mocks.mdx +++ b/api_docs/kbn_core_node_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-node-server-mocks title: "@kbn/core-node-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-node-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-node-server-mocks'] --- import kbnCoreNodeServerMocksObj from './kbn_core_node_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_notifications_browser.mdx b/api_docs/kbn_core_notifications_browser.mdx index dc6141f334d7f..480a622bf6c13 100644 --- a/api_docs/kbn_core_notifications_browser.mdx +++ b/api_docs/kbn_core_notifications_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-notifications-browser title: "@kbn/core-notifications-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-notifications-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-notifications-browser'] --- import kbnCoreNotificationsBrowserObj from './kbn_core_notifications_browser.devdocs.json'; diff --git a/api_docs/kbn_core_notifications_browser_internal.mdx b/api_docs/kbn_core_notifications_browser_internal.mdx index 46669cbba13f1..bedba1ce4753a 100644 --- a/api_docs/kbn_core_notifications_browser_internal.mdx +++ b/api_docs/kbn_core_notifications_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-notifications-browser-internal title: "@kbn/core-notifications-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-notifications-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-notifications-browser-internal'] --- import kbnCoreNotificationsBrowserInternalObj from './kbn_core_notifications_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_notifications_browser_mocks.mdx b/api_docs/kbn_core_notifications_browser_mocks.mdx index cea2c423d3165..97782f183823c 100644 --- a/api_docs/kbn_core_notifications_browser_mocks.mdx +++ b/api_docs/kbn_core_notifications_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-notifications-browser-mocks title: "@kbn/core-notifications-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-notifications-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-notifications-browser-mocks'] --- import kbnCoreNotificationsBrowserMocksObj from './kbn_core_notifications_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_overlays_browser.mdx b/api_docs/kbn_core_overlays_browser.mdx index f8de0aa40b5d6..67bd882d1ec17 100644 --- a/api_docs/kbn_core_overlays_browser.mdx +++ b/api_docs/kbn_core_overlays_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-overlays-browser title: "@kbn/core-overlays-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-overlays-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-overlays-browser'] --- import kbnCoreOverlaysBrowserObj from './kbn_core_overlays_browser.devdocs.json'; diff --git a/api_docs/kbn_core_overlays_browser_internal.mdx b/api_docs/kbn_core_overlays_browser_internal.mdx index f8a23d4459568..ec6547dc54313 100644 --- a/api_docs/kbn_core_overlays_browser_internal.mdx +++ b/api_docs/kbn_core_overlays_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-overlays-browser-internal title: "@kbn/core-overlays-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-overlays-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-overlays-browser-internal'] --- import kbnCoreOverlaysBrowserInternalObj from './kbn_core_overlays_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_overlays_browser_mocks.mdx b/api_docs/kbn_core_overlays_browser_mocks.mdx index be3822ca8903a..4830fb4bffd31 100644 --- a/api_docs/kbn_core_overlays_browser_mocks.mdx +++ b/api_docs/kbn_core_overlays_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-overlays-browser-mocks title: "@kbn/core-overlays-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-overlays-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-overlays-browser-mocks'] --- import kbnCoreOverlaysBrowserMocksObj from './kbn_core_overlays_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_plugins_browser.mdx b/api_docs/kbn_core_plugins_browser.mdx index cf4f827cc93bd..723e9c2cfdc49 100644 --- a/api_docs/kbn_core_plugins_browser.mdx +++ b/api_docs/kbn_core_plugins_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-plugins-browser title: "@kbn/core-plugins-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-plugins-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-plugins-browser'] --- import kbnCorePluginsBrowserObj from './kbn_core_plugins_browser.devdocs.json'; diff --git a/api_docs/kbn_core_plugins_browser_mocks.mdx b/api_docs/kbn_core_plugins_browser_mocks.mdx index 897b5f538f01e..3630ff553b686 100644 --- a/api_docs/kbn_core_plugins_browser_mocks.mdx +++ b/api_docs/kbn_core_plugins_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-plugins-browser-mocks title: "@kbn/core-plugins-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-plugins-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-plugins-browser-mocks'] --- import kbnCorePluginsBrowserMocksObj from './kbn_core_plugins_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_plugins_contracts_browser.mdx b/api_docs/kbn_core_plugins_contracts_browser.mdx index 8c87d7950966b..d5eb5a79e9040 100644 --- a/api_docs/kbn_core_plugins_contracts_browser.mdx +++ b/api_docs/kbn_core_plugins_contracts_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-plugins-contracts-browser title: "@kbn/core-plugins-contracts-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-plugins-contracts-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-plugins-contracts-browser'] --- import kbnCorePluginsContractsBrowserObj from './kbn_core_plugins_contracts_browser.devdocs.json'; diff --git a/api_docs/kbn_core_plugins_contracts_server.mdx b/api_docs/kbn_core_plugins_contracts_server.mdx index f13ce623702c1..ff744ed15cd17 100644 --- a/api_docs/kbn_core_plugins_contracts_server.mdx +++ b/api_docs/kbn_core_plugins_contracts_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-plugins-contracts-server title: "@kbn/core-plugins-contracts-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-plugins-contracts-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-plugins-contracts-server'] --- import kbnCorePluginsContractsServerObj from './kbn_core_plugins_contracts_server.devdocs.json'; diff --git a/api_docs/kbn_core_plugins_server.mdx b/api_docs/kbn_core_plugins_server.mdx index d5688ffad42f5..08e8c42ab3633 100644 --- a/api_docs/kbn_core_plugins_server.mdx +++ b/api_docs/kbn_core_plugins_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-plugins-server title: "@kbn/core-plugins-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-plugins-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-plugins-server'] --- import kbnCorePluginsServerObj from './kbn_core_plugins_server.devdocs.json'; diff --git a/api_docs/kbn_core_plugins_server_mocks.mdx b/api_docs/kbn_core_plugins_server_mocks.mdx index c73309239c403..4c33b9e3f2e45 100644 --- a/api_docs/kbn_core_plugins_server_mocks.mdx +++ b/api_docs/kbn_core_plugins_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-plugins-server-mocks title: "@kbn/core-plugins-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-plugins-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-plugins-server-mocks'] --- import kbnCorePluginsServerMocksObj from './kbn_core_plugins_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_preboot_server.mdx b/api_docs/kbn_core_preboot_server.mdx index 108688c335da3..d5294c547f27c 100644 --- a/api_docs/kbn_core_preboot_server.mdx +++ b/api_docs/kbn_core_preboot_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-preboot-server title: "@kbn/core-preboot-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-preboot-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-preboot-server'] --- import kbnCorePrebootServerObj from './kbn_core_preboot_server.devdocs.json'; diff --git a/api_docs/kbn_core_preboot_server_mocks.mdx b/api_docs/kbn_core_preboot_server_mocks.mdx index dd4ce2edffc10..97f77d282995f 100644 --- a/api_docs/kbn_core_preboot_server_mocks.mdx +++ b/api_docs/kbn_core_preboot_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-preboot-server-mocks title: "@kbn/core-preboot-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-preboot-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-preboot-server-mocks'] --- import kbnCorePrebootServerMocksObj from './kbn_core_preboot_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_rendering_browser.mdx b/api_docs/kbn_core_rendering_browser.mdx index 5bb829b1a08b2..2aa7a6172c556 100644 --- a/api_docs/kbn_core_rendering_browser.mdx +++ b/api_docs/kbn_core_rendering_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-rendering-browser title: "@kbn/core-rendering-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-rendering-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-rendering-browser'] --- import kbnCoreRenderingBrowserObj from './kbn_core_rendering_browser.devdocs.json'; diff --git a/api_docs/kbn_core_rendering_browser_mocks.mdx b/api_docs/kbn_core_rendering_browser_mocks.mdx index e756b03b9dbb3..99f8bbdd68be5 100644 --- a/api_docs/kbn_core_rendering_browser_mocks.mdx +++ b/api_docs/kbn_core_rendering_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-rendering-browser-mocks title: "@kbn/core-rendering-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-rendering-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-rendering-browser-mocks'] --- import kbnCoreRenderingBrowserMocksObj from './kbn_core_rendering_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_rendering_server_internal.mdx b/api_docs/kbn_core_rendering_server_internal.mdx index 872e72f77281d..8852d3279832c 100644 --- a/api_docs/kbn_core_rendering_server_internal.mdx +++ b/api_docs/kbn_core_rendering_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-rendering-server-internal title: "@kbn/core-rendering-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-rendering-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-rendering-server-internal'] --- import kbnCoreRenderingServerInternalObj from './kbn_core_rendering_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_rendering_server_mocks.mdx b/api_docs/kbn_core_rendering_server_mocks.mdx index 885fd8012dc37..30b6cb6e4cf5c 100644 --- a/api_docs/kbn_core_rendering_server_mocks.mdx +++ b/api_docs/kbn_core_rendering_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-rendering-server-mocks title: "@kbn/core-rendering-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-rendering-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-rendering-server-mocks'] --- import kbnCoreRenderingServerMocksObj from './kbn_core_rendering_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_root_server_internal.mdx b/api_docs/kbn_core_root_server_internal.mdx index 2db577e1df99a..f105416f683db 100644 --- a/api_docs/kbn_core_root_server_internal.mdx +++ b/api_docs/kbn_core_root_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-root-server-internal title: "@kbn/core-root-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-root-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-root-server-internal'] --- import kbnCoreRootServerInternalObj from './kbn_core_root_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_api_browser.mdx b/api_docs/kbn_core_saved_objects_api_browser.mdx index 972a007b1cc1a..727938a418996 100644 --- a/api_docs/kbn_core_saved_objects_api_browser.mdx +++ b/api_docs/kbn_core_saved_objects_api_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-api-browser title: "@kbn/core-saved-objects-api-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-api-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-api-browser'] --- import kbnCoreSavedObjectsApiBrowserObj from './kbn_core_saved_objects_api_browser.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_api_server.mdx b/api_docs/kbn_core_saved_objects_api_server.mdx index 46b39f18550a4..64ad14c3df8b3 100644 --- a/api_docs/kbn_core_saved_objects_api_server.mdx +++ b/api_docs/kbn_core_saved_objects_api_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-api-server title: "@kbn/core-saved-objects-api-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-api-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-api-server'] --- import kbnCoreSavedObjectsApiServerObj from './kbn_core_saved_objects_api_server.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_api_server_mocks.mdx b/api_docs/kbn_core_saved_objects_api_server_mocks.mdx index a7b8584f138f4..b3df5ad99e3ee 100644 --- a/api_docs/kbn_core_saved_objects_api_server_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_api_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-api-server-mocks title: "@kbn/core-saved-objects-api-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-api-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-api-server-mocks'] --- import kbnCoreSavedObjectsApiServerMocksObj from './kbn_core_saved_objects_api_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_base_server_internal.mdx b/api_docs/kbn_core_saved_objects_base_server_internal.mdx index 36eab41d4d3cb..3f16dc06f0e6a 100644 --- a/api_docs/kbn_core_saved_objects_base_server_internal.mdx +++ b/api_docs/kbn_core_saved_objects_base_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-base-server-internal title: "@kbn/core-saved-objects-base-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-base-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-base-server-internal'] --- import kbnCoreSavedObjectsBaseServerInternalObj from './kbn_core_saved_objects_base_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_base_server_mocks.mdx b/api_docs/kbn_core_saved_objects_base_server_mocks.mdx index c6115b154fac7..02abc62ebc686 100644 --- a/api_docs/kbn_core_saved_objects_base_server_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_base_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-base-server-mocks title: "@kbn/core-saved-objects-base-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-base-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-base-server-mocks'] --- import kbnCoreSavedObjectsBaseServerMocksObj from './kbn_core_saved_objects_base_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_browser.mdx b/api_docs/kbn_core_saved_objects_browser.mdx index fcd1b7702bf6b..9e0b4ffc5d0e7 100644 --- a/api_docs/kbn_core_saved_objects_browser.mdx +++ b/api_docs/kbn_core_saved_objects_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-browser title: "@kbn/core-saved-objects-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-browser'] --- import kbnCoreSavedObjectsBrowserObj from './kbn_core_saved_objects_browser.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_browser_internal.mdx b/api_docs/kbn_core_saved_objects_browser_internal.mdx index 241768fb2d620..0e47974efcbe8 100644 --- a/api_docs/kbn_core_saved_objects_browser_internal.mdx +++ b/api_docs/kbn_core_saved_objects_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-browser-internal title: "@kbn/core-saved-objects-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-browser-internal'] --- import kbnCoreSavedObjectsBrowserInternalObj from './kbn_core_saved_objects_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_browser_mocks.mdx b/api_docs/kbn_core_saved_objects_browser_mocks.mdx index a2be7a1f36218..c4a33ed558616 100644 --- a/api_docs/kbn_core_saved_objects_browser_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-browser-mocks title: "@kbn/core-saved-objects-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-browser-mocks'] --- import kbnCoreSavedObjectsBrowserMocksObj from './kbn_core_saved_objects_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_common.mdx b/api_docs/kbn_core_saved_objects_common.mdx index 90734033cce6e..73c59b3c1fd76 100644 --- a/api_docs/kbn_core_saved_objects_common.mdx +++ b/api_docs/kbn_core_saved_objects_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-common title: "@kbn/core-saved-objects-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-common'] --- import kbnCoreSavedObjectsCommonObj from './kbn_core_saved_objects_common.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_import_export_server_internal.mdx b/api_docs/kbn_core_saved_objects_import_export_server_internal.mdx index 8c8bee73f45b7..a8605fa69acd7 100644 --- a/api_docs/kbn_core_saved_objects_import_export_server_internal.mdx +++ b/api_docs/kbn_core_saved_objects_import_export_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-import-export-server-internal title: "@kbn/core-saved-objects-import-export-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-import-export-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-import-export-server-internal'] --- import kbnCoreSavedObjectsImportExportServerInternalObj from './kbn_core_saved_objects_import_export_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_import_export_server_mocks.mdx b/api_docs/kbn_core_saved_objects_import_export_server_mocks.mdx index 2d16687156a62..a2a79b40aa426 100644 --- a/api_docs/kbn_core_saved_objects_import_export_server_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_import_export_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-import-export-server-mocks title: "@kbn/core-saved-objects-import-export-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-import-export-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-import-export-server-mocks'] --- import kbnCoreSavedObjectsImportExportServerMocksObj from './kbn_core_saved_objects_import_export_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_migration_server_internal.mdx b/api_docs/kbn_core_saved_objects_migration_server_internal.mdx index 30de03a954eb9..13cf9755f2219 100644 --- a/api_docs/kbn_core_saved_objects_migration_server_internal.mdx +++ b/api_docs/kbn_core_saved_objects_migration_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-migration-server-internal title: "@kbn/core-saved-objects-migration-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-migration-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-migration-server-internal'] --- import kbnCoreSavedObjectsMigrationServerInternalObj from './kbn_core_saved_objects_migration_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_migration_server_mocks.mdx b/api_docs/kbn_core_saved_objects_migration_server_mocks.mdx index 06608434dcfdb..89314fb750287 100644 --- a/api_docs/kbn_core_saved_objects_migration_server_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_migration_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-migration-server-mocks title: "@kbn/core-saved-objects-migration-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-migration-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-migration-server-mocks'] --- import kbnCoreSavedObjectsMigrationServerMocksObj from './kbn_core_saved_objects_migration_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_server.mdx b/api_docs/kbn_core_saved_objects_server.mdx index c8de5ac29f50e..7f7ecd59f4fc9 100644 --- a/api_docs/kbn_core_saved_objects_server.mdx +++ b/api_docs/kbn_core_saved_objects_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-server title: "@kbn/core-saved-objects-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-server'] --- import kbnCoreSavedObjectsServerObj from './kbn_core_saved_objects_server.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_server_internal.mdx b/api_docs/kbn_core_saved_objects_server_internal.mdx index fe1b43b0de2f3..71775403d09ac 100644 --- a/api_docs/kbn_core_saved_objects_server_internal.mdx +++ b/api_docs/kbn_core_saved_objects_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-server-internal title: "@kbn/core-saved-objects-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-server-internal'] --- import kbnCoreSavedObjectsServerInternalObj from './kbn_core_saved_objects_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_server_mocks.mdx b/api_docs/kbn_core_saved_objects_server_mocks.mdx index 4b8d4e59a7f80..cb59efb0ac457 100644 --- a/api_docs/kbn_core_saved_objects_server_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-server-mocks title: "@kbn/core-saved-objects-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-server-mocks'] --- import kbnCoreSavedObjectsServerMocksObj from './kbn_core_saved_objects_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_utils_server.mdx b/api_docs/kbn_core_saved_objects_utils_server.mdx index 295d4edf328b5..fbc2e8fcc7e52 100644 --- a/api_docs/kbn_core_saved_objects_utils_server.mdx +++ b/api_docs/kbn_core_saved_objects_utils_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-utils-server title: "@kbn/core-saved-objects-utils-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-utils-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-utils-server'] --- import kbnCoreSavedObjectsUtilsServerObj from './kbn_core_saved_objects_utils_server.devdocs.json'; diff --git a/api_docs/kbn_core_security_browser.mdx b/api_docs/kbn_core_security_browser.mdx index 9968885a35076..43d191b769d43 100644 --- a/api_docs/kbn_core_security_browser.mdx +++ b/api_docs/kbn_core_security_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-security-browser title: "@kbn/core-security-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-security-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-security-browser'] --- import kbnCoreSecurityBrowserObj from './kbn_core_security_browser.devdocs.json'; diff --git a/api_docs/kbn_core_security_browser_internal.mdx b/api_docs/kbn_core_security_browser_internal.mdx index eb78e683cbba6..6930b5a6a570a 100644 --- a/api_docs/kbn_core_security_browser_internal.mdx +++ b/api_docs/kbn_core_security_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-security-browser-internal title: "@kbn/core-security-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-security-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-security-browser-internal'] --- import kbnCoreSecurityBrowserInternalObj from './kbn_core_security_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_security_browser_mocks.mdx b/api_docs/kbn_core_security_browser_mocks.mdx index ce5cc968fe645..f3b3f7c517ed1 100644 --- a/api_docs/kbn_core_security_browser_mocks.mdx +++ b/api_docs/kbn_core_security_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-security-browser-mocks title: "@kbn/core-security-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-security-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-security-browser-mocks'] --- import kbnCoreSecurityBrowserMocksObj from './kbn_core_security_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_security_common.mdx b/api_docs/kbn_core_security_common.mdx index 77c166007d9eb..56d6259c388ce 100644 --- a/api_docs/kbn_core_security_common.mdx +++ b/api_docs/kbn_core_security_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-security-common title: "@kbn/core-security-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-security-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-security-common'] --- import kbnCoreSecurityCommonObj from './kbn_core_security_common.devdocs.json'; diff --git a/api_docs/kbn_core_security_server.mdx b/api_docs/kbn_core_security_server.mdx index 65b6fc48f1b47..7bdd563cd14e3 100644 --- a/api_docs/kbn_core_security_server.mdx +++ b/api_docs/kbn_core_security_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-security-server title: "@kbn/core-security-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-security-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-security-server'] --- import kbnCoreSecurityServerObj from './kbn_core_security_server.devdocs.json'; diff --git a/api_docs/kbn_core_security_server_internal.mdx b/api_docs/kbn_core_security_server_internal.mdx index af0c87f0d635f..e24450339d309 100644 --- a/api_docs/kbn_core_security_server_internal.mdx +++ b/api_docs/kbn_core_security_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-security-server-internal title: "@kbn/core-security-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-security-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-security-server-internal'] --- import kbnCoreSecurityServerInternalObj from './kbn_core_security_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_security_server_mocks.mdx b/api_docs/kbn_core_security_server_mocks.mdx index a2a3feaa9e3d9..c487910daf3c6 100644 --- a/api_docs/kbn_core_security_server_mocks.mdx +++ b/api_docs/kbn_core_security_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-security-server-mocks title: "@kbn/core-security-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-security-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-security-server-mocks'] --- import kbnCoreSecurityServerMocksObj from './kbn_core_security_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_status_common.mdx b/api_docs/kbn_core_status_common.mdx index 081bc7cefdd91..7b109b2f21f27 100644 --- a/api_docs/kbn_core_status_common.mdx +++ b/api_docs/kbn_core_status_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-status-common title: "@kbn/core-status-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-status-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-status-common'] --- import kbnCoreStatusCommonObj from './kbn_core_status_common.devdocs.json'; diff --git a/api_docs/kbn_core_status_server.mdx b/api_docs/kbn_core_status_server.mdx index c8a65f4d1e754..7d13b41e805e6 100644 --- a/api_docs/kbn_core_status_server.mdx +++ b/api_docs/kbn_core_status_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-status-server title: "@kbn/core-status-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-status-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-status-server'] --- import kbnCoreStatusServerObj from './kbn_core_status_server.devdocs.json'; diff --git a/api_docs/kbn_core_status_server_internal.mdx b/api_docs/kbn_core_status_server_internal.mdx index 9c513eae319b2..8fca45621252b 100644 --- a/api_docs/kbn_core_status_server_internal.mdx +++ b/api_docs/kbn_core_status_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-status-server-internal title: "@kbn/core-status-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-status-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-status-server-internal'] --- import kbnCoreStatusServerInternalObj from './kbn_core_status_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_status_server_mocks.mdx b/api_docs/kbn_core_status_server_mocks.mdx index d94c9c89fa4f3..d658583a9e66a 100644 --- a/api_docs/kbn_core_status_server_mocks.mdx +++ b/api_docs/kbn_core_status_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-status-server-mocks title: "@kbn/core-status-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-status-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-status-server-mocks'] --- import kbnCoreStatusServerMocksObj from './kbn_core_status_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_test_helpers_deprecations_getters.mdx b/api_docs/kbn_core_test_helpers_deprecations_getters.mdx index 5cdce0a0c8b28..a2320c989db95 100644 --- a/api_docs/kbn_core_test_helpers_deprecations_getters.mdx +++ b/api_docs/kbn_core_test_helpers_deprecations_getters.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-test-helpers-deprecations-getters title: "@kbn/core-test-helpers-deprecations-getters" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-test-helpers-deprecations-getters plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-test-helpers-deprecations-getters'] --- import kbnCoreTestHelpersDeprecationsGettersObj from './kbn_core_test_helpers_deprecations_getters.devdocs.json'; diff --git a/api_docs/kbn_core_test_helpers_http_setup_browser.mdx b/api_docs/kbn_core_test_helpers_http_setup_browser.mdx index 428a86a4e544c..16ffcb2599742 100644 --- a/api_docs/kbn_core_test_helpers_http_setup_browser.mdx +++ b/api_docs/kbn_core_test_helpers_http_setup_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-test-helpers-http-setup-browser title: "@kbn/core-test-helpers-http-setup-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-test-helpers-http-setup-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-test-helpers-http-setup-browser'] --- import kbnCoreTestHelpersHttpSetupBrowserObj from './kbn_core_test_helpers_http_setup_browser.devdocs.json'; diff --git a/api_docs/kbn_core_test_helpers_kbn_server.mdx b/api_docs/kbn_core_test_helpers_kbn_server.mdx index b0e34997bb901..03d960a583b84 100644 --- a/api_docs/kbn_core_test_helpers_kbn_server.mdx +++ b/api_docs/kbn_core_test_helpers_kbn_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-test-helpers-kbn-server title: "@kbn/core-test-helpers-kbn-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-test-helpers-kbn-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-test-helpers-kbn-server'] --- import kbnCoreTestHelpersKbnServerObj from './kbn_core_test_helpers_kbn_server.devdocs.json'; diff --git a/api_docs/kbn_core_test_helpers_model_versions.mdx b/api_docs/kbn_core_test_helpers_model_versions.mdx index 8f4726b357b64..e829ad7a10064 100644 --- a/api_docs/kbn_core_test_helpers_model_versions.mdx +++ b/api_docs/kbn_core_test_helpers_model_versions.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-test-helpers-model-versions title: "@kbn/core-test-helpers-model-versions" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-test-helpers-model-versions plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-test-helpers-model-versions'] --- import kbnCoreTestHelpersModelVersionsObj from './kbn_core_test_helpers_model_versions.devdocs.json'; diff --git a/api_docs/kbn_core_test_helpers_so_type_serializer.mdx b/api_docs/kbn_core_test_helpers_so_type_serializer.mdx index 15131b4fc817c..3c1b7e6c4576f 100644 --- a/api_docs/kbn_core_test_helpers_so_type_serializer.mdx +++ b/api_docs/kbn_core_test_helpers_so_type_serializer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-test-helpers-so-type-serializer title: "@kbn/core-test-helpers-so-type-serializer" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-test-helpers-so-type-serializer plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-test-helpers-so-type-serializer'] --- import kbnCoreTestHelpersSoTypeSerializerObj from './kbn_core_test_helpers_so_type_serializer.devdocs.json'; diff --git a/api_docs/kbn_core_test_helpers_test_utils.mdx b/api_docs/kbn_core_test_helpers_test_utils.mdx index e94165ac68724..4d13057873d19 100644 --- a/api_docs/kbn_core_test_helpers_test_utils.mdx +++ b/api_docs/kbn_core_test_helpers_test_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-test-helpers-test-utils title: "@kbn/core-test-helpers-test-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-test-helpers-test-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-test-helpers-test-utils'] --- import kbnCoreTestHelpersTestUtilsObj from './kbn_core_test_helpers_test_utils.devdocs.json'; diff --git a/api_docs/kbn_core_theme_browser.mdx b/api_docs/kbn_core_theme_browser.mdx index 8dd37daafd4b5..e183cf16ca3d0 100644 --- a/api_docs/kbn_core_theme_browser.mdx +++ b/api_docs/kbn_core_theme_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-theme-browser title: "@kbn/core-theme-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-theme-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-theme-browser'] --- import kbnCoreThemeBrowserObj from './kbn_core_theme_browser.devdocs.json'; diff --git a/api_docs/kbn_core_theme_browser_mocks.mdx b/api_docs/kbn_core_theme_browser_mocks.mdx index 9df391fb91756..068860c348d9b 100644 --- a/api_docs/kbn_core_theme_browser_mocks.mdx +++ b/api_docs/kbn_core_theme_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-theme-browser-mocks title: "@kbn/core-theme-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-theme-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-theme-browser-mocks'] --- import kbnCoreThemeBrowserMocksObj from './kbn_core_theme_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_browser.mdx b/api_docs/kbn_core_ui_settings_browser.mdx index 048e455dd9bb0..8971528f75b7e 100644 --- a/api_docs/kbn_core_ui_settings_browser.mdx +++ b/api_docs/kbn_core_ui_settings_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-browser title: "@kbn/core-ui-settings-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-browser'] --- import kbnCoreUiSettingsBrowserObj from './kbn_core_ui_settings_browser.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_browser_internal.mdx b/api_docs/kbn_core_ui_settings_browser_internal.mdx index 996a25bcdafbf..da1cecb2601b9 100644 --- a/api_docs/kbn_core_ui_settings_browser_internal.mdx +++ b/api_docs/kbn_core_ui_settings_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-browser-internal title: "@kbn/core-ui-settings-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-browser-internal'] --- import kbnCoreUiSettingsBrowserInternalObj from './kbn_core_ui_settings_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_browser_mocks.mdx b/api_docs/kbn_core_ui_settings_browser_mocks.mdx index 9437bafd9857d..029851960e19a 100644 --- a/api_docs/kbn_core_ui_settings_browser_mocks.mdx +++ b/api_docs/kbn_core_ui_settings_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-browser-mocks title: "@kbn/core-ui-settings-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-browser-mocks'] --- import kbnCoreUiSettingsBrowserMocksObj from './kbn_core_ui_settings_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_common.mdx b/api_docs/kbn_core_ui_settings_common.mdx index ab4507126efbf..55f237c39ab67 100644 --- a/api_docs/kbn_core_ui_settings_common.mdx +++ b/api_docs/kbn_core_ui_settings_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-common title: "@kbn/core-ui-settings-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-common'] --- import kbnCoreUiSettingsCommonObj from './kbn_core_ui_settings_common.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_server.mdx b/api_docs/kbn_core_ui_settings_server.mdx index 445fa5056a81d..d6534396d5e47 100644 --- a/api_docs/kbn_core_ui_settings_server.mdx +++ b/api_docs/kbn_core_ui_settings_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-server title: "@kbn/core-ui-settings-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-server'] --- import kbnCoreUiSettingsServerObj from './kbn_core_ui_settings_server.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_server_internal.mdx b/api_docs/kbn_core_ui_settings_server_internal.mdx index 8bed77e868617..9a35185a645f9 100644 --- a/api_docs/kbn_core_ui_settings_server_internal.mdx +++ b/api_docs/kbn_core_ui_settings_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-server-internal title: "@kbn/core-ui-settings-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-server-internal'] --- import kbnCoreUiSettingsServerInternalObj from './kbn_core_ui_settings_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_server_mocks.mdx b/api_docs/kbn_core_ui_settings_server_mocks.mdx index 5604a4ac4130d..1156d22947f04 100644 --- a/api_docs/kbn_core_ui_settings_server_mocks.mdx +++ b/api_docs/kbn_core_ui_settings_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-server-mocks title: "@kbn/core-ui-settings-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-server-mocks'] --- import kbnCoreUiSettingsServerMocksObj from './kbn_core_ui_settings_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_usage_data_server.mdx b/api_docs/kbn_core_usage_data_server.mdx index 7486bf8cf4654..de6641a17e6f4 100644 --- a/api_docs/kbn_core_usage_data_server.mdx +++ b/api_docs/kbn_core_usage_data_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-usage-data-server title: "@kbn/core-usage-data-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-usage-data-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-usage-data-server'] --- import kbnCoreUsageDataServerObj from './kbn_core_usage_data_server.devdocs.json'; diff --git a/api_docs/kbn_core_usage_data_server_internal.mdx b/api_docs/kbn_core_usage_data_server_internal.mdx index 65c9194c83754..2037d2b7ccbc0 100644 --- a/api_docs/kbn_core_usage_data_server_internal.mdx +++ b/api_docs/kbn_core_usage_data_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-usage-data-server-internal title: "@kbn/core-usage-data-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-usage-data-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-usage-data-server-internal'] --- import kbnCoreUsageDataServerInternalObj from './kbn_core_usage_data_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_usage_data_server_mocks.mdx b/api_docs/kbn_core_usage_data_server_mocks.mdx index 23d12206eef3f..e257357f19ef3 100644 --- a/api_docs/kbn_core_usage_data_server_mocks.mdx +++ b/api_docs/kbn_core_usage_data_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-usage-data-server-mocks title: "@kbn/core-usage-data-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-usage-data-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-usage-data-server-mocks'] --- import kbnCoreUsageDataServerMocksObj from './kbn_core_usage_data_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_user_profile_browser.mdx b/api_docs/kbn_core_user_profile_browser.mdx index 6d60355543dfc..93e50303950f6 100644 --- a/api_docs/kbn_core_user_profile_browser.mdx +++ b/api_docs/kbn_core_user_profile_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-user-profile-browser title: "@kbn/core-user-profile-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-user-profile-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-user-profile-browser'] --- import kbnCoreUserProfileBrowserObj from './kbn_core_user_profile_browser.devdocs.json'; diff --git a/api_docs/kbn_core_user_profile_browser_internal.mdx b/api_docs/kbn_core_user_profile_browser_internal.mdx index eb8fcfcb05196..ca316a9b7440d 100644 --- a/api_docs/kbn_core_user_profile_browser_internal.mdx +++ b/api_docs/kbn_core_user_profile_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-user-profile-browser-internal title: "@kbn/core-user-profile-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-user-profile-browser-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-user-profile-browser-internal'] --- import kbnCoreUserProfileBrowserInternalObj from './kbn_core_user_profile_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_user_profile_browser_mocks.mdx b/api_docs/kbn_core_user_profile_browser_mocks.mdx index b6e7c3190184c..ce15c5d9187ca 100644 --- a/api_docs/kbn_core_user_profile_browser_mocks.mdx +++ b/api_docs/kbn_core_user_profile_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-user-profile-browser-mocks title: "@kbn/core-user-profile-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-user-profile-browser-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-user-profile-browser-mocks'] --- import kbnCoreUserProfileBrowserMocksObj from './kbn_core_user_profile_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_user_profile_common.mdx b/api_docs/kbn_core_user_profile_common.mdx index 62b0bdb3e10bb..e176da7666e88 100644 --- a/api_docs/kbn_core_user_profile_common.mdx +++ b/api_docs/kbn_core_user_profile_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-user-profile-common title: "@kbn/core-user-profile-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-user-profile-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-user-profile-common'] --- import kbnCoreUserProfileCommonObj from './kbn_core_user_profile_common.devdocs.json'; diff --git a/api_docs/kbn_core_user_profile_server.mdx b/api_docs/kbn_core_user_profile_server.mdx index 2f1c3425df459..e905ab234b2cf 100644 --- a/api_docs/kbn_core_user_profile_server.mdx +++ b/api_docs/kbn_core_user_profile_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-user-profile-server title: "@kbn/core-user-profile-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-user-profile-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-user-profile-server'] --- import kbnCoreUserProfileServerObj from './kbn_core_user_profile_server.devdocs.json'; diff --git a/api_docs/kbn_core_user_profile_server_internal.mdx b/api_docs/kbn_core_user_profile_server_internal.mdx index 5944de997fee9..47bdc7923c3d1 100644 --- a/api_docs/kbn_core_user_profile_server_internal.mdx +++ b/api_docs/kbn_core_user_profile_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-user-profile-server-internal title: "@kbn/core-user-profile-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-user-profile-server-internal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-user-profile-server-internal'] --- import kbnCoreUserProfileServerInternalObj from './kbn_core_user_profile_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_user_profile_server_mocks.mdx b/api_docs/kbn_core_user_profile_server_mocks.mdx index 38b4a05bed2d3..fa9cdd8477c21 100644 --- a/api_docs/kbn_core_user_profile_server_mocks.mdx +++ b/api_docs/kbn_core_user_profile_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-user-profile-server-mocks title: "@kbn/core-user-profile-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-user-profile-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-user-profile-server-mocks'] --- import kbnCoreUserProfileServerMocksObj from './kbn_core_user_profile_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_user_settings_server.mdx b/api_docs/kbn_core_user_settings_server.mdx index ffc3ed653acb3..72135202b986b 100644 --- a/api_docs/kbn_core_user_settings_server.mdx +++ b/api_docs/kbn_core_user_settings_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-user-settings-server title: "@kbn/core-user-settings-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-user-settings-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-user-settings-server'] --- import kbnCoreUserSettingsServerObj from './kbn_core_user_settings_server.devdocs.json'; diff --git a/api_docs/kbn_core_user_settings_server_mocks.mdx b/api_docs/kbn_core_user_settings_server_mocks.mdx index b13c5f9f06689..9d9d877ece9f0 100644 --- a/api_docs/kbn_core_user_settings_server_mocks.mdx +++ b/api_docs/kbn_core_user_settings_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-user-settings-server-mocks title: "@kbn/core-user-settings-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-user-settings-server-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-user-settings-server-mocks'] --- import kbnCoreUserSettingsServerMocksObj from './kbn_core_user_settings_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_crypto.mdx b/api_docs/kbn_crypto.mdx index 8606910aab563..5d6b5950fb19e 100644 --- a/api_docs/kbn_crypto.mdx +++ b/api_docs/kbn_crypto.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-crypto title: "@kbn/crypto" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/crypto plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/crypto'] --- import kbnCryptoObj from './kbn_crypto.devdocs.json'; diff --git a/api_docs/kbn_crypto_browser.mdx b/api_docs/kbn_crypto_browser.mdx index 5b02924617080..fc844713c66e0 100644 --- a/api_docs/kbn_crypto_browser.mdx +++ b/api_docs/kbn_crypto_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-crypto-browser title: "@kbn/crypto-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/crypto-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/crypto-browser'] --- import kbnCryptoBrowserObj from './kbn_crypto_browser.devdocs.json'; diff --git a/api_docs/kbn_custom_icons.mdx b/api_docs/kbn_custom_icons.mdx index 191644fd2f047..8547775b1ef88 100644 --- a/api_docs/kbn_custom_icons.mdx +++ b/api_docs/kbn_custom_icons.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-custom-icons title: "@kbn/custom-icons" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/custom-icons plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/custom-icons'] --- import kbnCustomIconsObj from './kbn_custom_icons.devdocs.json'; diff --git a/api_docs/kbn_custom_integrations.mdx b/api_docs/kbn_custom_integrations.mdx index 3a276de9cabfe..5cae0b608c83f 100644 --- a/api_docs/kbn_custom_integrations.mdx +++ b/api_docs/kbn_custom_integrations.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-custom-integrations title: "@kbn/custom-integrations" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/custom-integrations plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/custom-integrations'] --- import kbnCustomIntegrationsObj from './kbn_custom_integrations.devdocs.json'; diff --git a/api_docs/kbn_cypress_config.mdx b/api_docs/kbn_cypress_config.mdx index 9a633f12e8ca3..a6024600ac34b 100644 --- a/api_docs/kbn_cypress_config.mdx +++ b/api_docs/kbn_cypress_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-cypress-config title: "@kbn/cypress-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/cypress-config plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/cypress-config'] --- import kbnCypressConfigObj from './kbn_cypress_config.devdocs.json'; diff --git a/api_docs/kbn_data_forge.mdx b/api_docs/kbn_data_forge.mdx index 4ffc25f7252bd..15245ae56c285 100644 --- a/api_docs/kbn_data_forge.mdx +++ b/api_docs/kbn_data_forge.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-data-forge title: "@kbn/data-forge" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/data-forge plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/data-forge'] --- import kbnDataForgeObj from './kbn_data_forge.devdocs.json'; diff --git a/api_docs/kbn_data_service.mdx b/api_docs/kbn_data_service.mdx index 301315c43deda..e06e5e9aa9943 100644 --- a/api_docs/kbn_data_service.mdx +++ b/api_docs/kbn_data_service.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-data-service title: "@kbn/data-service" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/data-service plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/data-service'] --- import kbnDataServiceObj from './kbn_data_service.devdocs.json'; diff --git a/api_docs/kbn_data_stream_adapter.mdx b/api_docs/kbn_data_stream_adapter.mdx index 4aada483e5902..41c273ff1f69f 100644 --- a/api_docs/kbn_data_stream_adapter.mdx +++ b/api_docs/kbn_data_stream_adapter.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-data-stream-adapter title: "@kbn/data-stream-adapter" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/data-stream-adapter plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/data-stream-adapter'] --- import kbnDataStreamAdapterObj from './kbn_data_stream_adapter.devdocs.json'; diff --git a/api_docs/kbn_data_view_utils.mdx b/api_docs/kbn_data_view_utils.mdx index 19677ca4e48d3..3f27b427ed378 100644 --- a/api_docs/kbn_data_view_utils.mdx +++ b/api_docs/kbn_data_view_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-data-view-utils title: "@kbn/data-view-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/data-view-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/data-view-utils'] --- import kbnDataViewUtilsObj from './kbn_data_view_utils.devdocs.json'; diff --git a/api_docs/kbn_datemath.mdx b/api_docs/kbn_datemath.mdx index 1fa28ad9b2f16..574e2dfa79286 100644 --- a/api_docs/kbn_datemath.mdx +++ b/api_docs/kbn_datemath.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-datemath title: "@kbn/datemath" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/datemath plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/datemath'] --- import kbnDatemathObj from './kbn_datemath.devdocs.json'; diff --git a/api_docs/kbn_deeplinks_analytics.mdx b/api_docs/kbn_deeplinks_analytics.mdx index 2dc7df2b76026..7440a8f11b69f 100644 --- a/api_docs/kbn_deeplinks_analytics.mdx +++ b/api_docs/kbn_deeplinks_analytics.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-deeplinks-analytics title: "@kbn/deeplinks-analytics" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/deeplinks-analytics plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/deeplinks-analytics'] --- import kbnDeeplinksAnalyticsObj from './kbn_deeplinks_analytics.devdocs.json'; diff --git a/api_docs/kbn_deeplinks_devtools.mdx b/api_docs/kbn_deeplinks_devtools.mdx index 3dc61e33a7c39..1b1f474bcea75 100644 --- a/api_docs/kbn_deeplinks_devtools.mdx +++ b/api_docs/kbn_deeplinks_devtools.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-deeplinks-devtools title: "@kbn/deeplinks-devtools" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/deeplinks-devtools plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/deeplinks-devtools'] --- import kbnDeeplinksDevtoolsObj from './kbn_deeplinks_devtools.devdocs.json'; diff --git a/api_docs/kbn_deeplinks_fleet.mdx b/api_docs/kbn_deeplinks_fleet.mdx index bbef9a61f97fb..553e5d780394f 100644 --- a/api_docs/kbn_deeplinks_fleet.mdx +++ b/api_docs/kbn_deeplinks_fleet.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-deeplinks-fleet title: "@kbn/deeplinks-fleet" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/deeplinks-fleet plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/deeplinks-fleet'] --- import kbnDeeplinksFleetObj from './kbn_deeplinks_fleet.devdocs.json'; diff --git a/api_docs/kbn_deeplinks_management.mdx b/api_docs/kbn_deeplinks_management.mdx index 36215c4e6a08f..c613fe0122020 100644 --- a/api_docs/kbn_deeplinks_management.mdx +++ b/api_docs/kbn_deeplinks_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-deeplinks-management title: "@kbn/deeplinks-management" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/deeplinks-management plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/deeplinks-management'] --- import kbnDeeplinksManagementObj from './kbn_deeplinks_management.devdocs.json'; diff --git a/api_docs/kbn_deeplinks_ml.mdx b/api_docs/kbn_deeplinks_ml.mdx index 3407575ebf797..760ef2a625f7c 100644 --- a/api_docs/kbn_deeplinks_ml.mdx +++ b/api_docs/kbn_deeplinks_ml.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-deeplinks-ml title: "@kbn/deeplinks-ml" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/deeplinks-ml plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/deeplinks-ml'] --- import kbnDeeplinksMlObj from './kbn_deeplinks_ml.devdocs.json'; diff --git a/api_docs/kbn_deeplinks_observability.devdocs.json b/api_docs/kbn_deeplinks_observability.devdocs.json index 09daeec624069..820e8efc49cb6 100644 --- a/api_docs/kbn_deeplinks_observability.devdocs.json +++ b/api_docs/kbn_deeplinks_observability.devdocs.json @@ -857,7 +857,7 @@ "label": "AppId", "description": [], "signature": [ - "\"profiling\" | \"metrics\" | \"apm\" | \"synthetics\" | \"ux\" | \"logs\" | \"slo\" | \"observabilityAIAssistant\" | \"observability-overview\" | \"observability-logs-explorer\" | \"last-used-logs-viewer\" | \"observabilityOnboarding\" | \"inventory\"" + "\"profiling\" | \"metrics\" | \"apm\" | \"synthetics\" | \"ux\" | \"logs\" | \"slo\" | \"observabilityAIAssistant\" | \"observability-overview\" | \"streams\" | \"observability-logs-explorer\" | \"last-used-logs-viewer\" | \"observabilityOnboarding\" | \"inventory\"" ], "path": "packages/deeplinks/observability/deep_links.ts", "deprecated": false, @@ -938,7 +938,7 @@ "section": "def-common.AppId", "text": "AppId" }, - " | \"logs:settings\" | \"logs:stream\" | \"logs:log-categories\" | \"logs:anomalies\" | \"observability-overview:cases\" | \"observability-overview:alerts\" | \"observability-overview:rules\" | \"observability-overview:cases_create\" | \"observability-overview:cases_configure\" | \"metrics:settings\" | \"metrics:hosts\" | \"metrics:inventory\" | \"metrics:metrics-explorer\" | \"metrics:assetDetails\" | \"apm:services\" | \"apm:traces\" | \"apm:dependencies\" | \"apm:service-map\" | \"apm:settings\" | \"apm:service-groups-list\" | \"apm:storage-explorer\" | \"synthetics:overview\" | \"synthetics:certificates\" | \"profiling:functions\" | \"profiling:stacktraces\" | \"profiling:flamegraphs\" | \"inventory:datastreams\"" + " | \"logs:settings\" | \"logs:stream\" | \"logs:log-categories\" | \"logs:anomalies\" | \"observability-overview:cases\" | \"observability-overview:alerts\" | \"observability-overview:rules\" | \"observability-overview:cases_create\" | \"observability-overview:cases_configure\" | \"metrics:settings\" | \"metrics:hosts\" | \"metrics:inventory\" | \"metrics:metrics-explorer\" | \"metrics:assetDetails\" | \"apm:services\" | \"apm:traces\" | \"apm:dependencies\" | \"apm:service-map\" | \"apm:settings\" | \"apm:service-groups-list\" | \"apm:storage-explorer\" | \"synthetics:overview\" | \"synthetics:certificates\" | \"profiling:functions\" | \"profiling:stacktraces\" | \"profiling:flamegraphs\" | \"inventory:datastreams\" | \"streams:overview\"" ], "path": "packages/deeplinks/observability/deep_links.ts", "deprecated": false, diff --git a/api_docs/kbn_deeplinks_observability.mdx b/api_docs/kbn_deeplinks_observability.mdx index 7c0da4132386d..ce46a707aed40 100644 --- a/api_docs/kbn_deeplinks_observability.mdx +++ b/api_docs/kbn_deeplinks_observability.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-deeplinks-observability title: "@kbn/deeplinks-observability" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/deeplinks-observability plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/deeplinks-observability'] --- import kbnDeeplinksObservabilityObj from './kbn_deeplinks_observability.devdocs.json'; diff --git a/api_docs/kbn_deeplinks_search.mdx b/api_docs/kbn_deeplinks_search.mdx index 6c885b3204472..1e6b5a0da7bbc 100644 --- a/api_docs/kbn_deeplinks_search.mdx +++ b/api_docs/kbn_deeplinks_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-deeplinks-search title: "@kbn/deeplinks-search" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/deeplinks-search plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/deeplinks-search'] --- import kbnDeeplinksSearchObj from './kbn_deeplinks_search.devdocs.json'; diff --git a/api_docs/kbn_deeplinks_security.mdx b/api_docs/kbn_deeplinks_security.mdx index 9292ed0656a19..cd9f9d765bdd9 100644 --- a/api_docs/kbn_deeplinks_security.mdx +++ b/api_docs/kbn_deeplinks_security.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-deeplinks-security title: "@kbn/deeplinks-security" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/deeplinks-security plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/deeplinks-security'] --- import kbnDeeplinksSecurityObj from './kbn_deeplinks_security.devdocs.json'; diff --git a/api_docs/kbn_deeplinks_shared.mdx b/api_docs/kbn_deeplinks_shared.mdx index 2e03df47ecb2a..775abc35805ce 100644 --- a/api_docs/kbn_deeplinks_shared.mdx +++ b/api_docs/kbn_deeplinks_shared.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-deeplinks-shared title: "@kbn/deeplinks-shared" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/deeplinks-shared plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/deeplinks-shared'] --- import kbnDeeplinksSharedObj from './kbn_deeplinks_shared.devdocs.json'; diff --git a/api_docs/kbn_default_nav_analytics.mdx b/api_docs/kbn_default_nav_analytics.mdx index 7e6599344d0d3..9e2c4d9ec6cbc 100644 --- a/api_docs/kbn_default_nav_analytics.mdx +++ b/api_docs/kbn_default_nav_analytics.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-default-nav-analytics title: "@kbn/default-nav-analytics" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/default-nav-analytics plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/default-nav-analytics'] --- import kbnDefaultNavAnalyticsObj from './kbn_default_nav_analytics.devdocs.json'; diff --git a/api_docs/kbn_default_nav_devtools.mdx b/api_docs/kbn_default_nav_devtools.mdx index f912602543841..9788992efbc8a 100644 --- a/api_docs/kbn_default_nav_devtools.mdx +++ b/api_docs/kbn_default_nav_devtools.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-default-nav-devtools title: "@kbn/default-nav-devtools" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/default-nav-devtools plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/default-nav-devtools'] --- import kbnDefaultNavDevtoolsObj from './kbn_default_nav_devtools.devdocs.json'; diff --git a/api_docs/kbn_default_nav_management.mdx b/api_docs/kbn_default_nav_management.mdx index 2b00c4f093f6c..146e68be60282 100644 --- a/api_docs/kbn_default_nav_management.mdx +++ b/api_docs/kbn_default_nav_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-default-nav-management title: "@kbn/default-nav-management" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/default-nav-management plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/default-nav-management'] --- import kbnDefaultNavManagementObj from './kbn_default_nav_management.devdocs.json'; diff --git a/api_docs/kbn_default_nav_ml.mdx b/api_docs/kbn_default_nav_ml.mdx index 3ca3d416b59ef..635d11c0f003f 100644 --- a/api_docs/kbn_default_nav_ml.mdx +++ b/api_docs/kbn_default_nav_ml.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-default-nav-ml title: "@kbn/default-nav-ml" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/default-nav-ml plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/default-nav-ml'] --- import kbnDefaultNavMlObj from './kbn_default_nav_ml.devdocs.json'; diff --git a/api_docs/kbn_dev_cli_errors.mdx b/api_docs/kbn_dev_cli_errors.mdx index da60ea7a9cf6e..48c72e3b58e23 100644 --- a/api_docs/kbn_dev_cli_errors.mdx +++ b/api_docs/kbn_dev_cli_errors.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-dev-cli-errors title: "@kbn/dev-cli-errors" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/dev-cli-errors plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dev-cli-errors'] --- import kbnDevCliErrorsObj from './kbn_dev_cli_errors.devdocs.json'; diff --git a/api_docs/kbn_dev_cli_runner.mdx b/api_docs/kbn_dev_cli_runner.mdx index 3b90235cc0a43..12f4173a5491b 100644 --- a/api_docs/kbn_dev_cli_runner.mdx +++ b/api_docs/kbn_dev_cli_runner.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-dev-cli-runner title: "@kbn/dev-cli-runner" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/dev-cli-runner plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dev-cli-runner'] --- import kbnDevCliRunnerObj from './kbn_dev_cli_runner.devdocs.json'; diff --git a/api_docs/kbn_dev_proc_runner.mdx b/api_docs/kbn_dev_proc_runner.mdx index 1b7a916b80645..b61dd65e4bc3f 100644 --- a/api_docs/kbn_dev_proc_runner.mdx +++ b/api_docs/kbn_dev_proc_runner.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-dev-proc-runner title: "@kbn/dev-proc-runner" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/dev-proc-runner plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dev-proc-runner'] --- import kbnDevProcRunnerObj from './kbn_dev_proc_runner.devdocs.json'; diff --git a/api_docs/kbn_dev_utils.mdx b/api_docs/kbn_dev_utils.mdx index fda7fec1617ae..17e4c4bb4121b 100644 --- a/api_docs/kbn_dev_utils.mdx +++ b/api_docs/kbn_dev_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-dev-utils title: "@kbn/dev-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/dev-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dev-utils'] --- import kbnDevUtilsObj from './kbn_dev_utils.devdocs.json'; diff --git a/api_docs/kbn_discover_contextual_components.mdx b/api_docs/kbn_discover_contextual_components.mdx index c91f46ab37721..adb3f8a97b7b3 100644 --- a/api_docs/kbn_discover_contextual_components.mdx +++ b/api_docs/kbn_discover_contextual_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-discover-contextual-components title: "@kbn/discover-contextual-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/discover-contextual-components plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/discover-contextual-components'] --- import kbnDiscoverContextualComponentsObj from './kbn_discover_contextual_components.devdocs.json'; diff --git a/api_docs/kbn_discover_utils.mdx b/api_docs/kbn_discover_utils.mdx index 0114663e782e6..95caad56a3012 100644 --- a/api_docs/kbn_discover_utils.mdx +++ b/api_docs/kbn_discover_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-discover-utils title: "@kbn/discover-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/discover-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/discover-utils'] --- import kbnDiscoverUtilsObj from './kbn_discover_utils.devdocs.json'; diff --git a/api_docs/kbn_doc_links.mdx b/api_docs/kbn_doc_links.mdx index bfeb700f9a18e..5871dc272d70d 100644 --- a/api_docs/kbn_doc_links.mdx +++ b/api_docs/kbn_doc_links.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-doc-links title: "@kbn/doc-links" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/doc-links plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/doc-links'] --- import kbnDocLinksObj from './kbn_doc_links.devdocs.json'; diff --git a/api_docs/kbn_docs_utils.mdx b/api_docs/kbn_docs_utils.mdx index d0bcbd0c3808c..fb871eea8a504 100644 --- a/api_docs/kbn_docs_utils.mdx +++ b/api_docs/kbn_docs_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-docs-utils title: "@kbn/docs-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/docs-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/docs-utils'] --- import kbnDocsUtilsObj from './kbn_docs_utils.devdocs.json'; diff --git a/api_docs/kbn_dom_drag_drop.mdx b/api_docs/kbn_dom_drag_drop.mdx index 2219cf5cc9c24..81ffdf51aed03 100644 --- a/api_docs/kbn_dom_drag_drop.mdx +++ b/api_docs/kbn_dom_drag_drop.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-dom-drag-drop title: "@kbn/dom-drag-drop" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/dom-drag-drop plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dom-drag-drop'] --- import kbnDomDragDropObj from './kbn_dom_drag_drop.devdocs.json'; diff --git a/api_docs/kbn_ebt_tools.mdx b/api_docs/kbn_ebt_tools.mdx index abdbfcc73226f..eefd3b81ad839 100644 --- a/api_docs/kbn_ebt_tools.mdx +++ b/api_docs/kbn_ebt_tools.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ebt-tools title: "@kbn/ebt-tools" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ebt-tools plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ebt-tools'] --- import kbnEbtToolsObj from './kbn_ebt_tools.devdocs.json'; diff --git a/api_docs/kbn_ecs_data_quality_dashboard.mdx b/api_docs/kbn_ecs_data_quality_dashboard.mdx index ab803415bcb77..dffd2f935e9f1 100644 --- a/api_docs/kbn_ecs_data_quality_dashboard.mdx +++ b/api_docs/kbn_ecs_data_quality_dashboard.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ecs-data-quality-dashboard title: "@kbn/ecs-data-quality-dashboard" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ecs-data-quality-dashboard plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ecs-data-quality-dashboard'] --- import kbnEcsDataQualityDashboardObj from './kbn_ecs_data_quality_dashboard.devdocs.json'; diff --git a/api_docs/kbn_elastic_agent_utils.mdx b/api_docs/kbn_elastic_agent_utils.mdx index dfd85356a9713..a04d031096f72 100644 --- a/api_docs/kbn_elastic_agent_utils.mdx +++ b/api_docs/kbn_elastic_agent_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-elastic-agent-utils title: "@kbn/elastic-agent-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/elastic-agent-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/elastic-agent-utils'] --- import kbnElasticAgentUtilsObj from './kbn_elastic_agent_utils.devdocs.json'; diff --git a/api_docs/kbn_elastic_assistant.mdx b/api_docs/kbn_elastic_assistant.mdx index 7f6b7a80eeb37..cbec230aa1ddd 100644 --- a/api_docs/kbn_elastic_assistant.mdx +++ b/api_docs/kbn_elastic_assistant.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-elastic-assistant title: "@kbn/elastic-assistant" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/elastic-assistant plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/elastic-assistant'] --- import kbnElasticAssistantObj from './kbn_elastic_assistant.devdocs.json'; diff --git a/api_docs/kbn_elastic_assistant_common.mdx b/api_docs/kbn_elastic_assistant_common.mdx index 6ead2faf6b770..1e246228760bc 100644 --- a/api_docs/kbn_elastic_assistant_common.mdx +++ b/api_docs/kbn_elastic_assistant_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-elastic-assistant-common title: "@kbn/elastic-assistant-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/elastic-assistant-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/elastic-assistant-common'] --- import kbnElasticAssistantCommonObj from './kbn_elastic_assistant_common.devdocs.json'; diff --git a/api_docs/kbn_entities_schema.mdx b/api_docs/kbn_entities_schema.mdx index a4c348f528536..fe47eda50bc3b 100644 --- a/api_docs/kbn_entities_schema.mdx +++ b/api_docs/kbn_entities_schema.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-entities-schema title: "@kbn/entities-schema" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/entities-schema plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/entities-schema'] --- import kbnEntitiesSchemaObj from './kbn_entities_schema.devdocs.json'; diff --git a/api_docs/kbn_es.mdx b/api_docs/kbn_es.mdx index bca02380cf3bd..08801d68d9225 100644 --- a/api_docs/kbn_es.mdx +++ b/api_docs/kbn_es.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-es title: "@kbn/es" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/es plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/es'] --- import kbnEsObj from './kbn_es.devdocs.json'; diff --git a/api_docs/kbn_es_archiver.mdx b/api_docs/kbn_es_archiver.mdx index 4fe8627f56f2c..4032015f2f386 100644 --- a/api_docs/kbn_es_archiver.mdx +++ b/api_docs/kbn_es_archiver.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-es-archiver title: "@kbn/es-archiver" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/es-archiver plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/es-archiver'] --- import kbnEsArchiverObj from './kbn_es_archiver.devdocs.json'; diff --git a/api_docs/kbn_es_errors.mdx b/api_docs/kbn_es_errors.mdx index f51581035815a..1e212f9c25fce 100644 --- a/api_docs/kbn_es_errors.mdx +++ b/api_docs/kbn_es_errors.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-es-errors title: "@kbn/es-errors" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/es-errors plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/es-errors'] --- import kbnEsErrorsObj from './kbn_es_errors.devdocs.json'; diff --git a/api_docs/kbn_es_query.mdx b/api_docs/kbn_es_query.mdx index 93e8efe796b11..a18ed7ef8bf97 100644 --- a/api_docs/kbn_es_query.mdx +++ b/api_docs/kbn_es_query.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-es-query title: "@kbn/es-query" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/es-query plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/es-query'] --- import kbnEsQueryObj from './kbn_es_query.devdocs.json'; diff --git a/api_docs/kbn_es_types.devdocs.json b/api_docs/kbn_es_types.devdocs.json index 60ef30c14df1c..ec62dd1cd61ff 100644 --- a/api_docs/kbn_es_types.devdocs.json +++ b/api_docs/kbn_es_types.devdocs.json @@ -137,12 +137,13 @@ { "parentPluginId": "@kbn/es-types", "id": "def-common.ESQLSearchParams.params", - "type": "Array", + "type": "CompoundType", "tags": [], "label": "params", "description": [], "signature": [ - "Record[] | undefined" + "ScalarValue", + "[] | Record[] | undefined" ], "path": "packages/kbn-es-types/src/search.ts", "deprecated": false, diff --git a/api_docs/kbn_es_types.mdx b/api_docs/kbn_es_types.mdx index f32da0ce52a85..b11852542ff20 100644 --- a/api_docs/kbn_es_types.mdx +++ b/api_docs/kbn_es_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-es-types title: "@kbn/es-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/es-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/es-types'] --- import kbnEsTypesObj from './kbn_es_types.devdocs.json'; diff --git a/api_docs/kbn_eslint_plugin_imports.mdx b/api_docs/kbn_eslint_plugin_imports.mdx index 78afb0e9beec9..b42c3cb91b8fb 100644 --- a/api_docs/kbn_eslint_plugin_imports.mdx +++ b/api_docs/kbn_eslint_plugin_imports.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-eslint-plugin-imports title: "@kbn/eslint-plugin-imports" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/eslint-plugin-imports plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/eslint-plugin-imports'] --- import kbnEslintPluginImportsObj from './kbn_eslint_plugin_imports.devdocs.json'; diff --git a/api_docs/kbn_esql_ast.mdx b/api_docs/kbn_esql_ast.mdx index c5b1ce966c65e..20f834e8f624c 100644 --- a/api_docs/kbn_esql_ast.mdx +++ b/api_docs/kbn_esql_ast.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-esql-ast title: "@kbn/esql-ast" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/esql-ast plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/esql-ast'] --- import kbnEsqlAstObj from './kbn_esql_ast.devdocs.json'; diff --git a/api_docs/kbn_esql_editor.mdx b/api_docs/kbn_esql_editor.mdx index cf0168affcfe4..d498a1578740a 100644 --- a/api_docs/kbn_esql_editor.mdx +++ b/api_docs/kbn_esql_editor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-esql-editor title: "@kbn/esql-editor" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/esql-editor plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/esql-editor'] --- import kbnEsqlEditorObj from './kbn_esql_editor.devdocs.json'; diff --git a/api_docs/kbn_esql_utils.mdx b/api_docs/kbn_esql_utils.mdx index 3fb39be1a5f32..0480711869f37 100644 --- a/api_docs/kbn_esql_utils.mdx +++ b/api_docs/kbn_esql_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-esql-utils title: "@kbn/esql-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/esql-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/esql-utils'] --- import kbnEsqlUtilsObj from './kbn_esql_utils.devdocs.json'; diff --git a/api_docs/kbn_esql_validation_autocomplete.mdx b/api_docs/kbn_esql_validation_autocomplete.mdx index ef48fd401b87f..d4121d5e47864 100644 --- a/api_docs/kbn_esql_validation_autocomplete.mdx +++ b/api_docs/kbn_esql_validation_autocomplete.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-esql-validation-autocomplete title: "@kbn/esql-validation-autocomplete" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/esql-validation-autocomplete plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/esql-validation-autocomplete'] --- import kbnEsqlValidationAutocompleteObj from './kbn_esql_validation_autocomplete.devdocs.json'; diff --git a/api_docs/kbn_event_annotation_common.mdx b/api_docs/kbn_event_annotation_common.mdx index 1a76265b6d753..5268876010daa 100644 --- a/api_docs/kbn_event_annotation_common.mdx +++ b/api_docs/kbn_event_annotation_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-event-annotation-common title: "@kbn/event-annotation-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/event-annotation-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/event-annotation-common'] --- import kbnEventAnnotationCommonObj from './kbn_event_annotation_common.devdocs.json'; diff --git a/api_docs/kbn_event_annotation_components.mdx b/api_docs/kbn_event_annotation_components.mdx index f15f1210d4006..228d4b621ab0e 100644 --- a/api_docs/kbn_event_annotation_components.mdx +++ b/api_docs/kbn_event_annotation_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-event-annotation-components title: "@kbn/event-annotation-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/event-annotation-components plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/event-annotation-components'] --- import kbnEventAnnotationComponentsObj from './kbn_event_annotation_components.devdocs.json'; diff --git a/api_docs/kbn_expandable_flyout.mdx b/api_docs/kbn_expandable_flyout.mdx index 138b6fd0a1d4f..62abeb43f614e 100644 --- a/api_docs/kbn_expandable_flyout.mdx +++ b/api_docs/kbn_expandable_flyout.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-expandable-flyout title: "@kbn/expandable-flyout" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/expandable-flyout plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/expandable-flyout'] --- import kbnExpandableFlyoutObj from './kbn_expandable_flyout.devdocs.json'; diff --git a/api_docs/kbn_field_types.mdx b/api_docs/kbn_field_types.mdx index ea6e0344d3350..b9a651d13ca9b 100644 --- a/api_docs/kbn_field_types.mdx +++ b/api_docs/kbn_field_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-field-types title: "@kbn/field-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/field-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/field-types'] --- import kbnFieldTypesObj from './kbn_field_types.devdocs.json'; diff --git a/api_docs/kbn_field_utils.mdx b/api_docs/kbn_field_utils.mdx index b1273c94d3de7..69a0a5df9776a 100644 --- a/api_docs/kbn_field_utils.mdx +++ b/api_docs/kbn_field_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-field-utils title: "@kbn/field-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/field-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/field-utils'] --- import kbnFieldUtilsObj from './kbn_field_utils.devdocs.json'; diff --git a/api_docs/kbn_find_used_node_modules.mdx b/api_docs/kbn_find_used_node_modules.mdx index 1a3150c3cb9b4..87c6de8073c60 100644 --- a/api_docs/kbn_find_used_node_modules.mdx +++ b/api_docs/kbn_find_used_node_modules.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-find-used-node-modules title: "@kbn/find-used-node-modules" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/find-used-node-modules plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/find-used-node-modules'] --- import kbnFindUsedNodeModulesObj from './kbn_find_used_node_modules.devdocs.json'; diff --git a/api_docs/kbn_formatters.mdx b/api_docs/kbn_formatters.mdx index f161785f8f2cb..befe2998feec4 100644 --- a/api_docs/kbn_formatters.mdx +++ b/api_docs/kbn_formatters.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-formatters title: "@kbn/formatters" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/formatters plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/formatters'] --- import kbnFormattersObj from './kbn_formatters.devdocs.json'; diff --git a/api_docs/kbn_ftr_common_functional_services.mdx b/api_docs/kbn_ftr_common_functional_services.mdx index b9ae939c121ae..ba202f8df7f6d 100644 --- a/api_docs/kbn_ftr_common_functional_services.mdx +++ b/api_docs/kbn_ftr_common_functional_services.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ftr-common-functional-services title: "@kbn/ftr-common-functional-services" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ftr-common-functional-services plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ftr-common-functional-services'] --- import kbnFtrCommonFunctionalServicesObj from './kbn_ftr_common_functional_services.devdocs.json'; diff --git a/api_docs/kbn_ftr_common_functional_ui_services.mdx b/api_docs/kbn_ftr_common_functional_ui_services.mdx index 2b066278ac62f..829005b1172f1 100644 --- a/api_docs/kbn_ftr_common_functional_ui_services.mdx +++ b/api_docs/kbn_ftr_common_functional_ui_services.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ftr-common-functional-ui-services title: "@kbn/ftr-common-functional-ui-services" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ftr-common-functional-ui-services plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ftr-common-functional-ui-services'] --- import kbnFtrCommonFunctionalUiServicesObj from './kbn_ftr_common_functional_ui_services.devdocs.json'; diff --git a/api_docs/kbn_generate.mdx b/api_docs/kbn_generate.mdx index 91bfb9783cfaf..42890de4a8a45 100644 --- a/api_docs/kbn_generate.mdx +++ b/api_docs/kbn_generate.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-generate title: "@kbn/generate" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/generate plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/generate'] --- import kbnGenerateObj from './kbn_generate.devdocs.json'; diff --git a/api_docs/kbn_generate_console_definitions.mdx b/api_docs/kbn_generate_console_definitions.mdx index 926ad32e8a854..0358d5918a030 100644 --- a/api_docs/kbn_generate_console_definitions.mdx +++ b/api_docs/kbn_generate_console_definitions.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-generate-console-definitions title: "@kbn/generate-console-definitions" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/generate-console-definitions plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/generate-console-definitions'] --- import kbnGenerateConsoleDefinitionsObj from './kbn_generate_console_definitions.devdocs.json'; diff --git a/api_docs/kbn_generate_csv.mdx b/api_docs/kbn_generate_csv.mdx index 615c8e9d0be1b..8f050dcf9035d 100644 --- a/api_docs/kbn_generate_csv.mdx +++ b/api_docs/kbn_generate_csv.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-generate-csv title: "@kbn/generate-csv" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/generate-csv plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/generate-csv'] --- import kbnGenerateCsvObj from './kbn_generate_csv.devdocs.json'; diff --git a/api_docs/kbn_grid_layout.mdx b/api_docs/kbn_grid_layout.mdx index 60a7147b1f0ce..3e594a0f60ca4 100644 --- a/api_docs/kbn_grid_layout.mdx +++ b/api_docs/kbn_grid_layout.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-grid-layout title: "@kbn/grid-layout" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/grid-layout plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/grid-layout'] --- import kbnGridLayoutObj from './kbn_grid_layout.devdocs.json'; diff --git a/api_docs/kbn_grouping.mdx b/api_docs/kbn_grouping.mdx index b162daa842a1a..881e6c2117037 100644 --- a/api_docs/kbn_grouping.mdx +++ b/api_docs/kbn_grouping.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-grouping title: "@kbn/grouping" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/grouping plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/grouping'] --- import kbnGroupingObj from './kbn_grouping.devdocs.json'; diff --git a/api_docs/kbn_guided_onboarding.mdx b/api_docs/kbn_guided_onboarding.mdx index b53f1eedcdcca..7f6e1dd104f33 100644 --- a/api_docs/kbn_guided_onboarding.mdx +++ b/api_docs/kbn_guided_onboarding.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-guided-onboarding title: "@kbn/guided-onboarding" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/guided-onboarding plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/guided-onboarding'] --- import kbnGuidedOnboardingObj from './kbn_guided_onboarding.devdocs.json'; diff --git a/api_docs/kbn_handlebars.mdx b/api_docs/kbn_handlebars.mdx index 8c038391f1bc2..7f8f716549a48 100644 --- a/api_docs/kbn_handlebars.mdx +++ b/api_docs/kbn_handlebars.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-handlebars title: "@kbn/handlebars" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/handlebars plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/handlebars'] --- import kbnHandlebarsObj from './kbn_handlebars.devdocs.json'; diff --git a/api_docs/kbn_hapi_mocks.mdx b/api_docs/kbn_hapi_mocks.mdx index 8e361337e012d..a49ee1c98010e 100644 --- a/api_docs/kbn_hapi_mocks.mdx +++ b/api_docs/kbn_hapi_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-hapi-mocks title: "@kbn/hapi-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/hapi-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/hapi-mocks'] --- import kbnHapiMocksObj from './kbn_hapi_mocks.devdocs.json'; diff --git a/api_docs/kbn_health_gateway_server.mdx b/api_docs/kbn_health_gateway_server.mdx index 00a31b8eff64f..584edc08a3bf9 100644 --- a/api_docs/kbn_health_gateway_server.mdx +++ b/api_docs/kbn_health_gateway_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-health-gateway-server title: "@kbn/health-gateway-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/health-gateway-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/health-gateway-server'] --- import kbnHealthGatewayServerObj from './kbn_health_gateway_server.devdocs.json'; diff --git a/api_docs/kbn_home_sample_data_card.mdx b/api_docs/kbn_home_sample_data_card.mdx index fe36166e56679..0059f412e6980 100644 --- a/api_docs/kbn_home_sample_data_card.mdx +++ b/api_docs/kbn_home_sample_data_card.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-home-sample-data-card title: "@kbn/home-sample-data-card" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/home-sample-data-card plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/home-sample-data-card'] --- import kbnHomeSampleDataCardObj from './kbn_home_sample_data_card.devdocs.json'; diff --git a/api_docs/kbn_home_sample_data_tab.mdx b/api_docs/kbn_home_sample_data_tab.mdx index 1e3bb2fbe6800..1216eaceccf0c 100644 --- a/api_docs/kbn_home_sample_data_tab.mdx +++ b/api_docs/kbn_home_sample_data_tab.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-home-sample-data-tab title: "@kbn/home-sample-data-tab" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/home-sample-data-tab plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/home-sample-data-tab'] --- import kbnHomeSampleDataTabObj from './kbn_home_sample_data_tab.devdocs.json'; diff --git a/api_docs/kbn_i18n.mdx b/api_docs/kbn_i18n.mdx index 833d0a88e3000..fb7cb2cbfe0c4 100644 --- a/api_docs/kbn_i18n.mdx +++ b/api_docs/kbn_i18n.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-i18n title: "@kbn/i18n" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/i18n plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/i18n'] --- import kbnI18nObj from './kbn_i18n.devdocs.json'; diff --git a/api_docs/kbn_i18n_react.mdx b/api_docs/kbn_i18n_react.mdx index ec5d6fc432823..8e887e24edc6a 100644 --- a/api_docs/kbn_i18n_react.mdx +++ b/api_docs/kbn_i18n_react.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-i18n-react title: "@kbn/i18n-react" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/i18n-react plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/i18n-react'] --- import kbnI18nReactObj from './kbn_i18n_react.devdocs.json'; diff --git a/api_docs/kbn_import_resolver.mdx b/api_docs/kbn_import_resolver.mdx index fcc9e4f58bfc0..bb916f942f6c0 100644 --- a/api_docs/kbn_import_resolver.mdx +++ b/api_docs/kbn_import_resolver.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-import-resolver title: "@kbn/import-resolver" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/import-resolver plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/import-resolver'] --- import kbnImportResolverObj from './kbn_import_resolver.devdocs.json'; diff --git a/api_docs/kbn_index_adapter.mdx b/api_docs/kbn_index_adapter.mdx index ce7a278bd4bbe..4a02a43542bc4 100644 --- a/api_docs/kbn_index_adapter.mdx +++ b/api_docs/kbn_index_adapter.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-index-adapter title: "@kbn/index-adapter" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/index-adapter plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/index-adapter'] --- import kbnIndexAdapterObj from './kbn_index_adapter.devdocs.json'; diff --git a/api_docs/kbn_index_lifecycle_management_common_shared.mdx b/api_docs/kbn_index_lifecycle_management_common_shared.mdx index c3ff265717930..9f4c1059e25e4 100644 --- a/api_docs/kbn_index_lifecycle_management_common_shared.mdx +++ b/api_docs/kbn_index_lifecycle_management_common_shared.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-index-lifecycle-management-common-shared title: "@kbn/index-lifecycle-management-common-shared" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/index-lifecycle-management-common-shared plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/index-lifecycle-management-common-shared'] --- import kbnIndexLifecycleManagementCommonSharedObj from './kbn_index_lifecycle_management_common_shared.devdocs.json'; diff --git a/api_docs/kbn_index_management_shared_types.mdx b/api_docs/kbn_index_management_shared_types.mdx index 3a92a282f9506..4075f36aa7eb9 100644 --- a/api_docs/kbn_index_management_shared_types.mdx +++ b/api_docs/kbn_index_management_shared_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-index-management-shared-types title: "@kbn/index-management-shared-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/index-management-shared-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/index-management-shared-types'] --- import kbnIndexManagementSharedTypesObj from './kbn_index_management_shared_types.devdocs.json'; diff --git a/api_docs/kbn_inference_common.mdx b/api_docs/kbn_inference_common.mdx index 9a7cd1d068be2..fbafb23930796 100644 --- a/api_docs/kbn_inference_common.mdx +++ b/api_docs/kbn_inference_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-inference-common title: "@kbn/inference-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/inference-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/inference-common'] --- import kbnInferenceCommonObj from './kbn_inference_common.devdocs.json'; diff --git a/api_docs/kbn_inference_integration_flyout.mdx b/api_docs/kbn_inference_integration_flyout.mdx index 1caf6f85579bb..381d1f5f1e09d 100644 --- a/api_docs/kbn_inference_integration_flyout.mdx +++ b/api_docs/kbn_inference_integration_flyout.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-inference_integration_flyout title: "@kbn/inference_integration_flyout" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/inference_integration_flyout plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/inference_integration_flyout'] --- import kbnInferenceIntegrationFlyoutObj from './kbn_inference_integration_flyout.devdocs.json'; diff --git a/api_docs/kbn_infra_forge.mdx b/api_docs/kbn_infra_forge.mdx index ef58c7ed3bcaa..30f9899242b77 100644 --- a/api_docs/kbn_infra_forge.mdx +++ b/api_docs/kbn_infra_forge.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-infra-forge title: "@kbn/infra-forge" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/infra-forge plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/infra-forge'] --- import kbnInfraForgeObj from './kbn_infra_forge.devdocs.json'; diff --git a/api_docs/kbn_interpreter.mdx b/api_docs/kbn_interpreter.mdx index 4459be4144b33..9fc6b19407f71 100644 --- a/api_docs/kbn_interpreter.mdx +++ b/api_docs/kbn_interpreter.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-interpreter title: "@kbn/interpreter" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/interpreter plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/interpreter'] --- import kbnInterpreterObj from './kbn_interpreter.devdocs.json'; diff --git a/api_docs/kbn_investigation_shared.mdx b/api_docs/kbn_investigation_shared.mdx index 1db15ea6362f8..05476bbb7194e 100644 --- a/api_docs/kbn_investigation_shared.mdx +++ b/api_docs/kbn_investigation_shared.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-investigation-shared title: "@kbn/investigation-shared" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/investigation-shared plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/investigation-shared'] --- import kbnInvestigationSharedObj from './kbn_investigation_shared.devdocs.json'; diff --git a/api_docs/kbn_io_ts_utils.mdx b/api_docs/kbn_io_ts_utils.mdx index f56d5d8260c5f..685b884c1a3d2 100644 --- a/api_docs/kbn_io_ts_utils.mdx +++ b/api_docs/kbn_io_ts_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-io-ts-utils title: "@kbn/io-ts-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/io-ts-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/io-ts-utils'] --- import kbnIoTsUtilsObj from './kbn_io_ts_utils.devdocs.json'; diff --git a/api_docs/kbn_ipynb.mdx b/api_docs/kbn_ipynb.mdx index 3f2ab67576bce..a173fce5d5ca2 100644 --- a/api_docs/kbn_ipynb.mdx +++ b/api_docs/kbn_ipynb.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ipynb title: "@kbn/ipynb" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ipynb plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ipynb'] --- import kbnIpynbObj from './kbn_ipynb.devdocs.json'; diff --git a/api_docs/kbn_item_buffer.mdx b/api_docs/kbn_item_buffer.mdx index 07d9ff5c9265c..bdbe57dd15a7a 100644 --- a/api_docs/kbn_item_buffer.mdx +++ b/api_docs/kbn_item_buffer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-item-buffer title: "@kbn/item-buffer" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/item-buffer plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/item-buffer'] --- import kbnItemBufferObj from './kbn_item_buffer.devdocs.json'; diff --git a/api_docs/kbn_jest_serializers.mdx b/api_docs/kbn_jest_serializers.mdx index 2326104fdf280..a6d26dbe5d774 100644 --- a/api_docs/kbn_jest_serializers.mdx +++ b/api_docs/kbn_jest_serializers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-jest-serializers title: "@kbn/jest-serializers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/jest-serializers plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/jest-serializers'] --- import kbnJestSerializersObj from './kbn_jest_serializers.devdocs.json'; diff --git a/api_docs/kbn_journeys.mdx b/api_docs/kbn_journeys.mdx index 29fd905304841..6b22b642635c5 100644 --- a/api_docs/kbn_journeys.mdx +++ b/api_docs/kbn_journeys.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-journeys title: "@kbn/journeys" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/journeys plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/journeys'] --- import kbnJourneysObj from './kbn_journeys.devdocs.json'; diff --git a/api_docs/kbn_json_ast.mdx b/api_docs/kbn_json_ast.mdx index 67da4efb03bd5..11d6493238c4d 100644 --- a/api_docs/kbn_json_ast.mdx +++ b/api_docs/kbn_json_ast.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-json-ast title: "@kbn/json-ast" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/json-ast plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/json-ast'] --- import kbnJsonAstObj from './kbn_json_ast.devdocs.json'; diff --git a/api_docs/kbn_json_schemas.mdx b/api_docs/kbn_json_schemas.mdx index 9f5a50d068afc..5500be114a847 100644 --- a/api_docs/kbn_json_schemas.mdx +++ b/api_docs/kbn_json_schemas.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-json-schemas title: "@kbn/json-schemas" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/json-schemas plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/json-schemas'] --- import kbnJsonSchemasObj from './kbn_json_schemas.devdocs.json'; diff --git a/api_docs/kbn_kibana_manifest_schema.mdx b/api_docs/kbn_kibana_manifest_schema.mdx index c073220efab58..57bf04da6d251 100644 --- a/api_docs/kbn_kibana_manifest_schema.mdx +++ b/api_docs/kbn_kibana_manifest_schema.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-kibana-manifest-schema title: "@kbn/kibana-manifest-schema" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/kibana-manifest-schema plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/kibana-manifest-schema'] --- import kbnKibanaManifestSchemaObj from './kbn_kibana_manifest_schema.devdocs.json'; diff --git a/api_docs/kbn_language_documentation.mdx b/api_docs/kbn_language_documentation.mdx index b984f2415bdc4..090c6d2702648 100644 --- a/api_docs/kbn_language_documentation.mdx +++ b/api_docs/kbn_language_documentation.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-language-documentation title: "@kbn/language-documentation" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/language-documentation plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/language-documentation'] --- import kbnLanguageDocumentationObj from './kbn_language_documentation.devdocs.json'; diff --git a/api_docs/kbn_lens_embeddable_utils.mdx b/api_docs/kbn_lens_embeddable_utils.mdx index 18f1391fb3dc8..59c1110e68f2d 100644 --- a/api_docs/kbn_lens_embeddable_utils.mdx +++ b/api_docs/kbn_lens_embeddable_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-lens-embeddable-utils title: "@kbn/lens-embeddable-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/lens-embeddable-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/lens-embeddable-utils'] --- import kbnLensEmbeddableUtilsObj from './kbn_lens_embeddable_utils.devdocs.json'; diff --git a/api_docs/kbn_lens_formula_docs.mdx b/api_docs/kbn_lens_formula_docs.mdx index 331a1768f9df4..8b74ddb43264b 100644 --- a/api_docs/kbn_lens_formula_docs.mdx +++ b/api_docs/kbn_lens_formula_docs.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-lens-formula-docs title: "@kbn/lens-formula-docs" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/lens-formula-docs plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/lens-formula-docs'] --- import kbnLensFormulaDocsObj from './kbn_lens_formula_docs.devdocs.json'; diff --git a/api_docs/kbn_logging.mdx b/api_docs/kbn_logging.mdx index da16ef6e9e421..d02514d9dd632 100644 --- a/api_docs/kbn_logging.mdx +++ b/api_docs/kbn_logging.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-logging title: "@kbn/logging" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/logging plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/logging'] --- import kbnLoggingObj from './kbn_logging.devdocs.json'; diff --git a/api_docs/kbn_logging_mocks.mdx b/api_docs/kbn_logging_mocks.mdx index e8f0e3667e6b7..6a37fb4fb0266 100644 --- a/api_docs/kbn_logging_mocks.mdx +++ b/api_docs/kbn_logging_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-logging-mocks title: "@kbn/logging-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/logging-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/logging-mocks'] --- import kbnLoggingMocksObj from './kbn_logging_mocks.devdocs.json'; diff --git a/api_docs/kbn_managed_content_badge.mdx b/api_docs/kbn_managed_content_badge.mdx index aca328ce035fe..2e40f2092ce13 100644 --- a/api_docs/kbn_managed_content_badge.mdx +++ b/api_docs/kbn_managed_content_badge.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-managed-content-badge title: "@kbn/managed-content-badge" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/managed-content-badge plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/managed-content-badge'] --- import kbnManagedContentBadgeObj from './kbn_managed_content_badge.devdocs.json'; diff --git a/api_docs/kbn_managed_vscode_config.mdx b/api_docs/kbn_managed_vscode_config.mdx index 54a3731f60ef0..ca1af907c2054 100644 --- a/api_docs/kbn_managed_vscode_config.mdx +++ b/api_docs/kbn_managed_vscode_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-managed-vscode-config title: "@kbn/managed-vscode-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/managed-vscode-config plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/managed-vscode-config'] --- import kbnManagedVscodeConfigObj from './kbn_managed_vscode_config.devdocs.json'; diff --git a/api_docs/kbn_management_cards_navigation.mdx b/api_docs/kbn_management_cards_navigation.mdx index 3ec3a0ed53963..ec36db9e3b5db 100644 --- a/api_docs/kbn_management_cards_navigation.mdx +++ b/api_docs/kbn_management_cards_navigation.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-cards-navigation title: "@kbn/management-cards-navigation" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-cards-navigation plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-cards-navigation'] --- import kbnManagementCardsNavigationObj from './kbn_management_cards_navigation.devdocs.json'; diff --git a/api_docs/kbn_management_settings_application.mdx b/api_docs/kbn_management_settings_application.mdx index 6c85c9d2c2819..5193e5ff8f9e2 100644 --- a/api_docs/kbn_management_settings_application.mdx +++ b/api_docs/kbn_management_settings_application.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-settings-application title: "@kbn/management-settings-application" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-settings-application plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-settings-application'] --- import kbnManagementSettingsApplicationObj from './kbn_management_settings_application.devdocs.json'; diff --git a/api_docs/kbn_management_settings_components_field_category.mdx b/api_docs/kbn_management_settings_components_field_category.mdx index 0f0d3fc47f937..84444c534151e 100644 --- a/api_docs/kbn_management_settings_components_field_category.mdx +++ b/api_docs/kbn_management_settings_components_field_category.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-settings-components-field-category title: "@kbn/management-settings-components-field-category" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-settings-components-field-category plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-settings-components-field-category'] --- import kbnManagementSettingsComponentsFieldCategoryObj from './kbn_management_settings_components_field_category.devdocs.json'; diff --git a/api_docs/kbn_management_settings_components_field_input.mdx b/api_docs/kbn_management_settings_components_field_input.mdx index 898f3cf066d5c..775375de40128 100644 --- a/api_docs/kbn_management_settings_components_field_input.mdx +++ b/api_docs/kbn_management_settings_components_field_input.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-settings-components-field-input title: "@kbn/management-settings-components-field-input" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-settings-components-field-input plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-settings-components-field-input'] --- import kbnManagementSettingsComponentsFieldInputObj from './kbn_management_settings_components_field_input.devdocs.json'; diff --git a/api_docs/kbn_management_settings_components_field_row.mdx b/api_docs/kbn_management_settings_components_field_row.mdx index a5ba449014f31..a9d1e0deda03b 100644 --- a/api_docs/kbn_management_settings_components_field_row.mdx +++ b/api_docs/kbn_management_settings_components_field_row.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-settings-components-field-row title: "@kbn/management-settings-components-field-row" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-settings-components-field-row plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-settings-components-field-row'] --- import kbnManagementSettingsComponentsFieldRowObj from './kbn_management_settings_components_field_row.devdocs.json'; diff --git a/api_docs/kbn_management_settings_components_form.mdx b/api_docs/kbn_management_settings_components_form.mdx index 7394037614e33..3994861aad1ef 100644 --- a/api_docs/kbn_management_settings_components_form.mdx +++ b/api_docs/kbn_management_settings_components_form.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-settings-components-form title: "@kbn/management-settings-components-form" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-settings-components-form plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-settings-components-form'] --- import kbnManagementSettingsComponentsFormObj from './kbn_management_settings_components_form.devdocs.json'; diff --git a/api_docs/kbn_management_settings_field_definition.mdx b/api_docs/kbn_management_settings_field_definition.mdx index b7cdeb4e7a514..aeb6bebfbe4c2 100644 --- a/api_docs/kbn_management_settings_field_definition.mdx +++ b/api_docs/kbn_management_settings_field_definition.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-settings-field-definition title: "@kbn/management-settings-field-definition" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-settings-field-definition plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-settings-field-definition'] --- import kbnManagementSettingsFieldDefinitionObj from './kbn_management_settings_field_definition.devdocs.json'; diff --git a/api_docs/kbn_management_settings_ids.mdx b/api_docs/kbn_management_settings_ids.mdx index c6a5a442cab05..820a887822f7a 100644 --- a/api_docs/kbn_management_settings_ids.mdx +++ b/api_docs/kbn_management_settings_ids.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-settings-ids title: "@kbn/management-settings-ids" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-settings-ids plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-settings-ids'] --- import kbnManagementSettingsIdsObj from './kbn_management_settings_ids.devdocs.json'; diff --git a/api_docs/kbn_management_settings_section_registry.mdx b/api_docs/kbn_management_settings_section_registry.mdx index a79bc0649ab98..ab4b2d9db3eb1 100644 --- a/api_docs/kbn_management_settings_section_registry.mdx +++ b/api_docs/kbn_management_settings_section_registry.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-settings-section-registry title: "@kbn/management-settings-section-registry" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-settings-section-registry plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-settings-section-registry'] --- import kbnManagementSettingsSectionRegistryObj from './kbn_management_settings_section_registry.devdocs.json'; diff --git a/api_docs/kbn_management_settings_types.mdx b/api_docs/kbn_management_settings_types.mdx index d766d74c64597..50002e44d3671 100644 --- a/api_docs/kbn_management_settings_types.mdx +++ b/api_docs/kbn_management_settings_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-settings-types title: "@kbn/management-settings-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-settings-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-settings-types'] --- import kbnManagementSettingsTypesObj from './kbn_management_settings_types.devdocs.json'; diff --git a/api_docs/kbn_management_settings_utilities.mdx b/api_docs/kbn_management_settings_utilities.mdx index 50855372e1571..816b88e233134 100644 --- a/api_docs/kbn_management_settings_utilities.mdx +++ b/api_docs/kbn_management_settings_utilities.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-settings-utilities title: "@kbn/management-settings-utilities" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-settings-utilities plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-settings-utilities'] --- import kbnManagementSettingsUtilitiesObj from './kbn_management_settings_utilities.devdocs.json'; diff --git a/api_docs/kbn_management_storybook_config.mdx b/api_docs/kbn_management_storybook_config.mdx index 6744d8ecda9a5..d920b6d2d314c 100644 --- a/api_docs/kbn_management_storybook_config.mdx +++ b/api_docs/kbn_management_storybook_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-management-storybook-config title: "@kbn/management-storybook-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/management-storybook-config plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/management-storybook-config'] --- import kbnManagementStorybookConfigObj from './kbn_management_storybook_config.devdocs.json'; diff --git a/api_docs/kbn_manifest.mdx b/api_docs/kbn_manifest.mdx index cf274a13f0e4d..aff9287c745c8 100644 --- a/api_docs/kbn_manifest.mdx +++ b/api_docs/kbn_manifest.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-manifest title: "@kbn/manifest" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/manifest plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/manifest'] --- import kbnManifestObj from './kbn_manifest.devdocs.json'; diff --git a/api_docs/kbn_mapbox_gl.mdx b/api_docs/kbn_mapbox_gl.mdx index 7901329ad2f37..9abcee14c8e41 100644 --- a/api_docs/kbn_mapbox_gl.mdx +++ b/api_docs/kbn_mapbox_gl.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-mapbox-gl title: "@kbn/mapbox-gl" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/mapbox-gl plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/mapbox-gl'] --- import kbnMapboxGlObj from './kbn_mapbox_gl.devdocs.json'; diff --git a/api_docs/kbn_maps_vector_tile_utils.mdx b/api_docs/kbn_maps_vector_tile_utils.mdx index a13789db6c1be..f63532d26a526 100644 --- a/api_docs/kbn_maps_vector_tile_utils.mdx +++ b/api_docs/kbn_maps_vector_tile_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-maps-vector-tile-utils title: "@kbn/maps-vector-tile-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/maps-vector-tile-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/maps-vector-tile-utils'] --- import kbnMapsVectorTileUtilsObj from './kbn_maps_vector_tile_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_agg_utils.mdx b/api_docs/kbn_ml_agg_utils.mdx index fd9bf9b501a94..07170bae0914c 100644 --- a/api_docs/kbn_ml_agg_utils.mdx +++ b/api_docs/kbn_ml_agg_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-agg-utils title: "@kbn/ml-agg-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-agg-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-agg-utils'] --- import kbnMlAggUtilsObj from './kbn_ml_agg_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_anomaly_utils.mdx b/api_docs/kbn_ml_anomaly_utils.mdx index 80fc254f3df5e..103b41617b971 100644 --- a/api_docs/kbn_ml_anomaly_utils.mdx +++ b/api_docs/kbn_ml_anomaly_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-anomaly-utils title: "@kbn/ml-anomaly-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-anomaly-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-anomaly-utils'] --- import kbnMlAnomalyUtilsObj from './kbn_ml_anomaly_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_cancellable_search.mdx b/api_docs/kbn_ml_cancellable_search.mdx index 3dc6afdb39c5f..ca3823fca9cb7 100644 --- a/api_docs/kbn_ml_cancellable_search.mdx +++ b/api_docs/kbn_ml_cancellable_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-cancellable-search title: "@kbn/ml-cancellable-search" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-cancellable-search plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-cancellable-search'] --- import kbnMlCancellableSearchObj from './kbn_ml_cancellable_search.devdocs.json'; diff --git a/api_docs/kbn_ml_category_validator.mdx b/api_docs/kbn_ml_category_validator.mdx index 091d95c0c30a2..b00f17a2b7b5e 100644 --- a/api_docs/kbn_ml_category_validator.mdx +++ b/api_docs/kbn_ml_category_validator.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-category-validator title: "@kbn/ml-category-validator" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-category-validator plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-category-validator'] --- import kbnMlCategoryValidatorObj from './kbn_ml_category_validator.devdocs.json'; diff --git a/api_docs/kbn_ml_chi2test.mdx b/api_docs/kbn_ml_chi2test.mdx index fa68f284f67d3..627406f8d0146 100644 --- a/api_docs/kbn_ml_chi2test.mdx +++ b/api_docs/kbn_ml_chi2test.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-chi2test title: "@kbn/ml-chi2test" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-chi2test plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-chi2test'] --- import kbnMlChi2testObj from './kbn_ml_chi2test.devdocs.json'; diff --git a/api_docs/kbn_ml_data_frame_analytics_utils.mdx b/api_docs/kbn_ml_data_frame_analytics_utils.mdx index a9326362394b4..0241cecdf5ddc 100644 --- a/api_docs/kbn_ml_data_frame_analytics_utils.mdx +++ b/api_docs/kbn_ml_data_frame_analytics_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-data-frame-analytics-utils title: "@kbn/ml-data-frame-analytics-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-data-frame-analytics-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-data-frame-analytics-utils'] --- import kbnMlDataFrameAnalyticsUtilsObj from './kbn_ml_data_frame_analytics_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_data_grid.mdx b/api_docs/kbn_ml_data_grid.mdx index 79fe13a800199..4b147ace76c9c 100644 --- a/api_docs/kbn_ml_data_grid.mdx +++ b/api_docs/kbn_ml_data_grid.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-data-grid title: "@kbn/ml-data-grid" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-data-grid plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-data-grid'] --- import kbnMlDataGridObj from './kbn_ml_data_grid.devdocs.json'; diff --git a/api_docs/kbn_ml_date_picker.mdx b/api_docs/kbn_ml_date_picker.mdx index b150340b29587..6f8012fa8bbcf 100644 --- a/api_docs/kbn_ml_date_picker.mdx +++ b/api_docs/kbn_ml_date_picker.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-date-picker title: "@kbn/ml-date-picker" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-date-picker plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-date-picker'] --- import kbnMlDatePickerObj from './kbn_ml_date_picker.devdocs.json'; diff --git a/api_docs/kbn_ml_date_utils.mdx b/api_docs/kbn_ml_date_utils.mdx index 43a5022ad7f3e..00a4bbf3adf11 100644 --- a/api_docs/kbn_ml_date_utils.mdx +++ b/api_docs/kbn_ml_date_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-date-utils title: "@kbn/ml-date-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-date-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-date-utils'] --- import kbnMlDateUtilsObj from './kbn_ml_date_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_error_utils.mdx b/api_docs/kbn_ml_error_utils.mdx index d693a22a343f1..30f0bf06b92a6 100644 --- a/api_docs/kbn_ml_error_utils.mdx +++ b/api_docs/kbn_ml_error_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-error-utils title: "@kbn/ml-error-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-error-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-error-utils'] --- import kbnMlErrorUtilsObj from './kbn_ml_error_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_field_stats_flyout.mdx b/api_docs/kbn_ml_field_stats_flyout.mdx index c83147d9ab583..66fb04140bd35 100644 --- a/api_docs/kbn_ml_field_stats_flyout.mdx +++ b/api_docs/kbn_ml_field_stats_flyout.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-field-stats-flyout title: "@kbn/ml-field-stats-flyout" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-field-stats-flyout plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-field-stats-flyout'] --- import kbnMlFieldStatsFlyoutObj from './kbn_ml_field_stats_flyout.devdocs.json'; diff --git a/api_docs/kbn_ml_in_memory_table.mdx b/api_docs/kbn_ml_in_memory_table.mdx index d322c95878243..193779728388d 100644 --- a/api_docs/kbn_ml_in_memory_table.mdx +++ b/api_docs/kbn_ml_in_memory_table.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-in-memory-table title: "@kbn/ml-in-memory-table" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-in-memory-table plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-in-memory-table'] --- import kbnMlInMemoryTableObj from './kbn_ml_in_memory_table.devdocs.json'; diff --git a/api_docs/kbn_ml_is_defined.mdx b/api_docs/kbn_ml_is_defined.mdx index e5c7c38d38a84..35993d787a090 100644 --- a/api_docs/kbn_ml_is_defined.mdx +++ b/api_docs/kbn_ml_is_defined.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-is-defined title: "@kbn/ml-is-defined" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-is-defined plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-is-defined'] --- import kbnMlIsDefinedObj from './kbn_ml_is_defined.devdocs.json'; diff --git a/api_docs/kbn_ml_is_populated_object.mdx b/api_docs/kbn_ml_is_populated_object.mdx index 8ed3ac2e4e22f..5bebef5106bdc 100644 --- a/api_docs/kbn_ml_is_populated_object.mdx +++ b/api_docs/kbn_ml_is_populated_object.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-is-populated-object title: "@kbn/ml-is-populated-object" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-is-populated-object plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-is-populated-object'] --- import kbnMlIsPopulatedObjectObj from './kbn_ml_is_populated_object.devdocs.json'; diff --git a/api_docs/kbn_ml_kibana_theme.mdx b/api_docs/kbn_ml_kibana_theme.mdx index 9be101f87a477..5b24a4e177e0f 100644 --- a/api_docs/kbn_ml_kibana_theme.mdx +++ b/api_docs/kbn_ml_kibana_theme.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-kibana-theme title: "@kbn/ml-kibana-theme" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-kibana-theme plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-kibana-theme'] --- import kbnMlKibanaThemeObj from './kbn_ml_kibana_theme.devdocs.json'; diff --git a/api_docs/kbn_ml_local_storage.mdx b/api_docs/kbn_ml_local_storage.mdx index b499971c44fc9..c8e3b38ead011 100644 --- a/api_docs/kbn_ml_local_storage.mdx +++ b/api_docs/kbn_ml_local_storage.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-local-storage title: "@kbn/ml-local-storage" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-local-storage plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-local-storage'] --- import kbnMlLocalStorageObj from './kbn_ml_local_storage.devdocs.json'; diff --git a/api_docs/kbn_ml_nested_property.mdx b/api_docs/kbn_ml_nested_property.mdx index c9cfcfc8e82a3..5969cc11d46b8 100644 --- a/api_docs/kbn_ml_nested_property.mdx +++ b/api_docs/kbn_ml_nested_property.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-nested-property title: "@kbn/ml-nested-property" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-nested-property plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-nested-property'] --- import kbnMlNestedPropertyObj from './kbn_ml_nested_property.devdocs.json'; diff --git a/api_docs/kbn_ml_number_utils.mdx b/api_docs/kbn_ml_number_utils.mdx index 048bafe0c598c..ea1e230ef9fa5 100644 --- a/api_docs/kbn_ml_number_utils.mdx +++ b/api_docs/kbn_ml_number_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-number-utils title: "@kbn/ml-number-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-number-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-number-utils'] --- import kbnMlNumberUtilsObj from './kbn_ml_number_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_parse_interval.mdx b/api_docs/kbn_ml_parse_interval.mdx index 3a057e2276e43..f132ae5b8d04e 100644 --- a/api_docs/kbn_ml_parse_interval.mdx +++ b/api_docs/kbn_ml_parse_interval.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-parse-interval title: "@kbn/ml-parse-interval" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-parse-interval plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-parse-interval'] --- import kbnMlParseIntervalObj from './kbn_ml_parse_interval.devdocs.json'; diff --git a/api_docs/kbn_ml_query_utils.mdx b/api_docs/kbn_ml_query_utils.mdx index ed886af612037..f17bc1f24795a 100644 --- a/api_docs/kbn_ml_query_utils.mdx +++ b/api_docs/kbn_ml_query_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-query-utils title: "@kbn/ml-query-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-query-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-query-utils'] --- import kbnMlQueryUtilsObj from './kbn_ml_query_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_random_sampler_utils.mdx b/api_docs/kbn_ml_random_sampler_utils.mdx index 57711177bff78..6edeadd03cb32 100644 --- a/api_docs/kbn_ml_random_sampler_utils.mdx +++ b/api_docs/kbn_ml_random_sampler_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-random-sampler-utils title: "@kbn/ml-random-sampler-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-random-sampler-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-random-sampler-utils'] --- import kbnMlRandomSamplerUtilsObj from './kbn_ml_random_sampler_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_route_utils.mdx b/api_docs/kbn_ml_route_utils.mdx index 521037f178ae2..a2b8962092367 100644 --- a/api_docs/kbn_ml_route_utils.mdx +++ b/api_docs/kbn_ml_route_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-route-utils title: "@kbn/ml-route-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-route-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-route-utils'] --- import kbnMlRouteUtilsObj from './kbn_ml_route_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_runtime_field_utils.mdx b/api_docs/kbn_ml_runtime_field_utils.mdx index e7356e3bfc421..a5f8e062d3cef 100644 --- a/api_docs/kbn_ml_runtime_field_utils.mdx +++ b/api_docs/kbn_ml_runtime_field_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-runtime-field-utils title: "@kbn/ml-runtime-field-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-runtime-field-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-runtime-field-utils'] --- import kbnMlRuntimeFieldUtilsObj from './kbn_ml_runtime_field_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_string_hash.mdx b/api_docs/kbn_ml_string_hash.mdx index e6b02e756a9d8..3ffd7bd370809 100644 --- a/api_docs/kbn_ml_string_hash.mdx +++ b/api_docs/kbn_ml_string_hash.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-string-hash title: "@kbn/ml-string-hash" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-string-hash plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-string-hash'] --- import kbnMlStringHashObj from './kbn_ml_string_hash.devdocs.json'; diff --git a/api_docs/kbn_ml_time_buckets.mdx b/api_docs/kbn_ml_time_buckets.mdx index 55d0a275f06cf..a71518a993b92 100644 --- a/api_docs/kbn_ml_time_buckets.mdx +++ b/api_docs/kbn_ml_time_buckets.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-time-buckets title: "@kbn/ml-time-buckets" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-time-buckets plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-time-buckets'] --- import kbnMlTimeBucketsObj from './kbn_ml_time_buckets.devdocs.json'; diff --git a/api_docs/kbn_ml_trained_models_utils.mdx b/api_docs/kbn_ml_trained_models_utils.mdx index 45e27d757bf6e..3a0432c880c8b 100644 --- a/api_docs/kbn_ml_trained_models_utils.mdx +++ b/api_docs/kbn_ml_trained_models_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-trained-models-utils title: "@kbn/ml-trained-models-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-trained-models-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-trained-models-utils'] --- import kbnMlTrainedModelsUtilsObj from './kbn_ml_trained_models_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_ui_actions.mdx b/api_docs/kbn_ml_ui_actions.mdx index 0eafe665f1809..f2105856cceb3 100644 --- a/api_docs/kbn_ml_ui_actions.mdx +++ b/api_docs/kbn_ml_ui_actions.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-ui-actions title: "@kbn/ml-ui-actions" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-ui-actions plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-ui-actions'] --- import kbnMlUiActionsObj from './kbn_ml_ui_actions.devdocs.json'; diff --git a/api_docs/kbn_ml_url_state.mdx b/api_docs/kbn_ml_url_state.mdx index c7db61b936d08..6662e6b89afe6 100644 --- a/api_docs/kbn_ml_url_state.mdx +++ b/api_docs/kbn_ml_url_state.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-url-state title: "@kbn/ml-url-state" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-url-state plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-url-state'] --- import kbnMlUrlStateObj from './kbn_ml_url_state.devdocs.json'; diff --git a/api_docs/kbn_ml_validators.mdx b/api_docs/kbn_ml_validators.mdx index 5dc13ba5b674a..667311c58bb89 100644 --- a/api_docs/kbn_ml_validators.mdx +++ b/api_docs/kbn_ml_validators.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-validators title: "@kbn/ml-validators" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-validators plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-validators'] --- import kbnMlValidatorsObj from './kbn_ml_validators.devdocs.json'; diff --git a/api_docs/kbn_mock_idp_utils.mdx b/api_docs/kbn_mock_idp_utils.mdx index c4877945d3fc7..b0ddbd056b341 100644 --- a/api_docs/kbn_mock_idp_utils.mdx +++ b/api_docs/kbn_mock_idp_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-mock-idp-utils title: "@kbn/mock-idp-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/mock-idp-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/mock-idp-utils'] --- import kbnMockIdpUtilsObj from './kbn_mock_idp_utils.devdocs.json'; diff --git a/api_docs/kbn_monaco.mdx b/api_docs/kbn_monaco.mdx index 67288ca18f081..53926c1c55a34 100644 --- a/api_docs/kbn_monaco.mdx +++ b/api_docs/kbn_monaco.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-monaco title: "@kbn/monaco" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/monaco plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/monaco'] --- import kbnMonacoObj from './kbn_monaco.devdocs.json'; diff --git a/api_docs/kbn_object_versioning.mdx b/api_docs/kbn_object_versioning.mdx index 93cac837e9286..65d5efb93daf5 100644 --- a/api_docs/kbn_object_versioning.mdx +++ b/api_docs/kbn_object_versioning.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-object-versioning title: "@kbn/object-versioning" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/object-versioning plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/object-versioning'] --- import kbnObjectVersioningObj from './kbn_object_versioning.devdocs.json'; diff --git a/api_docs/kbn_object_versioning_utils.mdx b/api_docs/kbn_object_versioning_utils.mdx index 9793fa86c54c0..826a6d8dd2c17 100644 --- a/api_docs/kbn_object_versioning_utils.mdx +++ b/api_docs/kbn_object_versioning_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-object-versioning-utils title: "@kbn/object-versioning-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/object-versioning-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/object-versioning-utils'] --- import kbnObjectVersioningUtilsObj from './kbn_object_versioning_utils.devdocs.json'; diff --git a/api_docs/kbn_observability_alert_details.mdx b/api_docs/kbn_observability_alert_details.mdx index d1e0215d12884..56e416d7641de 100644 --- a/api_docs/kbn_observability_alert_details.mdx +++ b/api_docs/kbn_observability_alert_details.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-observability-alert-details title: "@kbn/observability-alert-details" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/observability-alert-details plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/observability-alert-details'] --- import kbnObservabilityAlertDetailsObj from './kbn_observability_alert_details.devdocs.json'; diff --git a/api_docs/kbn_observability_alerting_rule_utils.mdx b/api_docs/kbn_observability_alerting_rule_utils.mdx index 1ac262e910307..dde8f5839cbe9 100644 --- a/api_docs/kbn_observability_alerting_rule_utils.mdx +++ b/api_docs/kbn_observability_alerting_rule_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-observability-alerting-rule-utils title: "@kbn/observability-alerting-rule-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/observability-alerting-rule-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/observability-alerting-rule-utils'] --- import kbnObservabilityAlertingRuleUtilsObj from './kbn_observability_alerting_rule_utils.devdocs.json'; diff --git a/api_docs/kbn_observability_alerting_test_data.mdx b/api_docs/kbn_observability_alerting_test_data.mdx index 5162c11991780..1d555ed8230f9 100644 --- a/api_docs/kbn_observability_alerting_test_data.mdx +++ b/api_docs/kbn_observability_alerting_test_data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-observability-alerting-test-data title: "@kbn/observability-alerting-test-data" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/observability-alerting-test-data plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/observability-alerting-test-data'] --- import kbnObservabilityAlertingTestDataObj from './kbn_observability_alerting_test_data.devdocs.json'; diff --git a/api_docs/kbn_observability_get_padded_alert_time_range_util.mdx b/api_docs/kbn_observability_get_padded_alert_time_range_util.mdx index 6a2ea8b073f86..f3380e3aa41eb 100644 --- a/api_docs/kbn_observability_get_padded_alert_time_range_util.mdx +++ b/api_docs/kbn_observability_get_padded_alert_time_range_util.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-observability-get-padded-alert-time-range-util title: "@kbn/observability-get-padded-alert-time-range-util" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/observability-get-padded-alert-time-range-util plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/observability-get-padded-alert-time-range-util'] --- import kbnObservabilityGetPaddedAlertTimeRangeUtilObj from './kbn_observability_get_padded_alert_time_range_util.devdocs.json'; diff --git a/api_docs/kbn_observability_logs_overview.mdx b/api_docs/kbn_observability_logs_overview.mdx index 397296c38b9a5..0a9c546304bda 100644 --- a/api_docs/kbn_observability_logs_overview.mdx +++ b/api_docs/kbn_observability_logs_overview.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-observability-logs-overview title: "@kbn/observability-logs-overview" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/observability-logs-overview plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/observability-logs-overview'] --- import kbnObservabilityLogsOverviewObj from './kbn_observability_logs_overview.devdocs.json'; diff --git a/api_docs/kbn_observability_synthetics_test_data.mdx b/api_docs/kbn_observability_synthetics_test_data.mdx index 813210e82937b..5b65c86005640 100644 --- a/api_docs/kbn_observability_synthetics_test_data.mdx +++ b/api_docs/kbn_observability_synthetics_test_data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-observability-synthetics-test-data title: "@kbn/observability-synthetics-test-data" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/observability-synthetics-test-data plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/observability-synthetics-test-data'] --- import kbnObservabilitySyntheticsTestDataObj from './kbn_observability_synthetics_test_data.devdocs.json'; diff --git a/api_docs/kbn_openapi_bundler.mdx b/api_docs/kbn_openapi_bundler.mdx index fe3909fdf21ed..408b93acb7343 100644 --- a/api_docs/kbn_openapi_bundler.mdx +++ b/api_docs/kbn_openapi_bundler.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-openapi-bundler title: "@kbn/openapi-bundler" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/openapi-bundler plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/openapi-bundler'] --- import kbnOpenapiBundlerObj from './kbn_openapi_bundler.devdocs.json'; diff --git a/api_docs/kbn_openapi_generator.mdx b/api_docs/kbn_openapi_generator.mdx index 14c6da66974be..2cb8fea42618f 100644 --- a/api_docs/kbn_openapi_generator.mdx +++ b/api_docs/kbn_openapi_generator.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-openapi-generator title: "@kbn/openapi-generator" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/openapi-generator plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/openapi-generator'] --- import kbnOpenapiGeneratorObj from './kbn_openapi_generator.devdocs.json'; diff --git a/api_docs/kbn_optimizer.mdx b/api_docs/kbn_optimizer.mdx index 5258d36c8c9d2..e7bbc53b6b1f8 100644 --- a/api_docs/kbn_optimizer.mdx +++ b/api_docs/kbn_optimizer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-optimizer title: "@kbn/optimizer" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/optimizer plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/optimizer'] --- import kbnOptimizerObj from './kbn_optimizer.devdocs.json'; diff --git a/api_docs/kbn_optimizer_webpack_helpers.mdx b/api_docs/kbn_optimizer_webpack_helpers.mdx index 2ab4632f29b71..78a27b3faa5d0 100644 --- a/api_docs/kbn_optimizer_webpack_helpers.mdx +++ b/api_docs/kbn_optimizer_webpack_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-optimizer-webpack-helpers title: "@kbn/optimizer-webpack-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/optimizer-webpack-helpers plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/optimizer-webpack-helpers'] --- import kbnOptimizerWebpackHelpersObj from './kbn_optimizer_webpack_helpers.devdocs.json'; diff --git a/api_docs/kbn_osquery_io_ts_types.mdx b/api_docs/kbn_osquery_io_ts_types.mdx index 059e396955b4c..51955ddbfa84c 100644 --- a/api_docs/kbn_osquery_io_ts_types.mdx +++ b/api_docs/kbn_osquery_io_ts_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-osquery-io-ts-types title: "@kbn/osquery-io-ts-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/osquery-io-ts-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/osquery-io-ts-types'] --- import kbnOsqueryIoTsTypesObj from './kbn_osquery_io_ts_types.devdocs.json'; diff --git a/api_docs/kbn_panel_loader.mdx b/api_docs/kbn_panel_loader.mdx index 68affd833a0a3..cbabc2da6b757 100644 --- a/api_docs/kbn_panel_loader.mdx +++ b/api_docs/kbn_panel_loader.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-panel-loader title: "@kbn/panel-loader" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/panel-loader plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/panel-loader'] --- import kbnPanelLoaderObj from './kbn_panel_loader.devdocs.json'; diff --git a/api_docs/kbn_performance_testing_dataset_extractor.mdx b/api_docs/kbn_performance_testing_dataset_extractor.mdx index d1c2019ad2605..a6a447d772684 100644 --- a/api_docs/kbn_performance_testing_dataset_extractor.mdx +++ b/api_docs/kbn_performance_testing_dataset_extractor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-performance-testing-dataset-extractor title: "@kbn/performance-testing-dataset-extractor" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/performance-testing-dataset-extractor plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/performance-testing-dataset-extractor'] --- import kbnPerformanceTestingDatasetExtractorObj from './kbn_performance_testing_dataset_extractor.devdocs.json'; diff --git a/api_docs/kbn_plugin_check.mdx b/api_docs/kbn_plugin_check.mdx index 55016c5319c20..e532cb43b974c 100644 --- a/api_docs/kbn_plugin_check.mdx +++ b/api_docs/kbn_plugin_check.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-plugin-check title: "@kbn/plugin-check" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/plugin-check plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/plugin-check'] --- import kbnPluginCheckObj from './kbn_plugin_check.devdocs.json'; diff --git a/api_docs/kbn_plugin_generator.mdx b/api_docs/kbn_plugin_generator.mdx index 7b52efeb7389f..a621e1637afd3 100644 --- a/api_docs/kbn_plugin_generator.mdx +++ b/api_docs/kbn_plugin_generator.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-plugin-generator title: "@kbn/plugin-generator" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/plugin-generator plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/plugin-generator'] --- import kbnPluginGeneratorObj from './kbn_plugin_generator.devdocs.json'; diff --git a/api_docs/kbn_plugin_helpers.mdx b/api_docs/kbn_plugin_helpers.mdx index 530a546242b40..fe2913bec81fb 100644 --- a/api_docs/kbn_plugin_helpers.mdx +++ b/api_docs/kbn_plugin_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-plugin-helpers title: "@kbn/plugin-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/plugin-helpers plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/plugin-helpers'] --- import kbnPluginHelpersObj from './kbn_plugin_helpers.devdocs.json'; diff --git a/api_docs/kbn_presentation_containers.mdx b/api_docs/kbn_presentation_containers.mdx index 1ba98abe742e4..c5cb58046e3e0 100644 --- a/api_docs/kbn_presentation_containers.mdx +++ b/api_docs/kbn_presentation_containers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-presentation-containers title: "@kbn/presentation-containers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/presentation-containers plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/presentation-containers'] --- import kbnPresentationContainersObj from './kbn_presentation_containers.devdocs.json'; diff --git a/api_docs/kbn_presentation_publishing.devdocs.json b/api_docs/kbn_presentation_publishing.devdocs.json index 59b096c6077e7..fef2bc2149a7e 100644 --- a/api_docs/kbn_presentation_publishing.devdocs.json +++ b/api_docs/kbn_presentation_publishing.devdocs.json @@ -930,6 +930,46 @@ "returnComment": [], "initialIsOpen": false }, + { + "parentPluginId": "@kbn/presentation-publishing", + "id": "def-public.apiPublishesRendered", + "type": "Function", + "tags": [], + "label": "apiPublishesRendered", + "description": [], + "signature": [ + "(unknownApi: unknown) => unknownApi is ", + { + "pluginId": "@kbn/presentation-publishing", + "scope": "public", + "docId": "kibKbnPresentationPublishingPluginApi", + "section": "def-public.PublishesRendered", + "text": "PublishesRendered" + } + ], + "path": "packages/presentation/presentation_publishing/interfaces/publishes_rendered.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/presentation-publishing", + "id": "def-public.apiPublishesRendered.$1", + "type": "Unknown", + "tags": [], + "label": "unknownApi", + "description": [], + "signature": [ + "unknown" + ], + "path": "packages/presentation/presentation_publishing/interfaces/publishes_rendered.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + }, { "parentPluginId": "@kbn/presentation-publishing", "id": "def-public.apiPublishesSavedObjectId", @@ -6068,6 +6108,184 @@ ], "initialIsOpen": false }, + { + "parentPluginId": "@kbn/presentation-publishing", + "id": "def-public.PublishesRendered", + "type": "Interface", + "tags": [], + "label": "PublishesRendered", + "description": [], + "path": "packages/presentation/presentation_publishing/interfaces/publishes_rendered.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/presentation-publishing", + "id": "def-public.PublishesRendered.rendered$", + "type": "Object", + "tags": [], + "label": "rendered$", + "description": [], + "signature": [ + "{ source: ", + "Observable", + " | undefined; readonly value: boolean; error: (err: any) => void; forEach: { (next: (value: boolean) => void): Promise; (next: (value: boolean) => void, promiseCtor: PromiseConstructorLike): Promise; }; complete: () => void; getValue: () => boolean; closed: boolean; pipe: { (): ", + "Observable", + "; (op1: ", + "OperatorFunction", + "): ", + "Observable", + "; (op1: ", + "OperatorFunction", + ", op2: ", + "OperatorFunction", + "): ", + "Observable", + "; (op1: ", + "OperatorFunction", + ", op2: ", + "OperatorFunction", + ", op3: ", + "OperatorFunction", + "): ", + "Observable", + "; (op1: ", + "OperatorFunction", + ", op2: ", + "OperatorFunction", + ", op3: ", + "OperatorFunction", + ", op4: ", + "OperatorFunction", + "): ", + "Observable", + "; (op1: ", + "OperatorFunction", + ", op2: ", + "OperatorFunction", + ", op3: ", + "OperatorFunction", + ", op4: ", + "OperatorFunction", + ", op5: ", + "OperatorFunction", + "): ", + "Observable", + "; (op1: ", + "OperatorFunction", + ", op2: ", + "OperatorFunction", + ", op3: ", + "OperatorFunction", + ", op4: ", + "OperatorFunction", + ", op5: ", + "OperatorFunction", + ", op6: ", + "OperatorFunction", + "): ", + "Observable", + "; (op1: ", + "OperatorFunction", + ", op2: ", + "OperatorFunction", + ", op3: ", + "OperatorFunction", + ", op4: ", + "OperatorFunction", + ", op5: ", + "OperatorFunction", + ", op6: ", + "OperatorFunction", + ", op7: ", + "OperatorFunction", + "): ", + "Observable", + "; (op1: ", + "OperatorFunction", + ", op2: ", + "OperatorFunction", + ", op3: ", + "OperatorFunction", + ", op4: ", + "OperatorFunction", + ", op5: ", + "OperatorFunction", + ", op6: ", + "OperatorFunction", + ", op7: ", + "OperatorFunction", + ", op8: ", + "OperatorFunction", + "): ", + "Observable", + "; (op1: ", + "OperatorFunction", + ", op2: ", + "OperatorFunction", + ", op3: ", + "OperatorFunction", + ", op4: ", + "OperatorFunction", + ", op5: ", + "OperatorFunction", + ", op6: ", + "OperatorFunction", + ", op7: ", + "OperatorFunction", + ", op8: ", + "OperatorFunction", + ", op9: ", + "OperatorFunction", + "): ", + "Observable", + "; (op1: ", + "OperatorFunction", + ", op2: ", + "OperatorFunction", + ", op3: ", + "OperatorFunction", + ", op4: ", + "OperatorFunction", + ", op5: ", + "OperatorFunction", + ", op6: ", + "OperatorFunction", + ", op7: ", + "OperatorFunction", + ", op8: ", + "OperatorFunction", + ", op9: ", + "OperatorFunction", + ", ...operations: ", + "OperatorFunction", + "[]): ", + "Observable", + "; }; operator: ", + "Operator", + " | undefined; lift: (operator: ", + "Operator", + ") => ", + "Observable", + "; subscribe: { (observerOrNext?: Partial<", + "Observer", + "> | ((value: boolean) => void) | undefined): ", + "Subscription", + "; (next?: ((value: boolean) => void) | null | undefined, error?: ((error: any) => void) | null | undefined, complete?: (() => void) | null | undefined): ", + "Subscription", + "; }; toPromise: { (): Promise; (PromiseCtor: PromiseConstructor): Promise; (PromiseCtor: PromiseConstructorLike): Promise; }; observers: ", + "Observer", + "[]; isStopped: boolean; hasError: boolean; thrownError: any; unsubscribe: () => void; readonly observed: boolean; asObservable: () => ", + "Observable", + "; }" + ], + "path": "packages/presentation/presentation_publishing/interfaces/publishes_rendered.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "@kbn/presentation-publishing", "id": "def-public.PublishesSavedObjectId", diff --git a/api_docs/kbn_presentation_publishing.mdx b/api_docs/kbn_presentation_publishing.mdx index 76286971e8842..24a4bb0388453 100644 --- a/api_docs/kbn_presentation_publishing.mdx +++ b/api_docs/kbn_presentation_publishing.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-presentation-publishing title: "@kbn/presentation-publishing" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/presentation-publishing plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/presentation-publishing'] --- import kbnPresentationPublishingObj from './kbn_presentation_publishing.devdocs.json'; @@ -21,7 +21,7 @@ Contact [@elastic/kibana-presentation](https://github.com/orgs/elastic/teams/kib | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 224 | 0 | 188 | 6 | +| 228 | 0 | 192 | 6 | ## Client diff --git a/api_docs/kbn_product_doc_artifact_builder.mdx b/api_docs/kbn_product_doc_artifact_builder.mdx index eacf89c932c8c..cb6468a647068 100644 --- a/api_docs/kbn_product_doc_artifact_builder.mdx +++ b/api_docs/kbn_product_doc_artifact_builder.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-product-doc-artifact-builder title: "@kbn/product-doc-artifact-builder" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/product-doc-artifact-builder plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/product-doc-artifact-builder'] --- import kbnProductDocArtifactBuilderObj from './kbn_product_doc_artifact_builder.devdocs.json'; diff --git a/api_docs/kbn_product_doc_common.mdx b/api_docs/kbn_product_doc_common.mdx index f1e9069153800..cc22add6ac4a7 100644 --- a/api_docs/kbn_product_doc_common.mdx +++ b/api_docs/kbn_product_doc_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-product-doc-common title: "@kbn/product-doc-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/product-doc-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/product-doc-common'] --- import kbnProductDocCommonObj from './kbn_product_doc_common.devdocs.json'; diff --git a/api_docs/kbn_profiling_utils.mdx b/api_docs/kbn_profiling_utils.mdx index 97911af04d448..6c955c46d2720 100644 --- a/api_docs/kbn_profiling_utils.mdx +++ b/api_docs/kbn_profiling_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-profiling-utils title: "@kbn/profiling-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/profiling-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/profiling-utils'] --- import kbnProfilingUtilsObj from './kbn_profiling_utils.devdocs.json'; diff --git a/api_docs/kbn_random_sampling.mdx b/api_docs/kbn_random_sampling.mdx index 4114e8b479722..e64acc715b608 100644 --- a/api_docs/kbn_random_sampling.mdx +++ b/api_docs/kbn_random_sampling.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-random-sampling title: "@kbn/random-sampling" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/random-sampling plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/random-sampling'] --- import kbnRandomSamplingObj from './kbn_random_sampling.devdocs.json'; diff --git a/api_docs/kbn_react_field.mdx b/api_docs/kbn_react_field.mdx index 2f4f0dcd353d9..0e0c3f92862b0 100644 --- a/api_docs/kbn_react_field.mdx +++ b/api_docs/kbn_react_field.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-react-field title: "@kbn/react-field" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/react-field plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/react-field'] --- import kbnReactFieldObj from './kbn_react_field.devdocs.json'; diff --git a/api_docs/kbn_react_hooks.mdx b/api_docs/kbn_react_hooks.mdx index b435a5c89f4c4..3e2055792400e 100644 --- a/api_docs/kbn_react_hooks.mdx +++ b/api_docs/kbn_react_hooks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-react-hooks title: "@kbn/react-hooks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/react-hooks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/react-hooks'] --- import kbnReactHooksObj from './kbn_react_hooks.devdocs.json'; diff --git a/api_docs/kbn_react_kibana_context_common.mdx b/api_docs/kbn_react_kibana_context_common.mdx index 63d3d8f1ca2a7..44cf43856620a 100644 --- a/api_docs/kbn_react_kibana_context_common.mdx +++ b/api_docs/kbn_react_kibana_context_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-react-kibana-context-common title: "@kbn/react-kibana-context-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/react-kibana-context-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/react-kibana-context-common'] --- import kbnReactKibanaContextCommonObj from './kbn_react_kibana_context_common.devdocs.json'; diff --git a/api_docs/kbn_react_kibana_context_render.mdx b/api_docs/kbn_react_kibana_context_render.mdx index 659295fe6b758..aaa22aa533133 100644 --- a/api_docs/kbn_react_kibana_context_render.mdx +++ b/api_docs/kbn_react_kibana_context_render.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-react-kibana-context-render title: "@kbn/react-kibana-context-render" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/react-kibana-context-render plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/react-kibana-context-render'] --- import kbnReactKibanaContextRenderObj from './kbn_react_kibana_context_render.devdocs.json'; diff --git a/api_docs/kbn_react_kibana_context_root.mdx b/api_docs/kbn_react_kibana_context_root.mdx index 1943bc4316c8b..fab748b704898 100644 --- a/api_docs/kbn_react_kibana_context_root.mdx +++ b/api_docs/kbn_react_kibana_context_root.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-react-kibana-context-root title: "@kbn/react-kibana-context-root" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/react-kibana-context-root plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/react-kibana-context-root'] --- import kbnReactKibanaContextRootObj from './kbn_react_kibana_context_root.devdocs.json'; diff --git a/api_docs/kbn_react_kibana_context_styled.mdx b/api_docs/kbn_react_kibana_context_styled.mdx index 741d63a8bf5fe..989800844a429 100644 --- a/api_docs/kbn_react_kibana_context_styled.mdx +++ b/api_docs/kbn_react_kibana_context_styled.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-react-kibana-context-styled title: "@kbn/react-kibana-context-styled" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/react-kibana-context-styled plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/react-kibana-context-styled'] --- import kbnReactKibanaContextStyledObj from './kbn_react_kibana_context_styled.devdocs.json'; diff --git a/api_docs/kbn_react_kibana_context_theme.mdx b/api_docs/kbn_react_kibana_context_theme.mdx index 9ffe2f2d64866..f49c2cde94097 100644 --- a/api_docs/kbn_react_kibana_context_theme.mdx +++ b/api_docs/kbn_react_kibana_context_theme.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-react-kibana-context-theme title: "@kbn/react-kibana-context-theme" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/react-kibana-context-theme plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/react-kibana-context-theme'] --- import kbnReactKibanaContextThemeObj from './kbn_react_kibana_context_theme.devdocs.json'; diff --git a/api_docs/kbn_react_kibana_mount.mdx b/api_docs/kbn_react_kibana_mount.mdx index fe1bd538d403f..bf3050ab859ce 100644 --- a/api_docs/kbn_react_kibana_mount.mdx +++ b/api_docs/kbn_react_kibana_mount.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-react-kibana-mount title: "@kbn/react-kibana-mount" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/react-kibana-mount plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/react-kibana-mount'] --- import kbnReactKibanaMountObj from './kbn_react_kibana_mount.devdocs.json'; diff --git a/api_docs/kbn_recently_accessed.mdx b/api_docs/kbn_recently_accessed.mdx index 73a464a3f2e51..4940bb999e106 100644 --- a/api_docs/kbn_recently_accessed.mdx +++ b/api_docs/kbn_recently_accessed.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-recently-accessed title: "@kbn/recently-accessed" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/recently-accessed plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/recently-accessed'] --- import kbnRecentlyAccessedObj from './kbn_recently_accessed.devdocs.json'; diff --git a/api_docs/kbn_repo_file_maps.mdx b/api_docs/kbn_repo_file_maps.mdx index 7f5e35452de97..9e98e6924effb 100644 --- a/api_docs/kbn_repo_file_maps.mdx +++ b/api_docs/kbn_repo_file_maps.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-repo-file-maps title: "@kbn/repo-file-maps" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/repo-file-maps plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/repo-file-maps'] --- import kbnRepoFileMapsObj from './kbn_repo_file_maps.devdocs.json'; diff --git a/api_docs/kbn_repo_linter.mdx b/api_docs/kbn_repo_linter.mdx index cc7f315b437ce..b8cd9d852638a 100644 --- a/api_docs/kbn_repo_linter.mdx +++ b/api_docs/kbn_repo_linter.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-repo-linter title: "@kbn/repo-linter" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/repo-linter plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/repo-linter'] --- import kbnRepoLinterObj from './kbn_repo_linter.devdocs.json'; diff --git a/api_docs/kbn_repo_path.mdx b/api_docs/kbn_repo_path.mdx index 6f97c63aaa25a..40bb77a397c06 100644 --- a/api_docs/kbn_repo_path.mdx +++ b/api_docs/kbn_repo_path.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-repo-path title: "@kbn/repo-path" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/repo-path plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/repo-path'] --- import kbnRepoPathObj from './kbn_repo_path.devdocs.json'; diff --git a/api_docs/kbn_repo_source_classifier.mdx b/api_docs/kbn_repo_source_classifier.mdx index c45acb8bf3f14..8604d0e30b56a 100644 --- a/api_docs/kbn_repo_source_classifier.mdx +++ b/api_docs/kbn_repo_source_classifier.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-repo-source-classifier title: "@kbn/repo-source-classifier" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/repo-source-classifier plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/repo-source-classifier'] --- import kbnRepoSourceClassifierObj from './kbn_repo_source_classifier.devdocs.json'; diff --git a/api_docs/kbn_reporting_common.mdx b/api_docs/kbn_reporting_common.mdx index eec8972554ad2..d8c9725139d0e 100644 --- a/api_docs/kbn_reporting_common.mdx +++ b/api_docs/kbn_reporting_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-common title: "@kbn/reporting-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-common'] --- import kbnReportingCommonObj from './kbn_reporting_common.devdocs.json'; diff --git a/api_docs/kbn_reporting_csv_share_panel.mdx b/api_docs/kbn_reporting_csv_share_panel.mdx index ad8256a25dbbc..2a36aa5e07ef6 100644 --- a/api_docs/kbn_reporting_csv_share_panel.mdx +++ b/api_docs/kbn_reporting_csv_share_panel.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-csv-share-panel title: "@kbn/reporting-csv-share-panel" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-csv-share-panel plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-csv-share-panel'] --- import kbnReportingCsvSharePanelObj from './kbn_reporting_csv_share_panel.devdocs.json'; diff --git a/api_docs/kbn_reporting_export_types_csv.mdx b/api_docs/kbn_reporting_export_types_csv.mdx index 9fe4575cf1c8c..3db1848c9823d 100644 --- a/api_docs/kbn_reporting_export_types_csv.mdx +++ b/api_docs/kbn_reporting_export_types_csv.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-export-types-csv title: "@kbn/reporting-export-types-csv" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-export-types-csv plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-export-types-csv'] --- import kbnReportingExportTypesCsvObj from './kbn_reporting_export_types_csv.devdocs.json'; diff --git a/api_docs/kbn_reporting_export_types_csv_common.mdx b/api_docs/kbn_reporting_export_types_csv_common.mdx index cfb7e9fe106fb..cdcfec2e06e92 100644 --- a/api_docs/kbn_reporting_export_types_csv_common.mdx +++ b/api_docs/kbn_reporting_export_types_csv_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-export-types-csv-common title: "@kbn/reporting-export-types-csv-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-export-types-csv-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-export-types-csv-common'] --- import kbnReportingExportTypesCsvCommonObj from './kbn_reporting_export_types_csv_common.devdocs.json'; diff --git a/api_docs/kbn_reporting_export_types_pdf.mdx b/api_docs/kbn_reporting_export_types_pdf.mdx index 182690cbbccb9..b158e11ec5297 100644 --- a/api_docs/kbn_reporting_export_types_pdf.mdx +++ b/api_docs/kbn_reporting_export_types_pdf.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-export-types-pdf title: "@kbn/reporting-export-types-pdf" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-export-types-pdf plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-export-types-pdf'] --- import kbnReportingExportTypesPdfObj from './kbn_reporting_export_types_pdf.devdocs.json'; diff --git a/api_docs/kbn_reporting_export_types_pdf_common.mdx b/api_docs/kbn_reporting_export_types_pdf_common.mdx index 1aa0df0224f5a..61fff7e6e9d3f 100644 --- a/api_docs/kbn_reporting_export_types_pdf_common.mdx +++ b/api_docs/kbn_reporting_export_types_pdf_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-export-types-pdf-common title: "@kbn/reporting-export-types-pdf-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-export-types-pdf-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-export-types-pdf-common'] --- import kbnReportingExportTypesPdfCommonObj from './kbn_reporting_export_types_pdf_common.devdocs.json'; diff --git a/api_docs/kbn_reporting_export_types_png.mdx b/api_docs/kbn_reporting_export_types_png.mdx index 9ff0ed91851fb..09f70232100af 100644 --- a/api_docs/kbn_reporting_export_types_png.mdx +++ b/api_docs/kbn_reporting_export_types_png.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-export-types-png title: "@kbn/reporting-export-types-png" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-export-types-png plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-export-types-png'] --- import kbnReportingExportTypesPngObj from './kbn_reporting_export_types_png.devdocs.json'; diff --git a/api_docs/kbn_reporting_export_types_png_common.mdx b/api_docs/kbn_reporting_export_types_png_common.mdx index dc9ed5335a02c..0cf4c8e6e4514 100644 --- a/api_docs/kbn_reporting_export_types_png_common.mdx +++ b/api_docs/kbn_reporting_export_types_png_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-export-types-png-common title: "@kbn/reporting-export-types-png-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-export-types-png-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-export-types-png-common'] --- import kbnReportingExportTypesPngCommonObj from './kbn_reporting_export_types_png_common.devdocs.json'; diff --git a/api_docs/kbn_reporting_mocks_server.mdx b/api_docs/kbn_reporting_mocks_server.mdx index 0bcff18831701..a33d0e142cfe9 100644 --- a/api_docs/kbn_reporting_mocks_server.mdx +++ b/api_docs/kbn_reporting_mocks_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-mocks-server title: "@kbn/reporting-mocks-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-mocks-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-mocks-server'] --- import kbnReportingMocksServerObj from './kbn_reporting_mocks_server.devdocs.json'; diff --git a/api_docs/kbn_reporting_public.mdx b/api_docs/kbn_reporting_public.mdx index 53d714a60e947..cc9fbdb846d21 100644 --- a/api_docs/kbn_reporting_public.mdx +++ b/api_docs/kbn_reporting_public.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-public title: "@kbn/reporting-public" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-public plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-public'] --- import kbnReportingPublicObj from './kbn_reporting_public.devdocs.json'; diff --git a/api_docs/kbn_reporting_server.mdx b/api_docs/kbn_reporting_server.mdx index ec7e944b78ff2..d568f4981c682 100644 --- a/api_docs/kbn_reporting_server.mdx +++ b/api_docs/kbn_reporting_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-reporting-server title: "@kbn/reporting-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/reporting-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/reporting-server'] --- import kbnReportingServerObj from './kbn_reporting_server.devdocs.json'; diff --git a/api_docs/kbn_resizable_layout.mdx b/api_docs/kbn_resizable_layout.mdx index 368dd7347a219..a0ed515f89fa6 100644 --- a/api_docs/kbn_resizable_layout.mdx +++ b/api_docs/kbn_resizable_layout.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-resizable-layout title: "@kbn/resizable-layout" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/resizable-layout plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/resizable-layout'] --- import kbnResizableLayoutObj from './kbn_resizable_layout.devdocs.json'; diff --git a/api_docs/kbn_response_ops_feature_flag_service.mdx b/api_docs/kbn_response_ops_feature_flag_service.mdx index 0cccbc833db17..76db300e5b1f6 100644 --- a/api_docs/kbn_response_ops_feature_flag_service.mdx +++ b/api_docs/kbn_response_ops_feature_flag_service.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-response-ops-feature-flag-service title: "@kbn/response-ops-feature-flag-service" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/response-ops-feature-flag-service plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/response-ops-feature-flag-service'] --- import kbnResponseOpsFeatureFlagServiceObj from './kbn_response_ops_feature_flag_service.devdocs.json'; diff --git a/api_docs/kbn_response_ops_rule_params.mdx b/api_docs/kbn_response_ops_rule_params.mdx index d27d03bfb0863..37d9384669a34 100644 --- a/api_docs/kbn_response_ops_rule_params.mdx +++ b/api_docs/kbn_response_ops_rule_params.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-response-ops-rule-params title: "@kbn/response-ops-rule-params" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/response-ops-rule-params plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/response-ops-rule-params'] --- import kbnResponseOpsRuleParamsObj from './kbn_response_ops_rule_params.devdocs.json'; diff --git a/api_docs/kbn_rison.mdx b/api_docs/kbn_rison.mdx index 0bf8676a2c7ee..961d1403360c2 100644 --- a/api_docs/kbn_rison.mdx +++ b/api_docs/kbn_rison.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-rison title: "@kbn/rison" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/rison plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/rison'] --- import kbnRisonObj from './kbn_rison.devdocs.json'; diff --git a/api_docs/kbn_rollup.mdx b/api_docs/kbn_rollup.mdx index 03fbebede894e..e1c003215906e 100644 --- a/api_docs/kbn_rollup.mdx +++ b/api_docs/kbn_rollup.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-rollup title: "@kbn/rollup" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/rollup plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/rollup'] --- import kbnRollupObj from './kbn_rollup.devdocs.json'; diff --git a/api_docs/kbn_router_to_openapispec.mdx b/api_docs/kbn_router_to_openapispec.mdx index 2b8ed7b8d4ad5..0ce7b1d434468 100644 --- a/api_docs/kbn_router_to_openapispec.mdx +++ b/api_docs/kbn_router_to_openapispec.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-router-to-openapispec title: "@kbn/router-to-openapispec" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/router-to-openapispec plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/router-to-openapispec'] --- import kbnRouterToOpenapispecObj from './kbn_router_to_openapispec.devdocs.json'; diff --git a/api_docs/kbn_router_utils.mdx b/api_docs/kbn_router_utils.mdx index 80098445a8fcf..f73bc3665d78f 100644 --- a/api_docs/kbn_router_utils.mdx +++ b/api_docs/kbn_router_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-router-utils title: "@kbn/router-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/router-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/router-utils'] --- import kbnRouterUtilsObj from './kbn_router_utils.devdocs.json'; diff --git a/api_docs/kbn_rrule.mdx b/api_docs/kbn_rrule.mdx index b93eff791da1b..e7ae23fb5cd25 100644 --- a/api_docs/kbn_rrule.mdx +++ b/api_docs/kbn_rrule.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-rrule title: "@kbn/rrule" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/rrule plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/rrule'] --- import kbnRruleObj from './kbn_rrule.devdocs.json'; diff --git a/api_docs/kbn_rule_data_utils.mdx b/api_docs/kbn_rule_data_utils.mdx index 55b2d9f590c89..a7bf92317abc8 100644 --- a/api_docs/kbn_rule_data_utils.mdx +++ b/api_docs/kbn_rule_data_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-rule-data-utils title: "@kbn/rule-data-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/rule-data-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/rule-data-utils'] --- import kbnRuleDataUtilsObj from './kbn_rule_data_utils.devdocs.json'; diff --git a/api_docs/kbn_saved_objects_settings.mdx b/api_docs/kbn_saved_objects_settings.mdx index 0c5908cc65478..c82f7fc78e847 100644 --- a/api_docs/kbn_saved_objects_settings.mdx +++ b/api_docs/kbn_saved_objects_settings.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-saved-objects-settings title: "@kbn/saved-objects-settings" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/saved-objects-settings plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/saved-objects-settings'] --- import kbnSavedObjectsSettingsObj from './kbn_saved_objects_settings.devdocs.json'; diff --git a/api_docs/kbn_screenshotting_server.mdx b/api_docs/kbn_screenshotting_server.mdx index c24a5651c97b1..2648777ed4d17 100644 --- a/api_docs/kbn_screenshotting_server.mdx +++ b/api_docs/kbn_screenshotting_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-screenshotting-server title: "@kbn/screenshotting-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/screenshotting-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/screenshotting-server'] --- import kbnScreenshottingServerObj from './kbn_screenshotting_server.devdocs.json'; diff --git a/api_docs/kbn_search_api_keys_components.mdx b/api_docs/kbn_search_api_keys_components.mdx index 4f6cd2830e0b7..252c311b2585a 100644 --- a/api_docs/kbn_search_api_keys_components.mdx +++ b/api_docs/kbn_search_api_keys_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-search-api-keys-components title: "@kbn/search-api-keys-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/search-api-keys-components plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/search-api-keys-components'] --- import kbnSearchApiKeysComponentsObj from './kbn_search_api_keys_components.devdocs.json'; diff --git a/api_docs/kbn_search_api_keys_server.mdx b/api_docs/kbn_search_api_keys_server.mdx index cc79c6161b3b3..12f848f054b3d 100644 --- a/api_docs/kbn_search_api_keys_server.mdx +++ b/api_docs/kbn_search_api_keys_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-search-api-keys-server title: "@kbn/search-api-keys-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/search-api-keys-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/search-api-keys-server'] --- import kbnSearchApiKeysServerObj from './kbn_search_api_keys_server.devdocs.json'; diff --git a/api_docs/kbn_search_api_panels.mdx b/api_docs/kbn_search_api_panels.mdx index 2da7bee3bb53e..85b296ba8c93e 100644 --- a/api_docs/kbn_search_api_panels.mdx +++ b/api_docs/kbn_search_api_panels.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-search-api-panels title: "@kbn/search-api-panels" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/search-api-panels plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/search-api-panels'] --- import kbnSearchApiPanelsObj from './kbn_search_api_panels.devdocs.json'; diff --git a/api_docs/kbn_search_connectors.mdx b/api_docs/kbn_search_connectors.mdx index 37f057729e0bf..bcd0893e3c954 100644 --- a/api_docs/kbn_search_connectors.mdx +++ b/api_docs/kbn_search_connectors.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-search-connectors title: "@kbn/search-connectors" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/search-connectors plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/search-connectors'] --- import kbnSearchConnectorsObj from './kbn_search_connectors.devdocs.json'; diff --git a/api_docs/kbn_search_errors.mdx b/api_docs/kbn_search_errors.mdx index 21b427e050ea1..34b04e49892fa 100644 --- a/api_docs/kbn_search_errors.mdx +++ b/api_docs/kbn_search_errors.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-search-errors title: "@kbn/search-errors" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/search-errors plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/search-errors'] --- import kbnSearchErrorsObj from './kbn_search_errors.devdocs.json'; diff --git a/api_docs/kbn_search_index_documents.mdx b/api_docs/kbn_search_index_documents.mdx index 46b2a28af0161..241b13a85419f 100644 --- a/api_docs/kbn_search_index_documents.mdx +++ b/api_docs/kbn_search_index_documents.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-search-index-documents title: "@kbn/search-index-documents" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/search-index-documents plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/search-index-documents'] --- import kbnSearchIndexDocumentsObj from './kbn_search_index_documents.devdocs.json'; diff --git a/api_docs/kbn_search_response_warnings.mdx b/api_docs/kbn_search_response_warnings.mdx index 94856d08b26da..1bf051442a33d 100644 --- a/api_docs/kbn_search_response_warnings.mdx +++ b/api_docs/kbn_search_response_warnings.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-search-response-warnings title: "@kbn/search-response-warnings" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/search-response-warnings plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/search-response-warnings'] --- import kbnSearchResponseWarningsObj from './kbn_search_response_warnings.devdocs.json'; diff --git a/api_docs/kbn_search_shared_ui.mdx b/api_docs/kbn_search_shared_ui.mdx index c31d32f22316a..01a9b14b956b2 100644 --- a/api_docs/kbn_search_shared_ui.mdx +++ b/api_docs/kbn_search_shared_ui.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-search-shared-ui title: "@kbn/search-shared-ui" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/search-shared-ui plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/search-shared-ui'] --- import kbnSearchSharedUiObj from './kbn_search_shared_ui.devdocs.json'; diff --git a/api_docs/kbn_search_types.mdx b/api_docs/kbn_search_types.mdx index 47f7771094e05..de184274e37ba 100644 --- a/api_docs/kbn_search_types.mdx +++ b/api_docs/kbn_search_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-search-types title: "@kbn/search-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/search-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/search-types'] --- import kbnSearchTypesObj from './kbn_search_types.devdocs.json'; diff --git a/api_docs/kbn_security_api_key_management.mdx b/api_docs/kbn_security_api_key_management.mdx index f11ecfd24a00f..9b98d97b9f4dc 100644 --- a/api_docs/kbn_security_api_key_management.mdx +++ b/api_docs/kbn_security_api_key_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-api-key-management title: "@kbn/security-api-key-management" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-api-key-management plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-api-key-management'] --- import kbnSecurityApiKeyManagementObj from './kbn_security_api_key_management.devdocs.json'; diff --git a/api_docs/kbn_security_authorization_core.mdx b/api_docs/kbn_security_authorization_core.mdx index a7dfab04e4dff..eceb53a89e3b8 100644 --- a/api_docs/kbn_security_authorization_core.mdx +++ b/api_docs/kbn_security_authorization_core.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-authorization-core title: "@kbn/security-authorization-core" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-authorization-core plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-authorization-core'] --- import kbnSecurityAuthorizationCoreObj from './kbn_security_authorization_core.devdocs.json'; diff --git a/api_docs/kbn_security_authorization_core_common.mdx b/api_docs/kbn_security_authorization_core_common.mdx index 70ebe74b04bcd..31212cad0aec2 100644 --- a/api_docs/kbn_security_authorization_core_common.mdx +++ b/api_docs/kbn_security_authorization_core_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-authorization-core-common title: "@kbn/security-authorization-core-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-authorization-core-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-authorization-core-common'] --- import kbnSecurityAuthorizationCoreCommonObj from './kbn_security_authorization_core_common.devdocs.json'; diff --git a/api_docs/kbn_security_form_components.mdx b/api_docs/kbn_security_form_components.mdx index c0be3edd066f3..5041a0a85706c 100644 --- a/api_docs/kbn_security_form_components.mdx +++ b/api_docs/kbn_security_form_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-form-components title: "@kbn/security-form-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-form-components plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-form-components'] --- import kbnSecurityFormComponentsObj from './kbn_security_form_components.devdocs.json'; diff --git a/api_docs/kbn_security_hardening.mdx b/api_docs/kbn_security_hardening.mdx index 30af0823266d2..c34042683f479 100644 --- a/api_docs/kbn_security_hardening.mdx +++ b/api_docs/kbn_security_hardening.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-hardening title: "@kbn/security-hardening" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-hardening plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-hardening'] --- import kbnSecurityHardeningObj from './kbn_security_hardening.devdocs.json'; diff --git a/api_docs/kbn_security_plugin_types_common.mdx b/api_docs/kbn_security_plugin_types_common.mdx index 07a3ece9c80b5..da80a699e6d6a 100644 --- a/api_docs/kbn_security_plugin_types_common.mdx +++ b/api_docs/kbn_security_plugin_types_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-plugin-types-common title: "@kbn/security-plugin-types-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-plugin-types-common plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-plugin-types-common'] --- import kbnSecurityPluginTypesCommonObj from './kbn_security_plugin_types_common.devdocs.json'; diff --git a/api_docs/kbn_security_plugin_types_public.mdx b/api_docs/kbn_security_plugin_types_public.mdx index 5f6cc5b0e8b27..251647d177a74 100644 --- a/api_docs/kbn_security_plugin_types_public.mdx +++ b/api_docs/kbn_security_plugin_types_public.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-plugin-types-public title: "@kbn/security-plugin-types-public" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-plugin-types-public plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-plugin-types-public'] --- import kbnSecurityPluginTypesPublicObj from './kbn_security_plugin_types_public.devdocs.json'; diff --git a/api_docs/kbn_security_plugin_types_server.mdx b/api_docs/kbn_security_plugin_types_server.mdx index 794d9679077a6..300152e0bb729 100644 --- a/api_docs/kbn_security_plugin_types_server.mdx +++ b/api_docs/kbn_security_plugin_types_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-plugin-types-server title: "@kbn/security-plugin-types-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-plugin-types-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-plugin-types-server'] --- import kbnSecurityPluginTypesServerObj from './kbn_security_plugin_types_server.devdocs.json'; diff --git a/api_docs/kbn_security_role_management_model.mdx b/api_docs/kbn_security_role_management_model.mdx index d404ac91049cd..4c9d3f2b67ee6 100644 --- a/api_docs/kbn_security_role_management_model.mdx +++ b/api_docs/kbn_security_role_management_model.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-role-management-model title: "@kbn/security-role-management-model" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-role-management-model plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-role-management-model'] --- import kbnSecurityRoleManagementModelObj from './kbn_security_role_management_model.devdocs.json'; diff --git a/api_docs/kbn_security_solution_distribution_bar.mdx b/api_docs/kbn_security_solution_distribution_bar.mdx index 11af892062cd9..25da651b8271e 100644 --- a/api_docs/kbn_security_solution_distribution_bar.mdx +++ b/api_docs/kbn_security_solution_distribution_bar.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-solution-distribution-bar title: "@kbn/security-solution-distribution-bar" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-solution-distribution-bar plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-solution-distribution-bar'] --- import kbnSecuritySolutionDistributionBarObj from './kbn_security_solution_distribution_bar.devdocs.json'; diff --git a/api_docs/kbn_security_solution_features.mdx b/api_docs/kbn_security_solution_features.mdx index 395a87877f6da..66476323413bd 100644 --- a/api_docs/kbn_security_solution_features.mdx +++ b/api_docs/kbn_security_solution_features.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-solution-features title: "@kbn/security-solution-features" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-solution-features plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-solution-features'] --- import kbnSecuritySolutionFeaturesObj from './kbn_security_solution_features.devdocs.json'; diff --git a/api_docs/kbn_security_solution_navigation.mdx b/api_docs/kbn_security_solution_navigation.mdx index b0e779a3652cd..000b86f086aba 100644 --- a/api_docs/kbn_security_solution_navigation.mdx +++ b/api_docs/kbn_security_solution_navigation.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-solution-navigation title: "@kbn/security-solution-navigation" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-solution-navigation plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-solution-navigation'] --- import kbnSecuritySolutionNavigationObj from './kbn_security_solution_navigation.devdocs.json'; diff --git a/api_docs/kbn_security_solution_side_nav.mdx b/api_docs/kbn_security_solution_side_nav.mdx index bd4195c7a024a..2b59e0892a47f 100644 --- a/api_docs/kbn_security_solution_side_nav.mdx +++ b/api_docs/kbn_security_solution_side_nav.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-solution-side-nav title: "@kbn/security-solution-side-nav" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-solution-side-nav plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-solution-side-nav'] --- import kbnSecuritySolutionSideNavObj from './kbn_security_solution_side_nav.devdocs.json'; diff --git a/api_docs/kbn_security_solution_storybook_config.mdx b/api_docs/kbn_security_solution_storybook_config.mdx index 9240b7125e2bd..942e93d70f4cb 100644 --- a/api_docs/kbn_security_solution_storybook_config.mdx +++ b/api_docs/kbn_security_solution_storybook_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-solution-storybook-config title: "@kbn/security-solution-storybook-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-solution-storybook-config plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-solution-storybook-config'] --- import kbnSecuritySolutionStorybookConfigObj from './kbn_security_solution_storybook_config.devdocs.json'; diff --git a/api_docs/kbn_security_ui_components.mdx b/api_docs/kbn_security_ui_components.mdx index 124601367d2a6..e9e91ffa77ea6 100644 --- a/api_docs/kbn_security_ui_components.mdx +++ b/api_docs/kbn_security_ui_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-security-ui-components title: "@kbn/security-ui-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/security-ui-components plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/security-ui-components'] --- import kbnSecurityUiComponentsObj from './kbn_security_ui_components.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_autocomplete.mdx b/api_docs/kbn_securitysolution_autocomplete.mdx index a865f0cbf7d12..99371fca4450b 100644 --- a/api_docs/kbn_securitysolution_autocomplete.mdx +++ b/api_docs/kbn_securitysolution_autocomplete.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-autocomplete title: "@kbn/securitysolution-autocomplete" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-autocomplete plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-autocomplete'] --- import kbnSecuritysolutionAutocompleteObj from './kbn_securitysolution_autocomplete.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_data_table.mdx b/api_docs/kbn_securitysolution_data_table.mdx index e4f0ee8c5a530..bbef05d204664 100644 --- a/api_docs/kbn_securitysolution_data_table.mdx +++ b/api_docs/kbn_securitysolution_data_table.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-data-table title: "@kbn/securitysolution-data-table" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-data-table plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-data-table'] --- import kbnSecuritysolutionDataTableObj from './kbn_securitysolution_data_table.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_ecs.mdx b/api_docs/kbn_securitysolution_ecs.mdx index c2a4877c4bf07..67f457a110596 100644 --- a/api_docs/kbn_securitysolution_ecs.mdx +++ b/api_docs/kbn_securitysolution_ecs.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-ecs title: "@kbn/securitysolution-ecs" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-ecs plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-ecs'] --- import kbnSecuritysolutionEcsObj from './kbn_securitysolution_ecs.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_es_utils.mdx b/api_docs/kbn_securitysolution_es_utils.mdx index 6cbd54f05732c..9620ade2aaec0 100644 --- a/api_docs/kbn_securitysolution_es_utils.mdx +++ b/api_docs/kbn_securitysolution_es_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-es-utils title: "@kbn/securitysolution-es-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-es-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-es-utils'] --- import kbnSecuritysolutionEsUtilsObj from './kbn_securitysolution_es_utils.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_exception_list_components.mdx b/api_docs/kbn_securitysolution_exception_list_components.mdx index 1cedf06bc5935..6742cd81d2441 100644 --- a/api_docs/kbn_securitysolution_exception_list_components.mdx +++ b/api_docs/kbn_securitysolution_exception_list_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-exception-list-components title: "@kbn/securitysolution-exception-list-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-exception-list-components plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-exception-list-components'] --- import kbnSecuritysolutionExceptionListComponentsObj from './kbn_securitysolution_exception_list_components.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_hook_utils.mdx b/api_docs/kbn_securitysolution_hook_utils.mdx index 6fa955978373c..a1768c42be7b6 100644 --- a/api_docs/kbn_securitysolution_hook_utils.mdx +++ b/api_docs/kbn_securitysolution_hook_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-hook-utils title: "@kbn/securitysolution-hook-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-hook-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-hook-utils'] --- import kbnSecuritysolutionHookUtilsObj from './kbn_securitysolution_hook_utils.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_io_ts_alerting_types.mdx b/api_docs/kbn_securitysolution_io_ts_alerting_types.mdx index 64f359c7b04b2..70c1fb0109433 100644 --- a/api_docs/kbn_securitysolution_io_ts_alerting_types.mdx +++ b/api_docs/kbn_securitysolution_io_ts_alerting_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-io-ts-alerting-types title: "@kbn/securitysolution-io-ts-alerting-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-io-ts-alerting-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-io-ts-alerting-types'] --- import kbnSecuritysolutionIoTsAlertingTypesObj from './kbn_securitysolution_io_ts_alerting_types.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_io_ts_list_types.mdx b/api_docs/kbn_securitysolution_io_ts_list_types.mdx index 4af959b9f45b9..306ebd271f348 100644 --- a/api_docs/kbn_securitysolution_io_ts_list_types.mdx +++ b/api_docs/kbn_securitysolution_io_ts_list_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-io-ts-list-types title: "@kbn/securitysolution-io-ts-list-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-io-ts-list-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-io-ts-list-types'] --- import kbnSecuritysolutionIoTsListTypesObj from './kbn_securitysolution_io_ts_list_types.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_io_ts_types.mdx b/api_docs/kbn_securitysolution_io_ts_types.mdx index b5dd49f51deab..79cda27e5917a 100644 --- a/api_docs/kbn_securitysolution_io_ts_types.mdx +++ b/api_docs/kbn_securitysolution_io_ts_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-io-ts-types title: "@kbn/securitysolution-io-ts-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-io-ts-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-io-ts-types'] --- import kbnSecuritysolutionIoTsTypesObj from './kbn_securitysolution_io_ts_types.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_io_ts_utils.mdx b/api_docs/kbn_securitysolution_io_ts_utils.mdx index f50d4208e8ed5..3d5caaa549f76 100644 --- a/api_docs/kbn_securitysolution_io_ts_utils.mdx +++ b/api_docs/kbn_securitysolution_io_ts_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-io-ts-utils title: "@kbn/securitysolution-io-ts-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-io-ts-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-io-ts-utils'] --- import kbnSecuritysolutionIoTsUtilsObj from './kbn_securitysolution_io_ts_utils.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_list_api.mdx b/api_docs/kbn_securitysolution_list_api.mdx index ac76b805b4f61..ce14082229676 100644 --- a/api_docs/kbn_securitysolution_list_api.mdx +++ b/api_docs/kbn_securitysolution_list_api.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-list-api title: "@kbn/securitysolution-list-api" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-list-api plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-list-api'] --- import kbnSecuritysolutionListApiObj from './kbn_securitysolution_list_api.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_list_constants.mdx b/api_docs/kbn_securitysolution_list_constants.mdx index 028ce23021218..072ea012d8583 100644 --- a/api_docs/kbn_securitysolution_list_constants.mdx +++ b/api_docs/kbn_securitysolution_list_constants.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-list-constants title: "@kbn/securitysolution-list-constants" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-list-constants plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-list-constants'] --- import kbnSecuritysolutionListConstantsObj from './kbn_securitysolution_list_constants.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_list_hooks.mdx b/api_docs/kbn_securitysolution_list_hooks.mdx index de79383a8f551..9c90b07f00b30 100644 --- a/api_docs/kbn_securitysolution_list_hooks.mdx +++ b/api_docs/kbn_securitysolution_list_hooks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-list-hooks title: "@kbn/securitysolution-list-hooks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-list-hooks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-list-hooks'] --- import kbnSecuritysolutionListHooksObj from './kbn_securitysolution_list_hooks.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_list_utils.mdx b/api_docs/kbn_securitysolution_list_utils.mdx index 416ff129e82de..f4e420b4a3c24 100644 --- a/api_docs/kbn_securitysolution_list_utils.mdx +++ b/api_docs/kbn_securitysolution_list_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-list-utils title: "@kbn/securitysolution-list-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-list-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-list-utils'] --- import kbnSecuritysolutionListUtilsObj from './kbn_securitysolution_list_utils.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_rules.mdx b/api_docs/kbn_securitysolution_rules.mdx index a3abf620b9f5c..f866cebd99e38 100644 --- a/api_docs/kbn_securitysolution_rules.mdx +++ b/api_docs/kbn_securitysolution_rules.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-rules title: "@kbn/securitysolution-rules" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-rules plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-rules'] --- import kbnSecuritysolutionRulesObj from './kbn_securitysolution_rules.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_t_grid.mdx b/api_docs/kbn_securitysolution_t_grid.mdx index 52f0fa19f49e4..ea6b11f36e56f 100644 --- a/api_docs/kbn_securitysolution_t_grid.mdx +++ b/api_docs/kbn_securitysolution_t_grid.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-t-grid title: "@kbn/securitysolution-t-grid" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-t-grid plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-t-grid'] --- import kbnSecuritysolutionTGridObj from './kbn_securitysolution_t_grid.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_utils.mdx b/api_docs/kbn_securitysolution_utils.mdx index c3be89099151a..684e99e1216cb 100644 --- a/api_docs/kbn_securitysolution_utils.mdx +++ b/api_docs/kbn_securitysolution_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-utils title: "@kbn/securitysolution-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-utils'] --- import kbnSecuritysolutionUtilsObj from './kbn_securitysolution_utils.devdocs.json'; diff --git a/api_docs/kbn_server_http_tools.mdx b/api_docs/kbn_server_http_tools.mdx index 66a0437c1b61a..14ba1d76b7845 100644 --- a/api_docs/kbn_server_http_tools.mdx +++ b/api_docs/kbn_server_http_tools.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-server-http-tools title: "@kbn/server-http-tools" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/server-http-tools plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/server-http-tools'] --- import kbnServerHttpToolsObj from './kbn_server_http_tools.devdocs.json'; diff --git a/api_docs/kbn_server_route_repository.devdocs.json b/api_docs/kbn_server_route_repository.devdocs.json index 84958c23d1d99..b402826a9d604 100644 --- a/api_docs/kbn_server_route_repository.devdocs.json +++ b/api_docs/kbn_server_route_repository.devdocs.json @@ -88,7 +88,15 @@ "label": "formatRequest", "description": [], "signature": [ - "(endpoint: string, pathParams: Record) => { method: Method; pathname: string; version: string; }" + "(endpoint: string, pathParams: Record) => { method: \"get\" | ", + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.DestructiveRouteMethod", + "text": "DestructiveRouteMethod" + }, + "; pathname: string; version: string; }" ], "path": "packages/kbn-server-route-repository-utils/src/format_request.ts", "deprecated": false, @@ -136,7 +144,15 @@ "label": "parseEndpoint", "description": [], "signature": [ - "(endpoint: string) => { method: Method; pathname: string; version: string; }" + "(endpoint: string) => { method: \"get\" | ", + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.DestructiveRouteMethod", + "text": "DestructiveRouteMethod" + }, + "; pathname: string; version: string; }" ], "path": "packages/kbn-server-route-repository-utils/src/parse_endpoint.ts", "deprecated": false, @@ -185,15 +201,15 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - ">; logger: ", + " | undefined, any, any, any>>; logger: ", { "pluginId": "@kbn/logging", "scope": "common", @@ -255,15 +271,15 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - "; }" + " | undefined, any, any, any>; }" ], "path": "packages/kbn-server-route-repository/src/register_routes.ts", "deprecated": false, @@ -344,58 +360,6 @@ } ], "interfaces": [ - { - "parentPluginId": "@kbn/server-route-repository", - "id": "def-server.DefaultRouteCreateOptions", - "type": "Interface", - "tags": [], - "label": "DefaultRouteCreateOptions", - "description": [], - "path": "packages/kbn-server-route-repository-utils/src/typings.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "@kbn/server-route-repository", - "id": "def-server.DefaultRouteCreateOptions.options", - "type": "CompoundType", - "tags": [], - "label": "options", - "description": [], - "signature": [ - "(", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.RouteConfigOptions", - "text": "RouteConfigOptions" - }, - "<", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.RouteMethod", - "text": "RouteMethod" - }, - "> & { security?: ", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.RouteSecurity", - "text": "RouteSecurity" - }, - " | undefined; }) | undefined" - ], - "path": "packages/kbn-server-route-repository-utils/src/typings.ts", - "deprecated": false, - "trackAdoption": false - } - ], - "initialIsOpen": false - }, { "parentPluginId": "@kbn/server-route-repository", "id": "def-server.DefaultRouteHandlerResources", @@ -477,7 +441,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>) => Promise<", + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">) => Promise<", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -522,7 +494,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>" + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -548,7 +528,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>) => ", + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">) => ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -597,7 +585,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>" + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -609,34 +605,6 @@ } ], "initialIsOpen": false - }, - { - "parentPluginId": "@kbn/server-route-repository", - "id": "def-server.RouteState", - "type": "Interface", - "tags": [], - "label": "RouteState", - "description": [], - "path": "packages/kbn-server-route-repository-utils/src/typings.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "@kbn/server-route-repository", - "id": "def-server.RouteState.Unnamed", - "type": "IndexSignature", - "tags": [], - "label": "[endpoint: string]: any", - "description": [], - "signature": [ - "[endpoint: string]: any" - ], - "path": "packages/kbn-server-route-repository-utils/src/typings.ts", - "deprecated": false, - "trackAdoption": false - } - ], - "initialIsOpen": false } ], "enums": [], @@ -673,7 +641,7 @@ "section": "def-common.ServerRouteCreateOptions", "text": "ServerRouteCreateOptions" }, - "> ? TRouteParamsRT extends ", + " | undefined> ? TRouteParamsRT extends ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -712,15 +680,7 @@ "section": "def-common.RouteParamsRT", "text": "RouteParamsRT" }, - " | undefined, any, any, ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.ServerRouteCreateOptions", - "text": "ServerRouteCreateOptions" - }, - "> ? TRouteParamsRT extends ", + " | undefined, any, any, any> ? TRouteParamsRT extends ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -735,6 +695,36 @@ "trackAdoption": false, "initialIsOpen": false }, + { + "parentPluginId": "@kbn/server-route-repository", + "id": "def-server.DefaultRouteCreateOptions", + "type": "Type", + "tags": [], + "label": "DefaultRouteCreateOptions", + "description": [], + "signature": [ + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.RouteConfigOptions", + "text": "RouteConfigOptions" + }, + "<\"get\" | ", + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.DestructiveRouteMethod", + "text": "DestructiveRouteMethod" + }, + ">" + ], + "path": "packages/kbn-server-route-repository-utils/src/typings.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, { "parentPluginId": "@kbn/server-route-repository", "id": "def-server.EndpointOf", @@ -791,15 +781,7 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - " ? TReturnType extends ", + " ? TReturnType extends ", { "pluginId": "@kbn/core-http-server", "scope": "server", @@ -861,7 +843,15 @@ "label": "ServerRoute", "description": [], "signature": [ - "{ endpoint: TEndpoint; handler: ServerRouteHandler; } & TRouteCreateOptions & (TRouteParamsRT extends ", + "{ endpoint: TEndpoint; handler: ServerRouteHandler; security?: ", + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.RouteSecurity", + "text": "RouteSecurity" + }, + " | undefined; } & (TRouteParamsRT extends ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -869,7 +859,15 @@ "section": "def-common.RouteParamsRT", "text": "RouteParamsRT" }, - " ? { params: TRouteParamsRT; } : {})" + " ? { params: TRouteParamsRT; } : {}) & (TRouteCreateOptions extends ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.DefaultRouteCreateOptions", + "text": "DefaultRouteCreateOptions" + }, + " ? { options: TRouteCreateOptions; } : {})" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -900,7 +898,15 @@ "section": "def-common.RouteParamsRT", "text": "RouteParamsRT" }, - " | undefined, any, any, Record>; }" + " | undefined, any, any, ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRouteCreateOptions", + "text": "ServerRouteCreateOptions" + }, + " | undefined>; }" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, diff --git a/api_docs/kbn_server_route_repository.mdx b/api_docs/kbn_server_route_repository.mdx index 7d72096afe3c6..84a0b0c457bba 100644 --- a/api_docs/kbn_server_route_repository.mdx +++ b/api_docs/kbn_server_route_repository.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-server-route-repository title: "@kbn/server-route-repository" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/server-route-repository plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/server-route-repository'] --- import kbnServerRouteRepositoryObj from './kbn_server_route_repository.devdocs.json'; @@ -21,7 +21,7 @@ Contact [@elastic/obs-knowledge-team](https://github.com/orgs/elastic/teams/obs- | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 42 | 0 | 42 | 0 | +| 39 | 0 | 39 | 0 | ## Server diff --git a/api_docs/kbn_server_route_repository_client.devdocs.json b/api_docs/kbn_server_route_repository_client.devdocs.json index be6f4e7ecf2d7..03e5c79e96682 100644 --- a/api_docs/kbn_server_route_repository_client.devdocs.json +++ b/api_docs/kbn_server_route_repository_client.devdocs.json @@ -180,7 +180,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>) => Promise<", + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">) => Promise<", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -225,7 +233,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>" + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -251,7 +267,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>) => ", + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">) => ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -300,7 +324,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>" + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -348,7 +380,7 @@ "section": "def-common.ServerRouteCreateOptions", "text": "ServerRouteCreateOptions" }, - "> ? TRouteParamsRT extends ", + " | undefined> ? TRouteParamsRT extends ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", diff --git a/api_docs/kbn_server_route_repository_client.mdx b/api_docs/kbn_server_route_repository_client.mdx index 4c6943f6f26bb..594a8295b991f 100644 --- a/api_docs/kbn_server_route_repository_client.mdx +++ b/api_docs/kbn_server_route_repository_client.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-server-route-repository-client title: "@kbn/server-route-repository-client" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/server-route-repository-client plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/server-route-repository-client'] --- import kbnServerRouteRepositoryClientObj from './kbn_server_route_repository_client.devdocs.json'; diff --git a/api_docs/kbn_server_route_repository_utils.devdocs.json b/api_docs/kbn_server_route_repository_utils.devdocs.json index 49cb0273ddf64..b33006a95896a 100644 --- a/api_docs/kbn_server_route_repository_utils.devdocs.json +++ b/api_docs/kbn_server_route_repository_utils.devdocs.json @@ -27,7 +27,15 @@ "label": "formatRequest", "description": [], "signature": [ - "(endpoint: string, pathParams: Record) => { method: Method; pathname: string; version: string; }" + "(endpoint: string, pathParams: Record) => { method: \"get\" | ", + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.DestructiveRouteMethod", + "text": "DestructiveRouteMethod" + }, + "; pathname: string; version: string; }" ], "path": "packages/kbn-server-route-repository-utils/src/format_request.ts", "deprecated": false, @@ -75,7 +83,15 @@ "label": "parseEndpoint", "description": [], "signature": [ - "(endpoint: string) => { method: Method; pathname: string; version: string; }" + "(endpoint: string) => { method: \"get\" | ", + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.DestructiveRouteMethod", + "text": "DestructiveRouteMethod" + }, + "; pathname: string; version: string; }" ], "path": "packages/kbn-server-route-repository-utils/src/parse_endpoint.ts", "deprecated": false, @@ -102,58 +118,6 @@ } ], "interfaces": [ - { - "parentPluginId": "@kbn/server-route-repository-utils", - "id": "def-common.DefaultRouteCreateOptions", - "type": "Interface", - "tags": [], - "label": "DefaultRouteCreateOptions", - "description": [], - "path": "packages/kbn-server-route-repository-utils/src/typings.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "@kbn/server-route-repository-utils", - "id": "def-common.DefaultRouteCreateOptions.options", - "type": "CompoundType", - "tags": [], - "label": "options", - "description": [], - "signature": [ - "(", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.RouteConfigOptions", - "text": "RouteConfigOptions" - }, - "<", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.RouteMethod", - "text": "RouteMethod" - }, - "> & { security?: ", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.RouteSecurity", - "text": "RouteSecurity" - }, - " | undefined; }) | undefined" - ], - "path": "packages/kbn-server-route-repository-utils/src/typings.ts", - "deprecated": false, - "trackAdoption": false - } - ], - "initialIsOpen": false - }, { "parentPluginId": "@kbn/server-route-repository-utils", "id": "def-common.DefaultRouteHandlerResources", @@ -235,7 +199,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>) => Promise<", + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">) => Promise<", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -280,7 +252,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>" + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -306,7 +286,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>) => ", + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">) => ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -355,7 +343,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions>" + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -370,10 +366,10 @@ }, { "parentPluginId": "@kbn/server-route-repository-utils", - "id": "def-common.RouteState", + "id": "def-common.ServerRouteCreateOptions", "type": "Interface", "tags": [], - "label": "RouteState", + "label": "ServerRouteCreateOptions", "description": [], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -381,13 +377,13 @@ "children": [ { "parentPluginId": "@kbn/server-route-repository-utils", - "id": "def-common.RouteState.Unnamed", + "id": "def-common.ServerRouteCreateOptions.Unnamed", "type": "IndexSignature", "tags": [], - "label": "[endpoint: string]: any", + "label": "[x: string]: any", "description": [], "signature": [ - "[endpoint: string]: any" + "[x: string]: any" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -431,7 +427,7 @@ "section": "def-common.ServerRouteCreateOptions", "text": "ServerRouteCreateOptions" }, - "> ? TRouteParamsRT extends ", + " | undefined> ? TRouteParamsRT extends ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -470,15 +466,7 @@ "section": "def-common.RouteParamsRT", "text": "RouteParamsRT" }, - " | undefined, any, any, ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.ServerRouteCreateOptions", - "text": "ServerRouteCreateOptions" - }, - "> ? TRouteParamsRT extends ", + " | undefined, any, any, any> ? TRouteParamsRT extends ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -514,6 +502,36 @@ "trackAdoption": false, "initialIsOpen": false }, + { + "parentPluginId": "@kbn/server-route-repository-utils", + "id": "def-common.DefaultRouteCreateOptions", + "type": "Type", + "tags": [], + "label": "DefaultRouteCreateOptions", + "description": [], + "signature": [ + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.RouteConfigOptions", + "text": "RouteConfigOptions" + }, + "<\"get\" | ", + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.DestructiveRouteMethod", + "text": "DestructiveRouteMethod" + }, + ">" + ], + "path": "packages/kbn-server-route-repository-utils/src/typings.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, { "parentPluginId": "@kbn/server-route-repository-utils", "id": "def-common.EndpointOf", @@ -570,15 +588,7 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - " ? TReturnType extends ", + " ? TReturnType extends ", { "pluginId": "@kbn/core-http-server", "scope": "server", @@ -640,7 +650,15 @@ "label": "ServerRoute", "description": [], "signature": [ - "{ endpoint: TEndpoint; handler: ServerRouteHandler; } & TRouteCreateOptions & (TRouteParamsRT extends ", + "{ endpoint: TEndpoint; handler: ServerRouteHandler; security?: ", + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.RouteSecurity", + "text": "RouteSecurity" + }, + " | undefined; } & (TRouteParamsRT extends ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -648,22 +666,15 @@ "section": "def-common.RouteParamsRT", "text": "RouteParamsRT" }, - " ? { params: TRouteParamsRT; } : {})" - ], - "path": "packages/kbn-server-route-repository-utils/src/typings.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "@kbn/server-route-repository-utils", - "id": "def-common.ServerRouteCreateOptions", - "type": "Type", - "tags": [], - "label": "ServerRouteCreateOptions", - "description": [], - "signature": [ - "{ [x: string]: any; }" + " ? { params: TRouteParamsRT; } : {}) & (TRouteCreateOptions extends ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.DefaultRouteCreateOptions", + "text": "DefaultRouteCreateOptions" + }, + " ? { options: TRouteCreateOptions; } : {})" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -709,7 +720,15 @@ "section": "def-common.RouteParamsRT", "text": "RouteParamsRT" }, - " | undefined, any, any, Record>; }" + " | undefined, any, any, ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRouteCreateOptions", + "text": "ServerRouteCreateOptions" + }, + " | undefined>; }" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, diff --git a/api_docs/kbn_server_route_repository_utils.mdx b/api_docs/kbn_server_route_repository_utils.mdx index 0364b98a55672..3b615f43bdbc0 100644 --- a/api_docs/kbn_server_route_repository_utils.mdx +++ b/api_docs/kbn_server_route_repository_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-server-route-repository-utils title: "@kbn/server-route-repository-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/server-route-repository-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/server-route-repository-utils'] --- import kbnServerRouteRepositoryUtilsObj from './kbn_server_route_repository_utils.devdocs.json'; @@ -21,7 +21,7 @@ Contact [@elastic/obs-knowledge-team](https://github.com/orgs/elastic/teams/obs- | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 30 | 0 | 30 | 2 | +| 28 | 0 | 28 | 2 | ## Common diff --git a/api_docs/kbn_serverless_common_settings.mdx b/api_docs/kbn_serverless_common_settings.mdx index d8eae8c00900e..5af24bf26b9aa 100644 --- a/api_docs/kbn_serverless_common_settings.mdx +++ b/api_docs/kbn_serverless_common_settings.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-serverless-common-settings title: "@kbn/serverless-common-settings" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/serverless-common-settings plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/serverless-common-settings'] --- import kbnServerlessCommonSettingsObj from './kbn_serverless_common_settings.devdocs.json'; diff --git a/api_docs/kbn_serverless_observability_settings.mdx b/api_docs/kbn_serverless_observability_settings.mdx index f21ddb2e4fe39..a32946e24eb75 100644 --- a/api_docs/kbn_serverless_observability_settings.mdx +++ b/api_docs/kbn_serverless_observability_settings.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-serverless-observability-settings title: "@kbn/serverless-observability-settings" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/serverless-observability-settings plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/serverless-observability-settings'] --- import kbnServerlessObservabilitySettingsObj from './kbn_serverless_observability_settings.devdocs.json'; diff --git a/api_docs/kbn_serverless_project_switcher.mdx b/api_docs/kbn_serverless_project_switcher.mdx index f9964e431edfd..9372bb6b82636 100644 --- a/api_docs/kbn_serverless_project_switcher.mdx +++ b/api_docs/kbn_serverless_project_switcher.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-serverless-project-switcher title: "@kbn/serverless-project-switcher" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/serverless-project-switcher plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/serverless-project-switcher'] --- import kbnServerlessProjectSwitcherObj from './kbn_serverless_project_switcher.devdocs.json'; diff --git a/api_docs/kbn_serverless_search_settings.mdx b/api_docs/kbn_serverless_search_settings.mdx index af25175fca51a..a2a16b391f4f0 100644 --- a/api_docs/kbn_serverless_search_settings.mdx +++ b/api_docs/kbn_serverless_search_settings.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-serverless-search-settings title: "@kbn/serverless-search-settings" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/serverless-search-settings plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/serverless-search-settings'] --- import kbnServerlessSearchSettingsObj from './kbn_serverless_search_settings.devdocs.json'; diff --git a/api_docs/kbn_serverless_security_settings.mdx b/api_docs/kbn_serverless_security_settings.mdx index 79afa587e94cb..ffdd8b5556006 100644 --- a/api_docs/kbn_serverless_security_settings.mdx +++ b/api_docs/kbn_serverless_security_settings.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-serverless-security-settings title: "@kbn/serverless-security-settings" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/serverless-security-settings plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/serverless-security-settings'] --- import kbnServerlessSecuritySettingsObj from './kbn_serverless_security_settings.devdocs.json'; diff --git a/api_docs/kbn_serverless_storybook_config.mdx b/api_docs/kbn_serverless_storybook_config.mdx index cfdccbe1fc3d5..b01ce815b7f81 100644 --- a/api_docs/kbn_serverless_storybook_config.mdx +++ b/api_docs/kbn_serverless_storybook_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-serverless-storybook-config title: "@kbn/serverless-storybook-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/serverless-storybook-config plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/serverless-storybook-config'] --- import kbnServerlessStorybookConfigObj from './kbn_serverless_storybook_config.devdocs.json'; diff --git a/api_docs/kbn_shared_svg.mdx b/api_docs/kbn_shared_svg.mdx index f2af3d329306c..ac5533b9ef905 100644 --- a/api_docs/kbn_shared_svg.mdx +++ b/api_docs/kbn_shared_svg.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-svg title: "@kbn/shared-svg" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-svg plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-svg'] --- import kbnSharedSvgObj from './kbn_shared_svg.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_avatar_solution.mdx b/api_docs/kbn_shared_ux_avatar_solution.mdx index 44ee2b72dbd66..828275ec41a74 100644 --- a/api_docs/kbn_shared_ux_avatar_solution.mdx +++ b/api_docs/kbn_shared_ux_avatar_solution.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-avatar-solution title: "@kbn/shared-ux-avatar-solution" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-avatar-solution plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-avatar-solution'] --- import kbnSharedUxAvatarSolutionObj from './kbn_shared_ux_avatar_solution.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_button_exit_full_screen.mdx b/api_docs/kbn_shared_ux_button_exit_full_screen.mdx index 114c0ba564049..4ed1b3dad4780 100644 --- a/api_docs/kbn_shared_ux_button_exit_full_screen.mdx +++ b/api_docs/kbn_shared_ux_button_exit_full_screen.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-button-exit-full-screen title: "@kbn/shared-ux-button-exit-full-screen" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-button-exit-full-screen plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-button-exit-full-screen'] --- import kbnSharedUxButtonExitFullScreenObj from './kbn_shared_ux_button_exit_full_screen.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_button_toolbar.mdx b/api_docs/kbn_shared_ux_button_toolbar.mdx index be1dc75fb1a2d..6be9795e43a13 100644 --- a/api_docs/kbn_shared_ux_button_toolbar.mdx +++ b/api_docs/kbn_shared_ux_button_toolbar.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-button-toolbar title: "@kbn/shared-ux-button-toolbar" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-button-toolbar plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-button-toolbar'] --- import kbnSharedUxButtonToolbarObj from './kbn_shared_ux_button_toolbar.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_card_no_data.mdx b/api_docs/kbn_shared_ux_card_no_data.mdx index 196c418e9c2c4..e7a3613ba50af 100644 --- a/api_docs/kbn_shared_ux_card_no_data.mdx +++ b/api_docs/kbn_shared_ux_card_no_data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-card-no-data title: "@kbn/shared-ux-card-no-data" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-card-no-data plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-card-no-data'] --- import kbnSharedUxCardNoDataObj from './kbn_shared_ux_card_no_data.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_card_no_data_mocks.mdx b/api_docs/kbn_shared_ux_card_no_data_mocks.mdx index 8f09d5b47f699..9eaf87bfe6f03 100644 --- a/api_docs/kbn_shared_ux_card_no_data_mocks.mdx +++ b/api_docs/kbn_shared_ux_card_no_data_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-card-no-data-mocks title: "@kbn/shared-ux-card-no-data-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-card-no-data-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-card-no-data-mocks'] --- import kbnSharedUxCardNoDataMocksObj from './kbn_shared_ux_card_no_data_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_chrome_navigation.mdx b/api_docs/kbn_shared_ux_chrome_navigation.mdx index 7116cdd4a380f..b607d85c38a45 100644 --- a/api_docs/kbn_shared_ux_chrome_navigation.mdx +++ b/api_docs/kbn_shared_ux_chrome_navigation.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-chrome-navigation title: "@kbn/shared-ux-chrome-navigation" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-chrome-navigation plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-chrome-navigation'] --- import kbnSharedUxChromeNavigationObj from './kbn_shared_ux_chrome_navigation.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_error_boundary.mdx b/api_docs/kbn_shared_ux_error_boundary.mdx index b732afd33d766..d02498469d3d4 100644 --- a/api_docs/kbn_shared_ux_error_boundary.mdx +++ b/api_docs/kbn_shared_ux_error_boundary.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-error-boundary title: "@kbn/shared-ux-error-boundary" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-error-boundary plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-error-boundary'] --- import kbnSharedUxErrorBoundaryObj from './kbn_shared_ux_error_boundary.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_file_context.mdx b/api_docs/kbn_shared_ux_file_context.mdx index db30cfc4d00ef..ce695b9110af2 100644 --- a/api_docs/kbn_shared_ux_file_context.mdx +++ b/api_docs/kbn_shared_ux_file_context.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-file-context title: "@kbn/shared-ux-file-context" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-file-context plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-file-context'] --- import kbnSharedUxFileContextObj from './kbn_shared_ux_file_context.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_file_image.mdx b/api_docs/kbn_shared_ux_file_image.mdx index 5d324cf3ee97b..53e7342cc8ac5 100644 --- a/api_docs/kbn_shared_ux_file_image.mdx +++ b/api_docs/kbn_shared_ux_file_image.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-file-image title: "@kbn/shared-ux-file-image" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-file-image plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-file-image'] --- import kbnSharedUxFileImageObj from './kbn_shared_ux_file_image.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_file_image_mocks.mdx b/api_docs/kbn_shared_ux_file_image_mocks.mdx index 73a1329007bd0..fe8fc854a427e 100644 --- a/api_docs/kbn_shared_ux_file_image_mocks.mdx +++ b/api_docs/kbn_shared_ux_file_image_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-file-image-mocks title: "@kbn/shared-ux-file-image-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-file-image-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-file-image-mocks'] --- import kbnSharedUxFileImageMocksObj from './kbn_shared_ux_file_image_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_file_mocks.mdx b/api_docs/kbn_shared_ux_file_mocks.mdx index 43dee3e7eb928..3f94261f74cd4 100644 --- a/api_docs/kbn_shared_ux_file_mocks.mdx +++ b/api_docs/kbn_shared_ux_file_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-file-mocks title: "@kbn/shared-ux-file-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-file-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-file-mocks'] --- import kbnSharedUxFileMocksObj from './kbn_shared_ux_file_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_file_picker.mdx b/api_docs/kbn_shared_ux_file_picker.mdx index 45cd33a8e0ee4..b9a44358a238a 100644 --- a/api_docs/kbn_shared_ux_file_picker.mdx +++ b/api_docs/kbn_shared_ux_file_picker.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-file-picker title: "@kbn/shared-ux-file-picker" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-file-picker plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-file-picker'] --- import kbnSharedUxFilePickerObj from './kbn_shared_ux_file_picker.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_file_types.mdx b/api_docs/kbn_shared_ux_file_types.mdx index 1e6080c6989e6..2b06df69432bb 100644 --- a/api_docs/kbn_shared_ux_file_types.mdx +++ b/api_docs/kbn_shared_ux_file_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-file-types title: "@kbn/shared-ux-file-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-file-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-file-types'] --- import kbnSharedUxFileTypesObj from './kbn_shared_ux_file_types.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_file_upload.mdx b/api_docs/kbn_shared_ux_file_upload.mdx index f99d41f859b85..892a61449479b 100644 --- a/api_docs/kbn_shared_ux_file_upload.mdx +++ b/api_docs/kbn_shared_ux_file_upload.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-file-upload title: "@kbn/shared-ux-file-upload" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-file-upload plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-file-upload'] --- import kbnSharedUxFileUploadObj from './kbn_shared_ux_file_upload.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_file_util.mdx b/api_docs/kbn_shared_ux_file_util.mdx index dab15e971e78b..1eddf7801a4ff 100644 --- a/api_docs/kbn_shared_ux_file_util.mdx +++ b/api_docs/kbn_shared_ux_file_util.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-file-util title: "@kbn/shared-ux-file-util" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-file-util plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-file-util'] --- import kbnSharedUxFileUtilObj from './kbn_shared_ux_file_util.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_link_redirect_app.mdx b/api_docs/kbn_shared_ux_link_redirect_app.mdx index e5341dd26773e..afdd899fbc816 100644 --- a/api_docs/kbn_shared_ux_link_redirect_app.mdx +++ b/api_docs/kbn_shared_ux_link_redirect_app.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-link-redirect-app title: "@kbn/shared-ux-link-redirect-app" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-link-redirect-app plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-link-redirect-app'] --- import kbnSharedUxLinkRedirectAppObj from './kbn_shared_ux_link_redirect_app.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_link_redirect_app_mocks.mdx b/api_docs/kbn_shared_ux_link_redirect_app_mocks.mdx index 934a5e705db30..74f442793491c 100644 --- a/api_docs/kbn_shared_ux_link_redirect_app_mocks.mdx +++ b/api_docs/kbn_shared_ux_link_redirect_app_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-link-redirect-app-mocks title: "@kbn/shared-ux-link-redirect-app-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-link-redirect-app-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-link-redirect-app-mocks'] --- import kbnSharedUxLinkRedirectAppMocksObj from './kbn_shared_ux_link_redirect_app_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_markdown.mdx b/api_docs/kbn_shared_ux_markdown.mdx index 5099c2a0edc8a..549526ba37a87 100644 --- a/api_docs/kbn_shared_ux_markdown.mdx +++ b/api_docs/kbn_shared_ux_markdown.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-markdown title: "@kbn/shared-ux-markdown" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-markdown plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-markdown'] --- import kbnSharedUxMarkdownObj from './kbn_shared_ux_markdown.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_markdown_mocks.mdx b/api_docs/kbn_shared_ux_markdown_mocks.mdx index 5f19fcdeb7f48..8e9a5640362e4 100644 --- a/api_docs/kbn_shared_ux_markdown_mocks.mdx +++ b/api_docs/kbn_shared_ux_markdown_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-markdown-mocks title: "@kbn/shared-ux-markdown-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-markdown-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-markdown-mocks'] --- import kbnSharedUxMarkdownMocksObj from './kbn_shared_ux_markdown_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_analytics_no_data.mdx b/api_docs/kbn_shared_ux_page_analytics_no_data.mdx index ae11e5ad21858..cff5ce57bec5c 100644 --- a/api_docs/kbn_shared_ux_page_analytics_no_data.mdx +++ b/api_docs/kbn_shared_ux_page_analytics_no_data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-analytics-no-data title: "@kbn/shared-ux-page-analytics-no-data" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-analytics-no-data plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-analytics-no-data'] --- import kbnSharedUxPageAnalyticsNoDataObj from './kbn_shared_ux_page_analytics_no_data.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_analytics_no_data_mocks.mdx b/api_docs/kbn_shared_ux_page_analytics_no_data_mocks.mdx index f025843c5922f..264715c6829ee 100644 --- a/api_docs/kbn_shared_ux_page_analytics_no_data_mocks.mdx +++ b/api_docs/kbn_shared_ux_page_analytics_no_data_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-analytics-no-data-mocks title: "@kbn/shared-ux-page-analytics-no-data-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-analytics-no-data-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-analytics-no-data-mocks'] --- import kbnSharedUxPageAnalyticsNoDataMocksObj from './kbn_shared_ux_page_analytics_no_data_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_kibana_no_data.mdx b/api_docs/kbn_shared_ux_page_kibana_no_data.mdx index 84dc062a89e74..b80ec36ee70ce 100644 --- a/api_docs/kbn_shared_ux_page_kibana_no_data.mdx +++ b/api_docs/kbn_shared_ux_page_kibana_no_data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-kibana-no-data title: "@kbn/shared-ux-page-kibana-no-data" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-kibana-no-data plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-kibana-no-data'] --- import kbnSharedUxPageKibanaNoDataObj from './kbn_shared_ux_page_kibana_no_data.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_kibana_no_data_mocks.mdx b/api_docs/kbn_shared_ux_page_kibana_no_data_mocks.mdx index f8a184e0e8365..fd8981a1283cb 100644 --- a/api_docs/kbn_shared_ux_page_kibana_no_data_mocks.mdx +++ b/api_docs/kbn_shared_ux_page_kibana_no_data_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-kibana-no-data-mocks title: "@kbn/shared-ux-page-kibana-no-data-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-kibana-no-data-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-kibana-no-data-mocks'] --- import kbnSharedUxPageKibanaNoDataMocksObj from './kbn_shared_ux_page_kibana_no_data_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_kibana_template.mdx b/api_docs/kbn_shared_ux_page_kibana_template.mdx index de75a21869ab1..5fd147a25611b 100644 --- a/api_docs/kbn_shared_ux_page_kibana_template.mdx +++ b/api_docs/kbn_shared_ux_page_kibana_template.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-kibana-template title: "@kbn/shared-ux-page-kibana-template" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-kibana-template plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-kibana-template'] --- import kbnSharedUxPageKibanaTemplateObj from './kbn_shared_ux_page_kibana_template.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_kibana_template_mocks.mdx b/api_docs/kbn_shared_ux_page_kibana_template_mocks.mdx index 32262455f1ca7..d1d156832fd80 100644 --- a/api_docs/kbn_shared_ux_page_kibana_template_mocks.mdx +++ b/api_docs/kbn_shared_ux_page_kibana_template_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-kibana-template-mocks title: "@kbn/shared-ux-page-kibana-template-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-kibana-template-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-kibana-template-mocks'] --- import kbnSharedUxPageKibanaTemplateMocksObj from './kbn_shared_ux_page_kibana_template_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_no_data.mdx b/api_docs/kbn_shared_ux_page_no_data.mdx index 3f42d04f4e6b4..ab42168524038 100644 --- a/api_docs/kbn_shared_ux_page_no_data.mdx +++ b/api_docs/kbn_shared_ux_page_no_data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-no-data title: "@kbn/shared-ux-page-no-data" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-no-data plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-no-data'] --- import kbnSharedUxPageNoDataObj from './kbn_shared_ux_page_no_data.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_no_data_config.mdx b/api_docs/kbn_shared_ux_page_no_data_config.mdx index 52a7af66ef46a..c2ef272b6bbac 100644 --- a/api_docs/kbn_shared_ux_page_no_data_config.mdx +++ b/api_docs/kbn_shared_ux_page_no_data_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-no-data-config title: "@kbn/shared-ux-page-no-data-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-no-data-config plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-no-data-config'] --- import kbnSharedUxPageNoDataConfigObj from './kbn_shared_ux_page_no_data_config.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_no_data_config_mocks.mdx b/api_docs/kbn_shared_ux_page_no_data_config_mocks.mdx index 325f02d7cea50..cdbaf58b38f87 100644 --- a/api_docs/kbn_shared_ux_page_no_data_config_mocks.mdx +++ b/api_docs/kbn_shared_ux_page_no_data_config_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-no-data-config-mocks title: "@kbn/shared-ux-page-no-data-config-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-no-data-config-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-no-data-config-mocks'] --- import kbnSharedUxPageNoDataConfigMocksObj from './kbn_shared_ux_page_no_data_config_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_no_data_mocks.mdx b/api_docs/kbn_shared_ux_page_no_data_mocks.mdx index a343610cb154c..e016601968f91 100644 --- a/api_docs/kbn_shared_ux_page_no_data_mocks.mdx +++ b/api_docs/kbn_shared_ux_page_no_data_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-no-data-mocks title: "@kbn/shared-ux-page-no-data-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-no-data-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-no-data-mocks'] --- import kbnSharedUxPageNoDataMocksObj from './kbn_shared_ux_page_no_data_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_solution_nav.mdx b/api_docs/kbn_shared_ux_page_solution_nav.mdx index 68d98d99c5461..2f1c18770d8be 100644 --- a/api_docs/kbn_shared_ux_page_solution_nav.mdx +++ b/api_docs/kbn_shared_ux_page_solution_nav.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-solution-nav title: "@kbn/shared-ux-page-solution-nav" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-solution-nav plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-solution-nav'] --- import kbnSharedUxPageSolutionNavObj from './kbn_shared_ux_page_solution_nav.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_prompt_no_data_views.mdx b/api_docs/kbn_shared_ux_prompt_no_data_views.mdx index 173f3c1d7bd8e..4994db8600619 100644 --- a/api_docs/kbn_shared_ux_prompt_no_data_views.mdx +++ b/api_docs/kbn_shared_ux_prompt_no_data_views.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-prompt-no-data-views title: "@kbn/shared-ux-prompt-no-data-views" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-prompt-no-data-views plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-prompt-no-data-views'] --- import kbnSharedUxPromptNoDataViewsObj from './kbn_shared_ux_prompt_no_data_views.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_prompt_no_data_views_mocks.mdx b/api_docs/kbn_shared_ux_prompt_no_data_views_mocks.mdx index 88f148181ea1f..306bd2b22ba4a 100644 --- a/api_docs/kbn_shared_ux_prompt_no_data_views_mocks.mdx +++ b/api_docs/kbn_shared_ux_prompt_no_data_views_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-prompt-no-data-views-mocks title: "@kbn/shared-ux-prompt-no-data-views-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-prompt-no-data-views-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-prompt-no-data-views-mocks'] --- import kbnSharedUxPromptNoDataViewsMocksObj from './kbn_shared_ux_prompt_no_data_views_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_prompt_not_found.mdx b/api_docs/kbn_shared_ux_prompt_not_found.mdx index 62b7a5d92d4d3..0a27157b6556c 100644 --- a/api_docs/kbn_shared_ux_prompt_not_found.mdx +++ b/api_docs/kbn_shared_ux_prompt_not_found.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-prompt-not-found title: "@kbn/shared-ux-prompt-not-found" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-prompt-not-found plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-prompt-not-found'] --- import kbnSharedUxPromptNotFoundObj from './kbn_shared_ux_prompt_not_found.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_router.mdx b/api_docs/kbn_shared_ux_router.mdx index b131b55a19258..424b3544a220c 100644 --- a/api_docs/kbn_shared_ux_router.mdx +++ b/api_docs/kbn_shared_ux_router.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-router title: "@kbn/shared-ux-router" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-router plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-router'] --- import kbnSharedUxRouterObj from './kbn_shared_ux_router.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_router_mocks.mdx b/api_docs/kbn_shared_ux_router_mocks.mdx index 116b9eedc670b..720448f825e3e 100644 --- a/api_docs/kbn_shared_ux_router_mocks.mdx +++ b/api_docs/kbn_shared_ux_router_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-router-mocks title: "@kbn/shared-ux-router-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-router-mocks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-router-mocks'] --- import kbnSharedUxRouterMocksObj from './kbn_shared_ux_router_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_storybook_config.mdx b/api_docs/kbn_shared_ux_storybook_config.mdx index 8334a758d2555..b1d248e211e40 100644 --- a/api_docs/kbn_shared_ux_storybook_config.mdx +++ b/api_docs/kbn_shared_ux_storybook_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-storybook-config title: "@kbn/shared-ux-storybook-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-storybook-config plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-storybook-config'] --- import kbnSharedUxStorybookConfigObj from './kbn_shared_ux_storybook_config.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_storybook_mock.mdx b/api_docs/kbn_shared_ux_storybook_mock.mdx index 9ef2cb3a2893d..347eaed67d639 100644 --- a/api_docs/kbn_shared_ux_storybook_mock.mdx +++ b/api_docs/kbn_shared_ux_storybook_mock.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-storybook-mock title: "@kbn/shared-ux-storybook-mock" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-storybook-mock plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-storybook-mock'] --- import kbnSharedUxStorybookMockObj from './kbn_shared_ux_storybook_mock.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_tabbed_modal.mdx b/api_docs/kbn_shared_ux_tabbed_modal.mdx index afd278bed5aaf..4e0adc9c9f00c 100644 --- a/api_docs/kbn_shared_ux_tabbed_modal.mdx +++ b/api_docs/kbn_shared_ux_tabbed_modal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-tabbed-modal title: "@kbn/shared-ux-tabbed-modal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-tabbed-modal plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-tabbed-modal'] --- import kbnSharedUxTabbedModalObj from './kbn_shared_ux_tabbed_modal.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_table_persist.mdx b/api_docs/kbn_shared_ux_table_persist.mdx index d0950c907dc8a..a9693db65a6f9 100644 --- a/api_docs/kbn_shared_ux_table_persist.mdx +++ b/api_docs/kbn_shared_ux_table_persist.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-table-persist title: "@kbn/shared-ux-table-persist" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-table-persist plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-table-persist'] --- import kbnSharedUxTablePersistObj from './kbn_shared_ux_table_persist.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_utility.mdx b/api_docs/kbn_shared_ux_utility.mdx index a398bee0f6a5a..2be21ab5d350d 100644 --- a/api_docs/kbn_shared_ux_utility.mdx +++ b/api_docs/kbn_shared_ux_utility.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-utility title: "@kbn/shared-ux-utility" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-utility plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-utility'] --- import kbnSharedUxUtilityObj from './kbn_shared_ux_utility.devdocs.json'; diff --git a/api_docs/kbn_slo_schema.mdx b/api_docs/kbn_slo_schema.mdx index 557e89f9228d2..9bb30ca973831 100644 --- a/api_docs/kbn_slo_schema.mdx +++ b/api_docs/kbn_slo_schema.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-slo-schema title: "@kbn/slo-schema" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/slo-schema plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/slo-schema'] --- import kbnSloSchemaObj from './kbn_slo_schema.devdocs.json'; diff --git a/api_docs/kbn_some_dev_log.mdx b/api_docs/kbn_some_dev_log.mdx index 68804a3b9cce7..31fb54dab561d 100644 --- a/api_docs/kbn_some_dev_log.mdx +++ b/api_docs/kbn_some_dev_log.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-some-dev-log title: "@kbn/some-dev-log" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/some-dev-log plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/some-dev-log'] --- import kbnSomeDevLogObj from './kbn_some_dev_log.devdocs.json'; diff --git a/api_docs/kbn_sort_predicates.mdx b/api_docs/kbn_sort_predicates.mdx index cced3c15ed500..8e00e77169968 100644 --- a/api_docs/kbn_sort_predicates.mdx +++ b/api_docs/kbn_sort_predicates.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-sort-predicates title: "@kbn/sort-predicates" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/sort-predicates plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/sort-predicates'] --- import kbnSortPredicatesObj from './kbn_sort_predicates.devdocs.json'; diff --git a/api_docs/kbn_sse_utils.mdx b/api_docs/kbn_sse_utils.mdx index 82bfa6b6bf462..512b2b381ca2c 100644 --- a/api_docs/kbn_sse_utils.mdx +++ b/api_docs/kbn_sse_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-sse-utils title: "@kbn/sse-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/sse-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/sse-utils'] --- import kbnSseUtilsObj from './kbn_sse_utils.devdocs.json'; diff --git a/api_docs/kbn_sse_utils_client.mdx b/api_docs/kbn_sse_utils_client.mdx index 6a75b6126a1f4..74d5a7ca98ee3 100644 --- a/api_docs/kbn_sse_utils_client.mdx +++ b/api_docs/kbn_sse_utils_client.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-sse-utils-client title: "@kbn/sse-utils-client" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/sse-utils-client plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/sse-utils-client'] --- import kbnSseUtilsClientObj from './kbn_sse_utils_client.devdocs.json'; diff --git a/api_docs/kbn_sse_utils_server.mdx b/api_docs/kbn_sse_utils_server.mdx index ee02d83c2fa20..8acd0ef41ba91 100644 --- a/api_docs/kbn_sse_utils_server.mdx +++ b/api_docs/kbn_sse_utils_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-sse-utils-server title: "@kbn/sse-utils-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/sse-utils-server plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/sse-utils-server'] --- import kbnSseUtilsServerObj from './kbn_sse_utils_server.devdocs.json'; diff --git a/api_docs/kbn_std.mdx b/api_docs/kbn_std.mdx index b223c4ba0d249..dd30376ddadb1 100644 --- a/api_docs/kbn_std.mdx +++ b/api_docs/kbn_std.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-std title: "@kbn/std" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/std plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/std'] --- import kbnStdObj from './kbn_std.devdocs.json'; diff --git a/api_docs/kbn_stdio_dev_helpers.mdx b/api_docs/kbn_stdio_dev_helpers.mdx index 3cca60b4d59a5..9fac6ebb7c8c9 100644 --- a/api_docs/kbn_stdio_dev_helpers.mdx +++ b/api_docs/kbn_stdio_dev_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-stdio-dev-helpers title: "@kbn/stdio-dev-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/stdio-dev-helpers plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/stdio-dev-helpers'] --- import kbnStdioDevHelpersObj from './kbn_stdio_dev_helpers.devdocs.json'; diff --git a/api_docs/kbn_storybook.mdx b/api_docs/kbn_storybook.mdx index 58b5a9eedf959..d91038307b5c4 100644 --- a/api_docs/kbn_storybook.mdx +++ b/api_docs/kbn_storybook.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-storybook title: "@kbn/storybook" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/storybook plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/storybook'] --- import kbnStorybookObj from './kbn_storybook.devdocs.json'; diff --git a/api_docs/kbn_synthetics_e2e.mdx b/api_docs/kbn_synthetics_e2e.mdx index a00632652b59e..47eccbb5bfdf0 100644 --- a/api_docs/kbn_synthetics_e2e.mdx +++ b/api_docs/kbn_synthetics_e2e.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-synthetics-e2e title: "@kbn/synthetics-e2e" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/synthetics-e2e plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/synthetics-e2e'] --- import kbnSyntheticsE2eObj from './kbn_synthetics_e2e.devdocs.json'; diff --git a/api_docs/kbn_synthetics_private_location.mdx b/api_docs/kbn_synthetics_private_location.mdx index 966aa66fe2a17..420efbd1596c0 100644 --- a/api_docs/kbn_synthetics_private_location.mdx +++ b/api_docs/kbn_synthetics_private_location.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-synthetics-private-location title: "@kbn/synthetics-private-location" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/synthetics-private-location plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/synthetics-private-location'] --- import kbnSyntheticsPrivateLocationObj from './kbn_synthetics_private_location.devdocs.json'; diff --git a/api_docs/kbn_telemetry_tools.mdx b/api_docs/kbn_telemetry_tools.mdx index a3960f4552102..ee2ba59bbc03f 100644 --- a/api_docs/kbn_telemetry_tools.mdx +++ b/api_docs/kbn_telemetry_tools.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-telemetry-tools title: "@kbn/telemetry-tools" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/telemetry-tools plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/telemetry-tools'] --- import kbnTelemetryToolsObj from './kbn_telemetry_tools.devdocs.json'; diff --git a/api_docs/kbn_test.mdx b/api_docs/kbn_test.mdx index 64998911ca114..0e4ae833e3421 100644 --- a/api_docs/kbn_test.mdx +++ b/api_docs/kbn_test.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-test title: "@kbn/test" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/test plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/test'] --- import kbnTestObj from './kbn_test.devdocs.json'; diff --git a/api_docs/kbn_test_eui_helpers.mdx b/api_docs/kbn_test_eui_helpers.mdx index d4331bb68ebf0..5064aaa658b03 100644 --- a/api_docs/kbn_test_eui_helpers.mdx +++ b/api_docs/kbn_test_eui_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-test-eui-helpers title: "@kbn/test-eui-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/test-eui-helpers plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/test-eui-helpers'] --- import kbnTestEuiHelpersObj from './kbn_test_eui_helpers.devdocs.json'; diff --git a/api_docs/kbn_test_jest_helpers.mdx b/api_docs/kbn_test_jest_helpers.mdx index 944b375644114..fcb3f8e0fabb6 100644 --- a/api_docs/kbn_test_jest_helpers.mdx +++ b/api_docs/kbn_test_jest_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-test-jest-helpers title: "@kbn/test-jest-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/test-jest-helpers plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/test-jest-helpers'] --- import kbnTestJestHelpersObj from './kbn_test_jest_helpers.devdocs.json'; diff --git a/api_docs/kbn_test_subj_selector.mdx b/api_docs/kbn_test_subj_selector.mdx index 112a2a94c9ac6..9d362121294ad 100644 --- a/api_docs/kbn_test_subj_selector.mdx +++ b/api_docs/kbn_test_subj_selector.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-test-subj-selector title: "@kbn/test-subj-selector" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/test-subj-selector plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/test-subj-selector'] --- import kbnTestSubjSelectorObj from './kbn_test_subj_selector.devdocs.json'; diff --git a/api_docs/kbn_timerange.mdx b/api_docs/kbn_timerange.mdx index a42f33444a060..154ec8e5580ce 100644 --- a/api_docs/kbn_timerange.mdx +++ b/api_docs/kbn_timerange.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-timerange title: "@kbn/timerange" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/timerange plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/timerange'] --- import kbnTimerangeObj from './kbn_timerange.devdocs.json'; diff --git a/api_docs/kbn_tooling_log.mdx b/api_docs/kbn_tooling_log.mdx index 3a3d18a02dd39..6a5aa39d549b1 100644 --- a/api_docs/kbn_tooling_log.mdx +++ b/api_docs/kbn_tooling_log.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-tooling-log title: "@kbn/tooling-log" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/tooling-log plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/tooling-log'] --- import kbnToolingLogObj from './kbn_tooling_log.devdocs.json'; diff --git a/api_docs/kbn_transpose_utils.mdx b/api_docs/kbn_transpose_utils.mdx index 7092bebb55b5c..f7297c8bc4c78 100644 --- a/api_docs/kbn_transpose_utils.mdx +++ b/api_docs/kbn_transpose_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-transpose-utils title: "@kbn/transpose-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/transpose-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/transpose-utils'] --- import kbnTransposeUtilsObj from './kbn_transpose_utils.devdocs.json'; diff --git a/api_docs/kbn_triggers_actions_ui_types.mdx b/api_docs/kbn_triggers_actions_ui_types.mdx index 369a3c05a6b38..7954618a41f69 100644 --- a/api_docs/kbn_triggers_actions_ui_types.mdx +++ b/api_docs/kbn_triggers_actions_ui_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-triggers-actions-ui-types title: "@kbn/triggers-actions-ui-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/triggers-actions-ui-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/triggers-actions-ui-types'] --- import kbnTriggersActionsUiTypesObj from './kbn_triggers_actions_ui_types.devdocs.json'; diff --git a/api_docs/kbn_try_in_console.mdx b/api_docs/kbn_try_in_console.mdx index 489b2a75bfcf3..fe6b8736b54d7 100644 --- a/api_docs/kbn_try_in_console.mdx +++ b/api_docs/kbn_try_in_console.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-try-in-console title: "@kbn/try-in-console" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/try-in-console plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/try-in-console'] --- import kbnTryInConsoleObj from './kbn_try_in_console.devdocs.json'; diff --git a/api_docs/kbn_ts_projects.devdocs.json b/api_docs/kbn_ts_projects.devdocs.json index 6847c2a76965a..f9a2cddcbfe04 100644 --- a/api_docs/kbn_ts_projects.devdocs.json +++ b/api_docs/kbn_ts_projects.devdocs.json @@ -213,6 +213,22 @@ "deprecated": false, "trackAdoption": false }, + { + "parentPluginId": "@kbn/ts-projects", + "id": "def-common.TsProject.isEsm", + "type": "CompoundType", + "tags": [], + "label": "isEsm", + "description": [ + "the package is esm or not" + ], + "signature": [ + "boolean | undefined" + ], + "path": "packages/kbn-ts-projects/ts_project.ts", + "deprecated": false, + "trackAdoption": false + }, { "parentPluginId": "@kbn/ts-projects", "id": "def-common.TsProject.rootImportReq", diff --git a/api_docs/kbn_ts_projects.mdx b/api_docs/kbn_ts_projects.mdx index dab8172512023..a2df53a19b78b 100644 --- a/api_docs/kbn_ts_projects.mdx +++ b/api_docs/kbn_ts_projects.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ts-projects title: "@kbn/ts-projects" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ts-projects plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ts-projects'] --- import kbnTsProjectsObj from './kbn_ts_projects.devdocs.json'; @@ -21,7 +21,7 @@ Contact [@elastic/kibana-operations](https://github.com/orgs/elastic/teams/kiban | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 39 | 0 | 25 | 1 | +| 40 | 0 | 25 | 1 | ## Common diff --git a/api_docs/kbn_typed_react_router_config.devdocs.json b/api_docs/kbn_typed_react_router_config.devdocs.json index 9bab557b023ff..f20c6013c647f 100644 --- a/api_docs/kbn_typed_react_router_config.devdocs.json +++ b/api_docs/kbn_typed_react_router_config.devdocs.json @@ -1,26 +1,10 @@ { "id": "@kbn/typed-react-router-config", "client": { - "classes": [], - "functions": [], - "interfaces": [], - "enums": [], - "misc": [], - "objects": [] - }, - "server": { - "classes": [], - "functions": [], - "interfaces": [], - "enums": [], - "misc": [], - "objects": [] - }, - "common": { "classes": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.NotFoundRouteException", + "id": "def-public.NotFoundRouteException", "type": "Class", "tags": [], "label": "NotFoundRouteException", @@ -28,9 +12,9 @@ "signature": [ { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.NotFoundRouteException", + "section": "def-public.NotFoundRouteException", "text": "NotFoundRouteException" }, " extends Error" @@ -41,7 +25,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.NotFoundRouteException.Unnamed", + "id": "def-public.NotFoundRouteException.Unnamed", "type": "Function", "tags": [], "label": "Constructor", @@ -55,7 +39,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.NotFoundRouteException.Unnamed.$1", + "id": "def-public.NotFoundRouteException.Unnamed.$1", "type": "string", "tags": [], "label": "message", @@ -78,7 +62,52 @@ "functions": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.createRouter", + "id": "def-public.BreadcrumbsContextProvider", + "type": "Function", + "tags": [], + "label": "BreadcrumbsContextProvider", + "description": [], + "signature": [ + "({\n children,\n}: { children: React.ReactNode; }) => React.JSX.Element" + ], + "path": "packages/kbn-typed-react-router-config/src/breadcrumbs/context.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/typed-react-router-config", + "id": "def-public.BreadcrumbsContextProvider.$1", + "type": "Object", + "tags": [], + "label": "{\n children,\n}", + "description": [], + "path": "packages/kbn-typed-react-router-config/src/breadcrumbs/context.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/typed-react-router-config", + "id": "def-public.BreadcrumbsContextProvider.$1.children", + "type": "CompoundType", + "tags": [], + "label": "children", + "description": [], + "signature": [ + "string | number | boolean | React.ReactElement> | Iterable | React.ReactPortal | null | undefined" + ], + "path": "packages/kbn-typed-react-router-config/src/breadcrumbs/context.tsx", + "deprecated": false, + "trackAdoption": false + } + ] + } + ], + "returnComment": [], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/typed-react-router-config", + "id": "def-public.createRouter", "type": "Function", "tags": [], "label": "createRouter", @@ -87,9 +116,9 @@ "(routes: TRoutes) => ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Router", + "section": "def-public.Router", "text": "Router" }, "" @@ -100,7 +129,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.createRouter.$1", + "id": "def-public.createRouter.$1", "type": "Uncategorized", "tags": [], "label": "routes", @@ -119,7 +148,43 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.CurrentRouteContextProvider", + "id": "def-public.createRouterBreadcrumbComponent", + "type": "Function", + "tags": [], + "label": "createRouterBreadcrumbComponent", + "description": [], + "signature": [ + "() => ", + "RouterBreadcrumb", + "" + ], + "path": "packages/kbn-typed-react-router-config/src/breadcrumbs/create_router_breadcrumb_component.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [], + "returnComment": [], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/typed-react-router-config", + "id": "def-public.createUseBreadcrumbs", + "type": "Function", + "tags": [], + "label": "createUseBreadcrumbs", + "description": [], + "signature": [ + "() => UseBreadcrumbs" + ], + "path": "packages/kbn-typed-react-router-config/src/breadcrumbs/use_router_breadcrumb.ts", + "deprecated": false, + "trackAdoption": false, + "children": [], + "returnComment": [], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/typed-react-router-config", + "id": "def-public.CurrentRouteContextProvider", "type": "Function", "tags": [], "label": "CurrentRouteContextProvider", @@ -128,17 +193,17 @@ "({ match, element, children, }: { match: ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMatch", + "section": "def-public.RouteMatch", "text": "RouteMatch" }, "<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Route", + "section": "def-public.Route", "text": "Route" }, ">; element: React.ReactElement>; children: React.ReactElement>; }) => React.JSX.Element" @@ -149,7 +214,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.CurrentRouteContextProvider.$1", + "id": "def-public.CurrentRouteContextProvider.$1", "type": "Object", "tags": [], "label": "{\n match,\n element,\n children,\n}", @@ -160,7 +225,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.CurrentRouteContextProvider.$1.match", + "id": "def-public.CurrentRouteContextProvider.$1.match", "type": "Object", "tags": [], "label": "match", @@ -168,17 +233,17 @@ "signature": [ { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMatch", + "section": "def-public.RouteMatch", "text": "RouteMatch" }, "<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Route", + "section": "def-public.Route", "text": "Route" }, ">" @@ -189,7 +254,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.CurrentRouteContextProvider.$1.element", + "id": "def-public.CurrentRouteContextProvider.$1.element", "type": "Object", "tags": [], "label": "element", @@ -203,7 +268,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.CurrentRouteContextProvider.$1.children", + "id": "def-public.CurrentRouteContextProvider.$1.children", "type": "Object", "tags": [], "label": "children", @@ -223,7 +288,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Outlet", + "id": "def-public.Outlet", "type": "Function", "tags": [], "label": "Outlet", @@ -240,7 +305,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.OutletContextProvider", + "id": "def-public.OutletContextProvider", "type": "Function", "tags": [], "label": "OutletContextProvider", @@ -254,7 +319,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.OutletContextProvider.$1", + "id": "def-public.OutletContextProvider.$1", "type": "Object", "tags": [], "label": "{\n element,\n children,\n}", @@ -265,7 +330,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.OutletContextProvider.$1.element", + "id": "def-public.OutletContextProvider.$1.element", "type": "Object", "tags": [], "label": "element", @@ -279,7 +344,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.OutletContextProvider.$1.children", + "id": "def-public.OutletContextProvider.$1.children", "type": "CompoundType", "tags": [], "label": "children", @@ -299,7 +364,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouterContextProvider", + "id": "def-public.RouterContextProvider", "type": "Function", "tags": [], "label": "RouterContextProvider", @@ -308,17 +373,17 @@ "({ router, children, }: { router: ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Router", + "section": "def-public.Router", "text": "Router" }, "<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMap", + "section": "def-public.RouteMap", "text": "RouteMap" }, ">; children: React.ReactNode; }) => React.JSX.Element" @@ -329,7 +394,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouterContextProvider.$1", + "id": "def-public.RouterContextProvider.$1", "type": "Object", "tags": [], "label": "{\n router,\n children,\n}", @@ -340,7 +405,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouterContextProvider.$1.router", + "id": "def-public.RouterContextProvider.$1.router", "type": "Object", "tags": [], "label": "router", @@ -348,17 +413,17 @@ "signature": [ { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Router", + "section": "def-public.Router", "text": "Router" }, "<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMap", + "section": "def-public.RouteMap", "text": "RouteMap" }, ">" @@ -369,7 +434,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouterContextProvider.$1.children", + "id": "def-public.RouterContextProvider.$1.children", "type": "CompoundType", "tags": [], "label": "children", @@ -389,7 +454,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouteRenderer", + "id": "def-public.RouteRenderer", "type": "Function", "tags": [], "label": "RouteRenderer", @@ -406,7 +471,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouterProvider", + "id": "def-public.RouterProvider", "type": "Function", "tags": [], "label": "RouterProvider", @@ -415,17 +480,17 @@ "({\n children,\n router,\n history,\n}: { router: ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Router", + "section": "def-public.Router", "text": "Router" }, "<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMap", + "section": "def-public.RouteMap", "text": "RouteMap" }, ">; history: ", @@ -438,7 +503,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouterProvider.$1", + "id": "def-public.RouterProvider.$1", "type": "Object", "tags": [], "label": "{\n children,\n router,\n history,\n}", @@ -449,7 +514,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouterProvider.$1.router", + "id": "def-public.RouterProvider.$1.router", "type": "Object", "tags": [], "label": "router", @@ -457,17 +522,17 @@ "signature": [ { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Router", + "section": "def-public.Router", "text": "Router" }, "<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMap", + "section": "def-public.RouteMap", "text": "RouteMap" }, ">" @@ -478,7 +543,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouterProvider.$1.history", + "id": "def-public.RouterProvider.$1.history", "type": "Object", "tags": [], "label": "history", @@ -493,7 +558,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouterProvider.$1.children", + "id": "def-public.RouterProvider.$1.children", "type": "CompoundType", "tags": [], "label": "children", @@ -513,7 +578,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.useCurrentRoute", + "id": "def-public.useCurrentRoute", "type": "Function", "tags": [], "label": "useCurrentRoute", @@ -522,17 +587,17 @@ "() => { match: ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMatch", + "section": "def-public.RouteMatch", "text": "RouteMatch" }, "<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Route", + "section": "def-public.Route", "text": "Route" }, ">; element: React.ReactElement>; }" @@ -546,7 +611,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.useMatchRoutes", + "id": "def-public.useMatchRoutes", "type": "Function", "tags": [], "label": "useMatchRoutes", @@ -555,17 +620,17 @@ "(path: string | undefined) => ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMatch", + "section": "def-public.RouteMatch", "text": "RouteMatch" }, "<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Route", + "section": "def-public.Route", "text": "Route" }, ">[]" @@ -576,7 +641,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.useMatchRoutes.$1", + "id": "def-public.useMatchRoutes.$1", "type": "string", "tags": [], "label": "path", @@ -595,7 +660,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.useParams", + "id": "def-public.useParams", "type": "Function", "tags": [], "label": "useParams", @@ -604,9 +669,9 @@ "(args: any[]) => ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.DefaultOutput", + "section": "def-public.DefaultOutput", "text": "DefaultOutput" }, " | undefined" @@ -617,7 +682,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.useParams.$1", + "id": "def-public.useParams.$1", "type": "Array", "tags": [], "label": "args", @@ -636,7 +701,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.useRoutePath", + "id": "def-public.useRoutePath", "type": "Function", "tags": [], "label": "useRoutePath", @@ -653,7 +718,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.useRouter", + "id": "def-public.useRouter", "type": "Function", "tags": [], "label": "useRouter", @@ -662,20 +727,12 @@ "() => ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Router", + "section": "def-public.Router", "text": "Router" }, - "<", - { - "pluginId": "@kbn/typed-react-router-config", - "scope": "common", - "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMap", - "text": "RouteMap" - }, - ">" + "" ], "path": "packages/kbn-typed-react-router-config/src/use_router.tsx", "deprecated": false, @@ -688,7 +745,7 @@ "interfaces": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.DefaultOutput", + "id": "def-public.DefaultOutput", "type": "Interface", "tags": [], "label": "DefaultOutput", @@ -699,7 +756,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.DefaultOutput.path", + "id": "def-public.DefaultOutput.path", "type": "Object", "tags": [], "label": "path", @@ -713,7 +770,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.DefaultOutput.query", + "id": "def-public.DefaultOutput.query", "type": "Object", "tags": [], "label": "query", @@ -730,7 +787,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Route", + "id": "def-public.Route", "type": "Interface", "tags": [], "label": "Route", @@ -741,7 +798,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Route.element", + "id": "def-public.Route.element", "type": "Object", "tags": [], "label": "element", @@ -755,7 +812,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Route.children", + "id": "def-public.Route.children", "type": "Object", "tags": [], "label": "children", @@ -763,9 +820,9 @@ "signature": [ { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMap", + "section": "def-public.RouteMap", "text": "RouteMap" }, " | undefined" @@ -776,7 +833,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Route.params", + "id": "def-public.Route.params", "type": "Object", "tags": [], "label": "params", @@ -791,7 +848,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Route.defaults", + "id": "def-public.Route.defaults", "type": "Object", "tags": [], "label": "defaults", @@ -805,7 +862,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Route.pre", + "id": "def-public.Route.pre", "type": "Object", "tags": [], "label": "pre", @@ -822,7 +879,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouteMatch", + "id": "def-public.RouteMatch", "type": "Interface", "tags": [], "label": "RouteMatch", @@ -830,9 +887,9 @@ "signature": [ { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMatch", + "section": "def-public.RouteMatch", "text": "RouteMatch" }, "" @@ -843,7 +900,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouteMatch.route", + "id": "def-public.RouteMatch.route", "type": "CompoundType", "tags": [], "label": "route", @@ -857,7 +914,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouteMatch.match", + "id": "def-public.RouteMatch.match", "type": "Object", "tags": [], "label": "match", @@ -878,7 +935,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router", + "id": "def-public.Router", "type": "Interface", "tags": [], "label": "Router", @@ -886,9 +943,9 @@ "signature": [ { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Router", + "section": "def-public.Router", "text": "Router" }, "" @@ -899,7 +956,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.matchRoutes", + "id": "def-public.Router.matchRoutes", "type": "Function", "tags": [], "label": "matchRoutes", @@ -908,9 +965,9 @@ "{ >(path: TPath, location: ", @@ -918,9 +975,9 @@ "): ToRouteMatch<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Match", + "section": "def-public.Match", "text": "Match" }, ">; (location: ", @@ -928,17 +985,17 @@ "): ToRouteMatch<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Match", + "section": "def-public.Match", "text": "Match" }, ">>; }" @@ -949,7 +1006,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.matchRoutes.$1", + "id": "def-public.Router.matchRoutes.$1", "type": "Uncategorized", "tags": [], "label": "path", @@ -964,7 +1021,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.matchRoutes.$2", + "id": "def-public.Router.matchRoutes.$2", "type": "Object", "tags": [], "label": "location", @@ -983,7 +1040,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.matchRoutes", + "id": "def-public.Router.matchRoutes", "type": "Function", "tags": [], "label": "matchRoutes", @@ -992,9 +1049,9 @@ "{ >(path: TPath, location: ", @@ -1002,9 +1059,9 @@ "): ToRouteMatch<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Match", + "section": "def-public.Match", "text": "Match" }, ">; (location: ", @@ -1012,17 +1069,17 @@ "): ToRouteMatch<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Match", + "section": "def-public.Match", "text": "Match" }, ">>; }" @@ -1033,7 +1090,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.matchRoutes.$1", + "id": "def-public.Router.matchRoutes.$1", "type": "Object", "tags": [], "label": "location", @@ -1052,7 +1109,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams", + "id": "def-public.Router.getParams", "type": "Function", "tags": [], "label": "getParams", @@ -1061,9 +1118,9 @@ "{ >(path: TPath, location: ", @@ -1071,17 +1128,17 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , TOptional extends boolean>(path: TPath, location: ", @@ -1089,33 +1146,33 @@ ", optional: TOptional): TOptional extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | undefined : ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , T2 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ">(path1: T1, path2: T2, location: ", @@ -1123,41 +1180,41 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , T2 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ", T3 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ">(path1: T1, path2: T2, path3: T3, location: ", @@ -1165,33 +1222,33 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , TOptional extends boolean>(path: TPath, location: ", @@ -1199,17 +1256,17 @@ ", optional: TOptional): TOptional extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | undefined : ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; }" @@ -1220,7 +1277,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$1", + "id": "def-public.Router.getParams.$1", "type": "Uncategorized", "tags": [], "label": "path", @@ -1235,7 +1292,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$2", + "id": "def-public.Router.getParams.$2", "type": "Object", "tags": [], "label": "location", @@ -1254,7 +1311,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams", + "id": "def-public.Router.getParams", "type": "Function", "tags": [], "label": "getParams", @@ -1263,9 +1320,9 @@ "{ >(path: TPath, location: ", @@ -1273,17 +1330,17 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , TOptional extends boolean>(path: TPath, location: ", @@ -1291,33 +1348,33 @@ ", optional: TOptional): TOptional extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | undefined : ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , T2 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ">(path1: T1, path2: T2, location: ", @@ -1325,41 +1382,41 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , T2 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ", T3 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ">(path1: T1, path2: T2, path3: T3, location: ", @@ -1367,33 +1424,33 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , TOptional extends boolean>(path: TPath, location: ", @@ -1401,17 +1458,17 @@ ", optional: TOptional): TOptional extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | undefined : ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; }" @@ -1422,7 +1479,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$1", + "id": "def-public.Router.getParams.$1", "type": "Uncategorized", "tags": [], "label": "path", @@ -1437,7 +1494,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$2", + "id": "def-public.Router.getParams.$2", "type": "Object", "tags": [], "label": "location", @@ -1453,7 +1510,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$3", + "id": "def-public.Router.getParams.$3", "type": "Uncategorized", "tags": [], "label": "optional", @@ -1471,7 +1528,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams", + "id": "def-public.Router.getParams", "type": "Function", "tags": [], "label": "getParams", @@ -1480,9 +1537,9 @@ "{ >(path: TPath, location: ", @@ -1490,17 +1547,17 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , TOptional extends boolean>(path: TPath, location: ", @@ -1508,33 +1565,33 @@ ", optional: TOptional): TOptional extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | undefined : ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , T2 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ">(path1: T1, path2: T2, location: ", @@ -1542,41 +1599,41 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , T2 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ", T3 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ">(path1: T1, path2: T2, path3: T3, location: ", @@ -1584,33 +1641,33 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , TOptional extends boolean>(path: TPath, location: ", @@ -1618,17 +1675,17 @@ ", optional: TOptional): TOptional extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | undefined : ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; }" @@ -1639,7 +1696,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$1", + "id": "def-public.Router.getParams.$1", "type": "Uncategorized", "tags": [], "label": "path1", @@ -1654,7 +1711,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$2", + "id": "def-public.Router.getParams.$2", "type": "Uncategorized", "tags": [], "label": "path2", @@ -1669,7 +1726,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$3", + "id": "def-public.Router.getParams.$3", "type": "Object", "tags": [], "label": "location", @@ -1688,7 +1745,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams", + "id": "def-public.Router.getParams", "type": "Function", "tags": [], "label": "getParams", @@ -1697,9 +1754,9 @@ "{ >(path: TPath, location: ", @@ -1707,17 +1764,17 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , TOptional extends boolean>(path: TPath, location: ", @@ -1725,33 +1782,33 @@ ", optional: TOptional): TOptional extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | undefined : ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , T2 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ">(path1: T1, path2: T2, location: ", @@ -1759,41 +1816,41 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , T2 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ", T3 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ">(path1: T1, path2: T2, path3: T3, location: ", @@ -1801,33 +1858,33 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , TOptional extends boolean>(path: TPath, location: ", @@ -1835,17 +1892,17 @@ ", optional: TOptional): TOptional extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | undefined : ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; }" @@ -1856,7 +1913,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$1", + "id": "def-public.Router.getParams.$1", "type": "Uncategorized", "tags": [], "label": "path1", @@ -1871,7 +1928,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$2", + "id": "def-public.Router.getParams.$2", "type": "Uncategorized", "tags": [], "label": "path2", @@ -1886,7 +1943,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$3", + "id": "def-public.Router.getParams.$3", "type": "Uncategorized", "tags": [], "label": "path3", @@ -1901,7 +1958,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$4", + "id": "def-public.Router.getParams.$4", "type": "Object", "tags": [], "label": "location", @@ -1920,7 +1977,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams", + "id": "def-public.Router.getParams", "type": "Function", "tags": [], "label": "getParams", @@ -1929,9 +1986,9 @@ "{ >(path: TPath, location: ", @@ -1939,17 +1996,17 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , TOptional extends boolean>(path: TPath, location: ", @@ -1957,33 +2014,33 @@ ", optional: TOptional): TOptional extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | undefined : ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , T2 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ">(path1: T1, path2: T2, location: ", @@ -1991,41 +2048,41 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , T2 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ", T3 extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, ">(path1: T1, path2: T2, path3: T3, location: ", @@ -2033,33 +2090,33 @@ "): ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; , TOptional extends boolean>(path: TPath, location: ", @@ -2067,17 +2124,17 @@ ", optional: TOptional): TOptional extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, " | undefined : ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, "; }" @@ -2088,7 +2145,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$1", + "id": "def-public.Router.getParams.$1", "type": "Uncategorized", "tags": [], "label": "path", @@ -2103,7 +2160,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$2", + "id": "def-public.Router.getParams.$2", "type": "Object", "tags": [], "label": "location", @@ -2119,7 +2176,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getParams.$3", + "id": "def-public.Router.getParams.$3", "type": "Uncategorized", "tags": [], "label": "optional", @@ -2137,7 +2194,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.link", + "id": "def-public.Router.link", "type": "Function", "tags": [], "label": "link", @@ -2146,25 +2203,25 @@ ">(path: TPath, ...args: ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeAsArgs", + "section": "def-public.TypeAsArgs", "text": "TypeAsArgs" }, "<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, ">) => string" @@ -2175,7 +2232,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.link.$1", + "id": "def-public.Router.link.$1", "type": "Uncategorized", "tags": [], "label": "path", @@ -2190,7 +2247,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.link.$2", + "id": "def-public.Router.link.$2", "type": "Uncategorized", "tags": [], "label": "args", @@ -2198,17 +2255,17 @@ "signature": [ { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeAsArgs", + "section": "def-public.TypeAsArgs", "text": "TypeAsArgs" }, "<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.TypeOf", + "section": "def-public.TypeOf", "text": "TypeOf" }, ">" @@ -2223,7 +2280,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getRoutePath", + "id": "def-public.Router.getRoutePath", "type": "Function", "tags": [], "label": "getRoutePath", @@ -2232,9 +2289,9 @@ "(route: ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteWithPath", + "section": "def-public.RouteWithPath", "text": "RouteWithPath" }, ") => string" @@ -2245,7 +2302,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getRoutePath.$1", + "id": "def-public.Router.getRoutePath.$1", "type": "Object", "tags": [], "label": "route", @@ -2253,9 +2310,9 @@ "signature": [ { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteWithPath", + "section": "def-public.RouteWithPath", "text": "RouteWithPath" } ], @@ -2269,7 +2326,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getRoutesToMatch", + "id": "def-public.Router.getRoutesToMatch", "type": "Function", "tags": [], "label": "getRoutesToMatch", @@ -2278,9 +2335,9 @@ "(path: string) => ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.FlattenRoutesOf", + "section": "def-public.FlattenRoutesOf", "text": "FlattenRoutesOf" }, "" @@ -2291,7 +2348,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Router.getRoutesToMatch.$1", + "id": "def-public.Router.getRoutesToMatch.$1", "type": "string", "tags": [], "label": "path", @@ -2312,7 +2369,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouteWithPath", + "id": "def-public.RouteWithPath", "type": "Interface", "tags": [], "label": "RouteWithPath", @@ -2320,17 +2377,17 @@ "signature": [ { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteWithPath", + "section": "def-public.RouteWithPath", "text": "RouteWithPath" }, " extends ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Route", + "section": "def-public.Route", "text": "Route" } ], @@ -2340,7 +2397,7 @@ "children": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouteWithPath.path", + "id": "def-public.RouteWithPath.path", "type": "string", "tags": [], "label": "path", @@ -2357,7 +2414,7 @@ "misc": [ { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.FlattenRoutesOf", + "id": "def-public.FlattenRoutesOf", "type": "Type", "tags": [], "label": "FlattenRoutesOf", @@ -2375,7 +2432,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.Match", + "id": "def-public.Match", "type": "Type", "tags": [], "label": "Match", @@ -2390,7 +2447,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.OutputOf", + "id": "def-public.OutputOf", "type": "Type", "tags": [], "label": "OutputOf", @@ -2399,17 +2456,17 @@ "OutputOfRoutes<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Match", + "section": "def-public.Match", "text": "Match" }, "> & ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.DefaultOutput", + "section": "def-public.DefaultOutput", "text": "DefaultOutput" } ], @@ -2420,7 +2477,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.PathsOf", + "id": "def-public.PathsOf", "type": "Type", "tags": [], "label": "PathsOf", @@ -2431,9 +2488,9 @@ "<{ [key in keyof TRouteMap]: key | (TRouteMap[key] extends { children: ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.RouteMap", + "section": "def-public.RouteMap", "text": "RouteMap" }, "; } ? ", @@ -2441,9 +2498,9 @@ "<`${key & string}/*`> | ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.PathsOf", + "section": "def-public.PathsOf", "text": "PathsOf" }, " : never); }>" @@ -2455,7 +2512,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.RouteMap", + "id": "def-public.RouteMap", "type": "Type", "tags": [], "label": "RouteMap", @@ -2464,9 +2521,9 @@ "{ [x: string]: ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Route", + "section": "def-public.Route", "text": "Route" }, "; }" @@ -2478,7 +2535,7 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.TypeAsArgs", + "id": "def-public.TypeAsArgs", "type": "Type", "tags": [], "label": "TypeAsArgs", @@ -2495,7 +2552,24 @@ }, { "parentPluginId": "@kbn/typed-react-router-config", - "id": "def-common.TypeOf", + "id": "def-public.TypeAsParams", + "type": "Type", + "tags": [], + "label": "TypeAsParams", + "description": [], + "signature": [ + "keyof TObject extends never ? {} : ", + "RequiredKeys", + " extends never ? never : { params: TObject; }" + ], + "path": "packages/kbn-typed-react-router-config/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/typed-react-router-config", + "id": "def-public.TypeOf", "type": "Type", "tags": [], "label": "TypeOf", @@ -2504,17 +2578,17 @@ "TypeOfRoutes<", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.Match", + "section": "def-public.Match", "text": "Match" }, "> & (TWithDefaultOutput extends true ? ", { "pluginId": "@kbn/typed-react-router-config", - "scope": "common", + "scope": "public", "docId": "kibKbnTypedReactRouterConfigPluginApi", - "section": "def-common.DefaultOutput", + "section": "def-public.DefaultOutput", "text": "DefaultOutput" }, " : {})" @@ -2526,5 +2600,21 @@ } ], "objects": [] + }, + "server": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + }, + "common": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] } } \ No newline at end of file diff --git a/api_docs/kbn_typed_react_router_config.mdx b/api_docs/kbn_typed_react_router_config.mdx index d074e7c7ade58..6ac21c5e71b9e 100644 --- a/api_docs/kbn_typed_react_router_config.mdx +++ b/api_docs/kbn_typed_react_router_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-typed-react-router-config title: "@kbn/typed-react-router-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/typed-react-router-config plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/typed-react-router-config'] --- import kbnTypedReactRouterConfigObj from './kbn_typed_react_router_config.devdocs.json'; @@ -21,19 +21,19 @@ Contact [@elastic/obs-knowledge-team](https://github.com/orgs/elastic/teams/obs- | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 86 | 0 | 86 | 1 | +| 92 | 0 | 92 | 2 | -## Common +## Client ### Functions - + ### Classes - + ### Interfaces - + ### Consts, variables and types - + diff --git a/api_docs/kbn_ui_actions_browser.mdx b/api_docs/kbn_ui_actions_browser.mdx index e2283d44d7d85..d55d6709b24dc 100644 --- a/api_docs/kbn_ui_actions_browser.mdx +++ b/api_docs/kbn_ui_actions_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ui-actions-browser title: "@kbn/ui-actions-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ui-actions-browser plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ui-actions-browser'] --- import kbnUiActionsBrowserObj from './kbn_ui_actions_browser.devdocs.json'; diff --git a/api_docs/kbn_ui_shared_deps_src.mdx b/api_docs/kbn_ui_shared_deps_src.mdx index 91eb9b2c9f3dd..70408e877b20e 100644 --- a/api_docs/kbn_ui_shared_deps_src.mdx +++ b/api_docs/kbn_ui_shared_deps_src.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ui-shared-deps-src title: "@kbn/ui-shared-deps-src" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ui-shared-deps-src plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ui-shared-deps-src'] --- import kbnUiSharedDepsSrcObj from './kbn_ui_shared_deps_src.devdocs.json'; diff --git a/api_docs/kbn_ui_theme.mdx b/api_docs/kbn_ui_theme.mdx index 5597f44f08cc3..c2798b1527d7c 100644 --- a/api_docs/kbn_ui_theme.mdx +++ b/api_docs/kbn_ui_theme.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ui-theme title: "@kbn/ui-theme" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ui-theme plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ui-theme'] --- import kbnUiThemeObj from './kbn_ui_theme.devdocs.json'; diff --git a/api_docs/kbn_unified_data_table.mdx b/api_docs/kbn_unified_data_table.mdx index d4474b594a56c..57154c77cce62 100644 --- a/api_docs/kbn_unified_data_table.mdx +++ b/api_docs/kbn_unified_data_table.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-unified-data-table title: "@kbn/unified-data-table" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/unified-data-table plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/unified-data-table'] --- import kbnUnifiedDataTableObj from './kbn_unified_data_table.devdocs.json'; diff --git a/api_docs/kbn_unified_doc_viewer.mdx b/api_docs/kbn_unified_doc_viewer.mdx index 9695d6d2b7cdd..25cc5d25f6dc4 100644 --- a/api_docs/kbn_unified_doc_viewer.mdx +++ b/api_docs/kbn_unified_doc_viewer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-unified-doc-viewer title: "@kbn/unified-doc-viewer" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/unified-doc-viewer plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/unified-doc-viewer'] --- import kbnUnifiedDocViewerObj from './kbn_unified_doc_viewer.devdocs.json'; diff --git a/api_docs/kbn_unified_field_list.mdx b/api_docs/kbn_unified_field_list.mdx index 03ccff56164cc..388383c3db2dc 100644 --- a/api_docs/kbn_unified_field_list.mdx +++ b/api_docs/kbn_unified_field_list.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-unified-field-list title: "@kbn/unified-field-list" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/unified-field-list plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/unified-field-list'] --- import kbnUnifiedFieldListObj from './kbn_unified_field_list.devdocs.json'; diff --git a/api_docs/kbn_unsaved_changes_badge.mdx b/api_docs/kbn_unsaved_changes_badge.mdx index 0886e13ba31ab..3744ea5c190ea 100644 --- a/api_docs/kbn_unsaved_changes_badge.mdx +++ b/api_docs/kbn_unsaved_changes_badge.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-unsaved-changes-badge title: "@kbn/unsaved-changes-badge" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/unsaved-changes-badge plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/unsaved-changes-badge'] --- import kbnUnsavedChangesBadgeObj from './kbn_unsaved_changes_badge.devdocs.json'; diff --git a/api_docs/kbn_unsaved_changes_prompt.mdx b/api_docs/kbn_unsaved_changes_prompt.mdx index 48681209f51ba..da031414b9e81 100644 --- a/api_docs/kbn_unsaved_changes_prompt.mdx +++ b/api_docs/kbn_unsaved_changes_prompt.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-unsaved-changes-prompt title: "@kbn/unsaved-changes-prompt" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/unsaved-changes-prompt plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/unsaved-changes-prompt'] --- import kbnUnsavedChangesPromptObj from './kbn_unsaved_changes_prompt.devdocs.json'; diff --git a/api_docs/kbn_use_tracked_promise.mdx b/api_docs/kbn_use_tracked_promise.mdx index 302fc7347941f..bff0ef92d2fd0 100644 --- a/api_docs/kbn_use_tracked_promise.mdx +++ b/api_docs/kbn_use_tracked_promise.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-use-tracked-promise title: "@kbn/use-tracked-promise" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/use-tracked-promise plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/use-tracked-promise'] --- import kbnUseTrackedPromiseObj from './kbn_use_tracked_promise.devdocs.json'; diff --git a/api_docs/kbn_user_profile_components.mdx b/api_docs/kbn_user_profile_components.mdx index a6f3c785874b5..e427cbd8506fa 100644 --- a/api_docs/kbn_user_profile_components.mdx +++ b/api_docs/kbn_user_profile_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-user-profile-components title: "@kbn/user-profile-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/user-profile-components plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/user-profile-components'] --- import kbnUserProfileComponentsObj from './kbn_user_profile_components.devdocs.json'; diff --git a/api_docs/kbn_utility_types.devdocs.json b/api_docs/kbn_utility_types.devdocs.json index 6d177a2aa2cf2..b9cdddfd3ad02 100644 --- a/api_docs/kbn_utility_types.devdocs.json +++ b/api_docs/kbn_utility_types.devdocs.json @@ -361,11 +361,11 @@ "signature": [ "(Exclude<", "ValuesType", - "<{ [TKey in keyof TObject]: {} extends Pick ? ", + "<{ [TKey in keyof TObject as string]: string extends TKey ? Record : {} extends Pick ? ", "DeepPartial", ">> : DedotKey; }>, undefined> extends any ? (k: Exclude<", "ValuesType", - "<{ [TKey in keyof TObject]: {} extends Pick ? ", + "<{ [TKey in keyof TObject as string]: string extends TKey ? Record : {} extends Pick ? ", "DeepPartial", ">> : DedotKey; }>, undefined>) => void : never) extends (k: infer I) => void ? I : never" ], diff --git a/api_docs/kbn_utility_types.mdx b/api_docs/kbn_utility_types.mdx index 8e48c1e089bf0..6fffd02afd708 100644 --- a/api_docs/kbn_utility_types.mdx +++ b/api_docs/kbn_utility_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-utility-types title: "@kbn/utility-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/utility-types plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/utility-types'] --- import kbnUtilityTypesObj from './kbn_utility_types.devdocs.json'; diff --git a/api_docs/kbn_utility_types_jest.mdx b/api_docs/kbn_utility_types_jest.mdx index 3a20fa44e6b90..68f1c44d0929e 100644 --- a/api_docs/kbn_utility_types_jest.mdx +++ b/api_docs/kbn_utility_types_jest.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-utility-types-jest title: "@kbn/utility-types-jest" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/utility-types-jest plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/utility-types-jest'] --- import kbnUtilityTypesJestObj from './kbn_utility_types_jest.devdocs.json'; diff --git a/api_docs/kbn_utils.mdx b/api_docs/kbn_utils.mdx index 8930248203e2f..e6ae404396de6 100644 --- a/api_docs/kbn_utils.mdx +++ b/api_docs/kbn_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-utils title: "@kbn/utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/utils'] --- import kbnUtilsObj from './kbn_utils.devdocs.json'; diff --git a/api_docs/kbn_visualization_ui_components.mdx b/api_docs/kbn_visualization_ui_components.mdx index f097d07c11752..c6064a6fbe6da 100644 --- a/api_docs/kbn_visualization_ui_components.mdx +++ b/api_docs/kbn_visualization_ui_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-visualization-ui-components title: "@kbn/visualization-ui-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/visualization-ui-components plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/visualization-ui-components'] --- import kbnVisualizationUiComponentsObj from './kbn_visualization_ui_components.devdocs.json'; diff --git a/api_docs/kbn_visualization_utils.mdx b/api_docs/kbn_visualization_utils.mdx index 1a97d8f732aa2..cbfbdd595cf41 100644 --- a/api_docs/kbn_visualization_utils.mdx +++ b/api_docs/kbn_visualization_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-visualization-utils title: "@kbn/visualization-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/visualization-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/visualization-utils'] --- import kbnVisualizationUtilsObj from './kbn_visualization_utils.devdocs.json'; diff --git a/api_docs/kbn_xstate_utils.mdx b/api_docs/kbn_xstate_utils.mdx index f6f8974978783..94c73215d817b 100644 --- a/api_docs/kbn_xstate_utils.mdx +++ b/api_docs/kbn_xstate_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-xstate-utils title: "@kbn/xstate-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/xstate-utils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/xstate-utils'] --- import kbnXstateUtilsObj from './kbn_xstate_utils.devdocs.json'; diff --git a/api_docs/kbn_yarn_lock_validator.mdx b/api_docs/kbn_yarn_lock_validator.mdx index d4448ca0c4ccf..72af88d57102a 100644 --- a/api_docs/kbn_yarn_lock_validator.mdx +++ b/api_docs/kbn_yarn_lock_validator.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-yarn-lock-validator title: "@kbn/yarn-lock-validator" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/yarn-lock-validator plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/yarn-lock-validator'] --- import kbnYarnLockValidatorObj from './kbn_yarn_lock_validator.devdocs.json'; diff --git a/api_docs/kbn_zod.mdx b/api_docs/kbn_zod.mdx index f0ed4bbd91e8d..3b2c6c9426c52 100644 --- a/api_docs/kbn_zod.mdx +++ b/api_docs/kbn_zod.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-zod title: "@kbn/zod" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/zod plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/zod'] --- import kbnZodObj from './kbn_zod.devdocs.json'; diff --git a/api_docs/kbn_zod_helpers.mdx b/api_docs/kbn_zod_helpers.mdx index 29dea6738a696..e05b28083dde0 100644 --- a/api_docs/kbn_zod_helpers.mdx +++ b/api_docs/kbn_zod_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-zod-helpers title: "@kbn/zod-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/zod-helpers plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/zod-helpers'] --- import kbnZodHelpersObj from './kbn_zod_helpers.devdocs.json'; diff --git a/api_docs/kibana_overview.mdx b/api_docs/kibana_overview.mdx index 564123f2af26d..3e9be85719671 100644 --- a/api_docs/kibana_overview.mdx +++ b/api_docs/kibana_overview.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kibanaOverview title: "kibanaOverview" image: https://source.unsplash.com/400x175/?github description: API docs for the kibanaOverview plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'kibanaOverview'] --- import kibanaOverviewObj from './kibana_overview.devdocs.json'; diff --git a/api_docs/kibana_react.mdx b/api_docs/kibana_react.mdx index 529d11de6c1b8..a6f0de081762f 100644 --- a/api_docs/kibana_react.mdx +++ b/api_docs/kibana_react.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kibanaReact title: "kibanaReact" image: https://source.unsplash.com/400x175/?github description: API docs for the kibanaReact plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'kibanaReact'] --- import kibanaReactObj from './kibana_react.devdocs.json'; diff --git a/api_docs/kibana_utils.mdx b/api_docs/kibana_utils.mdx index d52498640b417..a1589a4c09545 100644 --- a/api_docs/kibana_utils.mdx +++ b/api_docs/kibana_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kibanaUtils title: "kibanaUtils" image: https://source.unsplash.com/400x175/?github description: API docs for the kibanaUtils plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'kibanaUtils'] --- import kibanaUtilsObj from './kibana_utils.devdocs.json'; diff --git a/api_docs/kubernetes_security.mdx b/api_docs/kubernetes_security.mdx index 5ef9844dd663a..7d0e464a720b7 100644 --- a/api_docs/kubernetes_security.mdx +++ b/api_docs/kubernetes_security.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kubernetesSecurity title: "kubernetesSecurity" image: https://source.unsplash.com/400x175/?github description: API docs for the kubernetesSecurity plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'kubernetesSecurity'] --- import kubernetesSecurityObj from './kubernetes_security.devdocs.json'; diff --git a/api_docs/lens.mdx b/api_docs/lens.mdx index 47010ffcca60a..0c9d7a8273d47 100644 --- a/api_docs/lens.mdx +++ b/api_docs/lens.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/lens title: "lens" image: https://source.unsplash.com/400x175/?github description: API docs for the lens plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'lens'] --- import lensObj from './lens.devdocs.json'; diff --git a/api_docs/license_api_guard.mdx b/api_docs/license_api_guard.mdx index f036e9680d534..bd9615bffba59 100644 --- a/api_docs/license_api_guard.mdx +++ b/api_docs/license_api_guard.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/licenseApiGuard title: "licenseApiGuard" image: https://source.unsplash.com/400x175/?github description: API docs for the licenseApiGuard plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'licenseApiGuard'] --- import licenseApiGuardObj from './license_api_guard.devdocs.json'; diff --git a/api_docs/license_management.mdx b/api_docs/license_management.mdx index 28163d0e9b802..d899125d85fd8 100644 --- a/api_docs/license_management.mdx +++ b/api_docs/license_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/licenseManagement title: "licenseManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the licenseManagement plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'licenseManagement'] --- import licenseManagementObj from './license_management.devdocs.json'; diff --git a/api_docs/licensing.mdx b/api_docs/licensing.mdx index 7891bdbffd53c..18faeeaf9fe97 100644 --- a/api_docs/licensing.mdx +++ b/api_docs/licensing.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/licensing title: "licensing" image: https://source.unsplash.com/400x175/?github description: API docs for the licensing plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'licensing'] --- import licensingObj from './licensing.devdocs.json'; diff --git a/api_docs/links.mdx b/api_docs/links.mdx index 7cd065f537e2e..2f2744df39473 100644 --- a/api_docs/links.mdx +++ b/api_docs/links.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/links title: "links" image: https://source.unsplash.com/400x175/?github description: API docs for the links plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'links'] --- import linksObj from './links.devdocs.json'; diff --git a/api_docs/lists.mdx b/api_docs/lists.mdx index e279800f0a366..4359102b2f850 100644 --- a/api_docs/lists.mdx +++ b/api_docs/lists.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/lists title: "lists" image: https://source.unsplash.com/400x175/?github description: API docs for the lists plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'lists'] --- import listsObj from './lists.devdocs.json'; diff --git a/api_docs/llm_tasks.mdx b/api_docs/llm_tasks.mdx index 9023dc64d2540..64a0480743e16 100644 --- a/api_docs/llm_tasks.mdx +++ b/api_docs/llm_tasks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/llmTasks title: "llmTasks" image: https://source.unsplash.com/400x175/?github description: API docs for the llmTasks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'llmTasks'] --- import llmTasksObj from './llm_tasks.devdocs.json'; diff --git a/api_docs/logs_data_access.mdx b/api_docs/logs_data_access.mdx index dec9fcafdf7b2..f519b78e8d3d7 100644 --- a/api_docs/logs_data_access.mdx +++ b/api_docs/logs_data_access.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/logsDataAccess title: "logsDataAccess" image: https://source.unsplash.com/400x175/?github description: API docs for the logsDataAccess plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'logsDataAccess'] --- import logsDataAccessObj from './logs_data_access.devdocs.json'; diff --git a/api_docs/logs_explorer.mdx b/api_docs/logs_explorer.mdx index a10d10902cd69..2c01072a671dd 100644 --- a/api_docs/logs_explorer.mdx +++ b/api_docs/logs_explorer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/logsExplorer title: "logsExplorer" image: https://source.unsplash.com/400x175/?github description: API docs for the logsExplorer plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'logsExplorer'] --- import logsExplorerObj from './logs_explorer.devdocs.json'; diff --git a/api_docs/logs_shared.mdx b/api_docs/logs_shared.mdx index d29a4764936c1..3caa322fa2b8e 100644 --- a/api_docs/logs_shared.mdx +++ b/api_docs/logs_shared.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/logsShared title: "logsShared" image: https://source.unsplash.com/400x175/?github description: API docs for the logsShared plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'logsShared'] --- import logsSharedObj from './logs_shared.devdocs.json'; diff --git a/api_docs/management.mdx b/api_docs/management.mdx index 7c49537d7066e..73aa58c63c4b5 100644 --- a/api_docs/management.mdx +++ b/api_docs/management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/management title: "management" image: https://source.unsplash.com/400x175/?github description: API docs for the management plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'management'] --- import managementObj from './management.devdocs.json'; diff --git a/api_docs/maps.mdx b/api_docs/maps.mdx index f3deeabdf82ab..706136b3ba414 100644 --- a/api_docs/maps.mdx +++ b/api_docs/maps.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/maps title: "maps" image: https://source.unsplash.com/400x175/?github description: API docs for the maps plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'maps'] --- import mapsObj from './maps.devdocs.json'; diff --git a/api_docs/maps_ems.mdx b/api_docs/maps_ems.mdx index ce1df7904abb8..04e10bd9621b4 100644 --- a/api_docs/maps_ems.mdx +++ b/api_docs/maps_ems.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/mapsEms title: "mapsEms" image: https://source.unsplash.com/400x175/?github description: API docs for the mapsEms plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'mapsEms'] --- import mapsEmsObj from './maps_ems.devdocs.json'; diff --git a/api_docs/metrics_data_access.mdx b/api_docs/metrics_data_access.mdx index ee33dbc9c8c30..77743d2ab64eb 100644 --- a/api_docs/metrics_data_access.mdx +++ b/api_docs/metrics_data_access.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/metricsDataAccess title: "metricsDataAccess" image: https://source.unsplash.com/400x175/?github description: API docs for the metricsDataAccess plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'metricsDataAccess'] --- import metricsDataAccessObj from './metrics_data_access.devdocs.json'; diff --git a/api_docs/ml.mdx b/api_docs/ml.mdx index cfd6e6424dc99..2a49a37a5e257 100644 --- a/api_docs/ml.mdx +++ b/api_docs/ml.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/ml title: "ml" image: https://source.unsplash.com/400x175/?github description: API docs for the ml plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'ml'] --- import mlObj from './ml.devdocs.json'; diff --git a/api_docs/mock_idp_plugin.mdx b/api_docs/mock_idp_plugin.mdx index f771652070d9b..ad9da5bc80c4a 100644 --- a/api_docs/mock_idp_plugin.mdx +++ b/api_docs/mock_idp_plugin.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/mockIdpPlugin title: "mockIdpPlugin" image: https://source.unsplash.com/400x175/?github description: API docs for the mockIdpPlugin plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'mockIdpPlugin'] --- import mockIdpPluginObj from './mock_idp_plugin.devdocs.json'; diff --git a/api_docs/monitoring.mdx b/api_docs/monitoring.mdx index 159553ebaf184..66318096eb922 100644 --- a/api_docs/monitoring.mdx +++ b/api_docs/monitoring.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/monitoring title: "monitoring" image: https://source.unsplash.com/400x175/?github description: API docs for the monitoring plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'monitoring'] --- import monitoringObj from './monitoring.devdocs.json'; diff --git a/api_docs/monitoring_collection.mdx b/api_docs/monitoring_collection.mdx index 9c691ba2910fd..4fd289aa19adb 100644 --- a/api_docs/monitoring_collection.mdx +++ b/api_docs/monitoring_collection.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/monitoringCollection title: "monitoringCollection" image: https://source.unsplash.com/400x175/?github description: API docs for the monitoringCollection plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'monitoringCollection'] --- import monitoringCollectionObj from './monitoring_collection.devdocs.json'; diff --git a/api_docs/navigation.mdx b/api_docs/navigation.mdx index a404765bbf8a7..fe5b59379a4db 100644 --- a/api_docs/navigation.mdx +++ b/api_docs/navigation.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/navigation title: "navigation" image: https://source.unsplash.com/400x175/?github description: API docs for the navigation plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'navigation'] --- import navigationObj from './navigation.devdocs.json'; diff --git a/api_docs/newsfeed.mdx b/api_docs/newsfeed.mdx index 7bd52ee4ed48c..1905d9ecf9080 100644 --- a/api_docs/newsfeed.mdx +++ b/api_docs/newsfeed.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/newsfeed title: "newsfeed" image: https://source.unsplash.com/400x175/?github description: API docs for the newsfeed plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'newsfeed'] --- import newsfeedObj from './newsfeed.devdocs.json'; diff --git a/api_docs/no_data_page.mdx b/api_docs/no_data_page.mdx index 81e085b96bc24..0a4821a723677 100644 --- a/api_docs/no_data_page.mdx +++ b/api_docs/no_data_page.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/noDataPage title: "noDataPage" image: https://source.unsplash.com/400x175/?github description: API docs for the noDataPage plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'noDataPage'] --- import noDataPageObj from './no_data_page.devdocs.json'; diff --git a/api_docs/notifications.mdx b/api_docs/notifications.mdx index c61a1cf13f00b..40517aef8a056 100644 --- a/api_docs/notifications.mdx +++ b/api_docs/notifications.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/notifications title: "notifications" image: https://source.unsplash.com/400x175/?github description: API docs for the notifications plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'notifications'] --- import notificationsObj from './notifications.devdocs.json'; diff --git a/api_docs/observability.devdocs.json b/api_docs/observability.devdocs.json index 7ff6ef019cc98..48c5cad2a518a 100644 --- a/api_docs/observability.devdocs.json +++ b/api_docs/observability.devdocs.json @@ -2863,6 +2863,27 @@ "path": "x-pack/plugins/observability_solution/observability/public/plugin.ts", "deprecated": false, "trackAdoption": false + }, + { + "parentPluginId": "observability", + "id": "def-public.ObservabilityPublicPluginsSetup.streams", + "type": "Object", + "tags": [], + "label": "streams", + "description": [], + "signature": [ + { + "pluginId": "streams", + "scope": "public", + "docId": "kibStreamsPluginApi", + "section": "def-public.StreamsPluginSetup", + "text": "StreamsPluginSetup" + }, + " | undefined" + ], + "path": "x-pack/plugins/observability_solution/observability/public/plugin.ts", + "deprecated": false, + "trackAdoption": false } ], "initialIsOpen": false @@ -3813,6 +3834,27 @@ "path": "x-pack/plugins/observability_solution/observability/public/plugin.ts", "deprecated": false, "trackAdoption": false + }, + { + "parentPluginId": "observability", + "id": "def-public.ObservabilityPublicPluginsStart.streams", + "type": "Object", + "tags": [], + "label": "streams", + "description": [], + "signature": [ + { + "pluginId": "streams", + "scope": "public", + "docId": "kibStreamsPluginApi", + "section": "def-public.StreamsPluginStart", + "text": "StreamsPluginStart" + }, + " | undefined" + ], + "path": "x-pack/plugins/observability_solution/observability/public/plugin.ts", + "deprecated": false, + "trackAdoption": false } ], "initialIsOpen": false @@ -8592,13 +8634,27 @@ "children": [ { "parentPluginId": "observability", - "id": "def-server.ObservabilityRouteCreateOptions.options", - "type": "Object", + "id": "def-server.ObservabilityRouteCreateOptions.tags", + "type": "Array", "tags": [], - "label": "options", + "label": "tags", + "description": [], + "signature": [ + "string[]" + ], + "path": "x-pack/plugins/observability_solution/observability/server/routes/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "observability", + "id": "def-server.ObservabilityRouteCreateOptions.access", + "type": "CompoundType", + "tags": [], + "label": "access", "description": [], "signature": [ - "{ tags: string[]; access?: \"internal\" | \"public\" | undefined; }" + "\"internal\" | \"public\" | undefined" ], "path": "x-pack/plugins/observability_solution/observability/server/routes/types.ts", "deprecated": false, @@ -8717,20 +8773,6 @@ "path": "x-pack/plugins/observability_solution/observability/server/routes/types.ts", "deprecated": false, "trackAdoption": false - }, - { - "parentPluginId": "observability", - "id": "def-server.ObservabilityRouteHandlerResources.config", - "type": "Object", - "tags": [], - "label": "config", - "description": [], - "signature": [ - "{ readonly enabled: boolean; readonly annotations: Readonly<{} & { index: string; enabled: boolean; }>; readonly unsafe: Readonly<{} & { alertDetails: Readonly<{} & { uptime: Readonly<{} & { enabled: boolean; }>; observability: Readonly<{} & { enabled: boolean; }>; metrics: Readonly<{} & { enabled: boolean; }>; logs: Readonly<{} & { enabled: boolean; }>; }>; thresholdRule: Readonly<{} & { enabled: boolean; }>; ruleFormV2: Readonly<{} & { enabled: boolean; }>; }>; readonly customThresholdRule: Readonly<{} & { groupByPageSize: number; }>; readonly createO11yGenericFeatureId: boolean; }" - ], - "path": "x-pack/plugins/observability_solution/observability/server/routes/types.ts", - "deprecated": false, - "trackAdoption": false } ], "initialIsOpen": false @@ -8762,7 +8804,15 @@ "section": "def-common.RouteParamsRT", "text": "RouteParamsRT" }, - " | undefined, any, any, Record>; }" + " | undefined, any, any, ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRouteCreateOptions", + "text": "ServerRouteCreateOptions" + }, + " | undefined>; }" ], "path": "x-pack/plugins/observability_solution/observability/server/routes/types.ts", "deprecated": false, @@ -8922,15 +8972,7 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - " ? TReturnType extends ", + " ? TReturnType extends ", { "pluginId": "@kbn/core-http-server", "scope": "server", diff --git a/api_docs/observability.mdx b/api_docs/observability.mdx index f5422a8081dd8..db6a0f97c7f77 100644 --- a/api_docs/observability.mdx +++ b/api_docs/observability.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/observability title: "observability" image: https://source.unsplash.com/400x175/?github description: API docs for the observability plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'observability'] --- import observabilityObj from './observability.devdocs.json'; @@ -21,7 +21,7 @@ Contact [@elastic/obs-ux-management-team](https://github.com/orgs/elastic/teams/ | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 695 | 2 | 687 | 23 | +| 697 | 2 | 689 | 23 | ## Client diff --git a/api_docs/observability_a_i_assistant.devdocs.json b/api_docs/observability_a_i_assistant.devdocs.json index 913dfebf5bf4f..a11aa4c4548bd 100644 --- a/api_docs/observability_a_i_assistant.devdocs.json +++ b/api_docs/observability_a_i_assistant.devdocs.json @@ -3159,7 +3159,15 @@ "Readable", ", ", "ObservabilityAIAssistantRouteCreateOptions", - ">; }, TEndpoint> & Omit & { signal: AbortSignal | null; }>) => Promise<", + ">; }, TEndpoint> & Omit & { signal: AbortSignal | null; } & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + ">) => Promise<", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -4169,7 +4177,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions> extends never ? [] | [", + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + "> extends never ? [] | [", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -4177,7 +4193,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions] : [", + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + "] : [", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -4185,7 +4209,15 @@ "section": "def-common.ClientRequestParamsOf", "text": "ClientRequestParamsOf" }, - " & TAdditionalClientOptions]" + " & TAdditionalClientOptions & ", + { + "pluginId": "@kbn/core-http-browser", + "scope": "public", + "docId": "kibKbnCoreHttpBrowserPluginApi", + "section": "def-public.HttpFetchOptions", + "text": "HttpFetchOptions" + }, + "]" ], "path": "packages/kbn-server-route-repository-utils/src/typings.ts", "deprecated": false, @@ -5832,15 +5864,7 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - " ? TReturnType extends ", + " ? TReturnType extends ", { "pluginId": "@kbn/core-http-server", "scope": "server", @@ -7063,7 +7087,7 @@ "section": "def-common.ServerRouteCreateOptions", "text": "ServerRouteCreateOptions" }, - "> ? TRouteParamsRT extends ", + " | undefined> ? TRouteParamsRT extends ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", diff --git a/api_docs/observability_a_i_assistant.mdx b/api_docs/observability_a_i_assistant.mdx index 80b8b5dff6e6b..83d6326878766 100644 --- a/api_docs/observability_a_i_assistant.mdx +++ b/api_docs/observability_a_i_assistant.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/observabilityAIAssistant title: "observabilityAIAssistant" image: https://source.unsplash.com/400x175/?github description: API docs for the observabilityAIAssistant plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'observabilityAIAssistant'] --- import observabilityAIAssistantObj from './observability_a_i_assistant.devdocs.json'; diff --git a/api_docs/observability_a_i_assistant_app.mdx b/api_docs/observability_a_i_assistant_app.mdx index 9f07fcec1b5a3..4b6a287761479 100644 --- a/api_docs/observability_a_i_assistant_app.mdx +++ b/api_docs/observability_a_i_assistant_app.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/observabilityAIAssistantApp title: "observabilityAIAssistantApp" image: https://source.unsplash.com/400x175/?github description: API docs for the observabilityAIAssistantApp plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'observabilityAIAssistantApp'] --- import observabilityAIAssistantAppObj from './observability_a_i_assistant_app.devdocs.json'; diff --git a/api_docs/observability_ai_assistant_management.mdx b/api_docs/observability_ai_assistant_management.mdx index e420d29c34353..6ec6533a095c7 100644 --- a/api_docs/observability_ai_assistant_management.mdx +++ b/api_docs/observability_ai_assistant_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/observabilityAiAssistantManagement title: "observabilityAiAssistantManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the observabilityAiAssistantManagement plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'observabilityAiAssistantManagement'] --- import observabilityAiAssistantManagementObj from './observability_ai_assistant_management.devdocs.json'; diff --git a/api_docs/observability_logs_explorer.mdx b/api_docs/observability_logs_explorer.mdx index c48fc3f417789..bdac03ae09a8c 100644 --- a/api_docs/observability_logs_explorer.mdx +++ b/api_docs/observability_logs_explorer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/observabilityLogsExplorer title: "observabilityLogsExplorer" image: https://source.unsplash.com/400x175/?github description: API docs for the observabilityLogsExplorer plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'observabilityLogsExplorer'] --- import observabilityLogsExplorerObj from './observability_logs_explorer.devdocs.json'; diff --git a/api_docs/observability_onboarding.mdx b/api_docs/observability_onboarding.mdx index 0b8ae2a4f5031..f7778665f7c2b 100644 --- a/api_docs/observability_onboarding.mdx +++ b/api_docs/observability_onboarding.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/observabilityOnboarding title: "observabilityOnboarding" image: https://source.unsplash.com/400x175/?github description: API docs for the observabilityOnboarding plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'observabilityOnboarding'] --- import observabilityOnboardingObj from './observability_onboarding.devdocs.json'; diff --git a/api_docs/observability_shared.mdx b/api_docs/observability_shared.mdx index de810033926bb..dfd831976712e 100644 --- a/api_docs/observability_shared.mdx +++ b/api_docs/observability_shared.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/observabilityShared title: "observabilityShared" image: https://source.unsplash.com/400x175/?github description: API docs for the observabilityShared plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'observabilityShared'] --- import observabilitySharedObj from './observability_shared.devdocs.json'; diff --git a/api_docs/osquery.mdx b/api_docs/osquery.mdx index 6535e516b6339..ef91a75573680 100644 --- a/api_docs/osquery.mdx +++ b/api_docs/osquery.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/osquery title: "osquery" image: https://source.unsplash.com/400x175/?github description: API docs for the osquery plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'osquery'] --- import osqueryObj from './osquery.devdocs.json'; diff --git a/api_docs/painless_lab.mdx b/api_docs/painless_lab.mdx index 6fbd09bc5b34f..662fa13379175 100644 --- a/api_docs/painless_lab.mdx +++ b/api_docs/painless_lab.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/painlessLab title: "painlessLab" image: https://source.unsplash.com/400x175/?github description: API docs for the painlessLab plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'painlessLab'] --- import painlessLabObj from './painless_lab.devdocs.json'; diff --git a/api_docs/plugin_directory.mdx b/api_docs/plugin_directory.mdx index ddd3ea92667f3..70a50eac81a70 100644 --- a/api_docs/plugin_directory.mdx +++ b/api_docs/plugin_directory.mdx @@ -7,7 +7,7 @@ id: kibDevDocsPluginDirectory slug: /kibana-dev-docs/api-meta/plugin-api-directory title: Directory description: Directory of public APIs available through plugins or packages. -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- @@ -15,13 +15,13 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | Count | Plugins or Packages with a
public API | Number of teams | |--------------|----------|------------------------| -| 890 | 759 | 43 | +| 892 | 760 | 43 | ### Public API health stats | API Count | Any Count | Missing comments | Missing exports | |--------------|----------|-----------------|--------| -| 54531 | 247 | 40962 | 2015 | +| 54552 | 240 | 40981 | 2020 | ## Plugin Directory @@ -104,7 +104,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [@elastic/kibana-presentation](https://github.com/orgs/elastic/teams/kibana-presentation) | The file upload plugin contains components and services for uploading a file, analyzing its data, and then importing the data into an Elasticsearch index. Supported file types include CSV, TSV, newline-delimited JSON and GeoJSON. | 89 | 0 | 89 | 8 | | | [@elastic/appex-sharedux](https://github.com/orgs/elastic/teams/appex-sharedux) | File upload, download, sharing, and serving over HTTP implementation in Kibana. | 240 | 0 | 24 | 9 | | | [@elastic/appex-sharedux](https://github.com/orgs/elastic/teams/appex-sharedux) | Simple UI for managing files in Kibana | 3 | 0 | 3 | 0 | -| | [@elastic/fleet](https://github.com/orgs/elastic/teams/fleet) | - | 1428 | 5 | 1303 | 81 | +| | [@elastic/fleet](https://github.com/orgs/elastic/teams/fleet) | - | 1430 | 5 | 1304 | 82 | | ftrApis | [@elastic/kibana-core](https://github.com/orgs/elastic/teams/kibana-core) | - | 0 | 0 | 0 | 0 | | | [@elastic/appex-sharedux](https://github.com/orgs/elastic/teams/appex-sharedux) | - | 72 | 0 | 14 | 5 | | globalSearchBar | [@elastic/appex-sharedux](https://github.com/orgs/elastic/teams/appex-sharedux) | - | 0 | 0 | 0 | 0 | @@ -154,7 +154,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [@elastic/kibana-core](https://github.com/orgs/elastic/teams/kibana-core) | - | 17 | 0 | 17 | 0 | | | [@elastic/appex-sharedux](https://github.com/orgs/elastic/teams/appex-sharedux) | - | 3 | 0 | 3 | 0 | | | [@elastic/appex-sharedux](https://github.com/orgs/elastic/teams/appex-sharedux) | - | 2 | 0 | 2 | 1 | -| | [@elastic/obs-ux-management-team](https://github.com/orgs/elastic/teams/obs-ux-management-team) | - | 695 | 2 | 687 | 23 | +| | [@elastic/obs-ux-management-team](https://github.com/orgs/elastic/teams/obs-ux-management-team) | - | 697 | 2 | 689 | 23 | | | [@elastic/obs-ai-assistant](https://github.com/orgs/elastic/teams/obs-ai-assistant) | - | 296 | 1 | 294 | 27 | | | [@elastic/obs-ai-assistant](https://github.com/orgs/elastic/teams/obs-ai-assistant) | - | 4 | 0 | 4 | 0 | | | [@elastic/obs-ai-assistant](https://github.com/orgs/elastic/teams/obs-ai-assistant) | - | 2 | 0 | 2 | 0 | @@ -204,7 +204,8 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [@elastic/kibana-security](https://github.com/orgs/elastic/teams/kibana-security) | This plugin provides the Spaces feature, which allows saved objects to be organized into meaningful categories. | 269 | 0 | 73 | 1 | | | [@elastic/response-ops](https://github.com/orgs/elastic/teams/response-ops) | - | 25 | 0 | 25 | 3 | | | [@elastic/response-ops](https://github.com/orgs/elastic/teams/response-ops) | - | 10 | 0 | 10 | 0 | -| | @simianhacker @flash1293 @dgieselaar | A manager for Streams | 12 | 7 | 12 | 2 | +| | @simianhacker @flash1293 @dgieselaar | A manager for Streams | 13 | 0 | 13 | 4 | +| | @simianhacker @flash1293 @dgieselaar | - | 8 | 0 | 8 | 0 | | synthetics | [@elastic/obs-ux-management-team](https://github.com/orgs/elastic/teams/obs-ux-management-team) | This plugin visualizes data from Synthetics and Heartbeat, and integrates with other Observability solutions. | 0 | 0 | 0 | 1 | | | [@elastic/response-ops](https://github.com/orgs/elastic/teams/response-ops) | - | 108 | 0 | 64 | 7 | | | [@elastic/kibana-core](https://github.com/orgs/elastic/teams/kibana-core) | - | 45 | 0 | 1 | 0 | @@ -265,7 +266,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [@elastic/kibana-core](https://github.com/orgs/elastic/teams/kibana-core) | - | 18 | 0 | 18 | 0 | | | [@elastic/obs-ux-infra_services-team](https://github.com/orgs/elastic/teams/obs-ux-infra_services-team) | - | 4 | 0 | 4 | 0 | | | [@elastic/obs-ux-infra_services-team](https://github.com/orgs/elastic/teams/obs-ux-infra_services-team) | - | 87 | 0 | 87 | 11 | -| | [@elastic/obs-ux-infra_services-team](https://github.com/orgs/elastic/teams/obs-ux-infra_services-team) | - | 268 | 0 | 268 | 38 | +| | [@elastic/obs-ux-infra_services-team](https://github.com/orgs/elastic/teams/obs-ux-infra_services-team) | - | 270 | 0 | 270 | 38 | | | [@elastic/obs-ux-infra_services-team](https://github.com/orgs/elastic/teams/obs-ux-infra_services-team) | - | 337 | 0 | 336 | 0 | | | [@elastic/obs-ux-infra_services-team](https://github.com/orgs/elastic/teams/obs-ux-infra_services-team) | - | 12 | 0 | 12 | 0 | | | [@elastic/security-defend-workflows](https://github.com/orgs/elastic/teams/security-defend-workflows) | - | 3 | 0 | 3 | 0 | @@ -642,7 +643,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [@elastic/kibana-operations](https://github.com/orgs/elastic/teams/kibana-operations) | - | 1 | 0 | 1 | 0 | | | [@elastic/kibana-operations](https://github.com/orgs/elastic/teams/kibana-operations) | - | 1 | 0 | 1 | 0 | | | [@elastic/kibana-presentation](https://github.com/orgs/elastic/teams/kibana-presentation) | - | 92 | 0 | 80 | 0 | -| | [@elastic/kibana-presentation](https://github.com/orgs/elastic/teams/kibana-presentation) | - | 224 | 0 | 188 | 6 | +| | [@elastic/kibana-presentation](https://github.com/orgs/elastic/teams/kibana-presentation) | - | 228 | 0 | 192 | 6 | | | [@elastic/appex-ai-infra](https://github.com/orgs/elastic/teams/appex-ai-infra) | - | 1 | 0 | 1 | 0 | | | [@elastic/appex-ai-infra](https://github.com/orgs/elastic/teams/appex-ai-infra) | - | 31 | 0 | 31 | 0 | | | [@elastic/obs-ux-infra_services-team](https://github.com/orgs/elastic/teams/obs-ux-infra_services-team) | - | 168 | 0 | 55 | 0 | @@ -724,9 +725,9 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [@elastic/security-detection-engine](https://github.com/orgs/elastic/teams/security-detection-engine) | - | 120 | 0 | 116 | 0 | | | [@elastic/security-detection-engine](https://github.com/orgs/elastic/teams/security-detection-engine) | - | 63 | 0 | 55 | 0 | | | [@elastic/kibana-core](https://github.com/orgs/elastic/teams/kibana-core) | - | 69 | 0 | 64 | 0 | -| | [@elastic/obs-knowledge-team](https://github.com/orgs/elastic/teams/obs-knowledge-team) | - | 42 | 0 | 42 | 0 | +| | [@elastic/obs-knowledge-team](https://github.com/orgs/elastic/teams/obs-knowledge-team) | - | 39 | 0 | 39 | 0 | | | [@elastic/obs-knowledge-team](https://github.com/orgs/elastic/teams/obs-knowledge-team) | - | 15 | 0 | 15 | 0 | -| | [@elastic/obs-knowledge-team](https://github.com/orgs/elastic/teams/obs-knowledge-team) | - | 30 | 0 | 30 | 2 | +| | [@elastic/obs-knowledge-team](https://github.com/orgs/elastic/teams/obs-knowledge-team) | - | 28 | 0 | 28 | 2 | | | [@elastic/appex-sharedux](https://github.com/orgs/elastic/teams/appex-sharedux) | - | 1 | 0 | 1 | 0 | | | [@elastic/appex-sharedux](https://github.com/orgs/elastic/teams/appex-sharedux) | - | 1 | 0 | 1 | 0 | | | [@elastic/appex-sharedux](https://github.com/orgs/elastic/teams/appex-sharedux) | - | 10 | 0 | 7 | 1 | @@ -795,8 +796,8 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [@elastic/kibana-visualizations](https://github.com/orgs/elastic/teams/kibana-visualizations) | - | 9 | 0 | 7 | 0 | | | [@elastic/response-ops](https://github.com/orgs/elastic/teams/response-ops) | - | 15 | 0 | 15 | 0 | | | [@elastic/search-kibana](https://github.com/orgs/elastic/teams/search-kibana) | - | 2 | 0 | 2 | 1 | -| | [@elastic/kibana-operations](https://github.com/orgs/elastic/teams/kibana-operations) | - | 39 | 0 | 25 | 1 | -| | [@elastic/obs-knowledge-team](https://github.com/orgs/elastic/teams/obs-knowledge-team) | - | 86 | 0 | 86 | 1 | +| | [@elastic/kibana-operations](https://github.com/orgs/elastic/teams/kibana-operations) | - | 40 | 0 | 25 | 1 | +| | [@elastic/obs-knowledge-team](https://github.com/orgs/elastic/teams/obs-knowledge-team) | - | 92 | 0 | 92 | 2 | | | [@elastic/appex-sharedux](https://github.com/orgs/elastic/teams/appex-sharedux) | - | 42 | 0 | 28 | 0 | | | [@elastic/kibana-operations](https://github.com/orgs/elastic/teams/kibana-operations) | - | 61 | 0 | 52 | 0 | | | [@elastic/kibana-operations](https://github.com/orgs/elastic/teams/kibana-operations) | - | 9 | 0 | 8 | 0 | diff --git a/api_docs/presentation_panel.mdx b/api_docs/presentation_panel.mdx index 5cec42ea8698f..dcf4c63e6fa94 100644 --- a/api_docs/presentation_panel.mdx +++ b/api_docs/presentation_panel.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/presentationPanel title: "presentationPanel" image: https://source.unsplash.com/400x175/?github description: API docs for the presentationPanel plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'presentationPanel'] --- import presentationPanelObj from './presentation_panel.devdocs.json'; diff --git a/api_docs/presentation_util.mdx b/api_docs/presentation_util.mdx index 91ad623ab3d7c..eb5ea5d344720 100644 --- a/api_docs/presentation_util.mdx +++ b/api_docs/presentation_util.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/presentationUtil title: "presentationUtil" image: https://source.unsplash.com/400x175/?github description: API docs for the presentationUtil plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'presentationUtil'] --- import presentationUtilObj from './presentation_util.devdocs.json'; diff --git a/api_docs/product_doc_base.mdx b/api_docs/product_doc_base.mdx index 1e5489aca046f..64daeee07e961 100644 --- a/api_docs/product_doc_base.mdx +++ b/api_docs/product_doc_base.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/productDocBase title: "productDocBase" image: https://source.unsplash.com/400x175/?github description: API docs for the productDocBase plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'productDocBase'] --- import productDocBaseObj from './product_doc_base.devdocs.json'; diff --git a/api_docs/profiling.mdx b/api_docs/profiling.mdx index b556a25f14a44..d4e574ee7c537 100644 --- a/api_docs/profiling.mdx +++ b/api_docs/profiling.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/profiling title: "profiling" image: https://source.unsplash.com/400x175/?github description: API docs for the profiling plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'profiling'] --- import profilingObj from './profiling.devdocs.json'; diff --git a/api_docs/profiling_data_access.mdx b/api_docs/profiling_data_access.mdx index a392080f432e4..c2e42aea3719c 100644 --- a/api_docs/profiling_data_access.mdx +++ b/api_docs/profiling_data_access.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/profilingDataAccess title: "profilingDataAccess" image: https://source.unsplash.com/400x175/?github description: API docs for the profilingDataAccess plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'profilingDataAccess'] --- import profilingDataAccessObj from './profiling_data_access.devdocs.json'; diff --git a/api_docs/remote_clusters.mdx b/api_docs/remote_clusters.mdx index f17a64747b73c..06bb00664875b 100644 --- a/api_docs/remote_clusters.mdx +++ b/api_docs/remote_clusters.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/remoteClusters title: "remoteClusters" image: https://source.unsplash.com/400x175/?github description: API docs for the remoteClusters plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'remoteClusters'] --- import remoteClustersObj from './remote_clusters.devdocs.json'; diff --git a/api_docs/reporting.mdx b/api_docs/reporting.mdx index 27d916415a4fe..b527b3781de40 100644 --- a/api_docs/reporting.mdx +++ b/api_docs/reporting.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/reporting title: "reporting" image: https://source.unsplash.com/400x175/?github description: API docs for the reporting plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'reporting'] --- import reportingObj from './reporting.devdocs.json'; diff --git a/api_docs/rollup.mdx b/api_docs/rollup.mdx index 48794c6d953e5..cb2de04b35033 100644 --- a/api_docs/rollup.mdx +++ b/api_docs/rollup.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/rollup title: "rollup" image: https://source.unsplash.com/400x175/?github description: API docs for the rollup plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'rollup'] --- import rollupObj from './rollup.devdocs.json'; diff --git a/api_docs/rule_registry.mdx b/api_docs/rule_registry.mdx index 98f99ecbdc9b2..cb5f1c312fee6 100644 --- a/api_docs/rule_registry.mdx +++ b/api_docs/rule_registry.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/ruleRegistry title: "ruleRegistry" image: https://source.unsplash.com/400x175/?github description: API docs for the ruleRegistry plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'ruleRegistry'] --- import ruleRegistryObj from './rule_registry.devdocs.json'; diff --git a/api_docs/runtime_fields.mdx b/api_docs/runtime_fields.mdx index a06fbdabfaf58..8035d2d528582 100644 --- a/api_docs/runtime_fields.mdx +++ b/api_docs/runtime_fields.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/runtimeFields title: "runtimeFields" image: https://source.unsplash.com/400x175/?github description: API docs for the runtimeFields plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'runtimeFields'] --- import runtimeFieldsObj from './runtime_fields.devdocs.json'; diff --git a/api_docs/saved_objects.mdx b/api_docs/saved_objects.mdx index eeeaa0128fe16..a613f2e9e51ca 100644 --- a/api_docs/saved_objects.mdx +++ b/api_docs/saved_objects.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedObjects title: "savedObjects" image: https://source.unsplash.com/400x175/?github description: API docs for the savedObjects plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjects'] --- import savedObjectsObj from './saved_objects.devdocs.json'; diff --git a/api_docs/saved_objects_finder.mdx b/api_docs/saved_objects_finder.mdx index 30c1df91b73e9..f1d7ffd140e81 100644 --- a/api_docs/saved_objects_finder.mdx +++ b/api_docs/saved_objects_finder.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedObjectsFinder title: "savedObjectsFinder" image: https://source.unsplash.com/400x175/?github description: API docs for the savedObjectsFinder plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjectsFinder'] --- import savedObjectsFinderObj from './saved_objects_finder.devdocs.json'; diff --git a/api_docs/saved_objects_management.mdx b/api_docs/saved_objects_management.mdx index 61622a60aa6bd..297b97bb5d3fb 100644 --- a/api_docs/saved_objects_management.mdx +++ b/api_docs/saved_objects_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedObjectsManagement title: "savedObjectsManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the savedObjectsManagement plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjectsManagement'] --- import savedObjectsManagementObj from './saved_objects_management.devdocs.json'; diff --git a/api_docs/saved_objects_tagging.mdx b/api_docs/saved_objects_tagging.mdx index 0ed9e6efd4242..7a76335945263 100644 --- a/api_docs/saved_objects_tagging.mdx +++ b/api_docs/saved_objects_tagging.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedObjectsTagging title: "savedObjectsTagging" image: https://source.unsplash.com/400x175/?github description: API docs for the savedObjectsTagging plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjectsTagging'] --- import savedObjectsTaggingObj from './saved_objects_tagging.devdocs.json'; diff --git a/api_docs/saved_objects_tagging_oss.mdx b/api_docs/saved_objects_tagging_oss.mdx index 8059d0af2b3a3..5e10e78038d1f 100644 --- a/api_docs/saved_objects_tagging_oss.mdx +++ b/api_docs/saved_objects_tagging_oss.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedObjectsTaggingOss title: "savedObjectsTaggingOss" image: https://source.unsplash.com/400x175/?github description: API docs for the savedObjectsTaggingOss plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjectsTaggingOss'] --- import savedObjectsTaggingOssObj from './saved_objects_tagging_oss.devdocs.json'; diff --git a/api_docs/saved_search.mdx b/api_docs/saved_search.mdx index 6ff063ad44a2a..3e8c5afe0f513 100644 --- a/api_docs/saved_search.mdx +++ b/api_docs/saved_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedSearch title: "savedSearch" image: https://source.unsplash.com/400x175/?github description: API docs for the savedSearch plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedSearch'] --- import savedSearchObj from './saved_search.devdocs.json'; diff --git a/api_docs/screenshot_mode.mdx b/api_docs/screenshot_mode.mdx index 4912e8e39fe1f..dd3181adece13 100644 --- a/api_docs/screenshot_mode.mdx +++ b/api_docs/screenshot_mode.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/screenshotMode title: "screenshotMode" image: https://source.unsplash.com/400x175/?github description: API docs for the screenshotMode plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'screenshotMode'] --- import screenshotModeObj from './screenshot_mode.devdocs.json'; diff --git a/api_docs/screenshotting.mdx b/api_docs/screenshotting.mdx index 411ab5b695143..1b475d9f8e81f 100644 --- a/api_docs/screenshotting.mdx +++ b/api_docs/screenshotting.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/screenshotting title: "screenshotting" image: https://source.unsplash.com/400x175/?github description: API docs for the screenshotting plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'screenshotting'] --- import screenshottingObj from './screenshotting.devdocs.json'; diff --git a/api_docs/search_assistant.mdx b/api_docs/search_assistant.mdx index 0797802999ee5..b08628810c98c 100644 --- a/api_docs/search_assistant.mdx +++ b/api_docs/search_assistant.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/searchAssistant title: "searchAssistant" image: https://source.unsplash.com/400x175/?github description: API docs for the searchAssistant plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'searchAssistant'] --- import searchAssistantObj from './search_assistant.devdocs.json'; diff --git a/api_docs/search_connectors.mdx b/api_docs/search_connectors.mdx index e40be90f5b9c3..ec297198df273 100644 --- a/api_docs/search_connectors.mdx +++ b/api_docs/search_connectors.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/searchConnectors title: "searchConnectors" image: https://source.unsplash.com/400x175/?github description: API docs for the searchConnectors plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'searchConnectors'] --- import searchConnectorsObj from './search_connectors.devdocs.json'; diff --git a/api_docs/search_homepage.mdx b/api_docs/search_homepage.mdx index 9167e1fcb2f04..608226b0265db 100644 --- a/api_docs/search_homepage.mdx +++ b/api_docs/search_homepage.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/searchHomepage title: "searchHomepage" image: https://source.unsplash.com/400x175/?github description: API docs for the searchHomepage plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'searchHomepage'] --- import searchHomepageObj from './search_homepage.devdocs.json'; diff --git a/api_docs/search_indices.devdocs.json b/api_docs/search_indices.devdocs.json index 755ed1e8ad89b..8446bc09cbb0d 100644 --- a/api_docs/search_indices.devdocs.json +++ b/api_docs/search_indices.devdocs.json @@ -85,7 +85,7 @@ "label": "startAppId", "description": [], "signature": [ - "\"fleet\" | \"graph\" | \"ml\" | \"monitoring\" | \"profiling\" | \"metrics\" | \"management\" | \"apm\" | \"synthetics\" | \"ux\" | \"canvas\" | \"logs\" | \"dashboards\" | \"slo\" | \"observabilityAIAssistant\" | \"home\" | \"integrations\" | \"discover\" | \"observability-overview\" | \"appSearch\" | \"dev_tools\" | \"maps\" | \"visualize\" | \"dev_tools:console\" | \"dev_tools:searchprofiler\" | \"dev_tools:painless_lab\" | \"dev_tools:grokdebugger\" | \"ml:notifications\" | \"ml:nodes\" | \"ml:overview\" | \"ml:memoryUsage\" | \"ml:settings\" | \"ml:dataVisualizer\" | \"ml:logPatternAnalysis\" | \"ml:logRateAnalysis\" | \"ml:singleMetricViewer\" | \"ml:anomalyDetection\" | \"ml:anomalyExplorer\" | \"ml:dataDrift\" | \"ml:dataFrameAnalytics\" | \"ml:resultExplorer\" | \"ml:analyticsMap\" | \"ml:aiOps\" | \"ml:changePointDetections\" | \"ml:modelManagement\" | \"ml:nodesOverview\" | \"ml:esqlDataVisualizer\" | \"ml:fileUpload\" | \"ml:indexDataVisualizer\" | \"ml:calendarSettings\" | \"ml:filterListsSettings\" | \"ml:suppliedConfigurations\" | \"osquery\" | \"management:transform\" | \"management:watcher\" | \"management:cases\" | \"management:tags\" | \"management:maintenanceWindows\" | \"management:cross_cluster_replication\" | \"management:dataViews\" | \"management:spaces\" | \"management:settings\" | \"management:users\" | \"management:migrate_data\" | \"management:search_sessions\" | \"management:data_quality\" | \"management:filesManagement\" | \"management:roles\" | \"management:reporting\" | \"management:aiAssistantManagementSelection\" | \"management:securityAiAssistantManagement\" | \"management:observabilityAiAssistantManagement\" | \"management:api_keys\" | \"management:license_management\" | \"management:index_lifecycle_management\" | \"management:index_management\" | \"management:ingest_pipelines\" | \"management:jobsListLink\" | \"management:objects\" | \"management:pipelines\" | \"management:remote_clusters\" | \"management:role_mappings\" | \"management:rollup_jobs\" | \"management:snapshot_restore\" | \"management:triggersActions\" | \"management:triggersActionsConnectors\" | \"management:upgrade_assistant\" | \"enterpriseSearch\" | \"enterpriseSearchContent\" | \"enterpriseSearchApplications\" | \"searchInferenceEndpoints\" | \"enterpriseSearchAnalytics\" | \"workplaceSearch\" | \"serverlessElasticsearch\" | \"serverlessConnectors\" | \"serverlessWebCrawlers\" | \"searchPlayground\" | \"searchHomepage\" | \"enterpriseSearchContent:connectors\" | \"enterpriseSearchContent:searchIndices\" | \"enterpriseSearchContent:webCrawlers\" | \"enterpriseSearchApplications:searchApplications\" | \"enterpriseSearchApplications:playground\" | \"appSearch:engines\" | \"searchInferenceEndpoints:inferenceEndpoints\" | \"elasticsearchStart\" | \"elasticsearchIndices\" | \"enterpriseSearchElasticsearch\" | \"enterpriseSearchVectorSearch\" | \"enterpriseSearchSemanticSearch\" | \"enterpriseSearchAISearch\" | \"elasticsearchIndices:createIndex\" | \"observability-logs-explorer\" | \"last-used-logs-viewer\" | \"observabilityOnboarding\" | \"inventory\" | \"logs:settings\" | \"logs:stream\" | \"logs:log-categories\" | \"logs:anomalies\" | \"observability-overview:cases\" | \"observability-overview:alerts\" | \"observability-overview:rules\" | \"observability-overview:cases_create\" | \"observability-overview:cases_configure\" | \"metrics:settings\" | \"metrics:hosts\" | \"metrics:inventory\" | \"metrics:metrics-explorer\" | \"metrics:assetDetails\" | \"apm:services\" | \"apm:traces\" | \"apm:dependencies\" | \"apm:service-map\" | \"apm:settings\" | \"apm:service-groups-list\" | \"apm:storage-explorer\" | \"synthetics:overview\" | \"synthetics:certificates\" | \"profiling:functions\" | \"profiling:stacktraces\" | \"profiling:flamegraphs\" | \"inventory:datastreams\" | \"securitySolutionUI\" | \"securitySolutionUI:\" | \"securitySolutionUI:cases\" | \"securitySolutionUI:alerts\" | \"securitySolutionUI:rules\" | \"securitySolutionUI:policy\" | \"securitySolutionUI:overview\" | \"securitySolutionUI:dashboards\" | \"securitySolutionUI:kubernetes\" | \"securitySolutionUI:cases_create\" | \"securitySolutionUI:cases_configure\" | \"securitySolutionUI:hosts\" | \"securitySolutionUI:users\" | \"securitySolutionUI:cloud_defend-policies\" | \"securitySolutionUI:cloud_security_posture-dashboard\" | \"securitySolutionUI:cloud_security_posture-findings\" | \"securitySolutionUI:cloud_security_posture-benchmarks\" | \"securitySolutionUI:network\" | \"securitySolutionUI:data_quality\" | \"securitySolutionUI:explore\" | \"securitySolutionUI:assets\" | \"securitySolutionUI:cloud_defend\" | \"securitySolutionUI:notes\" | \"securitySolutionUI:administration\" | \"securitySolutionUI:attack_discovery\" | \"securitySolutionUI:blocklist\" | \"securitySolutionUI:cloud_security_posture-rules\" | \"securitySolutionUI:detections\" | \"securitySolutionUI:detection_response\" | \"securitySolutionUI:endpoints\" | \"securitySolutionUI:event_filters\" | \"securitySolutionUI:exceptions\" | \"securitySolutionUI:host_isolation_exceptions\" | \"securitySolutionUI:hosts-all\" | \"securitySolutionUI:hosts-anomalies\" | \"securitySolutionUI:hosts-risk\" | \"securitySolutionUI:hosts-events\" | \"securitySolutionUI:hosts-sessions\" | \"securitySolutionUI:hosts-uncommon_processes\" | \"securitySolutionUI:investigations\" | \"securitySolutionUI:get_started\" | \"securitySolutionUI:machine_learning-landing\" | \"securitySolutionUI:network-anomalies\" | \"securitySolutionUI:network-dns\" | \"securitySolutionUI:network-events\" | \"securitySolutionUI:network-flows\" | \"securitySolutionUI:network-http\" | \"securitySolutionUI:network-tls\" | \"securitySolutionUI:response_actions_history\" | \"securitySolutionUI:rules-add\" | \"securitySolutionUI:rules-create\" | \"securitySolutionUI:rules-landing\" | \"securitySolutionUI:siem_migrations-rules\" | \"securitySolutionUI:threat_intelligence\" | \"securitySolutionUI:timelines\" | \"securitySolutionUI:timelines-templates\" | \"securitySolutionUI:trusted_apps\" | \"securitySolutionUI:users-all\" | \"securitySolutionUI:users-anomalies\" | \"securitySolutionUI:users-authentications\" | \"securitySolutionUI:users-events\" | \"securitySolutionUI:users-risk\" | \"securitySolutionUI:entity_analytics\" | \"securitySolutionUI:entity_analytics-management\" | \"securitySolutionUI:entity_analytics-asset-classification\" | \"securitySolutionUI:entity_analytics-entity_store_management\" | \"securitySolutionUI:coverage-overview\" | \"fleet:settings\" | \"fleet:agents\" | \"fleet:policies\" | \"fleet:data_streams\" | \"fleet:enrollment_tokens\" | \"fleet:uninstall_tokens\"" + "\"fleet\" | \"graph\" | \"ml\" | \"monitoring\" | \"profiling\" | \"metrics\" | \"management\" | \"apm\" | \"synthetics\" | \"ux\" | \"canvas\" | \"logs\" | \"dashboards\" | \"slo\" | \"observabilityAIAssistant\" | \"home\" | \"integrations\" | \"discover\" | \"observability-overview\" | \"streams\" | \"appSearch\" | \"dev_tools\" | \"maps\" | \"visualize\" | \"dev_tools:console\" | \"dev_tools:searchprofiler\" | \"dev_tools:painless_lab\" | \"dev_tools:grokdebugger\" | \"ml:notifications\" | \"ml:nodes\" | \"ml:overview\" | \"ml:memoryUsage\" | \"ml:settings\" | \"ml:dataVisualizer\" | \"ml:logPatternAnalysis\" | \"ml:logRateAnalysis\" | \"ml:singleMetricViewer\" | \"ml:anomalyDetection\" | \"ml:anomalyExplorer\" | \"ml:dataDrift\" | \"ml:dataFrameAnalytics\" | \"ml:resultExplorer\" | \"ml:analyticsMap\" | \"ml:aiOps\" | \"ml:changePointDetections\" | \"ml:modelManagement\" | \"ml:nodesOverview\" | \"ml:esqlDataVisualizer\" | \"ml:fileUpload\" | \"ml:indexDataVisualizer\" | \"ml:calendarSettings\" | \"ml:filterListsSettings\" | \"ml:suppliedConfigurations\" | \"osquery\" | \"management:transform\" | \"management:watcher\" | \"management:cases\" | \"management:tags\" | \"management:maintenanceWindows\" | \"management:cross_cluster_replication\" | \"management:dataViews\" | \"management:spaces\" | \"management:settings\" | \"management:users\" | \"management:migrate_data\" | \"management:search_sessions\" | \"management:data_quality\" | \"management:filesManagement\" | \"management:roles\" | \"management:reporting\" | \"management:aiAssistantManagementSelection\" | \"management:securityAiAssistantManagement\" | \"management:observabilityAiAssistantManagement\" | \"management:api_keys\" | \"management:license_management\" | \"management:index_lifecycle_management\" | \"management:index_management\" | \"management:ingest_pipelines\" | \"management:jobsListLink\" | \"management:objects\" | \"management:pipelines\" | \"management:remote_clusters\" | \"management:role_mappings\" | \"management:rollup_jobs\" | \"management:snapshot_restore\" | \"management:triggersActions\" | \"management:triggersActionsConnectors\" | \"management:upgrade_assistant\" | \"enterpriseSearch\" | \"enterpriseSearchContent\" | \"enterpriseSearchApplications\" | \"searchInferenceEndpoints\" | \"enterpriseSearchAnalytics\" | \"workplaceSearch\" | \"serverlessElasticsearch\" | \"serverlessConnectors\" | \"serverlessWebCrawlers\" | \"searchPlayground\" | \"searchHomepage\" | \"enterpriseSearchContent:connectors\" | \"enterpriseSearchContent:searchIndices\" | \"enterpriseSearchContent:webCrawlers\" | \"enterpriseSearchApplications:searchApplications\" | \"enterpriseSearchApplications:playground\" | \"appSearch:engines\" | \"searchInferenceEndpoints:inferenceEndpoints\" | \"elasticsearchStart\" | \"elasticsearchIndices\" | \"enterpriseSearchElasticsearch\" | \"enterpriseSearchVectorSearch\" | \"enterpriseSearchSemanticSearch\" | \"enterpriseSearchAISearch\" | \"elasticsearchIndices:createIndex\" | \"observability-logs-explorer\" | \"last-used-logs-viewer\" | \"observabilityOnboarding\" | \"inventory\" | \"logs:settings\" | \"logs:stream\" | \"logs:log-categories\" | \"logs:anomalies\" | \"observability-overview:cases\" | \"observability-overview:alerts\" | \"observability-overview:rules\" | \"observability-overview:cases_create\" | \"observability-overview:cases_configure\" | \"metrics:settings\" | \"metrics:hosts\" | \"metrics:inventory\" | \"metrics:metrics-explorer\" | \"metrics:assetDetails\" | \"apm:services\" | \"apm:traces\" | \"apm:dependencies\" | \"apm:service-map\" | \"apm:settings\" | \"apm:service-groups-list\" | \"apm:storage-explorer\" | \"synthetics:overview\" | \"synthetics:certificates\" | \"profiling:functions\" | \"profiling:stacktraces\" | \"profiling:flamegraphs\" | \"inventory:datastreams\" | \"streams:overview\" | \"securitySolutionUI\" | \"securitySolutionUI:\" | \"securitySolutionUI:cases\" | \"securitySolutionUI:alerts\" | \"securitySolutionUI:rules\" | \"securitySolutionUI:policy\" | \"securitySolutionUI:overview\" | \"securitySolutionUI:dashboards\" | \"securitySolutionUI:kubernetes\" | \"securitySolutionUI:cases_create\" | \"securitySolutionUI:cases_configure\" | \"securitySolutionUI:hosts\" | \"securitySolutionUI:users\" | \"securitySolutionUI:cloud_defend-policies\" | \"securitySolutionUI:cloud_security_posture-dashboard\" | \"securitySolutionUI:cloud_security_posture-findings\" | \"securitySolutionUI:cloud_security_posture-benchmarks\" | \"securitySolutionUI:network\" | \"securitySolutionUI:data_quality\" | \"securitySolutionUI:explore\" | \"securitySolutionUI:assets\" | \"securitySolutionUI:cloud_defend\" | \"securitySolutionUI:notes\" | \"securitySolutionUI:administration\" | \"securitySolutionUI:attack_discovery\" | \"securitySolutionUI:blocklist\" | \"securitySolutionUI:cloud_security_posture-rules\" | \"securitySolutionUI:detections\" | \"securitySolutionUI:detection_response\" | \"securitySolutionUI:endpoints\" | \"securitySolutionUI:event_filters\" | \"securitySolutionUI:exceptions\" | \"securitySolutionUI:host_isolation_exceptions\" | \"securitySolutionUI:hosts-all\" | \"securitySolutionUI:hosts-anomalies\" | \"securitySolutionUI:hosts-risk\" | \"securitySolutionUI:hosts-events\" | \"securitySolutionUI:hosts-sessions\" | \"securitySolutionUI:hosts-uncommon_processes\" | \"securitySolutionUI:investigations\" | \"securitySolutionUI:get_started\" | \"securitySolutionUI:machine_learning-landing\" | \"securitySolutionUI:network-anomalies\" | \"securitySolutionUI:network-dns\" | \"securitySolutionUI:network-events\" | \"securitySolutionUI:network-flows\" | \"securitySolutionUI:network-http\" | \"securitySolutionUI:network-tls\" | \"securitySolutionUI:response_actions_history\" | \"securitySolutionUI:rules-add\" | \"securitySolutionUI:rules-create\" | \"securitySolutionUI:rules-landing\" | \"securitySolutionUI:siem_migrations-rules\" | \"securitySolutionUI:threat_intelligence\" | \"securitySolutionUI:timelines\" | \"securitySolutionUI:timelines-templates\" | \"securitySolutionUI:trusted_apps\" | \"securitySolutionUI:users-all\" | \"securitySolutionUI:users-anomalies\" | \"securitySolutionUI:users-authentications\" | \"securitySolutionUI:users-events\" | \"securitySolutionUI:users-risk\" | \"securitySolutionUI:entity_analytics\" | \"securitySolutionUI:entity_analytics-management\" | \"securitySolutionUI:entity_analytics-asset-classification\" | \"securitySolutionUI:entity_analytics-entity_store_management\" | \"securitySolutionUI:coverage-overview\" | \"fleet:settings\" | \"fleet:agents\" | \"fleet:policies\" | \"fleet:data_streams\" | \"fleet:enrollment_tokens\" | \"fleet:uninstall_tokens\"" ], "path": "x-pack/plugins/search_indices/public/types.ts", "deprecated": false, diff --git a/api_docs/search_indices.mdx b/api_docs/search_indices.mdx index 698f3dacb0a75..b216966991247 100644 --- a/api_docs/search_indices.mdx +++ b/api_docs/search_indices.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/searchIndices title: "searchIndices" image: https://source.unsplash.com/400x175/?github description: API docs for the searchIndices plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'searchIndices'] --- import searchIndicesObj from './search_indices.devdocs.json'; diff --git a/api_docs/search_inference_endpoints.mdx b/api_docs/search_inference_endpoints.mdx index 8abc9ab47539f..5c485aa4fdf82 100644 --- a/api_docs/search_inference_endpoints.mdx +++ b/api_docs/search_inference_endpoints.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/searchInferenceEndpoints title: "searchInferenceEndpoints" image: https://source.unsplash.com/400x175/?github description: API docs for the searchInferenceEndpoints plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'searchInferenceEndpoints'] --- import searchInferenceEndpointsObj from './search_inference_endpoints.devdocs.json'; diff --git a/api_docs/search_navigation.devdocs.json b/api_docs/search_navigation.devdocs.json index 80bee9feff135..9f9ff7e4294c4 100644 --- a/api_docs/search_navigation.devdocs.json +++ b/api_docs/search_navigation.devdocs.json @@ -132,7 +132,7 @@ "label": "link", "description": [], "signature": [ - "\"fleet\" | \"graph\" | \"ml\" | \"monitoring\" | \"profiling\" | \"metrics\" | \"management\" | \"apm\" | \"synthetics\" | \"ux\" | \"canvas\" | \"logs\" | \"dashboards\" | \"slo\" | \"observabilityAIAssistant\" | \"home\" | \"integrations\" | \"discover\" | \"observability-overview\" | \"appSearch\" | \"dev_tools\" | \"maps\" | \"visualize\" | \"dev_tools:console\" | \"dev_tools:searchprofiler\" | \"dev_tools:painless_lab\" | \"dev_tools:grokdebugger\" | \"ml:notifications\" | \"ml:nodes\" | \"ml:overview\" | \"ml:memoryUsage\" | \"ml:settings\" | \"ml:dataVisualizer\" | \"ml:logPatternAnalysis\" | \"ml:logRateAnalysis\" | \"ml:singleMetricViewer\" | \"ml:anomalyDetection\" | \"ml:anomalyExplorer\" | \"ml:dataDrift\" | \"ml:dataFrameAnalytics\" | \"ml:resultExplorer\" | \"ml:analyticsMap\" | \"ml:aiOps\" | \"ml:changePointDetections\" | \"ml:modelManagement\" | \"ml:nodesOverview\" | \"ml:esqlDataVisualizer\" | \"ml:fileUpload\" | \"ml:indexDataVisualizer\" | \"ml:calendarSettings\" | \"ml:filterListsSettings\" | \"ml:suppliedConfigurations\" | \"osquery\" | \"management:transform\" | \"management:watcher\" | \"management:cases\" | \"management:tags\" | \"management:maintenanceWindows\" | \"management:cross_cluster_replication\" | \"management:dataViews\" | \"management:spaces\" | \"management:settings\" | \"management:users\" | \"management:migrate_data\" | \"management:search_sessions\" | \"management:data_quality\" | \"management:filesManagement\" | \"management:roles\" | \"management:reporting\" | \"management:aiAssistantManagementSelection\" | \"management:securityAiAssistantManagement\" | \"management:observabilityAiAssistantManagement\" | \"management:api_keys\" | \"management:license_management\" | \"management:index_lifecycle_management\" | \"management:index_management\" | \"management:ingest_pipelines\" | \"management:jobsListLink\" | \"management:objects\" | \"management:pipelines\" | \"management:remote_clusters\" | \"management:role_mappings\" | \"management:rollup_jobs\" | \"management:snapshot_restore\" | \"management:triggersActions\" | \"management:triggersActionsConnectors\" | \"management:upgrade_assistant\" | \"enterpriseSearch\" | \"enterpriseSearchContent\" | \"enterpriseSearchApplications\" | \"searchInferenceEndpoints\" | \"enterpriseSearchAnalytics\" | \"workplaceSearch\" | \"serverlessElasticsearch\" | \"serverlessConnectors\" | \"serverlessWebCrawlers\" | \"searchPlayground\" | \"searchHomepage\" | \"enterpriseSearchContent:connectors\" | \"enterpriseSearchContent:searchIndices\" | \"enterpriseSearchContent:webCrawlers\" | \"enterpriseSearchApplications:searchApplications\" | \"enterpriseSearchApplications:playground\" | \"appSearch:engines\" | \"searchInferenceEndpoints:inferenceEndpoints\" | \"elasticsearchStart\" | \"elasticsearchIndices\" | \"enterpriseSearchElasticsearch\" | \"enterpriseSearchVectorSearch\" | \"enterpriseSearchSemanticSearch\" | \"enterpriseSearchAISearch\" | \"elasticsearchIndices:createIndex\" | \"observability-logs-explorer\" | \"last-used-logs-viewer\" | \"observabilityOnboarding\" | \"inventory\" | \"logs:settings\" | \"logs:stream\" | \"logs:log-categories\" | \"logs:anomalies\" | \"observability-overview:cases\" | \"observability-overview:alerts\" | \"observability-overview:rules\" | \"observability-overview:cases_create\" | \"observability-overview:cases_configure\" | \"metrics:settings\" | \"metrics:hosts\" | \"metrics:inventory\" | \"metrics:metrics-explorer\" | \"metrics:assetDetails\" | \"apm:services\" | \"apm:traces\" | \"apm:dependencies\" | \"apm:service-map\" | \"apm:settings\" | \"apm:service-groups-list\" | \"apm:storage-explorer\" | \"synthetics:overview\" | \"synthetics:certificates\" | \"profiling:functions\" | \"profiling:stacktraces\" | \"profiling:flamegraphs\" | \"inventory:datastreams\" | \"securitySolutionUI\" | \"securitySolutionUI:\" | \"securitySolutionUI:cases\" | \"securitySolutionUI:alerts\" | \"securitySolutionUI:rules\" | \"securitySolutionUI:policy\" | \"securitySolutionUI:overview\" | \"securitySolutionUI:dashboards\" | \"securitySolutionUI:kubernetes\" | \"securitySolutionUI:cases_create\" | \"securitySolutionUI:cases_configure\" | \"securitySolutionUI:hosts\" | \"securitySolutionUI:users\" | \"securitySolutionUI:cloud_defend-policies\" | \"securitySolutionUI:cloud_security_posture-dashboard\" | \"securitySolutionUI:cloud_security_posture-findings\" | \"securitySolutionUI:cloud_security_posture-benchmarks\" | \"securitySolutionUI:network\" | \"securitySolutionUI:data_quality\" | \"securitySolutionUI:explore\" | \"securitySolutionUI:assets\" | \"securitySolutionUI:cloud_defend\" | \"securitySolutionUI:notes\" | \"securitySolutionUI:administration\" | \"securitySolutionUI:attack_discovery\" | \"securitySolutionUI:blocklist\" | \"securitySolutionUI:cloud_security_posture-rules\" | \"securitySolutionUI:detections\" | \"securitySolutionUI:detection_response\" | \"securitySolutionUI:endpoints\" | \"securitySolutionUI:event_filters\" | \"securitySolutionUI:exceptions\" | \"securitySolutionUI:host_isolation_exceptions\" | \"securitySolutionUI:hosts-all\" | \"securitySolutionUI:hosts-anomalies\" | \"securitySolutionUI:hosts-risk\" | \"securitySolutionUI:hosts-events\" | \"securitySolutionUI:hosts-sessions\" | \"securitySolutionUI:hosts-uncommon_processes\" | \"securitySolutionUI:investigations\" | \"securitySolutionUI:get_started\" | \"securitySolutionUI:machine_learning-landing\" | \"securitySolutionUI:network-anomalies\" | \"securitySolutionUI:network-dns\" | \"securitySolutionUI:network-events\" | \"securitySolutionUI:network-flows\" | \"securitySolutionUI:network-http\" | \"securitySolutionUI:network-tls\" | \"securitySolutionUI:response_actions_history\" | \"securitySolutionUI:rules-add\" | \"securitySolutionUI:rules-create\" | \"securitySolutionUI:rules-landing\" | \"securitySolutionUI:siem_migrations-rules\" | \"securitySolutionUI:threat_intelligence\" | \"securitySolutionUI:timelines\" | \"securitySolutionUI:timelines-templates\" | \"securitySolutionUI:trusted_apps\" | \"securitySolutionUI:users-all\" | \"securitySolutionUI:users-anomalies\" | \"securitySolutionUI:users-authentications\" | \"securitySolutionUI:users-events\" | \"securitySolutionUI:users-risk\" | \"securitySolutionUI:entity_analytics\" | \"securitySolutionUI:entity_analytics-management\" | \"securitySolutionUI:entity_analytics-asset-classification\" | \"securitySolutionUI:entity_analytics-entity_store_management\" | \"securitySolutionUI:coverage-overview\" | \"fleet:settings\" | \"fleet:agents\" | \"fleet:policies\" | \"fleet:data_streams\" | \"fleet:enrollment_tokens\" | \"fleet:uninstall_tokens\"" + "\"fleet\" | \"graph\" | \"ml\" | \"monitoring\" | \"profiling\" | \"metrics\" | \"management\" | \"apm\" | \"synthetics\" | \"ux\" | \"canvas\" | \"logs\" | \"dashboards\" | \"slo\" | \"observabilityAIAssistant\" | \"home\" | \"integrations\" | \"discover\" | \"observability-overview\" | \"streams\" | \"appSearch\" | \"dev_tools\" | \"maps\" | \"visualize\" | \"dev_tools:console\" | \"dev_tools:searchprofiler\" | \"dev_tools:painless_lab\" | \"dev_tools:grokdebugger\" | \"ml:notifications\" | \"ml:nodes\" | \"ml:overview\" | \"ml:memoryUsage\" | \"ml:settings\" | \"ml:dataVisualizer\" | \"ml:logPatternAnalysis\" | \"ml:logRateAnalysis\" | \"ml:singleMetricViewer\" | \"ml:anomalyDetection\" | \"ml:anomalyExplorer\" | \"ml:dataDrift\" | \"ml:dataFrameAnalytics\" | \"ml:resultExplorer\" | \"ml:analyticsMap\" | \"ml:aiOps\" | \"ml:changePointDetections\" | \"ml:modelManagement\" | \"ml:nodesOverview\" | \"ml:esqlDataVisualizer\" | \"ml:fileUpload\" | \"ml:indexDataVisualizer\" | \"ml:calendarSettings\" | \"ml:filterListsSettings\" | \"ml:suppliedConfigurations\" | \"osquery\" | \"management:transform\" | \"management:watcher\" | \"management:cases\" | \"management:tags\" | \"management:maintenanceWindows\" | \"management:cross_cluster_replication\" | \"management:dataViews\" | \"management:spaces\" | \"management:settings\" | \"management:users\" | \"management:migrate_data\" | \"management:search_sessions\" | \"management:data_quality\" | \"management:filesManagement\" | \"management:roles\" | \"management:reporting\" | \"management:aiAssistantManagementSelection\" | \"management:securityAiAssistantManagement\" | \"management:observabilityAiAssistantManagement\" | \"management:api_keys\" | \"management:license_management\" | \"management:index_lifecycle_management\" | \"management:index_management\" | \"management:ingest_pipelines\" | \"management:jobsListLink\" | \"management:objects\" | \"management:pipelines\" | \"management:remote_clusters\" | \"management:role_mappings\" | \"management:rollup_jobs\" | \"management:snapshot_restore\" | \"management:triggersActions\" | \"management:triggersActionsConnectors\" | \"management:upgrade_assistant\" | \"enterpriseSearch\" | \"enterpriseSearchContent\" | \"enterpriseSearchApplications\" | \"searchInferenceEndpoints\" | \"enterpriseSearchAnalytics\" | \"workplaceSearch\" | \"serverlessElasticsearch\" | \"serverlessConnectors\" | \"serverlessWebCrawlers\" | \"searchPlayground\" | \"searchHomepage\" | \"enterpriseSearchContent:connectors\" | \"enterpriseSearchContent:searchIndices\" | \"enterpriseSearchContent:webCrawlers\" | \"enterpriseSearchApplications:searchApplications\" | \"enterpriseSearchApplications:playground\" | \"appSearch:engines\" | \"searchInferenceEndpoints:inferenceEndpoints\" | \"elasticsearchStart\" | \"elasticsearchIndices\" | \"enterpriseSearchElasticsearch\" | \"enterpriseSearchVectorSearch\" | \"enterpriseSearchSemanticSearch\" | \"enterpriseSearchAISearch\" | \"elasticsearchIndices:createIndex\" | \"observability-logs-explorer\" | \"last-used-logs-viewer\" | \"observabilityOnboarding\" | \"inventory\" | \"logs:settings\" | \"logs:stream\" | \"logs:log-categories\" | \"logs:anomalies\" | \"observability-overview:cases\" | \"observability-overview:alerts\" | \"observability-overview:rules\" | \"observability-overview:cases_create\" | \"observability-overview:cases_configure\" | \"metrics:settings\" | \"metrics:hosts\" | \"metrics:inventory\" | \"metrics:metrics-explorer\" | \"metrics:assetDetails\" | \"apm:services\" | \"apm:traces\" | \"apm:dependencies\" | \"apm:service-map\" | \"apm:settings\" | \"apm:service-groups-list\" | \"apm:storage-explorer\" | \"synthetics:overview\" | \"synthetics:certificates\" | \"profiling:functions\" | \"profiling:stacktraces\" | \"profiling:flamegraphs\" | \"inventory:datastreams\" | \"streams:overview\" | \"securitySolutionUI\" | \"securitySolutionUI:\" | \"securitySolutionUI:cases\" | \"securitySolutionUI:alerts\" | \"securitySolutionUI:rules\" | \"securitySolutionUI:policy\" | \"securitySolutionUI:overview\" | \"securitySolutionUI:dashboards\" | \"securitySolutionUI:kubernetes\" | \"securitySolutionUI:cases_create\" | \"securitySolutionUI:cases_configure\" | \"securitySolutionUI:hosts\" | \"securitySolutionUI:users\" | \"securitySolutionUI:cloud_defend-policies\" | \"securitySolutionUI:cloud_security_posture-dashboard\" | \"securitySolutionUI:cloud_security_posture-findings\" | \"securitySolutionUI:cloud_security_posture-benchmarks\" | \"securitySolutionUI:network\" | \"securitySolutionUI:data_quality\" | \"securitySolutionUI:explore\" | \"securitySolutionUI:assets\" | \"securitySolutionUI:cloud_defend\" | \"securitySolutionUI:notes\" | \"securitySolutionUI:administration\" | \"securitySolutionUI:attack_discovery\" | \"securitySolutionUI:blocklist\" | \"securitySolutionUI:cloud_security_posture-rules\" | \"securitySolutionUI:detections\" | \"securitySolutionUI:detection_response\" | \"securitySolutionUI:endpoints\" | \"securitySolutionUI:event_filters\" | \"securitySolutionUI:exceptions\" | \"securitySolutionUI:host_isolation_exceptions\" | \"securitySolutionUI:hosts-all\" | \"securitySolutionUI:hosts-anomalies\" | \"securitySolutionUI:hosts-risk\" | \"securitySolutionUI:hosts-events\" | \"securitySolutionUI:hosts-sessions\" | \"securitySolutionUI:hosts-uncommon_processes\" | \"securitySolutionUI:investigations\" | \"securitySolutionUI:get_started\" | \"securitySolutionUI:machine_learning-landing\" | \"securitySolutionUI:network-anomalies\" | \"securitySolutionUI:network-dns\" | \"securitySolutionUI:network-events\" | \"securitySolutionUI:network-flows\" | \"securitySolutionUI:network-http\" | \"securitySolutionUI:network-tls\" | \"securitySolutionUI:response_actions_history\" | \"securitySolutionUI:rules-add\" | \"securitySolutionUI:rules-create\" | \"securitySolutionUI:rules-landing\" | \"securitySolutionUI:siem_migrations-rules\" | \"securitySolutionUI:threat_intelligence\" | \"securitySolutionUI:timelines\" | \"securitySolutionUI:timelines-templates\" | \"securitySolutionUI:trusted_apps\" | \"securitySolutionUI:users-all\" | \"securitySolutionUI:users-anomalies\" | \"securitySolutionUI:users-authentications\" | \"securitySolutionUI:users-events\" | \"securitySolutionUI:users-risk\" | \"securitySolutionUI:entity_analytics\" | \"securitySolutionUI:entity_analytics-management\" | \"securitySolutionUI:entity_analytics-asset-classification\" | \"securitySolutionUI:entity_analytics-entity_store_management\" | \"securitySolutionUI:coverage-overview\" | \"fleet:settings\" | \"fleet:agents\" | \"fleet:policies\" | \"fleet:data_streams\" | \"fleet:enrollment_tokens\" | \"fleet:uninstall_tokens\"" ], "path": "x-pack/plugins/search_solution/search_navigation/public/types.ts", "deprecated": false, diff --git a/api_docs/search_navigation.mdx b/api_docs/search_navigation.mdx index 4621fd226b606..b748885ca4e8e 100644 --- a/api_docs/search_navigation.mdx +++ b/api_docs/search_navigation.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/searchNavigation title: "searchNavigation" image: https://source.unsplash.com/400x175/?github description: API docs for the searchNavigation plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'searchNavigation'] --- import searchNavigationObj from './search_navigation.devdocs.json'; diff --git a/api_docs/search_notebooks.mdx b/api_docs/search_notebooks.mdx index 343845db44003..de74e78045c7a 100644 --- a/api_docs/search_notebooks.mdx +++ b/api_docs/search_notebooks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/searchNotebooks title: "searchNotebooks" image: https://source.unsplash.com/400x175/?github description: API docs for the searchNotebooks plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'searchNotebooks'] --- import searchNotebooksObj from './search_notebooks.devdocs.json'; diff --git a/api_docs/search_playground.mdx b/api_docs/search_playground.mdx index e6d090a2a13c7..4830ad3ee8160 100644 --- a/api_docs/search_playground.mdx +++ b/api_docs/search_playground.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/searchPlayground title: "searchPlayground" image: https://source.unsplash.com/400x175/?github description: API docs for the searchPlayground plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'searchPlayground'] --- import searchPlaygroundObj from './search_playground.devdocs.json'; diff --git a/api_docs/security.mdx b/api_docs/security.mdx index 5d6c02a7b68ff..70f8c0209b173 100644 --- a/api_docs/security.mdx +++ b/api_docs/security.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/security title: "security" image: https://source.unsplash.com/400x175/?github description: API docs for the security plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'security'] --- import securityObj from './security.devdocs.json'; diff --git a/api_docs/security_solution.devdocs.json b/api_docs/security_solution.devdocs.json index 263e8a131f7c9..f76d77c7255ef 100644 --- a/api_docs/security_solution.devdocs.json +++ b/api_docs/security_solution.devdocs.json @@ -3267,7 +3267,7 @@ "\nA list of allowed values that can be used in `xpack.securitySolution.enableExperimental`.\nThis object is then used to validate and parse the value entered." ], "signature": [ - "{ readonly excludePoliciesInFilterEnabled: false; readonly kubernetesEnabled: true; readonly donutChartEmbeddablesEnabled: false; readonly previewTelemetryUrlEnabled: false; readonly extendedRuleExecutionLoggingEnabled: false; readonly socTrendsEnabled: false; readonly responseActionUploadEnabled: true; readonly automatedProcessActionsEnabled: true; readonly responseActionsSentinelOneV1Enabled: true; readonly responseActionsSentinelOneV2Enabled: true; readonly responseActionsSentinelOneGetFileEnabled: true; readonly responseActionsSentinelOneKillProcessEnabled: true; readonly responseActionsSentinelOneProcessesEnabled: true; readonly responseActionsCrowdstrikeManualHostIsolationEnabled: true; readonly endpointManagementSpaceAwarenessEnabled: false; readonly securitySolutionNotesDisabled: false; readonly entityAlertPreviewDisabled: false; readonly assistantModelEvaluation: false; readonly newUserDetailsFlyoutManagedUser: false; readonly riskScoringPersistence: true; readonly riskScoringRoutesEnabled: true; readonly esqlRulesDisabled: false; readonly protectionUpdatesEnabled: true; readonly disableTimelineSaveTour: false; readonly riskEnginePrivilegesRouteEnabled: true; readonly sentinelOneDataInAnalyzerEnabled: true; readonly sentinelOneManualHostActionsEnabled: true; readonly crowdstrikeDataInAnalyzerEnabled: true; readonly responseActionsTelemetryEnabled: false; readonly jamfDataInAnalyzerEnabled: true; readonly timelineEsqlTabDisabled: false; readonly analyzerDatePickersAndSourcererDisabled: false; readonly graphVisualizationInFlyoutEnabled: false; readonly prebuiltRulesCustomizationEnabled: false; readonly malwareOnWriteScanOptionAvailable: true; readonly unifiedManifestEnabled: true; readonly valueListItemsModalEnabled: true; readonly filterProcessDescendantsForEventFiltersEnabled: true; readonly dataIngestionHubEnabled: false; readonly entityStoreDisabled: false; readonly siemMigrationsEnabled: false; readonly defendInsights: false; }" + "{ readonly excludePoliciesInFilterEnabled: false; readonly kubernetesEnabled: false; readonly donutChartEmbeddablesEnabled: false; readonly previewTelemetryUrlEnabled: false; readonly extendedRuleExecutionLoggingEnabled: false; readonly socTrendsEnabled: false; readonly responseActionUploadEnabled: true; readonly automatedProcessActionsEnabled: true; readonly responseActionsSentinelOneV1Enabled: true; readonly responseActionsSentinelOneV2Enabled: true; readonly responseActionsSentinelOneGetFileEnabled: true; readonly responseActionsSentinelOneKillProcessEnabled: true; readonly responseActionsSentinelOneProcessesEnabled: true; readonly responseActionsCrowdstrikeManualHostIsolationEnabled: true; readonly endpointManagementSpaceAwarenessEnabled: false; readonly securitySolutionNotesDisabled: false; readonly entityAlertPreviewDisabled: false; readonly assistantModelEvaluation: false; readonly newUserDetailsFlyoutManagedUser: false; readonly riskScoringPersistence: true; readonly riskScoringRoutesEnabled: true; readonly esqlRulesDisabled: false; readonly protectionUpdatesEnabled: true; readonly disableTimelineSaveTour: false; readonly riskEnginePrivilegesRouteEnabled: true; readonly sentinelOneDataInAnalyzerEnabled: true; readonly sentinelOneManualHostActionsEnabled: true; readonly crowdstrikeDataInAnalyzerEnabled: true; readonly responseActionsTelemetryEnabled: false; readonly jamfDataInAnalyzerEnabled: true; readonly timelineEsqlTabDisabled: false; readonly analyzerDatePickersAndSourcererDisabled: false; readonly graphVisualizationInFlyoutEnabled: false; readonly prebuiltRulesCustomizationEnabled: false; readonly malwareOnWriteScanOptionAvailable: true; readonly unifiedManifestEnabled: true; readonly valueListItemsModalEnabled: true; readonly filterProcessDescendantsForEventFiltersEnabled: true; readonly dataIngestionHubEnabled: false; readonly entityStoreDisabled: false; readonly siemMigrationsEnabled: false; readonly defendInsights: false; }" ], "path": "x-pack/plugins/security_solution/common/experimental_features.ts", "deprecated": false, diff --git a/api_docs/security_solution.mdx b/api_docs/security_solution.mdx index 4c8d42247ae4b..d074e246f4cbd 100644 --- a/api_docs/security_solution.mdx +++ b/api_docs/security_solution.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/securitySolution title: "securitySolution" image: https://source.unsplash.com/400x175/?github description: API docs for the securitySolution plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'securitySolution'] --- import securitySolutionObj from './security_solution.devdocs.json'; diff --git a/api_docs/security_solution_ess.mdx b/api_docs/security_solution_ess.mdx index dfdaed44ff5a2..155a6860ec2bb 100644 --- a/api_docs/security_solution_ess.mdx +++ b/api_docs/security_solution_ess.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/securitySolutionEss title: "securitySolutionEss" image: https://source.unsplash.com/400x175/?github description: API docs for the securitySolutionEss plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'securitySolutionEss'] --- import securitySolutionEssObj from './security_solution_ess.devdocs.json'; diff --git a/api_docs/security_solution_serverless.mdx b/api_docs/security_solution_serverless.mdx index 2427819aa3ee8..6f773dcd51a54 100644 --- a/api_docs/security_solution_serverless.mdx +++ b/api_docs/security_solution_serverless.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/securitySolutionServerless title: "securitySolutionServerless" image: https://source.unsplash.com/400x175/?github description: API docs for the securitySolutionServerless plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'securitySolutionServerless'] --- import securitySolutionServerlessObj from './security_solution_serverless.devdocs.json'; diff --git a/api_docs/serverless.mdx b/api_docs/serverless.mdx index 98302147e3b3e..4733779647065 100644 --- a/api_docs/serverless.mdx +++ b/api_docs/serverless.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/serverless title: "serverless" image: https://source.unsplash.com/400x175/?github description: API docs for the serverless plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'serverless'] --- import serverlessObj from './serverless.devdocs.json'; diff --git a/api_docs/serverless_observability.mdx b/api_docs/serverless_observability.mdx index c3c1d2190ee11..e4d126dc1774b 100644 --- a/api_docs/serverless_observability.mdx +++ b/api_docs/serverless_observability.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/serverlessObservability title: "serverlessObservability" image: https://source.unsplash.com/400x175/?github description: API docs for the serverlessObservability plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'serverlessObservability'] --- import serverlessObservabilityObj from './serverless_observability.devdocs.json'; diff --git a/api_docs/serverless_search.mdx b/api_docs/serverless_search.mdx index 9bee19ef32dad..2b4b60dc53e14 100644 --- a/api_docs/serverless_search.mdx +++ b/api_docs/serverless_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/serverlessSearch title: "serverlessSearch" image: https://source.unsplash.com/400x175/?github description: API docs for the serverlessSearch plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'serverlessSearch'] --- import serverlessSearchObj from './serverless_search.devdocs.json'; diff --git a/api_docs/session_view.mdx b/api_docs/session_view.mdx index 770b240630358..a82291e9e282f 100644 --- a/api_docs/session_view.mdx +++ b/api_docs/session_view.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/sessionView title: "sessionView" image: https://source.unsplash.com/400x175/?github description: API docs for the sessionView plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'sessionView'] --- import sessionViewObj from './session_view.devdocs.json'; diff --git a/api_docs/share.mdx b/api_docs/share.mdx index 4058b6574002a..b5618512cfd70 100644 --- a/api_docs/share.mdx +++ b/api_docs/share.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/share title: "share" image: https://source.unsplash.com/400x175/?github description: API docs for the share plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'share'] --- import shareObj from './share.devdocs.json'; diff --git a/api_docs/slo.mdx b/api_docs/slo.mdx index ae9d25a080fb5..03fcb2e0efdca 100644 --- a/api_docs/slo.mdx +++ b/api_docs/slo.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/slo title: "slo" image: https://source.unsplash.com/400x175/?github description: API docs for the slo plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'slo'] --- import sloObj from './slo.devdocs.json'; diff --git a/api_docs/snapshot_restore.mdx b/api_docs/snapshot_restore.mdx index 16aedd3dd9f21..3218b67bfa882 100644 --- a/api_docs/snapshot_restore.mdx +++ b/api_docs/snapshot_restore.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/snapshotRestore title: "snapshotRestore" image: https://source.unsplash.com/400x175/?github description: API docs for the snapshotRestore plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'snapshotRestore'] --- import snapshotRestoreObj from './snapshot_restore.devdocs.json'; diff --git a/api_docs/spaces.mdx b/api_docs/spaces.mdx index 951038d2e67ea..2c97f988ca03c 100644 --- a/api_docs/spaces.mdx +++ b/api_docs/spaces.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/spaces title: "spaces" image: https://source.unsplash.com/400x175/?github description: API docs for the spaces plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'spaces'] --- import spacesObj from './spaces.devdocs.json'; diff --git a/api_docs/stack_alerts.mdx b/api_docs/stack_alerts.mdx index eecefac9dce7d..7c5312908e7ce 100644 --- a/api_docs/stack_alerts.mdx +++ b/api_docs/stack_alerts.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/stackAlerts title: "stackAlerts" image: https://source.unsplash.com/400x175/?github description: API docs for the stackAlerts plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'stackAlerts'] --- import stackAlertsObj from './stack_alerts.devdocs.json'; diff --git a/api_docs/stack_connectors.mdx b/api_docs/stack_connectors.mdx index 0c75c977e16a8..a361cc1edd6b6 100644 --- a/api_docs/stack_connectors.mdx +++ b/api_docs/stack_connectors.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/stackConnectors title: "stackConnectors" image: https://source.unsplash.com/400x175/?github description: API docs for the stackConnectors plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'stackConnectors'] --- import stackConnectorsObj from './stack_connectors.devdocs.json'; diff --git a/api_docs/streams.devdocs.json b/api_docs/streams.devdocs.json index 02800505b0823..1d744b0580b2f 100644 --- a/api_docs/streams.devdocs.json +++ b/api_docs/streams.devdocs.json @@ -6,12 +6,323 @@ "interfaces": [], "enums": [], "misc": [], - "objects": [] + "objects": [], + "setup": { + "parentPluginId": "streams", + "id": "def-public.StreamsPluginSetup", + "type": "Interface", + "tags": [], + "label": "StreamsPluginSetup", + "description": [], + "path": "x-pack/plugins/streams/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "streams", + "id": "def-public.StreamsPluginSetup.status$", + "type": "Object", + "tags": [], + "label": "status$", + "description": [], + "signature": [ + "Observable", + "<{ status: \"unknown\" | \"disabled\" | \"enabled\"; }>" + ], + "path": "x-pack/plugins/streams/public/types.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "lifecycle": "setup", + "initialIsOpen": true + }, + "start": { + "parentPluginId": "streams", + "id": "def-public.StreamsPluginStart", + "type": "Interface", + "tags": [], + "label": "StreamsPluginStart", + "description": [], + "path": "x-pack/plugins/streams/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "streams", + "id": "def-public.StreamsPluginStart.streamsRepositoryClient", + "type": "Object", + "tags": [], + "label": "streamsRepositoryClient", + "description": [], + "signature": [ + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.RouteRepositoryClient", + "text": "RouteRepositoryClient" + }, + "<{ \"POST /api/streams/_disable\": ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRoute", + "text": "ServerRoute" + }, + "<\"POST /api/streams/_disable\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", + "StreamsRouteHandlerResources", + ", { acknowledged: true; }, undefined>; \"POST /internal/streams/esql\": ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRoute", + "text": "ServerRoute" + }, + "<\"POST /internal/streams/esql\", Zod.ZodObject<{ body: Zod.ZodObject<{ query: Zod.ZodString; operationName: Zod.ZodString; filter: Zod.ZodOptional, Zod.objectInputType<{}, Zod.ZodTypeAny, \"passthrough\">>>; kuery: Zod.ZodOptional; start: Zod.ZodOptional; end: Zod.ZodOptional; }, \"strip\", Zod.ZodTypeAny, { query: string; operationName: string; start?: number | undefined; end?: number | undefined; filter?: Zod.objectOutputType<{}, Zod.ZodTypeAny, \"passthrough\"> | undefined; kuery?: string | undefined; }, { query: string; operationName: string; start?: number | undefined; end?: number | undefined; filter?: Zod.objectInputType<{}, Zod.ZodTypeAny, \"passthrough\"> | undefined; kuery?: string | undefined; }>; }, \"strip\", Zod.ZodTypeAny, { body: { query: string; operationName: string; start?: number | undefined; end?: number | undefined; filter?: Zod.objectOutputType<{}, Zod.ZodTypeAny, \"passthrough\"> | undefined; kuery?: string | undefined; }; }, { body: { query: string; operationName: string; start?: number | undefined; end?: number | undefined; filter?: Zod.objectInputType<{}, Zod.ZodTypeAny, \"passthrough\"> | undefined; kuery?: string | undefined; }; }>, ", + "StreamsRouteHandlerResources", + ", ", + "UnparsedEsqlResponse", + ", undefined>; \"GET /api/streams/_status\": { endpoint: \"GET /api/streams/_status\"; handler: ServerRouteHandler<", + "StreamsRouteHandlerResources", + ", undefined, { enabled: boolean; }>; security?: ", + { + "pluginId": "@kbn/core-http-server", + "scope": "server", + "docId": "kibKbnCoreHttpServerPluginApi", + "section": "def-server.RouteSecurity", + "text": "RouteSecurity" + }, + " | undefined; }; \"GET /api/streams\": ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRoute", + "text": "ServerRoute" + }, + "<\"GET /api/streams\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", + "StreamsRouteHandlerResources", + ", { definitions: { id: string; children: { id: string; condition?: ", + "Condition", + "; }[]; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }[]; trees: ", + "StreamTree", + "[]; }, undefined>; \"DELETE /api/streams/{id}\": ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRoute", + "text": "ServerRoute" + }, + "<\"DELETE /api/streams/{id}\", Zod.ZodObject<{ path: Zod.ZodObject<{ id: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { id: string; }, { id: string; }>; }, \"strip\", Zod.ZodTypeAny, { path: { id: string; }; }, { path: { id: string; }; }>, ", + "StreamsRouteHandlerResources", + ", { acknowledged: true; }, undefined>; \"PUT /api/streams/{id}\": ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRoute", + "text": "ServerRoute" + }, + "<\"PUT /api/streams/{id}\", Zod.ZodObject<{ path: Zod.ZodObject<{ id: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { id: string; }, { id: string; }>; body: Zod.ZodObject<{ processing: Zod.ZodDefault>; config: Zod.ZodDiscriminatedUnion<\"type\", [Zod.ZodObject<{ type: Zod.ZodLiteral<\"grok\">; field: Zod.ZodString; patterns: Zod.ZodArray; pattern_definitions: Zod.ZodOptional>; }, \"strip\", Zod.ZodTypeAny, { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; }, { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; }>, Zod.ZodObject<{ type: Zod.ZodLiteral<\"dissect\">; field: Zod.ZodString; pattern: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { type: \"dissect\"; field: string; pattern: string; }, { type: \"dissect\"; field: string; pattern: string; }>]>; }, \"strip\", Zod.ZodTypeAny, { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }, { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }>, \"many\">>; fields: Zod.ZodDefault; }, \"strip\", Zod.ZodTypeAny, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }>, \"many\">>; children: Zod.ZodDefault>; }, \"strip\", Zod.ZodTypeAny, { id: string; condition?: ", + "Condition", + "; }, { id: string; condition?: ", + "Condition", + "; }>, \"many\">>; }, \"strip\", Zod.ZodTypeAny, { children: { id: string; condition?: ", + "Condition", + "; }[]; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }, { children?: { id: string; condition?: ", + "Condition", + "; }[] | undefined; fields?: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[] | undefined; processing?: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[] | undefined; }>; }, \"strip\", Zod.ZodTypeAny, { path: { id: string; }; body: { children: { id: string; condition?: ", + "Condition", + "; }[]; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }; }, { path: { id: string; }; body: { children?: { id: string; condition?: ", + "Condition", + "; }[] | undefined; fields?: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[] | undefined; processing?: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[] | undefined; }; }>, ", + "StreamsRouteHandlerResources", + ", { acknowledged: boolean; }, undefined>; \"GET /api/streams/{id}\": ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRoute", + "text": "ServerRoute" + }, + "<\"GET /api/streams/{id}\", Zod.ZodObject<{ path: Zod.ZodObject<{ id: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { id: string; }, { id: string; }>; }, \"strip\", Zod.ZodTypeAny, { path: { id: string; }; }, { path: { id: string; }; }>, ", + "StreamsRouteHandlerResources", + ", { id: string; children: { id: string; condition?: ", + "Condition", + "; }[]; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; } & { inheritedFields: ({ type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; } & { from: string; })[]; }, undefined>; \"POST /api/streams/{id}/_fork\": ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRoute", + "text": "ServerRoute" + }, + "<\"POST /api/streams/{id}/_fork\", Zod.ZodObject<{ path: Zod.ZodObject<{ id: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { id: string; }, { id: string; }>; body: Zod.ZodObject<{ stream: Zod.ZodObject>; config: Zod.ZodDiscriminatedUnion<\"type\", [Zod.ZodObject<{ type: Zod.ZodLiteral<\"grok\">; field: Zod.ZodString; patterns: Zod.ZodArray; pattern_definitions: Zod.ZodOptional>; }, \"strip\", Zod.ZodTypeAny, { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; }, { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; }>, Zod.ZodObject<{ type: Zod.ZodLiteral<\"dissect\">; field: Zod.ZodString; pattern: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { type: \"dissect\"; field: string; pattern: string; }, { type: \"dissect\"; field: string; pattern: string; }>]>; }, \"strip\", Zod.ZodTypeAny, { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }, { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }>, \"many\">>; fields: Zod.ZodDefault; }, \"strip\", Zod.ZodTypeAny, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }>, \"many\">>; children: Zod.ZodDefault>; }, \"strip\", Zod.ZodTypeAny, { id: string; condition?: ", + "Condition", + "; }, { id: string; condition?: ", + "Condition", + "; }>, \"many\">>; }, { id: Zod.ZodString; }>, \"children\">, \"strip\", Zod.ZodTypeAny, { id: string; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }, { id: string; fields?: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[] | undefined; processing?: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[] | undefined; }>; condition: Zod.ZodType<", + "Condition", + ", Zod.ZodTypeDef, ", + "Condition", + ">; }, \"strip\", Zod.ZodTypeAny, { stream: { id: string; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }; condition?: ", + "Condition", + "; }, { stream: { id: string; fields?: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[] | undefined; processing?: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[] | undefined; }; condition?: ", + "Condition", + "; }>; }, \"strip\", Zod.ZodTypeAny, { path: { id: string; }; body: { stream: { id: string; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }; condition?: ", + "Condition", + "; }; }, { path: { id: string; }; body: { stream: { id: string; fields?: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[] | undefined; processing?: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[] | undefined; }; condition?: ", + "Condition", + "; }; }>, ", + "StreamsRouteHandlerResources", + ", { acknowledged: true; }, undefined>; \"POST /api/streams/_resync\": ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRoute", + "text": "ServerRoute" + }, + "<\"POST /api/streams/_resync\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", + "StreamsRouteHandlerResources", + ", { acknowledged: true; }, undefined>; \"POST /api/streams/_enable\": ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRoute", + "text": "ServerRoute" + }, + "<\"POST /api/streams/_enable\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", + "StreamsRouteHandlerResources", + ", { acknowledged: true; }, undefined>; }, ", + "StreamsRepositoryClientOptions", + ">" + ], + "path": "x-pack/plugins/streams/public/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "streams", + "id": "def-public.StreamsPluginStart.status$", + "type": "Object", + "tags": [], + "label": "status$", + "description": [], + "signature": [ + "Observable", + "<{ status: \"unknown\" | \"disabled\" | \"enabled\"; }>" + ], + "path": "x-pack/plugins/streams/public/types.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "lifecycle": "start", + "initialIsOpen": true + } }, "server": { "classes": [], "functions": [], - "interfaces": [], + "interfaces": [ + { + "parentPluginId": "streams", + "id": "def-server.ListStreamResponse", + "type": "Interface", + "tags": [], + "label": "ListStreamResponse", + "description": [], + "path": "x-pack/plugins/streams/server/lib/streams/stream_crud.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "streams", + "id": "def-server.ListStreamResponse.total", + "type": "number", + "tags": [], + "label": "total", + "description": [], + "path": "x-pack/plugins/streams/server/lib/streams/stream_crud.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "streams", + "id": "def-server.ListStreamResponse.definitions", + "type": "Array", + "tags": [], + "label": "definitions", + "description": [], + "signature": [ + "{ id: string; children: { id: string; condition?: ", + "Condition", + "; }[]; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }[]" + ], + "path": "x-pack/plugins/streams/server/lib/streams/stream_crud.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + } + ], "enums": [], "misc": [ { @@ -37,7 +348,7 @@ "label": "StreamsRouteRepository", "description": [], "signature": [ - "{ \"GET /api/streams 2023-10-31\": ", + "{ \"POST /api/streams/_disable\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -45,25 +356,9 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/streams 2023-10-31\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", + "<\"POST /api/streams/_disable\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", "StreamsRouteHandlerResources", - ", ", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" - }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"DELETE /api/streams/{id} 2023-10-31\": ", + ", { acknowledged: true; }, undefined>; \"POST /internal/streams/esql\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -71,25 +366,37 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - "<\"DELETE /api/streams/{id} 2023-10-31\", Zod.ZodObject<{ path: Zod.ZodObject<{ id: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { id: string; }, { id: string; }>; }, \"strip\", Zod.ZodTypeAny, { path: { id: string; }; }, { path: { id: string; }; }>, ", + "<\"POST /internal/streams/esql\", Zod.ZodObject<{ body: Zod.ZodObject<{ query: Zod.ZodString; operationName: Zod.ZodString; filter: Zod.ZodOptional, Zod.objectInputType<{}, Zod.ZodTypeAny, \"passthrough\">>>; kuery: Zod.ZodOptional; start: Zod.ZodOptional; end: Zod.ZodOptional; }, \"strip\", Zod.ZodTypeAny, { query: string; operationName: string; start?: number | undefined; end?: number | undefined; filter?: Zod.objectOutputType<{}, Zod.ZodTypeAny, \"passthrough\"> | undefined; kuery?: string | undefined; }, { query: string; operationName: string; start?: number | undefined; end?: number | undefined; filter?: Zod.objectInputType<{}, Zod.ZodTypeAny, \"passthrough\"> | undefined; kuery?: string | undefined; }>; }, \"strip\", Zod.ZodTypeAny, { body: { query: string; operationName: string; start?: number | undefined; end?: number | undefined; filter?: Zod.objectOutputType<{}, Zod.ZodTypeAny, \"passthrough\"> | undefined; kuery?: string | undefined; }; }, { body: { query: string; operationName: string; start?: number | undefined; end?: number | undefined; filter?: Zod.objectInputType<{}, Zod.ZodTypeAny, \"passthrough\"> | undefined; kuery?: string | undefined; }; }>, ", "StreamsRouteHandlerResources", ", ", + "UnparsedEsqlResponse", + ", undefined>; \"GET /api/streams/_status\": { endpoint: \"GET /api/streams/_status\"; handler: ServerRouteHandler<", + "StreamsRouteHandlerResources", + ", undefined, { enabled: boolean; }>; security?: ", { "pluginId": "@kbn/core-http-server", "scope": "server", "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" + "section": "def-server.RouteSecurity", + "text": "RouteSecurity" }, - ", ", + " | undefined; }; \"GET /api/streams\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" + "section": "def-common.ServerRoute", + "text": "ServerRoute" }, - ">; \"PUT /api/streams/{id} 2023-10-31\": ", + "<\"GET /api/streams\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", + "StreamsRouteHandlerResources", + ", { definitions: { id: string; children: { id: string; condition?: ", + "Condition", + "; }[]; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }[]; trees: ", + "StreamTree", + "[]; }, undefined>; \"DELETE /api/streams/{id}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -97,7 +404,17 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - "<\"PUT /api/streams/{id} 2023-10-31\", Zod.ZodObject<{ path: Zod.ZodObject<{ id: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { id: string; }, { id: string; }>; body: Zod.ZodObject<{ processing: Zod.ZodDefault; }, \"strip\", Zod.ZodTypeAny, { path: { id: string; }; }, { path: { id: string; }; }>, ", + "StreamsRouteHandlerResources", + ", { acknowledged: true; }, undefined>; \"PUT /api/streams/{id}\": ", + { + "pluginId": "@kbn/server-route-repository-utils", + "scope": "common", + "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", + "section": "def-common.ServerRoute", + "text": "ServerRoute" + }, + "<\"PUT /api/streams/{id}\", Zod.ZodObject<{ path: Zod.ZodObject<{ id: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { id: string; }, { id: string; }>; body: Zod.ZodObject<{ processing: Zod.ZodDefault | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", "Condition", - "; }>, \"many\">>; fields: Zod.ZodDefault; }, \"strip\", Zod.ZodTypeAny, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }>, \"many\">>; children: Zod.ZodDefault, \"many\">>; fields: Zod.ZodDefault; }, \"strip\", Zod.ZodTypeAny, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }>, \"many\">>; children: Zod.ZodDefault; }, \"strip\", Zod.ZodTypeAny, { id: string; condition?: ", + ">>; }, \"strip\", Zod.ZodTypeAny, { id: string; condition?: ", "Condition", "; }, { id: string; condition?: ", "Condition", @@ -131,23 +448,7 @@ "Condition", "; }[] | undefined; }; }>, ", "StreamsRouteHandlerResources", - ", ", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" - }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"GET /api/streams/{id} 2023-10-31\": ", + ", { acknowledged: boolean; }, undefined>; \"GET /api/streams/{id}\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -155,25 +456,13 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/streams/{id} 2023-10-31\", Zod.ZodObject<{ path: Zod.ZodObject<{ id: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { id: string; }, { id: string; }>; }, \"strip\", Zod.ZodTypeAny, { path: { id: string; }; }, { path: { id: string; }; }>, ", + "<\"GET /api/streams/{id}\", Zod.ZodObject<{ path: Zod.ZodObject<{ id: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { id: string; }, { id: string; }>; }, \"strip\", Zod.ZodTypeAny, { path: { id: string; }; }, { path: { id: string; }; }>, ", "StreamsRouteHandlerResources", - ", ", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" - }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /api/streams/{id}/_fork 2023-10-31\": ", + ", { id: string; children: { id: string; condition?: ", + "Condition", + "; }[]; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; } & { inheritedFields: ({ type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; } & { from: string; })[]; }, undefined>; \"POST /api/streams/{id}/_fork\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -181,7 +470,7 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - "<\"POST /api/streams/{id}/_fork 2023-10-31\", Zod.ZodObject<{ path: Zod.ZodObject<{ id: Zod.ZodString; }, \"strip\", Zod.ZodTypeAny, { id: string; }, { id: string; }>; body: Zod.ZodObject<{ stream: Zod.ZodObject; body: Zod.ZodObject<{ stream: Zod.ZodObject | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", "Condition", - "; }>, \"many\">>; fields: Zod.ZodDefault; }, \"strip\", Zod.ZodTypeAny, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }>, \"many\">>; children: Zod.ZodDefault, \"many\">>; fields: Zod.ZodDefault; }, \"strip\", Zod.ZodTypeAny, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }, { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }>, \"many\">>; children: Zod.ZodDefault; }, \"strip\", Zod.ZodTypeAny, { id: string; condition?: ", + ">>; }, \"strip\", Zod.ZodTypeAny, { id: string; condition?: ", "Condition", "; }, { id: string; condition?: ", "Condition", @@ -223,23 +512,7 @@ "Condition", "; }; }>, ", "StreamsRouteHandlerResources", - ", ", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" - }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /api/streams/_resync 2023-10-31\": ", + ", { acknowledged: true; }, undefined>; \"POST /api/streams/_resync\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -247,25 +520,9 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - "<\"POST /api/streams/_resync 2023-10-31\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", + "<\"POST /api/streams/_resync\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", "StreamsRouteHandlerResources", - ", ", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" - }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; \"POST /api/streams/_enable 2023-10-31\": ", + ", { acknowledged: true; }, undefined>; \"POST /api/streams/_enable\": ", { "pluginId": "@kbn/server-route-repository-utils", "scope": "common", @@ -273,25 +530,9 @@ "section": "def-common.ServerRoute", "text": "ServerRoute" }, - "<\"POST /api/streams/_enable 2023-10-31\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", + "<\"POST /api/streams/_enable\", Zod.ZodObject<{}, \"strip\", Zod.ZodTypeAny, {}, {}>, ", "StreamsRouteHandlerResources", - ", ", - { - "pluginId": "@kbn/core-http-server", - "scope": "server", - "docId": "kibKbnCoreHttpServerPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" - }, - ", ", - { - "pluginId": "@kbn/server-route-repository-utils", - "scope": "common", - "docId": "kibKbnServerRouteRepositoryUtilsPluginApi", - "section": "def-common.DefaultRouteCreateOptions", - "text": "DefaultRouteCreateOptions" - }, - ">; }" + ", { acknowledged: true; }, undefined>; }" ], "path": "x-pack/plugins/streams/server/routes/index.ts", "deprecated": false, @@ -299,120 +540,7 @@ "initialIsOpen": false } ], - "objects": [ - { - "parentPluginId": "streams", - "id": "def-server.StreamsRouteRepository", - "type": "Object", - "tags": [], - "label": "StreamsRouteRepository", - "description": [], - "path": "x-pack/plugins/streams/server/routes/index.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "streams", - "id": "def-server.StreamsRouteRepository.Unnamed", - "type": "Any", - "tags": [], - "label": "Unnamed", - "description": [], - "signature": [ - "any" - ], - "path": "x-pack/plugins/streams/server/routes/index.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "streams", - "id": "def-server.StreamsRouteRepository.Unnamed", - "type": "Any", - "tags": [], - "label": "Unnamed", - "description": [], - "signature": [ - "any" - ], - "path": "x-pack/plugins/streams/server/routes/index.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "streams", - "id": "def-server.StreamsRouteRepository.Unnamed", - "type": "Any", - "tags": [], - "label": "Unnamed", - "description": [], - "signature": [ - "any" - ], - "path": "x-pack/plugins/streams/server/routes/index.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "streams", - "id": "def-server.StreamsRouteRepository.Unnamed", - "type": "Any", - "tags": [], - "label": "Unnamed", - "description": [], - "signature": [ - "any" - ], - "path": "x-pack/plugins/streams/server/routes/index.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "streams", - "id": "def-server.StreamsRouteRepository.Unnamed", - "type": "Any", - "tags": [], - "label": "Unnamed", - "description": [], - "signature": [ - "any" - ], - "path": "x-pack/plugins/streams/server/routes/index.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "streams", - "id": "def-server.StreamsRouteRepository.Unnamed", - "type": "Any", - "tags": [], - "label": "Unnamed", - "description": [], - "signature": [ - "any" - ], - "path": "x-pack/plugins/streams/server/routes/index.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "streams", - "id": "def-server.StreamsRouteRepository.Unnamed", - "type": "Any", - "tags": [], - "label": "Unnamed", - "description": [], - "signature": [ - "any" - ], - "path": "x-pack/plugins/streams/server/routes/index.ts", - "deprecated": false, - "trackAdoption": false - } - ], - "initialIsOpen": false - } - ], + "objects": [], "setup": { "parentPluginId": "streams", "id": "def-server.StreamsPluginSetup", @@ -447,7 +575,27 @@ "functions": [], "interfaces": [], "enums": [], - "misc": [], + "misc": [ + { + "parentPluginId": "streams", + "id": "def-common.StreamDefinition", + "type": "Type", + "tags": [], + "label": "StreamDefinition", + "description": [], + "signature": [ + "{ id: string; children: { id: string; condition?: ", + "Condition", + "; }[]; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }" + ], + "path": "x-pack/plugins/streams/common/types.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + } + ], "objects": [] } } \ No newline at end of file diff --git a/api_docs/streams.mdx b/api_docs/streams.mdx index 90ce184e20ddb..711ba66f71ab0 100644 --- a/api_docs/streams.mdx +++ b/api_docs/streams.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/streams title: "streams" image: https://source.unsplash.com/400x175/?github description: API docs for the streams plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'streams'] --- import streamsObj from './streams.devdocs.json'; @@ -21,7 +21,15 @@ Contact @simianhacker @flash1293 @dgieselaar for questions regarding this plugin | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 12 | 7 | 12 | 2 | +| 13 | 0 | 13 | 4 | + +## Client + +### Setup + + +### Start + ## Server @@ -31,9 +39,14 @@ Contact @simianhacker @flash1293 @dgieselaar for questions regarding this plugin ### Start -### Objects - +### Interfaces + ### Consts, variables and types +## Common + +### Consts, variables and types + + diff --git a/api_docs/streams_app.devdocs.json b/api_docs/streams_app.devdocs.json new file mode 100644 index 0000000000000..2bb7bd48fb0cb --- /dev/null +++ b/api_docs/streams_app.devdocs.json @@ -0,0 +1,148 @@ +{ + "id": "streamsApp", + "client": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [], + "setup": { + "parentPluginId": "streamsApp", + "id": "def-public.StreamsAppPublicSetup", + "type": "Interface", + "tags": [], + "label": "StreamsAppPublicSetup", + "description": [], + "path": "x-pack/plugins/streams_app/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [], + "lifecycle": "setup", + "initialIsOpen": true + }, + "start": { + "parentPluginId": "streamsApp", + "id": "def-public.StreamsAppPublicStart", + "type": "Interface", + "tags": [], + "label": "StreamsAppPublicStart", + "description": [], + "path": "x-pack/plugins/streams_app/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [], + "lifecycle": "start", + "initialIsOpen": true + } + }, + "server": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [], + "setup": { + "parentPluginId": "streamsApp", + "id": "def-server.StreamsAppServerSetup", + "type": "Interface", + "tags": [], + "label": "StreamsAppServerSetup", + "description": [], + "path": "x-pack/plugins/streams_app/server/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [], + "lifecycle": "setup", + "initialIsOpen": true + }, + "start": { + "parentPluginId": "streamsApp", + "id": "def-server.StreamsAppServerStart", + "type": "Interface", + "tags": [], + "label": "StreamsAppServerStart", + "description": [], + "path": "x-pack/plugins/streams_app/server/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [], + "lifecycle": "start", + "initialIsOpen": true + } + }, + "common": { + "classes": [], + "functions": [], + "interfaces": [ + { + "parentPluginId": "streamsApp", + "id": "def-common.EntityTypeDefinition", + "type": "Interface", + "tags": [], + "label": "EntityTypeDefinition", + "description": [], + "path": "x-pack/plugins/streams_app/common/index.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "streamsApp", + "id": "def-common.EntityTypeDefinition.displayName", + "type": "string", + "tags": [], + "label": "displayName", + "description": [], + "path": "x-pack/plugins/streams_app/common/index.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + } + ], + "enums": [], + "misc": [ + { + "parentPluginId": "streamsApp", + "id": "def-common.Entity", + "type": "Type", + "tags": [], + "label": "Entity", + "description": [], + "signature": [ + "EntityBase & { type: \"stream\"; properties: { id: string; children: { id: string; condition?: ", + "Condition", + "; }[]; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }; }" + ], + "path": "x-pack/plugins/streams_app/common/index.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, + { + "parentPluginId": "streamsApp", + "id": "def-common.StreamEntity", + "type": "Type", + "tags": [], + "label": "StreamEntity", + "description": [], + "signature": [ + "EntityBase & { type: \"stream\"; properties: { id: string; children: { id: string; condition?: ", + "Condition", + "; }[]; fields: { type: \"boolean\" | \"ip\" | \"keyword\" | \"date\" | \"long\" | \"double\" | \"match_only_text\"; name: string; }[]; processing: { config: { type: \"grok\"; field: string; patterns: string[]; pattern_definitions?: Record | undefined; } | { type: \"dissect\"; field: string; pattern: string; }; condition?: ", + "Condition", + "; }[]; }; }" + ], + "path": "x-pack/plugins/streams_app/common/index.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + } + ], + "objects": [] + } +} \ No newline at end of file diff --git a/api_docs/streams_app.mdx b/api_docs/streams_app.mdx new file mode 100644 index 0000000000000..1a91877bccb03 --- /dev/null +++ b/api_docs/streams_app.mdx @@ -0,0 +1,49 @@ +--- +#### +#### This document is auto-generated and is meant to be viewed inside our experimental, new docs system. +#### Reach out in #docs-engineering for more info. +#### +id: kibStreamsAppPluginApi +slug: /kibana-dev-docs/api/streamsApp +title: "streamsApp" +image: https://source.unsplash.com/400x175/?github +description: API docs for the streamsApp plugin +date: 2024-11-26 +tags: ['contributor', 'dev', 'apidocs', 'kibana', 'streamsApp'] +--- +import streamsAppObj from './streams_app.devdocs.json'; + + + +Contact @simianhacker @flash1293 @dgieselaar for questions regarding this plugin. + +**Code health stats** + +| Public API count | Any count | Items lacking comments | Missing exports | +|-------------------|-----------|------------------------|-----------------| +| 8 | 0 | 8 | 0 | + +## Client + +### Setup + + +### Start + + +## Server + +### Setup + + +### Start + + +## Common + +### Interfaces + + +### Consts, variables and types + + diff --git a/api_docs/task_manager.mdx b/api_docs/task_manager.mdx index 53cc2f93289b9..1aa0629eaac5e 100644 --- a/api_docs/task_manager.mdx +++ b/api_docs/task_manager.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/taskManager title: "taskManager" image: https://source.unsplash.com/400x175/?github description: API docs for the taskManager plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'taskManager'] --- import taskManagerObj from './task_manager.devdocs.json'; diff --git a/api_docs/telemetry.mdx b/api_docs/telemetry.mdx index bdc0cca49e486..d11feca183d97 100644 --- a/api_docs/telemetry.mdx +++ b/api_docs/telemetry.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/telemetry title: "telemetry" image: https://source.unsplash.com/400x175/?github description: API docs for the telemetry plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'telemetry'] --- import telemetryObj from './telemetry.devdocs.json'; diff --git a/api_docs/telemetry_collection_manager.mdx b/api_docs/telemetry_collection_manager.mdx index 7183e11003786..52bea13e8a621 100644 --- a/api_docs/telemetry_collection_manager.mdx +++ b/api_docs/telemetry_collection_manager.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/telemetryCollectionManager title: "telemetryCollectionManager" image: https://source.unsplash.com/400x175/?github description: API docs for the telemetryCollectionManager plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'telemetryCollectionManager'] --- import telemetryCollectionManagerObj from './telemetry_collection_manager.devdocs.json'; diff --git a/api_docs/telemetry_management_section.mdx b/api_docs/telemetry_management_section.mdx index 8f12f3bd109f3..cef1f9e119e0c 100644 --- a/api_docs/telemetry_management_section.mdx +++ b/api_docs/telemetry_management_section.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/telemetryManagementSection title: "telemetryManagementSection" image: https://source.unsplash.com/400x175/?github description: API docs for the telemetryManagementSection plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'telemetryManagementSection'] --- import telemetryManagementSectionObj from './telemetry_management_section.devdocs.json'; diff --git a/api_docs/threat_intelligence.mdx b/api_docs/threat_intelligence.mdx index 9e1ffb1fa4767..141a225a8a666 100644 --- a/api_docs/threat_intelligence.mdx +++ b/api_docs/threat_intelligence.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/threatIntelligence title: "threatIntelligence" image: https://source.unsplash.com/400x175/?github description: API docs for the threatIntelligence plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'threatIntelligence'] --- import threatIntelligenceObj from './threat_intelligence.devdocs.json'; diff --git a/api_docs/timelines.mdx b/api_docs/timelines.mdx index b1b59d701ab62..88f7e01a3eec2 100644 --- a/api_docs/timelines.mdx +++ b/api_docs/timelines.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/timelines title: "timelines" image: https://source.unsplash.com/400x175/?github description: API docs for the timelines plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'timelines'] --- import timelinesObj from './timelines.devdocs.json'; diff --git a/api_docs/transform.mdx b/api_docs/transform.mdx index b3133d84e618e..0e972db1e2298 100644 --- a/api_docs/transform.mdx +++ b/api_docs/transform.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/transform title: "transform" image: https://source.unsplash.com/400x175/?github description: API docs for the transform plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'transform'] --- import transformObj from './transform.devdocs.json'; diff --git a/api_docs/triggers_actions_ui.mdx b/api_docs/triggers_actions_ui.mdx index 587e209b6eb64..401e974737e77 100644 --- a/api_docs/triggers_actions_ui.mdx +++ b/api_docs/triggers_actions_ui.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/triggersActionsUi title: "triggersActionsUi" image: https://source.unsplash.com/400x175/?github description: API docs for the triggersActionsUi plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'triggersActionsUi'] --- import triggersActionsUiObj from './triggers_actions_ui.devdocs.json'; diff --git a/api_docs/ui_actions.mdx b/api_docs/ui_actions.mdx index ad02c7f5dff0e..9d126442020dc 100644 --- a/api_docs/ui_actions.mdx +++ b/api_docs/ui_actions.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/uiActions title: "uiActions" image: https://source.unsplash.com/400x175/?github description: API docs for the uiActions plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'uiActions'] --- import uiActionsObj from './ui_actions.devdocs.json'; diff --git a/api_docs/ui_actions_enhanced.mdx b/api_docs/ui_actions_enhanced.mdx index ad90f13cad031..54888f409d0c2 100644 --- a/api_docs/ui_actions_enhanced.mdx +++ b/api_docs/ui_actions_enhanced.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/uiActionsEnhanced title: "uiActionsEnhanced" image: https://source.unsplash.com/400x175/?github description: API docs for the uiActionsEnhanced plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'uiActionsEnhanced'] --- import uiActionsEnhancedObj from './ui_actions_enhanced.devdocs.json'; diff --git a/api_docs/unified_doc_viewer.mdx b/api_docs/unified_doc_viewer.mdx index 42288efbacfad..8619114a71693 100644 --- a/api_docs/unified_doc_viewer.mdx +++ b/api_docs/unified_doc_viewer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/unifiedDocViewer title: "unifiedDocViewer" image: https://source.unsplash.com/400x175/?github description: API docs for the unifiedDocViewer plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'unifiedDocViewer'] --- import unifiedDocViewerObj from './unified_doc_viewer.devdocs.json'; diff --git a/api_docs/unified_histogram.mdx b/api_docs/unified_histogram.mdx index 12f9887a336cf..4b186ad113eba 100644 --- a/api_docs/unified_histogram.mdx +++ b/api_docs/unified_histogram.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/unifiedHistogram title: "unifiedHistogram" image: https://source.unsplash.com/400x175/?github description: API docs for the unifiedHistogram plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'unifiedHistogram'] --- import unifiedHistogramObj from './unified_histogram.devdocs.json'; diff --git a/api_docs/unified_search.mdx b/api_docs/unified_search.mdx index ce922b308d074..7cf003158cdde 100644 --- a/api_docs/unified_search.mdx +++ b/api_docs/unified_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/unifiedSearch title: "unifiedSearch" image: https://source.unsplash.com/400x175/?github description: API docs for the unifiedSearch plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'unifiedSearch'] --- import unifiedSearchObj from './unified_search.devdocs.json'; diff --git a/api_docs/unified_search_autocomplete.mdx b/api_docs/unified_search_autocomplete.mdx index 64a2f67f79a27..862dbba5825df 100644 --- a/api_docs/unified_search_autocomplete.mdx +++ b/api_docs/unified_search_autocomplete.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/unifiedSearch-autocomplete title: "unifiedSearch.autocomplete" image: https://source.unsplash.com/400x175/?github description: API docs for the unifiedSearch.autocomplete plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'unifiedSearch.autocomplete'] --- import unifiedSearchAutocompleteObj from './unified_search_autocomplete.devdocs.json'; diff --git a/api_docs/uptime.mdx b/api_docs/uptime.mdx index d7f332f2cf360..afeb97f9a2346 100644 --- a/api_docs/uptime.mdx +++ b/api_docs/uptime.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/uptime title: "uptime" image: https://source.unsplash.com/400x175/?github description: API docs for the uptime plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'uptime'] --- import uptimeObj from './uptime.devdocs.json'; diff --git a/api_docs/url_forwarding.mdx b/api_docs/url_forwarding.mdx index e4734dfa0653b..d290f15b8d29d 100644 --- a/api_docs/url_forwarding.mdx +++ b/api_docs/url_forwarding.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/urlForwarding title: "urlForwarding" image: https://source.unsplash.com/400x175/?github description: API docs for the urlForwarding plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'urlForwarding'] --- import urlForwardingObj from './url_forwarding.devdocs.json'; diff --git a/api_docs/usage_collection.mdx b/api_docs/usage_collection.mdx index aa0b2dbaff3ff..82ca2063d3474 100644 --- a/api_docs/usage_collection.mdx +++ b/api_docs/usage_collection.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/usageCollection title: "usageCollection" image: https://source.unsplash.com/400x175/?github description: API docs for the usageCollection plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'usageCollection'] --- import usageCollectionObj from './usage_collection.devdocs.json'; diff --git a/api_docs/ux.mdx b/api_docs/ux.mdx index 2e8ee7925b0ea..ca1c1c544650a 100644 --- a/api_docs/ux.mdx +++ b/api_docs/ux.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/ux title: "ux" image: https://source.unsplash.com/400x175/?github description: API docs for the ux plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'ux'] --- import uxObj from './ux.devdocs.json'; diff --git a/api_docs/vis_default_editor.mdx b/api_docs/vis_default_editor.mdx index 2592bad7448be..e21c0b14aff64 100644 --- a/api_docs/vis_default_editor.mdx +++ b/api_docs/vis_default_editor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visDefaultEditor title: "visDefaultEditor" image: https://source.unsplash.com/400x175/?github description: API docs for the visDefaultEditor plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visDefaultEditor'] --- import visDefaultEditorObj from './vis_default_editor.devdocs.json'; diff --git a/api_docs/vis_type_gauge.mdx b/api_docs/vis_type_gauge.mdx index e79e6e6a10194..2a95c87e774dd 100644 --- a/api_docs/vis_type_gauge.mdx +++ b/api_docs/vis_type_gauge.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeGauge title: "visTypeGauge" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeGauge plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeGauge'] --- import visTypeGaugeObj from './vis_type_gauge.devdocs.json'; diff --git a/api_docs/vis_type_heatmap.mdx b/api_docs/vis_type_heatmap.mdx index 1b1c8408ddf92..e10792c5d7e68 100644 --- a/api_docs/vis_type_heatmap.mdx +++ b/api_docs/vis_type_heatmap.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeHeatmap title: "visTypeHeatmap" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeHeatmap plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeHeatmap'] --- import visTypeHeatmapObj from './vis_type_heatmap.devdocs.json'; diff --git a/api_docs/vis_type_pie.mdx b/api_docs/vis_type_pie.mdx index e77a01bc14912..6cad51ffd9cfc 100644 --- a/api_docs/vis_type_pie.mdx +++ b/api_docs/vis_type_pie.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypePie title: "visTypePie" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypePie plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypePie'] --- import visTypePieObj from './vis_type_pie.devdocs.json'; diff --git a/api_docs/vis_type_table.mdx b/api_docs/vis_type_table.mdx index 831f371255a7d..f749b43b6da1d 100644 --- a/api_docs/vis_type_table.mdx +++ b/api_docs/vis_type_table.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeTable title: "visTypeTable" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeTable plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeTable'] --- import visTypeTableObj from './vis_type_table.devdocs.json'; diff --git a/api_docs/vis_type_timelion.mdx b/api_docs/vis_type_timelion.mdx index 6e3f05380d5ce..6c8c83062bb24 100644 --- a/api_docs/vis_type_timelion.mdx +++ b/api_docs/vis_type_timelion.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeTimelion title: "visTypeTimelion" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeTimelion plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeTimelion'] --- import visTypeTimelionObj from './vis_type_timelion.devdocs.json'; diff --git a/api_docs/vis_type_timeseries.mdx b/api_docs/vis_type_timeseries.mdx index 25dc11852a15c..8b11a9920127b 100644 --- a/api_docs/vis_type_timeseries.mdx +++ b/api_docs/vis_type_timeseries.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeTimeseries title: "visTypeTimeseries" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeTimeseries plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeTimeseries'] --- import visTypeTimeseriesObj from './vis_type_timeseries.devdocs.json'; diff --git a/api_docs/vis_type_vega.mdx b/api_docs/vis_type_vega.mdx index 62e65a5205dfb..a86e7396aab6f 100644 --- a/api_docs/vis_type_vega.mdx +++ b/api_docs/vis_type_vega.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeVega title: "visTypeVega" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeVega plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeVega'] --- import visTypeVegaObj from './vis_type_vega.devdocs.json'; diff --git a/api_docs/vis_type_vislib.mdx b/api_docs/vis_type_vislib.mdx index a00959fdf5faf..b1ff41b15eb94 100644 --- a/api_docs/vis_type_vislib.mdx +++ b/api_docs/vis_type_vislib.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeVislib title: "visTypeVislib" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeVislib plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeVislib'] --- import visTypeVislibObj from './vis_type_vislib.devdocs.json'; diff --git a/api_docs/vis_type_xy.mdx b/api_docs/vis_type_xy.mdx index a10069fc3517c..4a38efe31c722 100644 --- a/api_docs/vis_type_xy.mdx +++ b/api_docs/vis_type_xy.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeXy title: "visTypeXy" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeXy plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeXy'] --- import visTypeXyObj from './vis_type_xy.devdocs.json'; diff --git a/api_docs/visualizations.mdx b/api_docs/visualizations.mdx index 4c8ef69806d02..831e757cf5abc 100644 --- a/api_docs/visualizations.mdx +++ b/api_docs/visualizations.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visualizations title: "visualizations" image: https://source.unsplash.com/400x175/?github description: API docs for the visualizations plugin -date: 2024-11-25 +date: 2024-11-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visualizations'] --- import visualizationsObj from './visualizations.devdocs.json'; From 3188cda4e3f16161f58fb6c314cf1bffbdac4f41 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Tue, 26 Nov 2024 00:12:14 -0800 Subject: [PATCH 61/71] [UII] Add status tracking for agentless integrations (#199567) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Resolves https://github.com/elastic/ingest-dev/issues/3933. For deployments that support agentless, integrations with agentless deployment mode enabled will allow the status of agentless integration policies to be tracked. ### Key technical changes - A new field `supports_agentless` was added to package policies. This field already exists on agent policies. When an agentless integration is created, `supports_agentless: true` is now added to both the package policy and its parent agent policy. - This allows easier filtering for agentless integrations as we avoid having to retrieve & check against every parent agent policy. - This also means existing agentless policies do not get this new status tracking UI, only new ones created after this change. Since agentless is not yet GA, I think this is okay. - `/api/fleet/agent_status/data` now takes optional query params `pkgName` and `pkgVersion`. When both are specified, the API will check if agent(s) have ingested data for only that package's datastreams. ## UI walkthrough
🖼️ Click to show screenshots 1. **Integration policies** page now shows two tables for integrations meeting the above condition, one for agentless policies and one for agent-based policies: ![image](https://github.com/user-attachments/assets/58c6a932-9bda-4229-ba5f-d341bdbd539a) 2. Clicking the status badge in the agentless policies table opens a flyout with two steps: confirm agentless enrollment and confirm incoming data: ![image](https://github.com/user-attachments/assets/e19e6ba0-f40d-48a7-a524-0373934ac46a) 3. Confirm agentless enrollment polls for an agent enrolled into that integration policy's agent policy. If that agent is reporting an unhealthy status, the integration component UI is shown. This UI is the same one used on Fleet > Agents > Agent details page and shows all components reported by that agent: ![image](https://github.com/user-attachments/assets/ce214f7f-4bdd-48e5-a5eb-a1e8fcc7a512) 4. Once a healthy agentless enrollment is established, confirm incoming data starts polling for data for that integration ingested by that agent ID in the past 5 minutes: ![image](https://github.com/user-attachments/assets/7f3de40b-3418-4174-b529-e805407949b6) 5. If data could not be retrieved in 5 minutes, an error message shows while polling continues in the background: ![image](https://github.com/user-attachments/assets/a3fd198e-1570-4357-9b7f-e541a769d33f) 6. If data is retrieved, a success message is shown: ![image](https://github.com/user-attachments/assets/f4e442af-ca60-4448-9bfb-3f244cd03c2d)
## Testing Easiest way to test is use the Cloud deployment from this PR. Enable Beta integrations and navigate to CSPM. Add a CSPM integration using `Agentless` setup technology. Then you can track the status of the agentless deployment on the Integrations policies tab. For local testing, the following is required to simulate agentless agent: 1. Add the following to kibana.dev.yml: ``` xpack.cloud.id: 'anything-to-pass-cloud-validation-checks' xpack.fleet.agentless.enabled: true xpack.fleet.agentless.api.url: 'https://localhost:8443' xpack.fleet.agentless.api.tls.certificate: './config/certs/ess-client.crt' xpack.fleet.agentless.api.tls.key: './config/certs/ess-client.key' xpack.fleet.agentless.api.tls.ca: './config/certs/ca.crt' ``` 2. Apply [this patch](https://gist.github.com/jen-huang/dfc3e02ceb63976ad54bd1f50c524cb4) to prevent attempt to create agentless pod 3. Enroll a Fleet Server as usual 4. Enable Beta integrations and navigate to CSPM. Add a CSPM integration using `Agentless` setup technology. 5. Enroll a normal Elastic Agent to the agent policy for that CSPM integration by using the token from Enrollment tokens ## To-do - [x] API tests - [x] Unit UI tests - [x] Manual Cloud tests - [x] File docs request - https://github.com/elastic/ingest-docs/issues/1466 - [ ] Update troubleshooting guide link once available ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- oas_docs/bundle.json | 118 ++++ oas_docs/bundle.serverless.json | 118 ++++ oas_docs/output/kibana.serverless.yaml | 95 +++ oas_docs/output/kibana.yaml | 95 +++ .../current_fields.json | 2 + .../current_mappings.json | 6 + .../check_registered_types.test.ts | 4 +- .../fleet/common/constants/mappings.ts | 1 + ...plified_package_policy_helper.test.ts.snap | 1 + .../simplified_package_policy_helper.ts | 24 +- .../common/types/models/package_policy.ts | 1 + .../fleet/common/types/rest_spec/agent.ts | 2 + .../confirm_incoming_data_with_preview.tsx | 8 +- .../hooks/setup_technology.test.ts | 23 + .../hooks/setup_technology.ts | 28 +- .../single_page_layout/index.tsx | 1 + .../hooks/use_package_policy_steps.tsx | 1 + .../agent_details_integration.tsx | 206 ++++--- .../agent_details_integration_inputs.tsx | 37 +- .../agent_details_integrations.tsx | 4 +- .../agents/components/agent_health.tsx | 117 ++-- .../sections/epm/screens/detail/index.tsx | 2 +- .../components/agent_based_table.test.tsx | 126 ++++ .../policies/components/agent_based_table.tsx | 346 +++++++++++ .../components/agentless_table.test.tsx | 158 +++++ .../policies/components/agentless_table.tsx | 300 ++++++++++ .../detail/policies/package_policies.tsx | 564 +++++++----------- .../confirm_incoming_data.tsx | 2 +- .../use_get_agent_incoming_data.tsx | 39 +- .../index.test.tsx | 151 +++++ .../agentless_enrollment_flyout/index.tsx | 212 +++++++ .../step_confirm_data.tsx | 99 +++ .../step_confirm_enrollment.tsx | 151 +++++ .../plugins/fleet/public/components/index.ts | 1 + .../package_policy_actions_menu.test.tsx | 5 +- .../package_policy_actions_menu.tsx | 39 +- .../fleet/server/routes/agent/handlers.ts | 31 +- .../fleet/server/saved_objects/index.ts | 22 + .../fleet/server/services/agents/status.ts | 24 +- .../fleet/server/services/package_policy.ts | 1 + .../server/types/models/package_policy.ts | 20 + .../fleet/server/types/rest_spec/agent.ts | 2 + .../agentless/create_agent.ts | 8 +- .../add_cis_integration_form_page.ts | 22 +- .../apis/agents/status.ts | 26 + .../agentless_api/create_agent.ts | 6 +- 46 files changed, 2659 insertions(+), 590 deletions(-) create mode 100644 x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agent_based_table.test.tsx create mode 100644 x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agent_based_table.tsx create mode 100644 x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agentless_table.test.tsx create mode 100644 x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agentless_table.tsx create mode 100644 x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/index.test.tsx create mode 100644 x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/index.tsx create mode 100644 x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/step_confirm_data.tsx create mode 100644 x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/step_confirm_enrollment.tsx diff --git a/oas_docs/bundle.json b/oas_docs/bundle.json index 1d03129d262c2..b96aaa3a3ce00 100644 --- a/oas_docs/bundle.json +++ b/oas_docs/bundle.json @@ -6919,6 +6919,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -7943,6 +7949,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -8736,6 +8748,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -9790,6 +9808,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -10813,6 +10837,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -11607,6 +11637,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -12744,6 +12780,22 @@ ] } }, + { + "in": "query", + "name": "pkgName", + "required": false, + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "pkgVersion", + "required": false, + "schema": { + "type": "string" + } + }, { "in": "query", "name": "previewData", @@ -30076,6 +30128,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -30563,6 +30621,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "vars": { "additionalProperties": { "additionalProperties": false, @@ -30800,6 +30864,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "vars": { "additionalProperties": { "anyOf": [ @@ -31336,6 +31406,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -32038,6 +32114,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -33210,6 +33292,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -33622,6 +33710,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "vars": { "additionalProperties": { "additionalProperties": false, @@ -34314,6 +34408,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -34808,6 +34908,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "vars": { "additionalProperties": { "additionalProperties": false, @@ -35044,6 +35150,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "vars": { "additionalProperties": { "anyOf": [ @@ -35579,6 +35691,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, diff --git a/oas_docs/bundle.serverless.json b/oas_docs/bundle.serverless.json index 5a1e2b69438e1..9115670ecb313 100644 --- a/oas_docs/bundle.serverless.json +++ b/oas_docs/bundle.serverless.json @@ -6919,6 +6919,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -7943,6 +7949,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -8736,6 +8748,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -9790,6 +9808,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -10813,6 +10837,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -11607,6 +11637,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -12744,6 +12780,22 @@ ] } }, + { + "in": "query", + "name": "pkgName", + "required": false, + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "pkgVersion", + "required": false, + "schema": { + "type": "string" + } + }, { "in": "query", "name": "previewData", @@ -30076,6 +30128,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -30563,6 +30621,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "vars": { "additionalProperties": { "additionalProperties": false, @@ -30800,6 +30864,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "vars": { "additionalProperties": { "anyOf": [ @@ -31336,6 +31406,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -32038,6 +32114,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -33210,6 +33292,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -33622,6 +33710,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "vars": { "additionalProperties": { "additionalProperties": false, @@ -34314,6 +34408,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, @@ -34808,6 +34908,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "vars": { "additionalProperties": { "additionalProperties": false, @@ -35044,6 +35150,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "vars": { "additionalProperties": { "anyOf": [ @@ -35579,6 +35691,12 @@ }, "type": "array" }, + "supports_agentless": { + "default": false, + "description": "Indicates whether the package policy belongs to an agentless agent policy.", + "nullable": true, + "type": "boolean" + }, "updated_at": { "type": "string" }, diff --git a/oas_docs/output/kibana.serverless.yaml b/oas_docs/output/kibana.serverless.yaml index 33378690b6500..68a5ccaff2e10 100644 --- a/oas_docs/output/kibana.serverless.yaml +++ b/oas_docs/output/kibana.serverless.yaml @@ -9909,6 +9909,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -10618,6 +10623,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -11167,6 +11177,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -11696,6 +11711,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -12404,6 +12424,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -12953,6 +12978,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -13891,6 +13921,16 @@ paths: type: string type: array - type: string + - in: query + name: pkgName + required: false + schema: + type: string + - in: query + name: pkgVersion + required: false + schema: + type: string - in: query name: previewData required: false @@ -25537,6 +25577,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -25865,6 +25910,11 @@ paths: description: Agent policy IDs where that package policy will be added type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean vars: additionalProperties: additionalProperties: false @@ -26015,6 +26065,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean vars: additionalProperties: anyOf: @@ -26366,6 +26421,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -26826,6 +26886,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -27325,6 +27390,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -27655,6 +27725,11 @@ paths: description: Agent policy IDs where that package policy will be added type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean vars: additionalProperties: additionalProperties: false @@ -27804,6 +27879,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean vars: additionalProperties: anyOf: @@ -28154,6 +28234,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -28931,6 +29016,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -29210,6 +29300,11 @@ paths: description: Agent policy IDs where that package policy will be added type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean vars: additionalProperties: additionalProperties: false diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index 6eb1e4c23f065..208bced5d70f6 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -12769,6 +12769,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -13477,6 +13482,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -14025,6 +14035,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -14553,6 +14568,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -15260,6 +15280,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -15808,6 +15833,11 @@ paths: required: - id type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -16739,6 +16769,16 @@ paths: type: string type: array - type: string + - in: query + name: pkgName + required: false + schema: + type: string + - in: query + name: pkgVersion + required: false + schema: + type: string - in: query name: previewData required: false @@ -28320,6 +28360,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -28647,6 +28692,11 @@ paths: description: Agent policy IDs where that package policy will be added type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean vars: additionalProperties: additionalProperties: false @@ -28797,6 +28847,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean vars: additionalProperties: anyOf: @@ -29148,6 +29203,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -29607,6 +29667,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -30104,6 +30169,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -30433,6 +30503,11 @@ paths: description: Agent policy IDs where that package policy will be added type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean vars: additionalProperties: additionalProperties: false @@ -30582,6 +30657,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean vars: additionalProperties: anyOf: @@ -30932,6 +31012,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -31706,6 +31791,11 @@ paths: items: type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean updated_at: type: string updated_by: @@ -31985,6 +32075,11 @@ paths: description: Agent policy IDs where that package policy will be added type: string type: array + supports_agentless: + default: false + description: Indicates whether the package policy belongs to an agentless agent policy. + nullable: true + type: boolean vars: additionalProperties: additionalProperties: false diff --git a/packages/kbn-check-mappings-update-cli/current_fields.json b/packages/kbn-check-mappings-update-cli/current_fields.json index 1b1b847bb2747..45313933ab1b4 100644 --- a/packages/kbn-check-mappings-update-cli/current_fields.json +++ b/packages/kbn-check-mappings-update-cli/current_fields.json @@ -533,6 +533,7 @@ "revision", "secret_references", "secret_references.id", + "supports_agentless", "updated_at", "updated_by", "vars" @@ -715,6 +716,7 @@ "revision", "secret_references", "secret_references.id", + "supports_agentless", "updated_at", "updated_by", "vars" diff --git a/packages/kbn-check-mappings-update-cli/current_mappings.json b/packages/kbn-check-mappings-update-cli/current_mappings.json index 80739b3412e9b..17fb2c8cff1ed 100644 --- a/packages/kbn-check-mappings-update-cli/current_mappings.json +++ b/packages/kbn-check-mappings-update-cli/current_mappings.json @@ -1786,6 +1786,9 @@ } } }, + "supports_agentless": { + "type": "boolean" + }, "updated_at": { "type": "date" }, @@ -2374,6 +2377,9 @@ } } }, + "supports_agentless": { + "type": "boolean" + }, "updated_at": { "type": "date" }, diff --git a/src/core/server/integration_tests/ci_checks/saved_objects/check_registered_types.test.ts b/src/core/server/integration_tests/ci_checks/saved_objects/check_registered_types.test.ts index 61b92f4ccda64..fe08e3737800e 100644 --- a/src/core/server/integration_tests/ci_checks/saved_objects/check_registered_types.test.ts +++ b/src/core/server/integration_tests/ci_checks/saved_objects/check_registered_types.test.ts @@ -108,7 +108,7 @@ describe('checking migration metadata changes on all registered SO types', () => "fleet-agent-policies": "f57d3b70e4175a19a18f18ee72a379ceec82e1fc", "fleet-fleet-server-host": "69be15f6b6f2a2875ad3c7050ddea7a87f505417", "fleet-message-signing-keys": "93421f43fed2526b59092a4e3c65d64bc2266c0f", - "fleet-package-policies": "8be2cabfed89e103e0d413f2900e9cf6cd31bc68", + "fleet-package-policies": "0206c20f27286787b91814a2e7872f06dc1e8e47", "fleet-preconfiguration-deletion-record": "c52ea1e13c919afe8a5e8e3adbb7080980ecc08e", "fleet-proxy": "6cb688f0d2dd856400c1dbc998b28704ff70363d", "fleet-setup-lock": "0dc784792c79b5af5a6e6b5dcac06b0dbaa90bde", @@ -124,7 +124,7 @@ describe('checking migration metadata changes on all registered SO types', () => "ingest-agent-policies": "5e95e539826a40ad08fd0c1d161da0a4d86ffc6d", "ingest-download-sources": "279a68147e62e4d8858c09ad1cf03bd5551ce58d", "ingest-outputs": "55988d5f778bbe0e76caa7e6468707a0a056bdd8", - "ingest-package-policies": "dfa7b1045a2667a822181f40f012786724492439", + "ingest-package-policies": "60d43f475f91417d14d9df05476acf2e63e99435", "ingest_manager_settings": "111a616eb72627c002029c19feb9e6c439a10505", "inventory-view": "b8683c8e352a286b4aca1ab21003115a4800af83", "kql-telemetry": "93c1d16c1a0dfca9c8842062cf5ef8f62ae401ad", diff --git a/x-pack/plugins/fleet/common/constants/mappings.ts b/x-pack/plugins/fleet/common/constants/mappings.ts index 6499da7f86cc9..f3d2b200cac58 100644 --- a/x-pack/plugins/fleet/common/constants/mappings.ts +++ b/x-pack/plugins/fleet/common/constants/mappings.ts @@ -72,6 +72,7 @@ export const PACKAGE_POLICIES_MAPPINGS = { properties: {}, }, secret_references: { properties: { id: { type: 'keyword' } } }, + supports_agentless: { type: 'boolean' }, revision: { type: 'integer' }, updated_at: { type: 'date' }, updated_by: { type: 'keyword' }, diff --git a/x-pack/plugins/fleet/common/services/__snapshots__/simplified_package_policy_helper.test.ts.snap b/x-pack/plugins/fleet/common/services/__snapshots__/simplified_package_policy_helper.test.ts.snap index 7c549b030a337..f2d4067be434b 100644 --- a/x-pack/plugins/fleet/common/services/__snapshots__/simplified_package_policy_helper.test.ts.snap +++ b/x-pack/plugins/fleet/common/services/__snapshots__/simplified_package_policy_helper.test.ts.snap @@ -238,6 +238,7 @@ Object { "policy_ids": Array [ "policy123", ], + "supports_agentless": undefined, "vars": undefined, } `; diff --git a/x-pack/plugins/fleet/common/services/simplified_package_policy_helper.ts b/x-pack/plugins/fleet/common/services/simplified_package_policy_helper.ts index 14c7b3888f775..5e39f94959486 100644 --- a/x-pack/plugins/fleet/common/services/simplified_package_policy_helper.ts +++ b/x-pack/plugins/fleet/common/services/simplified_package_policy_helper.ts @@ -49,6 +49,7 @@ export interface SimplifiedPackagePolicy { description?: string; vars?: SimplifiedVars; inputs?: SimplifiedInputs; + supports_agentless?: boolean | null; } export interface FormattedPackagePolicy extends Omit { @@ -154,18 +155,19 @@ export function simplifiedPackagePolicytoNewPackagePolicy( description, inputs = {}, vars: packageLevelVars, + supports_agentless: supportsAgentless, } = data; - const packagePolicy = packageToPackagePolicy( - packageInfo, - policyId && isEmpty(policyIds) ? policyId : policyIds, - namespace, - name, - description - ); - - if (outputId) { - packagePolicy.output_id = outputId; - } + const packagePolicy = { + ...packageToPackagePolicy( + packageInfo, + policyId && isEmpty(policyIds) ? policyId : policyIds, + namespace, + name, + description + ), + supports_agentless: supportsAgentless, + output_id: outputId, + }; if (packagePolicy.package && options?.experimental_data_stream_features) { packagePolicy.package.experimental_data_stream_features = diff --git a/x-pack/plugins/fleet/common/types/models/package_policy.ts b/x-pack/plugins/fleet/common/types/models/package_policy.ts index 354834d2571dc..5c98729ff6cd7 100644 --- a/x-pack/plugins/fleet/common/types/models/package_policy.ts +++ b/x-pack/plugins/fleet/common/types/models/package_policy.ts @@ -93,6 +93,7 @@ export interface NewPackagePolicy { [key: string]: any; }; overrides?: { inputs?: { [key: string]: any } } | null; + supports_agentless?: boolean | null; } export interface UpdatePackagePolicy extends NewPackagePolicy { diff --git a/x-pack/plugins/fleet/common/types/rest_spec/agent.ts b/x-pack/plugins/fleet/common/types/rest_spec/agent.ts index b990e5367bb42..57e0cc4f735fe 100644 --- a/x-pack/plugins/fleet/common/types/rest_spec/agent.ts +++ b/x-pack/plugins/fleet/common/types/rest_spec/agent.ts @@ -220,6 +220,8 @@ export interface GetAgentStatusResponse { export interface GetAgentIncomingDataRequest { query: { agentsIds: string[]; + pkgName?: string; + pkgVersion?: string; previewData?: boolean; }; } diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/components/confirm_incoming_data_with_preview.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/components/confirm_incoming_data_with_preview.tsx index 1642abe05d72b..d6d4c3abd63f5 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/components/confirm_incoming_data_with_preview.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/components/confirm_incoming_data_with_preview.tsx @@ -131,11 +131,11 @@ export const ConfirmIncomingDataWithPreview: React.FunctionComponent = ({ setAgentDataConfirmed, troubleshootLink, }) => { - const { incomingData, dataPreview, isLoading, hasReachedTimeout } = usePollingIncomingData( + const { incomingData, dataPreview, isLoading, hasReachedTimeout } = usePollingIncomingData({ agentIds, - true, - MAX_AGENT_DATA_PREVIEW_COUNT - ); + previewData: true, + stopPollingAfterPreviewLength: MAX_AGENT_DATA_PREVIEW_COUNT, + }); const { enrolledAgents, numAgentsWithData } = useGetAgentIncomingData(incomingData, packageInfo); const isGuidedOnboardingActive = useIsGuidedOnboardingActive(packageInfo?.name); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.test.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.test.ts index ead6dd71dba79..1564d934b960e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.test.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.test.ts @@ -115,6 +115,7 @@ describe('useAgentless', () => { describe('useSetupTechnology', () => { const setNewAgentPolicy = jest.fn(); const updateAgentPoliciesMock = jest.fn(); + const updatePackagePolicyMock = jest.fn(); const setSelectedPolicyTabMock = jest.fn(); const newAgentPolicyMock = { name: 'mock_new_agent_policy', @@ -183,6 +184,7 @@ describe('useSetupTechnology', () => { updateAgentPolicies: updateAgentPoliciesMock, setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -212,6 +214,7 @@ describe('useSetupTechnology', () => { packagePolicy: packagePolicyMock, isEditPage: true, agentPolicies: [{ id: 'agentless-policy-id', supports_agentless: true } as any], + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -239,6 +242,7 @@ describe('useSetupTechnology', () => { updateAgentPolicies: updateAgentPoliciesMock, setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -248,6 +252,7 @@ describe('useSetupTechnology', () => { result.current.handleSetupTechnologyChange(SetupTechnology.AGENTLESS); }); await waitFor(() => { + expect(updatePackagePolicyMock).toHaveBeenCalledWith({ supports_agentless: true }); expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENTLESS); expect(setNewAgentPolicy).toHaveBeenCalledWith({ name: 'Agentless policy for endpoint-1', @@ -278,6 +283,7 @@ describe('useSetupTechnology', () => { updateAgentPolicies: updateAgentPoliciesMock, setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, + updatePackagePolicy: updatePackagePolicyMock, }; const { result, rerender } = renderHook((props = initialProps) => useSetupTechnology(props), { @@ -291,6 +297,7 @@ describe('useSetupTechnology', () => { }); expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENTLESS); + expect(updatePackagePolicyMock).toHaveBeenCalledWith({ supports_agentless: true }); expect(setNewAgentPolicy).toHaveBeenCalledWith({ inactivity_timeout: 3600, name: 'Agentless policy for endpoint-1', @@ -306,9 +313,11 @@ describe('useSetupTechnology', () => { ...packagePolicyMock, name: 'endpoint-2', }, + updatePackagePolicy: updatePackagePolicyMock, }); await waitFor(() => { + expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENTLESS); expect(setNewAgentPolicy).toHaveBeenCalledWith({ name: 'Agentless policy for endpoint-2', inactivity_timeout: 3600, @@ -332,6 +341,7 @@ describe('useSetupTechnology', () => { updateAgentPolicies: updateAgentPoliciesMock, setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -366,6 +376,7 @@ describe('useSetupTechnology', () => { updateAgentPolicies: updateAgentPoliciesMock, setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -376,12 +387,14 @@ describe('useSetupTechnology', () => { }); expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENTLESS); + expect(updatePackagePolicyMock).toHaveBeenCalledWith({ supports_agentless: true }); act(() => { result.current.handleSetupTechnologyChange(SetupTechnology.AGENT_BASED); }); expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); + expect(updatePackagePolicyMock).toHaveBeenCalledWith({ supports_agentless: false }); await waitFor(() => { expect(setNewAgentPolicy).toHaveBeenCalledWith(newAgentPolicyMock); @@ -397,6 +410,7 @@ describe('useSetupTechnology', () => { updateAgentPolicies: updateAgentPoliciesMock, setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -410,6 +424,7 @@ describe('useSetupTechnology', () => { expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); + expect(updatePackagePolicyMock).not.toHaveBeenCalled(); expect(setNewAgentPolicy).not.toHaveBeenCalled(); expect(setSelectedPolicyTabMock).not.toHaveBeenCalled(); }); @@ -435,6 +450,7 @@ describe('useSetupTechnology', () => { updateAgentPolicies: updateAgentPoliciesMock, setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -454,6 +470,7 @@ describe('useSetupTechnology', () => { supports_agentless: true, inactivity_timeout: 3600, }); + expect(updatePackagePolicyMock).toHaveBeenCalledWith({ supports_agentless: true }); }); act(() => { @@ -463,6 +480,7 @@ describe('useSetupTechnology', () => { await waitFor(() => { expect(result.current.selectedSetupTechnology).toBe(SetupTechnology.AGENT_BASED); expect(setNewAgentPolicy).toHaveBeenCalledWith(newAgentPolicyMock); + expect(updatePackagePolicyMock).toHaveBeenCalledWith({ supports_agentless: false }); }); }); @@ -489,6 +507,7 @@ describe('useSetupTechnology', () => { setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, packageInfo: packageInfoMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -533,6 +552,7 @@ describe('useSetupTechnology', () => { setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, packageInfo: packageInfoMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -582,6 +602,7 @@ describe('useSetupTechnology', () => { setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, packageInfo: packageInfoMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -627,6 +648,7 @@ describe('useSetupTechnology', () => { updateAgentPolicies: updateAgentPoliciesMock, setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); @@ -673,6 +695,7 @@ describe('useSetupTechnology', () => { setSelectedPolicyTab: setSelectedPolicyTabMock, packagePolicy: packagePolicyMock, packageInfo: packageInfoMock, + updatePackagePolicy: updatePackagePolicyMock, }) ); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts index d785dd988ba3a..85f5cbdc5fae1 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts @@ -61,6 +61,7 @@ export function useSetupTechnology({ setNewAgentPolicy, newAgentPolicy, updateAgentPolicies, + updatePackagePolicy, setSelectedPolicyTab, packageInfo, packagePolicy, @@ -70,6 +71,7 @@ export function useSetupTechnology({ setNewAgentPolicy: (policy: NewAgentPolicy) => void; newAgentPolicy: NewAgentPolicy; updateAgentPolicies: (policies: AgentPolicy[]) => void; + updatePackagePolicy: (policy: Partial) => void; setSelectedPolicyTab: (tab: SelectedPolicyTab) => void; packageInfo?: PackageInfo; packagePolicy: NewPackagePolicy; @@ -112,16 +114,33 @@ export function useSetupTechnology({ updateAgentPolicies([nextNewAgentlessPolicy] as AgentPolicy[]); } } + if ( + selectedSetupTechnology === SetupTechnology.AGENTLESS && + !packagePolicy.supports_agentless + ) { + updatePackagePolicy({ + supports_agentless: true, + }); + } else if ( + selectedSetupTechnology !== SetupTechnology.AGENTLESS && + packagePolicy.supports_agentless + ) { + updatePackagePolicy({ + supports_agentless: false, + }); + } }, [ isAgentlessEnabled, isEditPage, newAgentlessPolicy, packagePolicy.name, + packagePolicy.supports_agentless, selectedSetupTechnology, updateAgentPolicies, setNewAgentPolicy, agentPolicies, setSelectedSetupTechnology, + updatePackagePolicy, ]); const handleSetupTechnologyChange = useCallback( @@ -142,11 +161,17 @@ export function useSetupTechnology({ setSelectedPolicyTab(SelectedPolicyTab.NEW); updateAgentPolicies([agentlessPolicy] as AgentPolicy[]); } + updatePackagePolicy({ + supports_agentless: true, + }); } else if (setupTechnology === SetupTechnology.AGENT_BASED) { setNewAgentPolicy({ ...newAgentBasedPolicy.current, supports_agentless: false, }); + updatePackagePolicy({ + supports_agentless: false, + }); setSelectedPolicyTab(SelectedPolicyTab.NEW); updateAgentPolicies([newAgentBasedPolicy.current] as AgentPolicy[]); } @@ -155,11 +180,12 @@ export function useSetupTechnology({ [ isAgentlessEnabled, selectedSetupTechnology, + updatePackagePolicy, setNewAgentPolicy, newAgentlessPolicy, + packageInfo, setSelectedPolicyTab, updateAgentPolicies, - packageInfo, ] ); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.tsx index 93631f63d0e04..3941c92a76c39 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.tsx @@ -355,6 +355,7 @@ export const CreatePackagePolicySinglePage: CreatePackagePolicyParams = ({ newAgentPolicy, setNewAgentPolicy, updateAgentPolicies, + updatePackagePolicy, setSelectedPolicyTab, packageInfo, packagePolicy, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/hooks/use_package_policy_steps.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/hooks/use_package_policy_steps.tsx index 1f2bdecf9e5ad..56f6a747dd574 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/hooks/use_package_policy_steps.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/hooks/use_package_policy_steps.tsx @@ -134,6 +134,7 @@ export function usePackagePolicySteps({ newAgentPolicy, setNewAgentPolicy, updateAgentPolicies, + updatePackagePolicy, setSelectedPolicyTab, packagePolicy, isEditPage: true, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integration.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integration.tsx index db14401edfadb..84895a021df35 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integration.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integration.tsx @@ -97,114 +97,122 @@ export const AgentDetailsIntegration: React.FunctionComponent<{ agent: Agent; agentPolicy: AgentPolicy; packagePolicy: PackagePolicy; + linkToLogs: boolean; 'data-test-subj'?: string; -}> = memo(({ agent, agentPolicy, packagePolicy, 'data-test-subj': dataTestSubj }) => { - const { getHref } = useLink(); - const theme = useEuiTheme(); +}> = memo( + ({ agent, agentPolicy, packagePolicy, linkToLogs = true, 'data-test-subj': dataTestSubj }) => { + const { getHref } = useLink(); + const theme = useEuiTheme(); - const [isAttentionBadgeNeededForPolicyResponse, setIsAttentionBadgeNeededForPolicyResponse] = - useState(false); + const [isAttentionBadgeNeededForPolicyResponse, setIsAttentionBadgeNeededForPolicyResponse] = + useState(false); - const policyResponseExtensionView = useUIExtension( - packagePolicy.package?.name ?? '', - 'package-policy-response' - ); - - const policyResponseExtensionViewWrapper = useMemo(() => { - return ( - policyResponseExtensionView && ( - - - - ) - ); - }, [agent, policyResponseExtensionView]); - - const packageErrors = useMemo(() => { - if (!agent.components) { - return []; - } - return getInputUnitsByPackage(agent.components, packagePolicy).filter( - (u) => u.status === 'DEGRADED' || u.status === 'FAILED' + const policyResponseExtensionView = useUIExtension( + packagePolicy.package?.name ?? '', + 'package-policy-response' ); - }, [agent.components, packagePolicy]); - const showNeedsAttentionBadge = isAttentionBadgeNeededForPolicyResponse || !!packageErrors.length; + const policyResponseExtensionViewWrapper = useMemo(() => { + return ( + policyResponseExtensionView && ( + + + + ) + ); + }, [agent, policyResponseExtensionView]); + + const packageErrors = useMemo(() => { + if (!agent.components) { + return []; + } + return getInputUnitsByPackage(agent.components, packagePolicy).filter( + (u) => u.status === 'DEGRADED' || u.status === 'FAILED' + ); + }, [agent.components, packagePolicy]); - const genericErrorsListExtensionView = useUIExtension( - packagePolicy.package?.name ?? '', - 'package-generic-errors-list' - ); + const showNeedsAttentionBadge = + isAttentionBadgeNeededForPolicyResponse || !!packageErrors.length; - const genericErrorsListExtensionViewWrapper = useMemo(() => { - return ( - genericErrorsListExtensionView && ( - - - - ) + const genericErrorsListExtensionView = useUIExtension( + packagePolicy.package?.name ?? '', + 'package-generic-errors-list' ); - }, [packageErrors, genericErrorsListExtensionView]); - return ( - -

- - - {packagePolicy.package ? ( - - ) : ( - - )} - - - - {packagePolicy.name} - - - {showNeedsAttentionBadge && ( + const genericErrorsListExtensionViewWrapper = useMemo(() => { + return ( + genericErrorsListExtensionView && ( + + + + ) + ); + }, [packageErrors, genericErrorsListExtensionView]); + + return ( + +

+ - - - + ) : ( + + )} - )} - -

- - } - > - - {policyResponseExtensionViewWrapper} - {genericErrorsListExtensionViewWrapper} - -
- ); -}); + + + {packagePolicy.name} + + + {showNeedsAttentionBadge && ( + + + + + + )} +
+

+ + } + > + + {policyResponseExtensionViewWrapper} + {genericErrorsListExtensionViewWrapper} + +
+ ); + } +); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integration_inputs.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integration_inputs.tsx index 71b1a1ad6fe3e..7630b61c08be6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integration_inputs.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integration_inputs.tsx @@ -66,8 +66,9 @@ const StyledEuiTreeView = styled(EuiTreeView)` export const AgentDetailsIntegrationInputs: React.FunctionComponent<{ agent: Agent; packagePolicy: PackagePolicy; + linkToLogs?: boolean; 'data-test-subj'?: string; -}> = memo(({ agent, packagePolicy, 'data-test-subj': dataTestSubj }) => { +}> = memo(({ agent, packagePolicy, linkToLogs = true, 'data-test-subj': dataTestSubj }) => { const { getHref } = useLink(); const inputStatusMap = useMemo( @@ -138,21 +139,25 @@ export const AgentDetailsIntegrationInputs: React.FunctionComponent<{ defaultMessage: 'View logs', })} > - - {displayInputType(current.type)} - + {linkToLogs ? ( + + {displayInputType(current.type)} + + ) : ( + <>{displayInputType(current.type)} + )} ), id: current.type, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx index 5a7b135b46440..0a1df537e7bcd 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx @@ -15,7 +15,8 @@ import { AgentDetailsIntegration } from './agent_details_integration'; export const AgentDetailsIntegrations: React.FunctionComponent<{ agent: Agent; agentPolicy?: AgentPolicy; -}> = memo(({ agent, agentPolicy }) => { + linkToLogs?: boolean; +}> = memo(({ agent, agentPolicy, linkToLogs = true }) => { if (!agentPolicy || !agentPolicy.package_policies) { return null; } @@ -31,6 +32,7 @@ export const AgentDetailsIntegrations: React.FunctionComponent<{ agent={agent} agentPolicy={agentPolicy} packagePolicy={packagePolicy} + linkToLogs={linkToLogs} data-test-subj={`${testSubj}-accordion`} /> diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx index fa8e263c16170..c7b71af5f97b6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx @@ -8,6 +8,7 @@ import React, { useMemo, useState } from 'react'; import styled from 'styled-components'; import { FormattedMessage, FormattedRelative } from '@kbn/i18n-react'; +import type { EuiBadgeProps } from '@elastic/eui'; import { EuiBadge, EuiButton, @@ -34,67 +35,75 @@ import { useAgentRefresh } from '../agent_details_page/hooks'; import { AgentUpgradeAgentModal } from './agent_upgrade_modal'; -interface Props { +type Props = EuiBadgeProps & { agent: Agent; fromDetails?: boolean; -} - -const Status = { - Healthy: ( - - - - ), - Offline: ( - - - - ), - Inactive: ( - - - - ), - Unenrolled: ( - - - - ), - Unhealthy: ( - - - - ), - Updating: ( - - - - ), }; -function getStatusComponent(status: Agent['status']): React.ReactElement { +function getStatusComponent({ + status, + ...restOfProps +}: { + status: Agent['status']; +} & EuiBadgeProps): React.ReactElement { switch (status) { case 'error': case 'degraded': - return Status.Unhealthy; + return ( + + + + ); case 'inactive': - return Status.Inactive; + return ( + + + + ); case 'offline': - return Status.Offline; + return ( + + + + ); case 'unenrolling': case 'enrolling': case 'updating': - return Status.Updating; + return ( + + + + ); case 'unenrolled': - return Status.Unenrolled; + return ( + + + + ); default: - return Status.Healthy; + return ( + + + + ); } } @@ -102,7 +111,11 @@ const WrappedEuiCallOut = styled(EuiCallOut)` white-space: wrap !important; `; -export const AgentHealth: React.FunctionComponent = ({ agent, fromDetails }) => { +export const AgentHealth: React.FunctionComponent = ({ + agent, + fromDetails, + ...restOfProps +}) => { const { last_checkin: lastCheckIn, last_checkin_message: lastCheckInMessage } = agent; const msLastCheckIn = new Date(lastCheckIn || 0).getTime(); const lastCheckInMessageText = lastCheckInMessage ? ( @@ -172,14 +185,16 @@ export const AgentHealth: React.FunctionComponent = ({ agent, fromDetails > {isStuckInUpdating(agent) && !fromDetails ? (
- {getStatusComponent(agent.status)} + {getStatusComponent({ status: agent.status, ...restOfProps })}  
) : ( <> - {getStatusComponent(agent.status)} - {previousToOfflineStatus ? getStatusComponent(previousToOfflineStatus) : null} + {getStatusComponent({ status: agent.status, ...restOfProps })} + {previousToOfflineStatus + ? getStatusComponent({ status: previousToOfflineStatus, ...restOfProps }) + : null} )} diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx index 9a707500bb03d..0e7e6117d2cf2 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx @@ -846,7 +846,7 @@ export function Detail() { {canReadIntegrationPolicies ? ( - + ) : ( { + it('renders the table with package policies', async () => { + const renderer = createIntegrationsTestRendererMock(); + const result = renderer.render( + + ); + await act(async () => { + expect(result.getByText('Integration policy')).toBeInTheDocument(); + expect(result.getByText('Package Policy 1')).toBeInTheDocument(); + expect(result.getByText('v1.0.0')).toBeInTheDocument(); + }); + }); + + it('shows loading message when isLoading is true', async () => { + const renderer = createIntegrationsTestRendererMock(); + const result = renderer.render( + + ); + await act(async () => { + expect(result.getByText('Loading integration policies…')).toBeInTheDocument(); + }); + }); + + it('shows no policies message when there are no package policies', async () => { + const renderer = createIntegrationsTestRendererMock(); + const result = renderer.render( + + ); + await act(async () => { + expect(result.getByText('No integration policies')).toBeInTheDocument(); + }); + }); + + it('opens the agent enrollment flyout when add agent button is clicked', async () => { + const renderer = createIntegrationsTestRendererMock(); + const result = renderer.render( + + ); + + await act(async () => { + fireEvent.click(screen.getByText('Add agent')); + }); + expect(result.getByTestId('agentEnrollmentFlyout')).toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agent_based_table.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agent_based_table.tsx new file mode 100644 index 0000000000000..197fa84bf4dd9 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agent_based_table.tsx @@ -0,0 +1,346 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { stringify, parse } from 'query-string'; +import React, { useEffect, useState } from 'react'; +import { useLocation, useHistory } from 'react-router-dom'; +import { + EuiBasicTable, + EuiLink, + EuiFlexGroup, + EuiFlexItem, + EuiText, + EuiButton, + EuiIcon, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedRelative, FormattedMessage } from '@kbn/i18n-react'; + +import type { AgentPolicy, InMemoryPackagePolicy, PackagePolicy } from '../../../../../../types'; +import type { usePagination } from '../../../../../../hooks'; +import { useLink, useAuthz, useMultipleAgentPolicies } from '../../../../../../hooks'; +import { + AgentEnrollmentFlyout, + MultipleAgentPoliciesSummaryLine, + AgentPolicySummaryLine, + PackagePolicyActionsMenu, +} from '../../../../../../components'; + +import { Persona } from '../persona'; + +import { PackagePolicyAgentsCell } from './package_policy_agents_cell'; + +export const AgentBasedPackagePoliciesTable = ({ + isLoading, + packagePolicies, + packagePoliciesTotal, + refreshPackagePolicies, + pagination, + addAgentToPolicyIdFromParams, + showAddAgentHelpForPolicyId, +}: { + isLoading: boolean; + packagePolicies: Array<{ + agentPolicies: AgentPolicy[]; + packagePolicy: InMemoryPackagePolicy; + rowIndex: number; + }>; + packagePoliciesTotal: number; + refreshPackagePolicies: () => void; + pagination: ReturnType; + addAgentToPolicyIdFromParams?: string | null; + showAddAgentHelpForPolicyId?: string | null; +}) => { + const { getHref } = useLink(); + const { search } = useLocation(); + const history = useHistory(); + + const [selectedTableIndex, setSelectedTableIndex] = useState(); + const { canUseMultipleAgentPolicies } = useMultipleAgentPolicies(); + const canWriteIntegrationPolicies = useAuthz().integrations.writeIntegrationPolicies; + const canReadIntegrationPolicies = useAuthz().integrations.readIntegrationPolicies; + const canReadAgentPolicies = useAuthz().fleet.readAgentPolicies; + const canShowMultiplePoliciesCell = + canUseMultipleAgentPolicies && canReadIntegrationPolicies && canReadAgentPolicies; + + // Show tour help for adding agents to a policy + const addAgentHelpForPolicyId = packagePolicies.find(({ agentPolicies }) => + agentPolicies.find((agentPolicy) => agentPolicy.id === showAddAgentHelpForPolicyId) + )?.packagePolicy?.id; + + // Handle the "add agent" link displayed in post-installation toast notifications in the case + // where a user is clicking the link while on the package policies listing page + const [flyoutOpenForPolicyId, setFlyoutOpenForPolicyId] = useState( + addAgentToPolicyIdFromParams || null + ); + useEffect(() => { + const unlisten = history.listen((location) => { + const params = new URLSearchParams(location.search); + const addAgentToPolicyId = params.get('addAgentToPolicyId'); + + if (addAgentToPolicyId) { + setFlyoutOpenForPolicyId(addAgentToPolicyId); + } + }); + + return () => unlisten(); + }, [history]); + + const selectedPolicies = + selectedTableIndex !== undefined ? packagePolicies[selectedTableIndex] : undefined; + const selectedAgentPolicies = selectedPolicies?.agentPolicies; + const selectedPackagePolicy = selectedPolicies?.packagePolicy; + const flyoutPolicy = selectedAgentPolicies?.length === 1 ? selectedAgentPolicies[0] : undefined; + + return ( + <> + + items={packagePolicies || []} + columns={[ + { + field: 'packagePolicy.name', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.name', { + defaultMessage: 'Integration policy', + }), + render(_, { agentPolicies, packagePolicy }) { + return ( + + {packagePolicy.name} + + ); + }, + }, + { + field: 'packagePolicy.package.version', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.version', { + defaultMessage: 'Version', + }), + render(_version, { agentPolicies, packagePolicy }) { + return ( + + + + + + + + {agentPolicies.length > 0 && packagePolicy.hasUpgrade && ( + + + + + + )} + + ); + }, + }, + { + field: 'packagePolicy.policy_ids', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.agentPolicy', { + defaultMessage: 'Agent policies', + }), + truncateText: true, + render(ids, { agentPolicies, packagePolicy }) { + return agentPolicies.length > 0 ? ( + canShowMultiplePoliciesCell ? ( + + ) : ( + + ) + ) : ids.length === 0 ? ( + + + + ) : ( + + +   + + + ); + }, + }, + { + field: 'packagePolicy.updated_by', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.updatedBy', { + defaultMessage: 'Last updated by', + }), + truncateText: true, + render(updatedBy: PackagePolicy['updated_by']) { + return ; + }, + }, + { + field: 'packagePolicy.updated_at', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.updatedAt', { + defaultMessage: 'Last updated', + }), + truncateText: true, + render(updatedAt: PackagePolicy['updated_at']) { + return ( + + + + ); + }, + }, + { + field: '', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.agentCount', { + defaultMessage: 'Agents', + }), + render({ + agentPolicies, + packagePolicy, + rowIndex, + }: { + agentPolicies: AgentPolicy[]; + packagePolicy: InMemoryPackagePolicy; + rowIndex: number; + }) { + if (agentPolicies.length === 0) { + return ( + + + + ); + } + return ( + { + setSelectedTableIndex(rowIndex); + setFlyoutOpenForPolicyId(agentPolicies[0].id); + }} + hasHelpPopover={addAgentHelpForPolicyId === packagePolicy.id} + /> + ); + }, + }, + { + field: '', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.actions', { + defaultMessage: 'Actions', + }), + width: '8ch', + align: 'right', + render({ + agentPolicies, + packagePolicy, + }: { + agentPolicies: AgentPolicy[]; + packagePolicy: InMemoryPackagePolicy; + }) { + const agentPolicy = agentPolicies[0]; // TODO: handle multiple agent policies + return ( + + ); + }, + }, + ]} + loading={isLoading} + data-test-subj="integrationPolicyTable" + pagination={{ + pageIndex: pagination.pagination.currentPage - 1, + pageSize: pagination.pagination.pageSize, + totalItemCount: packagePoliciesTotal, + pageSizeOptions: pagination.pageSizeOptions, + }} + onChange={({ page }: { page: { index: number; size: number } }) => { + pagination.setPagination({ + currentPage: page.index + 1, + pageSize: page.size, + }); + }} + noItemsMessage={ + isLoading ? ( + + ) : ( + + ) + } + /> + {flyoutOpenForPolicyId && selectedAgentPolicies && !isLoading && ( + { + setFlyoutOpenForPolicyId(null); + const { addAgentToPolicyId, ...rest } = parse(search); + history.replace({ search: stringify(rest) }); + }} + agentPolicy={flyoutPolicy} + selectedAgentPolicies={selectedAgentPolicies} + isIntegrationFlow={true} + installedPackagePolicy={{ + name: selectedPackagePolicy?.package?.name || '', + version: selectedPackagePolicy?.package?.version || '', + }} + /> + )} + + ); +}; diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agentless_table.test.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agentless_table.test.tsx new file mode 100644 index 0000000000000..25a9933fd7197 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agentless_table.test.tsx @@ -0,0 +1,158 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { fireEvent, act, waitFor } from '@testing-library/react'; + +import { AGENTS_PREFIX } from '../../../../../../../../../common/constants'; +import { sendGetAgents } from '../../../../../../hooks'; +import { createIntegrationsTestRendererMock } from '../../../../../../../../mock'; + +import { AgentlessPackagePoliciesTable } from './agentless_table'; + +jest.mock('../../../../../../hooks', () => ({ + ...jest.requireActual('../../../../../../hooks'), + useConfirmForceInstall: jest.fn(), + sendGetAgents: jest.fn(), +})); + +describe('AgentlessPackagePoliciesTable', () => { + const mockSendGetAgents = sendGetAgents as jest.MockedFunction; + + beforeEach(() => { + mockSendGetAgents.mockResolvedValue({ + data: { + items: [ + { + policy_id: 'policy1', + id: 'agent1', + packages: ['package'], + type: 'PERMANENT', + active: true, + enrolled_at: '2023-01-01T00:00:00Z', + local_metadata: {}, + status: 'online', + }, + ], + total: 1, + page: 1, + perPage: 10000, + }, + error: null, + }); + }); + + afterEach(() => { + jest.clearAllMocks(); + }); + + const defaultProps = { + isLoading: false, + packagePolicies: [ + { + agentPolicies: [ + { + id: 'policy1', + name: 'Policy 1', + status: 'active' as const, + is_managed: false, + updated_at: '2023-01-01T00:00:00Z', + updated_by: 'user1', + namespace: 'default', + monitoring_enabled: [], + revision: 1, + is_protected: false, + }, + ], + packagePolicy: { + id: 'packagePolicy1', + name: 'Package Policy 1', + updated_by: 'user1', + updated_at: '2023-01-01T00:00:00Z', + inputs: [], + policy_id: 'policy1', + namespace: 'default', + enabled: true, + package: { + name: 'package', + title: 'Package', + version: '1.0.0', + }, + hasUpgrade: false, + revision: 1, + created_at: '2023-01-01T00:00:00Z', + created_by: 'user1', + policy_ids: ['policy1'], + }, + rowIndex: 0, + }, + ], + packagePoliciesTotal: 1, + refreshPackagePolicies: jest.fn(), + pagination: { + pagination: { currentPage: 1, pageSize: 10 }, + setPagination: jest.fn(), + pageSizeOptions: [10, 20, 50], + }, + }; + + it('shows loading message when isLoading is true', async () => { + const renderer = createIntegrationsTestRendererMock(); + const result = renderer.render( + + ); + await act(async () => { + expect(result.getByText('Loading integration policies…')).toBeInTheDocument(); + }); + }); + + it('shows no items message when there are no package policies', async () => { + const renderer = createIntegrationsTestRendererMock(); + const result = renderer.render( + + ); + await act(async () => { + expect(result.getByText('No agentless integration policies')).toBeInTheDocument(); + }); + }); + + it('renders the table with package policies', async () => { + const renderer = createIntegrationsTestRendererMock(); + const result = renderer.render(); + + await act(async () => { + expect(result.getByText('Package Policy 1')).toBeInTheDocument(); + expect(result.getByText('user1')).toBeInTheDocument(); + }); + }); + + it('displays agent health status when agents are loaded', async () => { + const renderer = createIntegrationsTestRendererMock(); + const result = renderer.render(); + await waitFor(() => { + expect(mockSendGetAgents).toHaveBeenCalledWith({ + perPage: 10000, + kuery: `${AGENTS_PREFIX}.policy_id: "policy1"`, + }); + }); + expect(await result.findByText('Healthy')).toBeInTheDocument(); + }); + + it('opens flyout when status badge is clicked', async () => { + const renderer = createIntegrationsTestRendererMock(); + const result = renderer.render(); + await waitFor(() => { + expect(mockSendGetAgents).toHaveBeenCalledWith({ + perPage: 10000, + kuery: `${AGENTS_PREFIX}.policy_id: "policy1"`, + }); + }); + await act(async () => { + fireEvent.click(await result.findByText('Healthy')); + }); + expect(result.getByText('Confirm agentless enrollment')).toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agentless_table.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agentless_table.tsx new file mode 100644 index 0000000000000..22348f137c513 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agentless_table.tsx @@ -0,0 +1,300 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React, { useEffect, useMemo, useState } from 'react'; +import type { HorizontalAlignment } from '@elastic/eui'; +import { EuiBadge, EuiBasicTable, EuiLink } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedRelative, FormattedMessage } from '@kbn/i18n-react'; + +import type { + Agent, + AgentPolicy, + InMemoryPackagePolicy, + PackagePolicy, +} from '../../../../../../types'; +import { AGENTS_PREFIX, SO_SEARCH_LIMIT } from '../../../../../../../../../common/constants'; +import type { usePagination } from '../../../../../../hooks'; +import { useLink, sendGetAgents, useAuthz, useStartServices } from '../../../../../../hooks'; +import { + Loading, + PackagePolicyActionsMenu, + AgentlessEnrollmentFlyout, +} from '../../../../../../components'; + +import { Persona } from '../persona'; +import { AgentHealth } from '../../../../../../../fleet/sections/agents/components'; + +const REFRESH_INTERVAL_MS = 30000; + +export const AgentlessPackagePoliciesTable = ({ + isLoading, + packagePolicies, + packagePoliciesTotal, + refreshPackagePolicies, + pagination, +}: { + isLoading: boolean; + packagePolicies: Array<{ + agentPolicies: AgentPolicy[]; + packagePolicy: InMemoryPackagePolicy; + rowIndex: number; + }>; + packagePoliciesTotal: number; + refreshPackagePolicies: () => void; + pagination: ReturnType; +}) => { + const core = useStartServices(); + const { notifications } = core; + const authz = useAuthz(); + const { getHref } = useLink(); + const [isAgentsLoading, setIsAgentsLoading] = useState(false); + const [agentsByPolicyId, setAgentsByPolicyId] = useState>({}); + const canReadAgents = authz.fleet.readAgents; + + // Kuery for all agents enrolled into the agent policies associated with the package policies + // We use the first agent policy as agentless package policies have a 1:1 relationship with agent policies + // Maximum # of agent policies is 50, based on the max page size in UI + const agentsKuery = useMemo(() => { + return packagePolicies + .reduce((policyIds, { agentPolicies }) => { + return [...policyIds, ...(agentPolicies[0] ? [agentPolicies[0]?.id] : [])]; + }, [] as string[]) + .map((policyId) => `${AGENTS_PREFIX}.policy_id: "${policyId}"`) + .join(' or '); + }, [packagePolicies]); + + // Fetch agents using above kuery, if the user has access to read agents + // Polls every 30 seconds + useEffect(() => { + const fetchAgents = async () => { + const { data: agentsData, error } = await sendGetAgents({ + perPage: SO_SEARCH_LIMIT, + kuery: agentsKuery, + }); + + setAgentsByPolicyId( + (agentsData?.items || []).reduce((acc, agent) => { + if (agent.policy_id) { + acc[agent.policy_id] = agent; + } + return acc; + }, {} as Record) + ); + + if (error) { + notifications.toasts.addError(error, { + title: i18n.translate( + 'xpack.fleet.epm.packageDetails.integrationList.agentlessStatusError', + { + defaultMessage: 'Error fetching agentless status information', + } + ), + }); + } + setIsAgentsLoading(false); + }; + + if (canReadAgents) { + setIsAgentsLoading(true); + fetchAgents(); + const interval = setInterval(() => { + fetchAgents(); + }, REFRESH_INTERVAL_MS); + return () => clearInterval(interval); + } + }, [agentsKuery, canReadAgents, notifications.toasts]); + + // Flyout state + const [flyoutOpenForPolicyId, setFlyoutOpenForPolicyId] = useState(); + const [flyoutPackagePolicy, setFlyoutPackagePolicy] = useState(); + const [flyoutAgentPolicy, setFlyoutAgentPolicy] = useState(); + + return ( + <> + + items={packagePolicies || []} + columns={[ + { + field: 'packagePolicy.name', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.name', { + defaultMessage: 'Integration policy', + }), + render(_, { agentPolicies, packagePolicy }) { + return ( + + {packagePolicy.name} + + ); + }, + }, + { + field: 'packagePolicy.updated_by', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.updatedBy', { + defaultMessage: 'Last updated by', + }), + truncateText: true, + render(updatedBy: PackagePolicy['updated_by']) { + return ; + }, + }, + { + field: 'packagePolicy.updated_at', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.updatedAt', { + defaultMessage: 'Last updated', + }), + truncateText: true, + render(updatedAt: PackagePolicy['updated_at']) { + return ( + + + + ); + }, + }, + ...(canReadAgents + ? [ + { + field: '', + name: i18n.translate( + 'xpack.fleet.epm.packageDetails.integrationList.agentlessStatus', + { + defaultMessage: 'Status', + } + ), + align: 'left' as HorizontalAlignment, + render({ + agentPolicies, + packagePolicy, + }: { + agentPolicies: AgentPolicy[]; + packagePolicy: InMemoryPackagePolicy; + rowIndex: number; + }) { + if (isAgentsLoading) { + return ; + } + // Use the first agent policy ID associated with the package policy + // because agentless package policies are only associated with one agent policy + const agentPolicy = agentPolicies[0]; + const agent = + (agentPolicy?.id && agentsByPolicyId[agentPolicy.id]) || undefined; + + // Status badge click handler + const statusBadgeProps = { + onClick: () => { + setFlyoutOpenForPolicyId(packagePolicy.id); + setFlyoutPackagePolicy(packagePolicy); + setFlyoutAgentPolicy(agentPolicy); + }, + 'data-test-subj': 'agentlessStatusBadge', + onClickAriaLabel: i18n.translate( + 'xpack.fleet.epm.packageDetails.integrationList.agentlessStatusAriaLabel', + { + defaultMessage: 'Open status details', + } + ), + }; + + return agent ? ( + + ) : ( + + + + ); + }, + }, + ] + : []), + { + field: '', + name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.actions', { + defaultMessage: 'Actions', + }), + width: '8ch', + align: 'right' as HorizontalAlignment, + render({ + agentPolicies, + packagePolicy, + }: { + agentPolicies: AgentPolicy[]; + packagePolicy: InMemoryPackagePolicy; + }) { + const agentPolicy = agentPolicies[0]; // TODO: handle multiple agent policies + return ( + + ); + }, + }, + ]} + loading={isLoading} + data-test-subj="integrationPolicyTable" + pagination={{ + pageIndex: pagination.pagination.currentPage - 1, + pageSize: pagination.pagination.pageSize, + totalItemCount: packagePoliciesTotal, + pageSizeOptions: pagination.pageSizeOptions, + }} + onChange={({ page }: { page: { index: number; size: number } }) => { + pagination.setPagination({ + currentPage: page.index + 1, + pageSize: page.size, + }); + }} + noItemsMessage={ + isLoading ? ( + + ) : ( + + ) + } + /> + {flyoutOpenForPolicyId && flyoutPackagePolicy && ( + { + setFlyoutOpenForPolicyId(undefined); + setFlyoutPackagePolicy(undefined); + setFlyoutAgentPolicy(undefined); + }} + packagePolicy={flyoutPackagePolicy} + agentPolicy={flyoutAgentPolicy} + /> + )} + + ); +}; diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/package_policies.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/package_policies.tsx index 300de597f6900..06096b1c3de5b 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/package_policies.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/package_policies.tsx @@ -4,80 +4,49 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { stringify, parse } from 'query-string'; -import React, { memo, useCallback, useEffect, useMemo, useState } from 'react'; -import { Redirect, useLocation, useHistory } from 'react-router-dom'; -import type { CriteriaWithPagination, EuiTableFieldDataColumnType } from '@elastic/eui'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { Redirect, useLocation } from 'react-router-dom'; import { - EuiBasicTable, - EuiLink, + EuiAccordion, EuiFlexGroup, EuiFlexItem, + EuiNotificationBadge, + EuiPanel, + EuiSpacer, EuiText, - EuiButton, - EuiIcon, } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { FormattedRelative, FormattedMessage } from '@kbn/i18n-react'; + +import { FormattedMessage } from '@kbn/i18n-react'; import { InstallStatus } from '../../../../../types'; -import type { GetAgentPoliciesResponseItem, InMemoryPackagePolicy } from '../../../../../types'; +import type { + AgentPolicy, + GetAgentPoliciesResponseItem, + InMemoryPackagePolicy, + PackageInfo, + PackagePolicy, +} from '../../../../../types'; import { useLink, - useUrlPagination, useGetPackageInstallStatus, AgentPolicyRefreshContext, useIsPackagePolicyUpgradable, - useAuthz, - useMultipleAgentPolicies, + usePagination, } from '../../../../../hooks'; import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../../../constants'; -import { - AgentEnrollmentFlyout, - MultipleAgentPoliciesSummaryLine, - AgentPolicySummaryLine, - PackagePolicyActionsMenu, -} from '../../../../../components'; import { SideBarColumn } from '../../../components/side_bar_column'; -import { PackagePolicyAgentsCell } from './components/package_policy_agents_cell'; -import { usePackagePoliciesWithAgentPolicy } from './use_package_policies_with_agent_policy'; -import { Persona } from './persona'; - -interface PackagePoliciesPanelProps { - name: string; - version: string; -} - -interface InMemoryPackagePolicyAndAgentPolicy { - packagePolicy: InMemoryPackagePolicy; - agentPolicies: GetAgentPoliciesResponseItem[]; - rowIndex: number; -} +import { useAgentless } from '../../../../../../fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology'; -const IntegrationDetailsLink = memo<{ - packagePolicy: InMemoryPackagePolicyAndAgentPolicy['packagePolicy']; - agentPolicies: InMemoryPackagePolicyAndAgentPolicy['agentPolicies']; -}>(({ packagePolicy }) => { - const { getHref } = useLink(); - return ( - - {packagePolicy.name} - - ); -}); +import { usePackagePoliciesWithAgentPolicy } from './use_package_policies_with_agent_policy'; +import { AgentBasedPackagePoliciesTable } from './components/agent_based_table'; +import { AgentlessPackagePoliciesTable } from './components/agentless_table'; -export const PackagePoliciesPage = ({ name, version }: PackagePoliciesPanelProps) => { +export const PackagePoliciesPage = ({ packageInfo }: { packageInfo: PackageInfo }) => { + const { name, version } = packageInfo; const { search } = useLocation(); - const history = useHistory(); const queryParams = useMemo(() => new URLSearchParams(search), [search]); - const agentPolicyIdFromParams = useMemo( + const addAgentToPolicyIdFromParams = useMemo( () => queryParams.get('addAgentToPolicyId'), [queryParams] ); @@ -85,44 +54,27 @@ export const PackagePoliciesPage = ({ name, version }: PackagePoliciesPanelProps () => queryParams.get('showAddAgentHelpForPolicyId'), [queryParams] ); - const [flyoutOpenForPolicyId, setFlyoutOpenForPolicyId] = useState( - agentPolicyIdFromParams - ); - const [selectedTableIndex, setSelectedTableIndex] = useState(); - - const { getPath, getHref } = useLink(); + const { getPath } = useLink(); const getPackageInstallStatus = useGetPackageInstallStatus(); const packageInstallStatus = getPackageInstallStatus(name); - const { pagination, pageSizeOptions, setPagination } = useUrlPagination(); - const { canUseMultipleAgentPolicies } = useMultipleAgentPolicies(); - const { - data, - isLoading, - resendRequest: refreshPolicies, - } = usePackagePoliciesWithAgentPolicy({ - page: pagination.currentPage, - perPage: pagination.pageSize, - kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name: ${name}`, - }); const { isPackagePolicyUpgradable } = useIsPackagePolicyUpgradable(); + const { isAgentlessIntegration } = useAgentless(); + const canHaveAgentlessPolicies = useMemo( + () => isAgentlessIntegration(packageInfo), + [isAgentlessIntegration, packageInfo] + ); - const canWriteIntegrationPolicies = useAuthz().integrations.writeIntegrationPolicies; - const canReadIntegrationPolicies = useAuthz().integrations.readIntegrationPolicies; - const canReadAgentPolicies = useAuthz().fleet.readAgentPolicies; - - const packageAndAgentPolicies = useMemo((): Array<{ - agentPolicies: GetAgentPoliciesResponseItem[]; - packagePolicy: InMemoryPackagePolicy; - rowIndex: number; - }> => { - if (!data?.items) { - return []; - } - - const newPolicies = data.items.map(({ agentPolicies, packagePolicy }, index) => { + // Helper function to map raw policies data for consumption by the table + const mapPoliciesData = useCallback( + ( + { + agentPolicies, + packagePolicy, + }: { agentPolicies: AgentPolicy[]; packagePolicy: PackagePolicy }, + index: number + ) => { const hasUpgrade = isPackagePolicyUpgradable(packagePolicy); - return { agentPolicies, packagePolicy: { @@ -131,284 +83,204 @@ export const PackagePoliciesPage = ({ name, version }: PackagePoliciesPanelProps }, rowIndex: index, }; - }); - - return newPolicies; - }, [data?.items, isPackagePolicyUpgradable]); - - const showAddAgentHelpForPackagePolicyId = packageAndAgentPolicies.find(({ agentPolicies }) => - agentPolicies.find((agentPolicy) => agentPolicy.id === showAddAgentHelpForPolicyId) - )?.packagePolicy?.id; - // Handle the "add agent" link displayed in post-installation toast notifications in the case - // where a user is clicking the link while on the package policies listing page - useEffect(() => { - const unlisten = history.listen((location) => { - const params = new URLSearchParams(location.search); - const addAgentToPolicyId = params.get('addAgentToPolicyId'); - - if (addAgentToPolicyId) { - setFlyoutOpenForPolicyId(addAgentToPolicyId); - } - }); - - return () => unlisten(); - }, [history]); - - const handleTableOnChange = useCallback( - ({ page }: CriteriaWithPagination) => { - setPagination({ - currentPage: page.index + 1, - pageSize: page.size, - }); }, - [setPagination] + [isPackagePolicyUpgradable] ); - const canShowMultiplePoliciesCell = - canUseMultipleAgentPolicies && canReadIntegrationPolicies && canReadAgentPolicies; - const columns: Array> = useMemo( - () => [ - { - field: 'packagePolicy.name', - name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.name', { - defaultMessage: 'Integration policy', - }), - render(_, { agentPolicies, packagePolicy }) { - return ( - - ); - }, - }, - { - field: 'packagePolicy.package.version', - name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.version', { - defaultMessage: 'Version', - }), - render(_version, { agentPolicies, packagePolicy }) { - return ( - - - - - - - {agentPolicies.length > 0 && packagePolicy.hasUpgrade && ( - - - - - - )} - - ); - }, - }, - { - field: 'packagePolicy.policy_ids', - name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.agentPolicy', { - defaultMessage: 'Agent policies', - }), - truncateText: true, - render(ids, { agentPolicies, packagePolicy }) { - return agentPolicies.length > 0 ? ( - canShowMultiplePoliciesCell ? ( - - ) : ( - - ) - ) : ids.length === 0 ? ( - - - - ) : ( - - -   - - - ); - }, - }, - { - field: 'packagePolicy.updated_by', - name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.updatedBy', { - defaultMessage: 'Last updated by', - }), - truncateText: true, - render(updatedBy) { - return ; - }, - }, - { - field: 'packagePolicy.updated_at', - name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.updatedAt', { - defaultMessage: 'Last updated', - }), - truncateText: true, - render(updatedAt: InMemoryPackagePolicyAndAgentPolicy['packagePolicy']['updated_at']) { - return ( - - - - ); - }, - }, - { - field: '', - name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.agentCount', { - defaultMessage: 'Agents', - }), - render({ agentPolicies, packagePolicy, rowIndex }: InMemoryPackagePolicyAndAgentPolicy) { - if (agentPolicies.length === 0) { - return ( - - - - ); - } - return ( - { - setSelectedTableIndex(rowIndex); - setFlyoutOpenForPolicyId(agentPolicies[0].id); - }} - hasHelpPopover={showAddAgentHelpForPackagePolicyId === packagePolicy.id} - /> - ); - }, - }, - { - field: '', - name: i18n.translate('xpack.fleet.epm.packageDetails.integrationList.actions', { - defaultMessage: 'Actions', - }), - width: '8ch', - align: 'right', - render({ agentPolicies, packagePolicy }) { - const agentPolicy = agentPolicies[0]; // TODO: handle multiple agent policies - return ( - - ); - }, - }, - ], - [ - getHref, - canWriteIntegrationPolicies, - canShowMultiplePoliciesCell, - showAddAgentHelpForPackagePolicyId, - refreshPolicies, - ] - ); - - const noItemsMessage = useMemo(() => { - return isLoading ? ( - - ) : undefined; - }, [isLoading]); + // States and data for agent-based policies table + // If agentless is not supported or not an agentless integration, skip the + // conditional in the kuery + const { + pagination: agentBasedPagination, + pageSizeOptions: agentBasedPageSizeOptions, + setPagination: agentBasedSetPagination, + } = usePagination(); + const [agentBasedPackageAndAgentPolicies, setAgentBasedPackageAndAgentPolicies] = useState< + Array<{ + agentPolicies: GetAgentPoliciesResponseItem[]; + packagePolicy: InMemoryPackagePolicy; + rowIndex: number; + }> + >([]); + const { + data: agentBasedData, + isLoading: agentBasedIsLoading, + resendRequest: refreshAgentBasedPolicies, + } = usePackagePoliciesWithAgentPolicy({ + page: agentBasedPagination.currentPage, + perPage: agentBasedPagination.pageSize, + kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name: "${name}" ${ + canHaveAgentlessPolicies + ? `AND NOT ${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.supports_agentless: true` + : `` + }`, + }); + useEffect(() => { + setAgentBasedPackageAndAgentPolicies( + !agentBasedData?.items ? [] : agentBasedData.items.map(mapPoliciesData) + ); + }, [agentBasedData, mapPoliciesData]); - const tablePagination = useMemo(() => { - return { - pageIndex: pagination.currentPage - 1, - pageSize: pagination.pageSize, - totalItemCount: data?.total ?? 0, - pageSizeOptions, - }; - }, [data?.total, pageSizeOptions, pagination.currentPage, pagination.pageSize]); + // States and data for agentless policies table + // If agentless is not supported or not an agentless integration, this block and + // initial request is unnessary but reduces code complexity + const { + pagination: agentlessPagination, + pageSizeOptions: agentlessPageSizeOptions, + setPagination: agentlessSetPagination, + } = usePagination(); + const [agentlessPackageAndAgentPolicies, setAgentlessPackageAndAgentPolicies] = useState< + Array<{ + agentPolicies: GetAgentPoliciesResponseItem[]; + packagePolicy: InMemoryPackagePolicy; + rowIndex: number; + }> + >([]); + const { + data: agentlessData, + isLoading: agentlessIsLoading, + resendRequest: refreshAgentlessPolicies, + } = usePackagePoliciesWithAgentPolicy({ + page: agentlessPagination.currentPage, + perPage: agentlessPagination.pageSize, + kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name: "${name}" AND ${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.supports_agentless: true`, + }); + useEffect(() => { + setAgentlessPackageAndAgentPolicies( + !agentlessData?.items ? [] : agentlessData.items.map(mapPoliciesData) + ); + }, [agentlessData, mapPoliciesData]); // if they arrive at this page and the package is not installed, send them to overview // this happens if they arrive with a direct url or they uninstall while on this tab - // Check flyoutOpenForPolicyId otherwise right after installing a new integration the flyout won't open - if (packageInstallStatus.status !== InstallStatus.installed && !flyoutOpenForPolicyId) { + // Check `addAgentToPolicyIdFromParams` otherwise right after installing a new integration the flyout won't open + if (packageInstallStatus.status !== InstallStatus.installed && !addAgentToPolicyIdFromParams) { return ( ); } - const selectedPolicies = - selectedTableIndex !== undefined ? packageAndAgentPolicies[selectedTableIndex] : undefined; - - const agentPolicies = selectedPolicies?.agentPolicies; - const packagePolicy = selectedPolicies?.packagePolicy; - const flyoutPolicy = agentPolicies?.length === 1 ? agentPolicies[0] : undefined; - return ( - + { + refreshAgentBasedPolicies(); + refreshAgentlessPolicies(); + }, + }} + > - + {!canHaveAgentlessPolicies ? ( + + ) : ( + <> + + + +

+ +

+
+
+ + +

{agentlessData?.total ?? 0}

+
+
+
+ } + > + + + + + + + + + +

+ +

+
+
+ + +

{agentBasedData?.total ?? 0}

+
+
+ + } + > + + + + +
+ + )} - {flyoutOpenForPolicyId && agentPolicies && !isLoading && ( - { - setFlyoutOpenForPolicyId(null); - const { addAgentToPolicyId, ...rest } = parse(search); - history.replace({ search: stringify(rest) }); - }} - agentPolicy={flyoutPolicy} - selectedAgentPolicies={agentPolicies} - isIntegrationFlow={true} - installedPackagePolicy={{ - name: packagePolicy?.package?.name || '', - version: packagePolicy?.package?.version || '', - }} - /> - )}
); }; diff --git a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/confirm_incoming_data.tsx b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/confirm_incoming_data.tsx index 2a111e5d638a9..412b221e88d47 100644 --- a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/confirm_incoming_data.tsx +++ b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/confirm_incoming_data.tsx @@ -30,7 +30,7 @@ export const ConfirmIncomingData: React.FunctionComponent = ({ setAgentDataConfirmed, troubleshootLink, }) => { - const { incomingData, isLoading } = usePollingIncomingData(agentIds); + const { incomingData, isLoading } = usePollingIncomingData({ agentIds }); const isGuidedOnboardingActive = useIsGuidedOnboardingActive(installedPolicy?.name); const { guidedOnboarding } = useStartServices(); diff --git a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/use_get_agent_incoming_data.tsx b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/use_get_agent_incoming_data.tsx index 19034151d80a1..be08dbd186e5a 100644 --- a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/use_get_agent_incoming_data.tsx +++ b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/use_get_agent_incoming_data.tsx @@ -75,18 +75,26 @@ export const useGetAgentIncomingData = ( }; const POLLING_INTERVAL_MS = 5 * 1000; // 5 sec -const POLLING_TIMEOUT_MS = 5 * 60 * 1000; // 5 min +export const POLLING_TIMEOUT_MS = 5 * 60 * 1000; // 5 min /** - * Hook for polling incoming data for the selected agent policy. + * Hook for polling incoming data for the selected agent(s). * @param agentIds * @returns incomingData, isLoading */ -export const usePollingIncomingData = ( - agentIds: string[], - previewData?: boolean, - stopPollingAfterPreviewLength: number = 0 -) => { +export const usePollingIncomingData = ({ + agentIds, + pkgName, + pkgVersion, + previewData, + stopPollingAfterPreviewLength = 0, +}: { + agentIds: string[]; + pkgName?: string; + pkgVersion?: string; + previewData?: boolean; + stopPollingAfterPreviewLength?: number; +}) => { const timeout = useRef(undefined); const [result, setResult] = useState<{ incomingData: IncomingDataList[]; @@ -117,7 +125,12 @@ export const usePollingIncomingData = ( setHasReachedTimeout(true); } - const { data } = await sendGetAgentIncomingData({ agentsIds: agentIds, previewData }); + const { data } = await sendGetAgentIncomingData({ + agentsIds: agentIds, + previewData, + pkgName, + pkgVersion, + }); if (data?.items) { // filter out agents that have `data = false` and keep polling const filtered = data?.items.filter((item) => { @@ -153,7 +166,15 @@ export const usePollingIncomingData = ( return () => { isAborted = true; }; - }, [agentIds, result, previewData, stopPollingAfterPreviewLength, startedPollingAt]); + }, [ + agentIds, + result, + previewData, + stopPollingAfterPreviewLength, + startedPollingAt, + pkgName, + pkgVersion, + ]); return { ...result, diff --git a/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/index.test.tsx b/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/index.test.tsx new file mode 100644 index 0000000000000..ef3eb2b0da3cb --- /dev/null +++ b/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/index.test.tsx @@ -0,0 +1,151 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { act, waitFor } from '@testing-library/react'; + +import { sendGetAgents, useGetPackageInfoByKeyQuery } from '../../hooks'; +import { usePollingIncomingData } from '../agent_enrollment_flyout/use_get_agent_incoming_data'; +import { createIntegrationsTestRendererMock } from '../../mock'; + +import { AGENTS_PREFIX } from '../../constants'; + +import type { PackagePolicy } from '../../types'; + +import { AgentlessEnrollmentFlyout } from '.'; + +jest.mock('../../hooks', () => ({ + ...jest.requireActual('../../hooks'), + useGetPackageInfoByKeyQuery: jest.fn(), + sendGetAgents: jest.fn(), +})); + +jest.mock('../agent_enrollment_flyout/use_get_agent_incoming_data', () => ({ + usePollingIncomingData: jest.fn(), +})); + +const mockSendGetAgents = sendGetAgents as jest.Mock; +const mockUseGetPackageInfoByKeyQuery = useGetPackageInfoByKeyQuery as jest.Mock; +const mockUsePollingIncomingData = usePollingIncomingData as jest.Mock; + +describe('AgentlessEnrollmentFlyout', () => { + const onClose = jest.fn(); + const packagePolicy: PackagePolicy = { + id: 'test-package-policy-id', + name: 'test-package-policy', + namespace: 'default', + policy_ids: ['test-policy-id'], + policy_id: 'test-policy-id', + enabled: true, + output_id: '', + package: { name: 'test-package', title: 'Test Package', version: '1.0.0' }, + inputs: [{ enabled: true, policy_template: 'test-template', type: 'test-type', streams: [] }], + revision: 1, + created_at: '', + created_by: '', + updated_at: '', + updated_by: '', + }; + + beforeEach(() => { + mockSendGetAgents.mockResolvedValue({ data: { items: [] } }); + mockUseGetPackageInfoByKeyQuery.mockReturnValue({ data: { item: { title: 'Test Package' } } }); + }); + + afterEach(() => { + jest.clearAllMocks(); + }); + + it('renders the flyout with initial loading state', async () => { + const renderer = createIntegrationsTestRendererMock(); + const { getByText } = renderer.render( + + ); + await act(async () => { + expect(getByText('Confirm agentless enrollment')).toBeInTheDocument(); + expect(getByText('Step 1 is loading')).toBeInTheDocument(); + expect( + getByText('Listening for agentless connection... this could take several minutes') + ).toBeInTheDocument(); + expect(getByText('Confirm incoming data')).toBeInTheDocument(); + expect(getByText('Step 2 is disabled')).toBeInTheDocument(); + }); + }); + + it('updates step statuses when agent deployment fails', async () => { + const renderer = createIntegrationsTestRendererMock(); + const agentData = { status: 'error' }; + mockSendGetAgents.mockResolvedValueOnce({ data: { items: [agentData] } }); + + const { getByText } = renderer.render( + + ); + + await waitFor(() => { + expect(getByText('Confirm agentless enrollment')).toBeInTheDocument(); + expect(getByText('Step 1 has errors')).toBeInTheDocument(); + expect(getByText('Agentless deployment failed')).toBeInTheDocument(); + expect(getByText('Confirm incoming data')).toBeInTheDocument(); + expect(getByText('Step 2 is disabled')).toBeInTheDocument(); + }); + }); + + it('fetches agents data on mount and sets step statuses when agent deployment succeeds', async () => { + const renderer = createIntegrationsTestRendererMock(); + const agentData = { status: 'online' }; + mockSendGetAgents.mockResolvedValueOnce({ data: { items: [agentData] } }); + mockUsePollingIncomingData.mockReturnValue({ incomingData: [], hasReachedTimeout: false }); + + const { getByText } = renderer.render( + + ); + + await waitFor(() => { + expect(mockSendGetAgents).toHaveBeenCalledWith({ + kuery: `${AGENTS_PREFIX}.policy_id: "test-policy-id"`, + }); + expect(getByText('Confirm agentless enrollment')).toBeInTheDocument(); + expect(getByText('Step 1 is complete')).toBeInTheDocument(); + expect(getByText('Agentless deployment was successful')).toBeInTheDocument(); + expect(getByText('Confirm incoming data')).toBeInTheDocument(); + expect(getByText('Step 2 is loading')).toBeInTheDocument(); + }); + }); + + it('shows confirm data step as failed when timeout has been reached', async () => { + const renderer = createIntegrationsTestRendererMock(); + mockSendGetAgents.mockResolvedValueOnce({ data: { items: [{ status: 'online' }] } }); + mockUsePollingIncomingData.mockReturnValue({ incomingData: [], hasReachedTimeout: true }); + + const { getByText } = renderer.render( + + ); + + await waitFor(() => { + expect(getByText('Step 1 is complete')).toBeInTheDocument(); + expect(getByText('Confirm incoming data')).toBeInTheDocument(); + expect(getByText('Step 2 has errors')).toBeInTheDocument(); + expect(getByText('No incoming data received from agentless integration')).toBeInTheDocument(); + }); + }); + + it('shows confirm data step as successful when incoming data is received', async () => { + const renderer = createIntegrationsTestRendererMock(); + mockSendGetAgents.mockResolvedValueOnce({ data: { items: [{ status: 'online' }] } }); + mockUsePollingIncomingData.mockReturnValue({ incomingData: [{ data: 'test-data' }] }); + + const { getByText } = renderer.render( + + ); + + await waitFor(() => { + expect(getByText('Step 1 is complete')).toBeInTheDocument(); + expect(getByText('Confirm incoming data')).toBeInTheDocument(); + expect(getByText('Step 2 is complete')).toBeInTheDocument(); + expect(getByText('Incoming data received from agentless integration')).toBeInTheDocument(); + }); + }); +}); diff --git a/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/index.tsx b/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/index.tsx new file mode 100644 index 0000000000000..0fbf8d278fab8 --- /dev/null +++ b/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/index.tsx @@ -0,0 +1,212 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, useMemo, useRef, useState } from 'react'; +import type { EuiStepStatus } from '@elastic/eui'; +import { + EuiFlyout, + EuiFlyoutBody, + EuiFlyoutHeader, + EuiTitle, + EuiFlexGroup, + EuiFlexItem, + EuiButtonEmpty, + EuiFlyoutFooter, + EuiSteps, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n-react'; + +import { AGENTS_PREFIX, MAX_FLYOUT_WIDTH } from '../../constants'; +import type { Agent, AgentPolicy, PackagePolicy } from '../../types'; +import { sendGetAgents, useStartServices, useGetPackageInfoByKeyQuery } from '../../hooks'; + +import { AgentlessStepConfirmEnrollment } from './step_confirm_enrollment'; +import { AgentlessStepConfirmData } from './step_confirm_data'; + +const REFRESH_INTERVAL_MS = 30000; + +/** + * This component displays additional status details of an agentless agent enrolled + * the chosen package policy (and its agent policy). + * It also displays confirmation that the agentless agent is ingesting data from + * the chosen package policy. + */ +export const AgentlessEnrollmentFlyout = ({ + onClose, + packagePolicy, + agentPolicy, +}: { + onClose: () => void; + packagePolicy: PackagePolicy; + agentPolicy?: AgentPolicy; +}) => { + const core = useStartServices(); + const { notifications } = core; + const [confirmEnrollmentStatus, setConfirmEnrollmentStatus] = useState('loading'); + const [confirmDataStatus, setConfirmDataStatus] = useState('disabled'); + const [agentData, setAgentData] = useState(); + + // Clear agent data polling + // Called when component is unmounted or when agent is healthy + const agentDataInterval = useRef(); + const clearAgentDataPolling = useMemo(() => { + return () => { + if (agentDataInterval.current) { + clearInterval(agentDataInterval.current); + } + }; + }, [agentDataInterval]); + + // Fetch agent(s) data for the first associated agent policy + // Polls every 30 seconds until agent is found and healthy + useEffect(() => { + const fetchAgents = async () => { + const { data: agentsData, error } = await sendGetAgents({ + kuery: `${AGENTS_PREFIX}.policy_id: "${packagePolicy.policy_ids[0]}"`, + }); + + if (error) { + notifications.toasts.addError(error, { + title: i18n.translate( + 'xpack.fleet.epm.packageDetails.integrationList.agentlessStatusError', + { + defaultMessage: 'Error fetching agentless status information', + } + ), + }); + } + + if (agentsData?.items?.[0]) { + setAgentData(agentsData.items?.[0]); + } + }; + + fetchAgents(); + agentDataInterval.current = setInterval(() => { + fetchAgents(); + }, REFRESH_INTERVAL_MS); + + return () => clearAgentDataPolling(); + }, [clearAgentDataPolling, notifications.toasts, packagePolicy.policy_ids]); + + // Watches agent data and updates step statuses and clears polling when agent is healthy + useEffect(() => { + if (agentData) { + if (agentData.status === 'online') { + setConfirmEnrollmentStatus('complete'); + setConfirmDataStatus('loading'); + clearAgentDataPolling(); + } else if (agentData.status === 'error' || agentData.status === 'degraded') { + setConfirmEnrollmentStatus('danger'); + setConfirmDataStatus('disabled'); + } else { + setConfirmEnrollmentStatus('loading'); + setConfirmDataStatus('disabled'); + } + } else { + setConfirmEnrollmentStatus('loading'); + setConfirmDataStatus('disabled'); + } + }, [agentData, clearAgentDataPolling]); + + // Calculate integration title from the base package info and what + // is configured on the package policy. + const { data: packageInfoData } = useGetPackageInfoByKeyQuery( + packagePolicy.package!.name, + packagePolicy.package!.version, + { + prerelease: true, + } + ); + + const integrationTitle = useMemo(() => { + if (packageInfoData?.item) { + const enabledInputs = packagePolicy.inputs?.filter((input) => input.enabled); + + // If only one input is enabled, find the input name from the package info and + // and use that for integration title. Otherwise, use the package name. + if (enabledInputs.length === 1 && enabledInputs[0].policy_template) { + const policyTemplate = packageInfoData.item.policy_templates?.find( + (template) => template.name === enabledInputs[0].policy_template + ); + const input = + policyTemplate && 'inputs' in policyTemplate + ? policyTemplate.inputs?.find((i) => i.type === enabledInputs[0].type) + : null; + return input?.title || packageInfoData.item.title; + } else { + return packageInfoData.item.title; + } + } + return packagePolicy.name; + }, [packageInfoData, packagePolicy]); + + return ( + + + +

{packagePolicy.name}

+
+
+ + + ), + status: confirmEnrollmentStatus, + }, + { + title: i18n.translate('xpack.fleet.agentlessEnrollmentFlyout.stepConfirmDataTitle', { + defaultMessage: 'Confirm incoming data', + }), + children: + agentData && confirmEnrollmentStatus === 'complete' ? ( + + ) : ( + <> // Avoids React error about null children prop + ), + status: confirmDataStatus, + }, + ]} + /> + + + + + + + + + + +
+ ); +}; diff --git a/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/step_confirm_data.tsx b/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/step_confirm_data.tsx new file mode 100644 index 0000000000000..34e69d8ef839a --- /dev/null +++ b/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/step_confirm_data.tsx @@ -0,0 +1,99 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, useState } from 'react'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n-react'; +import type { EuiStepStatus } from '@elastic/eui'; +import { EuiText, EuiLink, EuiSpacer, EuiCallOut } from '@elastic/eui'; + +import { useStartServices } from '../../hooks'; +import type { Agent, PackagePolicy } from '../../types'; +import { + usePollingIncomingData, + POLLING_TIMEOUT_MS, +} from '../agent_enrollment_flyout/use_get_agent_incoming_data'; + +export const AgentlessStepConfirmData = ({ + agent, + packagePolicy, + setConfirmDataStatus, +}: { + agent: Agent; + packagePolicy: PackagePolicy; + setConfirmDataStatus: (status: EuiStepStatus) => void; +}) => { + const { docLinks } = useStartServices(); + const [overallState, setOverallState] = useState<'pending' | 'success' | 'failure'>('pending'); + + // Fetch integration data for the given agent and package policy + const { incomingData, hasReachedTimeout } = usePollingIncomingData({ + agentIds: [agent.id], + pkgName: packagePolicy.package!.name, + pkgVersion: packagePolicy.package!.version, + }); + + // Calculate overall UI state from polling data + useEffect(() => { + if (incomingData.length > 0) { + setConfirmDataStatus('complete'); + setOverallState('success'); + } else if (hasReachedTimeout) { + setConfirmDataStatus('danger'); + setOverallState('failure'); + } else { + setConfirmDataStatus('loading'); + setOverallState('pending'); + } + }, [incomingData, hasReachedTimeout, setConfirmDataStatus]); + + if (overallState === 'success') { + return ( + + ); + } else if (overallState === 'failure') { + return ( + <> + + + +

+ + + + ), + }} + /> +

+
+ + ); + } + + return null; +}; diff --git a/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/step_confirm_enrollment.tsx b/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/step_confirm_enrollment.tsx new file mode 100644 index 0000000000000..f8a5832e04875 --- /dev/null +++ b/x-pack/plugins/fleet/public/components/agentless_enrollment_flyout/step_confirm_enrollment.tsx @@ -0,0 +1,151 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, useState } from 'react'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { EuiButton, EuiPanel, EuiText, EuiLink, EuiSpacer, EuiCallOut } from '@elastic/eui'; + +import type { Agent, AgentPolicy } from '../../types'; +import { useStartServices } from '../../hooks'; +import { AgentDetailsIntegrations } from '../../applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integrations'; + +export const AgentlessStepConfirmEnrollment = ({ + agent, + agentPolicy, + integrationTitle, +}: { + agent?: Agent; + agentPolicy?: AgentPolicy; + integrationTitle: string; +}) => { + const { docLinks } = useStartServices(); + const [overallState, setOverallState] = useState<'pending' | 'success' | 'failure'>('pending'); + + // Calculate overall UI state from agent status + useEffect(() => { + if (agent && agent.status === 'online') { + setOverallState('success'); + } else if (agent && (agent.status === 'error' || agent.status === 'degraded')) { + setOverallState('failure'); + } else { + setOverallState('pending'); + } + }, [agent]); + + if (overallState === 'success') { + return ( + <> + + + +

+ +

+
+ + ); + } else if (overallState === 'failure') { + return ( + <> + + {agent?.last_checkin_message &&

{agent.last_checkin_message}

} +
+ + +

+ + + + ), + }} + /> +

+
+ {agent && agentPolicy && ( + <> + + + + )} + + ); + } + + return ( + <> + + + + + + + +

+ + + + ), + policyPagePath: ( + + + + ), + }} + /> +

+
+ + ); +}; diff --git a/x-pack/plugins/fleet/public/components/index.ts b/x-pack/plugins/fleet/public/components/index.ts index 5a995ab1ecbce..39dcfa3e3cd62 100644 --- a/x-pack/plugins/fleet/public/components/index.ts +++ b/x-pack/plugins/fleet/public/components/index.ts @@ -29,3 +29,4 @@ export { HeaderReleaseBadge, InlineReleaseBadge } from './release_badge'; export { WithGuidedOnboardingTour } from './with_guided_onboarding_tour'; export { UninstallCommandFlyout } from './uninstall_command_flyout'; export { MultipleAgentPoliciesSummaryLine } from './multiple_agent_policy_summary_line'; +export { AgentlessEnrollmentFlyout } from './agentless_enrollment_flyout'; diff --git a/x-pack/plugins/fleet/public/components/package_policy_actions_menu.test.tsx b/x-pack/plugins/fleet/public/components/package_policy_actions_menu.test.tsx index f016acf8783aa..b7759438986d5 100644 --- a/x-pack/plugins/fleet/public/components/package_policy_actions_menu.test.tsx +++ b/x-pack/plugins/fleet/public/components/package_policy_actions_menu.test.tsx @@ -115,13 +115,12 @@ describe.skip('PackagePolicyActionsMenu', () => { useMultipleAgentPoliciesMock.mockReturnValue({ canUseMultipleAgentPolicies: false }); }); - it('Should disable upgrade button if package does not have upgrade', async () => { + it('Should not have upgrade button if package does not have upgrade', async () => { const agentPolicies = createMockAgentPolicies(); const packagePolicy = createMockPackagePolicy({ hasUpgrade: false }); const { utils } = renderMenu({ agentPolicies, packagePolicy }); await act(async () => { - const upgradeButton = utils.getByTestId('PackagePolicyActionsUpgradeItem'); - expect(upgradeButton).toBeDisabled(); + expect(utils.queryByTestId('PackagePolicyActionsUpgradeItem')).toBeNull(); }); }); diff --git a/x-pack/plugins/fleet/public/components/package_policy_actions_menu.tsx b/x-pack/plugins/fleet/public/components/package_policy_actions_menu.tsx index e51d61ea8ab24..25ed040f05e79 100644 --- a/x-pack/plugins/fleet/public/components/package_policy_actions_menu.tsx +++ b/x-pack/plugins/fleet/public/components/package_policy_actions_menu.tsx @@ -108,24 +108,27 @@ export const PackagePolicyActionsMenu: React.FunctionComponent<{ defaultMessage="Edit integration" /> , - - - , + ...(packagePolicy.hasUpgrade + ? [ + + + , + ] + : []), // FIXME: implement Copy package policy action // {}} key="packagePolicyCopy"> // = async (context, request, response) => { const coreContext = await context.core; const esClient = coreContext.elasticsearch.client.asCurrentUser; - - const returnDataPreview = request.query.previewData; - const agentIds = isStringArray(request.query.agentsIds) + const agentsIds = isStringArray(request.query.agentsIds) ? request.query.agentsIds : [request.query.agentsIds]; + const { pkgName, pkgVersion, previewData: returnDataPreview } = request.query; + + // If a package is specified, get data stream patterns for that package + // and scope incoming data query to that pattern + let dataStreamPattern: string | undefined; + if (pkgName && pkgVersion) { + const packageInfo = await getPackageInfo({ + savedObjectsClient: coreContext.savedObjects.client, + prerelease: true, + pkgName, + pkgVersion, + }); + dataStreamPattern = (packageInfo.data_streams || []) + .map((ds) => generateTemplateIndexPattern(ds)) + .join(','); + } - const { items, dataPreview } = await AgentService.getIncomingDataByAgentsId( + const { items, dataPreview } = await AgentService.getIncomingDataByAgentsId({ esClient, - agentIds, - returnDataPreview - ); + agentsIds, + dataStreamPattern, + returnDataPreview, + }); const body = { items, dataPreview }; diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index 5173ada3f5418..0f196686a4719 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -614,6 +614,7 @@ export const getSavedObjectTypes = ( }, secret_references: { properties: { id: { type: 'keyword' } } }, overrides: { type: 'flattened', index: false }, + supports_agentless: { type: 'boolean' }, revision: { type: 'integer' }, updated_at: { type: 'date' }, updated_by: { type: 'keyword' }, @@ -774,6 +775,16 @@ export const getSavedObjectTypes = ( }, ], }, + '16': { + changes: [ + { + type: 'mappings_addition', + addedMappings: { + supports_agentless: { type: 'boolean' }, + }, + }, + ], + }, }, migrations: { '7.10.0': migratePackagePolicyToV7100, @@ -829,6 +840,7 @@ export const getSavedObjectTypes = ( }, secret_references: { properties: { id: { type: 'keyword' } } }, overrides: { type: 'flattened', index: false }, + supports_agentless: { type: 'boolean' }, revision: { type: 'integer' }, updated_at: { type: 'date' }, updated_by: { type: 'keyword' }, @@ -848,6 +860,16 @@ export const getSavedObjectTypes = ( }, ], }, + '2': { + changes: [ + { + type: 'mappings_addition', + addedMappings: { + supports_agentless: { type: 'boolean' }, + }, + }, + ], + }, }, }, [PACKAGES_SAVED_OBJECT_TYPE]: { diff --git a/x-pack/plugins/fleet/server/services/agents/status.ts b/x-pack/plugins/fleet/server/services/agents/status.ts index c413ee7e268c8..e960a7b955fea 100644 --- a/x-pack/plugins/fleet/server/services/agents/status.ts +++ b/x-pack/plugins/fleet/server/services/agents/status.ts @@ -177,11 +177,17 @@ export async function getAgentStatusForAgentPolicy( }; } -export async function getIncomingDataByAgentsId( - esClient: ElasticsearchClient, - agentsIds: string[], - returnDataPreview: boolean = false -) { +export async function getIncomingDataByAgentsId({ + esClient, + agentsIds, + dataStreamPattern = DATA_STREAM_INDEX_PATTERN, + returnDataPreview = false, +}: { + esClient: ElasticsearchClient; + agentsIds: string[]; + dataStreamPattern?: string; + returnDataPreview?: boolean; +}) { const logger = appContextService.getLogger(); try { @@ -189,7 +195,7 @@ export async function getIncomingDataByAgentsId( body: { index: [ { - names: [DATA_STREAM_INDEX_PATTERN], + names: [dataStreamPattern], privileges: ['read'], }, ], @@ -203,7 +209,7 @@ export async function getIncomingDataByAgentsId( const searchResult = await retryTransientEsErrors( () => esClient.search({ - index: DATA_STREAM_INDEX_PATTERN, + index: dataStreamPattern, allow_partial_search_results: true, _source: returnDataPreview, timeout: '5s', @@ -244,9 +250,9 @@ export async function getIncomingDataByAgentsId( if (!searchResult.aggregations?.agent_ids) { return { items: agentsIds.map((id) => { - return { items: { [id]: { data: false } } }; + return { [id]: { data: false } }; }), - data: [], + dataPreview: [], }; } diff --git a/x-pack/plugins/fleet/server/services/package_policy.ts b/x-pack/plugins/fleet/server/services/package_policy.ts index 31747952173ce..eac31bb980256 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.ts @@ -1929,6 +1929,7 @@ class PackagePolicyClientImpl implements PackagePolicyClient { output_id: newPolicy.output_id, inputs: newPolicy.inputs[0]?.streams ? newPolicy.inputs : inputs, vars: newPolicy.vars || newPP.vars, + supports_agentless: newPolicy.supports_agentless, }; } } diff --git a/x-pack/plugins/fleet/server/types/models/package_policy.ts b/x-pack/plugins/fleet/server/types/models/package_policy.ts index c5f3e94868cf7..bbbb94b28cd4c 100644 --- a/x-pack/plugins/fleet/server/types/models/package_policy.ts +++ b/x-pack/plugins/fleet/server/types/models/package_policy.ts @@ -172,6 +172,16 @@ export const PackagePolicyBaseSchema = { ), ]) ), + supports_agentless: schema.maybe( + schema.nullable( + schema.boolean({ + defaultValue: false, + meta: { + description: 'Indicates whether the package policy belongs to an agentless agent policy.', + }, + }) + ) + ), }; export const NewPackagePolicySchema = schema.object({ @@ -286,6 +296,16 @@ export const SimplifiedPackagePolicyBaseSchema = schema.object({ output_id: schema.maybe(schema.oneOf([schema.literal(null), schema.string()])), vars: schema.maybe(SimplifiedVarsSchema), inputs: SimplifiedPackagePolicyInputsSchema, + supports_agentless: schema.maybe( + schema.nullable( + schema.boolean({ + defaultValue: false, + meta: { + description: 'Indicates whether the package policy belongs to an agentless agent policy.', + }, + }) + ) + ), }); export const SimplifiedPackagePolicyPreconfiguredSchema = SimplifiedPackagePolicyBaseSchema.extends( diff --git a/x-pack/plugins/fleet/server/types/rest_spec/agent.ts b/x-pack/plugins/fleet/server/types/rest_spec/agent.ts index f9db02b92a659..a5fb3e9e034ed 100644 --- a/x-pack/plugins/fleet/server/types/rest_spec/agent.ts +++ b/x-pack/plugins/fleet/server/types/rest_spec/agent.ts @@ -527,6 +527,8 @@ export const GetAgentStatusResponseSchema = schema.object({ export const GetAgentDataRequestSchema = { query: schema.object({ agentsIds: schema.oneOf([schema.arrayOf(schema.string()), schema.string()]), + pkgName: schema.maybe(schema.string()), + pkgVersion: schema.maybe(schema.string()), previewData: schema.boolean({ defaultValue: false }), }), }; diff --git a/x-pack/test/cloud_security_posture_functional/agentless/create_agent.ts b/x-pack/test/cloud_security_posture_functional/agentless/create_agent.ts index 2065d1307fbda..8f48bbb7d1bf4 100644 --- a/x-pack/test/cloud_security_posture_functional/agentless/create_agent.ts +++ b/x-pack/test/cloud_security_posture_functional/agentless/create_agent.ts @@ -65,12 +65,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await cisIntegration.navigateToIntegrationCspList(); await pageObjects.header.waitUntilLoadingHasFinished(); - expect(await cisIntegration.getFirstCspmIntegrationPageIntegration()).to.be( + expect(await cisIntegration.getFirstCspmIntegrationPageAgentlessIntegration()).to.be( integrationPolicyName ); - expect(await cisIntegration.getFirstCspmIntegrationPageAgent()).to.be( - `Agentless policy for ${integrationPolicyName}` - ); + expect(await cisIntegration.getFirstCspmIntegrationPageAgentlessStatus()).to.be('Pending'); }); it(`should show setup technology selector in edit mode`, async () => { @@ -97,7 +95,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await cisIntegration.navigateToIntegrationCspList(); await pageObjects.header.waitUntilLoadingHasFinished(); - await cisIntegration.navigateToEditIntegrationPage(); + await cisIntegration.navigateToEditAgentlessIntegrationPage(); await pageObjects.header.waitUntilLoadingHasFinished(); expect(await cisIntegration.showSetupTechnologyComponent()).to.be(true); diff --git a/x-pack/test/cloud_security_posture_functional/page_objects/add_cis_integration_form_page.ts b/x-pack/test/cloud_security_posture_functional/page_objects/add_cis_integration_form_page.ts index 563507d705583..fe95c0887711d 100644 --- a/x-pack/test/cloud_security_posture_functional/page_objects/add_cis_integration_form_page.ts +++ b/x-pack/test/cloud_security_posture_functional/page_objects/add_cis_integration_form_page.ts @@ -218,6 +218,10 @@ export function AddCisIntegrationFormPageProvider({ await testSubjects.click('integrationNameLink'); }; + const navigateToEditAgentlessIntegrationPage = async () => { + await testSubjects.click('agentlessIntegrationNameLink'); + }; + const navigateToAddIntegrationKspmPage = async (space?: string) => { const options = space ? { @@ -485,7 +489,7 @@ export function AddCisIntegrationFormPageProvider({ await navigateToIntegrationCspList(); await PageObjects.header.waitUntilLoadingHasFinished(); - await navigateToEditIntegrationPage(); + await navigateToEditAgentlessIntegrationPage(); await PageObjects.header.waitUntilLoadingHasFinished(); // Fill out form to edit an agentless integration @@ -498,7 +502,7 @@ export function AddCisIntegrationFormPageProvider({ // Check if the Direct Access Key is updated package policy api with successful toast expect(await testSubjects.exists('policyUpdateSuccessToast')).to.be(true); - await navigateToEditIntegrationPage(); + await navigateToEditAgentlessIntegrationPage(); await PageObjects.header.waitUntilLoadingHasFinished(); }; @@ -511,12 +515,23 @@ export function AddCisIntegrationFormPageProvider({ return await integration.getVisibleText(); }; + const getFirstCspmIntegrationPageAgentlessIntegration = async () => { + const integration = await testSubjects.find('agentlessIntegrationNameLink'); + return await integration.getVisibleText(); + }; + const getFirstCspmIntegrationPageAgent = async () => { const agent = await testSubjects.find('agentPolicyNameLink'); // this is assuming that the agent was just created therefor should be the first element return await agent.getVisibleText(); }; + const getFirstCspmIntegrationPageAgentlessStatus = async () => { + const agent = await testSubjects.find('agentlessStatusBadge'); + // this is assuming that the agent was just created therefor should be the first element + return await agent.getVisibleText(); + }; + const getAgentBasedPolicyValue = async () => { const agentName = await testSubjects.find('createAgentPolicyNameField'); return await agentName.getAttribute('value'); @@ -568,10 +583,13 @@ export function AddCisIntegrationFormPageProvider({ testSubjectIds, inputIntegrationName, getFirstCspmIntegrationPageIntegration, + getFirstCspmIntegrationPageAgentlessIntegration, getFirstCspmIntegrationPageAgent, + getFirstCspmIntegrationPageAgentlessStatus, getAgentBasedPolicyValue, showSuccessfulToast, showSetupTechnologyComponent, navigateToEditIntegrationPage, + navigateToEditAgentlessIntegrationPage, }; } diff --git a/x-pack/test/fleet_api_integration/apis/agents/status.ts b/x-pack/test/fleet_api_integration/apis/agents/status.ts index 42b60a0624a96..4b56601078da2 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/status.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/status.ts @@ -334,5 +334,31 @@ export default function ({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xxxx') .expect(400); }); + + it('should return incoming data status for specified agents', async () => { + // force install the system package to override package verification + await supertest + .post(`/api/fleet/epm/packages/system/1.50.0`) + .set('kbn-xsrf', 'xxxx') + .send({ force: true }) + .expect(200); + + const { body: apiResponse1 } = await supertest + .get(`/api/fleet/agent_status/data?agentsIds=agent1&agentsIds=agent2`) + .expect(200); + const { body: apiResponse2 } = await supertest + .get( + `/api/fleet/agent_status/data?agentsIds=agent1&agentsIds=agent2&pkgName=system&pkgVersion=1.50.0` + ) + .expect(200); + expect(apiResponse1).to.eql({ + items: [{ agent1: { data: false } }, { agent2: { data: false } }], + dataPreview: [], + }); + expect(apiResponse2).to.eql({ + items: [{ agent1: { data: false } }, { agent2: { data: false } }], + dataPreview: [], + }); + }); }); } diff --git a/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts b/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts index 7611061398f18..017ef1b2fa82a 100644 --- a/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts +++ b/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts @@ -78,12 +78,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await cisIntegration.navigateToIntegrationCspList(); await pageObjects.header.waitUntilLoadingHasFinished(); - expect(await cisIntegration.getFirstCspmIntegrationPageIntegration()).to.be( + expect(await cisIntegration.getFirstCspmIntegrationPageAgentlessIntegration()).to.be( integrationPolicyName ); - expect(await cisIntegration.getFirstCspmIntegrationPageAgent()).to.be( - `Agentless policy for ${integrationPolicyName}` - ); + expect(await cisIntegration.getFirstCspmIntegrationPageAgentlessStatus()).to.be('Pending'); }); it(`should create default agent-based agent`, async () => { From aead7b9acd5de0e5668c5f860eda473071a5a42d Mon Sep 17 00:00:00 2001 From: Carlos Crespo Date: Tue, 26 Nov 2024 09:29:23 +0100 Subject: [PATCH 62/71] [Inventory] Inventory k8s entities fixes (#201260) closes [#201226](https://github.com/elastic/kibana/issues/201226) ## Summary This PR makes the final adjustments on k8s entities after the https://github.com/elastic/kibana/pull/196916 was merged. I had to fix most of the ECS entities because they had their `entityId` defined with `uid` field. Most of the ECS K8s entities don't have this field and should use the `name` field instead (see [metricsets](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-kubernetes.html#_metricsets_41)) ~I also had to fix the transforms to include an aggregation for the `displayNameTemplate` field, when it doesn't match with the `entity.Id`~ ### Real data Otel The screenshots below are from a tests running the `opentemeletry-demo` sending otel data image image ### Real data ECS The screenshots below are from a tests running the `opentemeletry-demo` with elastic agent installed with Kubernetes integration image image ### Additional test with synthtrace image ### Fix ECS k8s service entity was missing the link to its corresponding dashboard image image ### How to test - Start local kibana and es instances - run ` node scripts/synthtrace k8s_entities.ts --clean --live` - Navigate to Inventory and enable EEM --------- Co-authored-by: Elastic Machine --- .../src/lib/entities/index.ts | 8 ++-- .../lib/entities/kubernetes/cluster_entity.ts | 2 + .../entities/kubernetes/container_entity.ts | 2 + .../entities/kubernetes/cron_job_entity.ts | 7 ++-- .../entities/kubernetes/daemon_set_entity.ts | 6 ++- .../entities/kubernetes/deployment_entity.ts | 3 +- .../src/lib/entities/kubernetes/index.ts | 42 +++++++++++-------- .../{job_set_entity.ts => job_entity.ts} | 5 ++- .../lib/entities/kubernetes/node_entity.ts | 3 +- .../src/lib/entities/kubernetes/pod_entity.ts | 2 + .../lib/entities/kubernetes/replica_set.ts | 7 ++-- .../src/lib/entities/kubernetes/service.ts | 39 +++++++++++++++++ .../lib/entities/kubernetes/stateful_set.ts | 7 ++-- .../entities/entities_synthtrace_es_client.ts | 10 ++--- .../src/scenarios/k8s_entities.ts | 23 ++++++++-- .../src/scenarios/many_entities.ts | 4 +- .../built_in/kubernetes/ecs/cron_job.ts | 4 +- .../built_in/kubernetes/ecs/daemon_set.ts | 2 +- .../built_in/kubernetes/ecs/deployment.ts | 4 +- .../entities/built_in/kubernetes/ecs/job.ts | 4 +- .../entities/built_in/kubernetes/ecs/node.ts | 4 +- .../entities/built_in/kubernetes/ecs/pod.ts | 11 ++++- .../built_in/kubernetes/ecs/replica_set.ts | 3 +- .../built_in/kubernetes/ecs/stateful_set.ts | 4 +- .../built_in/kubernetes/semconv/cluster.ts | 9 +++- .../built_in/kubernetes/semconv/cron_job.ts | 9 +++- .../built_in/kubernetes/semconv/daemon_set.ts | 9 +++- .../built_in/kubernetes/semconv/deployment.ts | 9 +++- .../built_in/kubernetes/semconv/job.ts | 9 +++- .../built_in/kubernetes/semconv/node.ts | 11 ++++- .../built_in/kubernetes/semconv/pod.ts | 9 +++- .../kubernetes/semconv/replica_set.ts | 13 ++++-- .../kubernetes/semconv/stateful_set.ts | 9 +++- .../asset_details/hooks/use_entity_summary.ts | 10 ++++- .../tabs/processes/processes.tsx | 4 +- .../infra/server/routes/entities/index.ts | 6 +-- .../public/components/entity_icon/index.tsx | 2 +- .../hooks/use_detail_view_redirect.test.ts | 35 +++++++++++----- .../public/hooks/use_detail_view_redirect.ts | 24 ++++++----- .../common/entity/entity_types.ts | 11 ++--- .../common/entity/index.ts | 2 +- .../observability_shared/common/index.ts | 2 +- 42 files changed, 282 insertions(+), 107 deletions(-) rename packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/{job_set_entity.ts => job_entity.ts} (91%) create mode 100644 packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/service.ts diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/index.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/index.ts index 8665ef0120e25..4b316ebb822e5 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/index.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/index.ts @@ -15,15 +15,16 @@ import { k8sClusterJobEntity } from './kubernetes/cluster_entity'; import { k8sCronJobEntity } from './kubernetes/cron_job_entity'; import { k8sDaemonSetEntity } from './kubernetes/daemon_set_entity'; import { k8sDeploymentEntity } from './kubernetes/deployment_entity'; -import { k8sJobSetEntity } from './kubernetes/job_set_entity'; +import { k8sJobEntity } from './kubernetes/job_entity'; import { k8sNodeEntity } from './kubernetes/node_entity'; import { k8sPodEntity } from './kubernetes/pod_entity'; import { k8sReplicaSetEntity } from './kubernetes/replica_set'; import { k8sStatefulSetEntity } from './kubernetes/stateful_set'; +import { k8sServiceEntity } from './kubernetes/service'; import { k8sContainerEntity } from './kubernetes/container_entity'; export type EntityDataStreamType = 'metrics' | 'logs' | 'traces'; -export type Schema = 'ecs' | 'semconv'; +export type Schema = 'ecs' | 'otel'; export type EntityFields = Fields & Partial<{ @@ -52,11 +53,12 @@ export const entities = { k8sCronJobEntity, k8sDaemonSetEntity, k8sDeploymentEntity, - k8sJobSetEntity, + k8sJobEntity, k8sNodeEntity, k8sPodEntity, k8sReplicaSetEntity, k8sStatefulSetEntity, + k8sServiceEntity, k8sContainerEntity, }, }; diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/cluster_entity.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/cluster_entity.ts index 9fa4c81d86ffb..487ddc89a8c6f 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/cluster_entity.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/cluster_entity.ts @@ -23,6 +23,7 @@ export function k8sClusterJobEntity({ }) { if (schema === 'ecs') { return new K8sEntity(schema, { + 'entity.definition_id': 'cluster', 'entity.type': 'cluster', 'orchestrator.cluster.name': name, 'entity.id': entityId, @@ -31,6 +32,7 @@ export function k8sClusterJobEntity({ } return new K8sEntity(schema, { + 'entity.definition_id': 'cluster', 'entity.type': 'cluster', 'k8s.cluster.uid': name, 'entity.id': entityId, diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/container_entity.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/container_entity.ts index b05d412b0dd5c..116563e731f0c 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/container_entity.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/container_entity.ts @@ -23,6 +23,7 @@ export function k8sContainerEntity({ }) { if (schema === 'ecs') { return new K8sEntity(schema, { + 'entity.definition_id': 'container', 'entity.type': 'container', 'kubernetes.container.id': id, 'entity.id': entityId, @@ -31,6 +32,7 @@ export function k8sContainerEntity({ } return new K8sEntity(schema, { + 'entity.definition_id': 'container', 'entity.type': 'container', 'container.id': id, 'entity.id': entityId, diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/cron_job_entity.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/cron_job_entity.ts index 8590378e699fb..86e17b5d4cfc5 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/cron_job_entity.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/cron_job_entity.ts @@ -27,9 +27,9 @@ export function k8sCronJobEntity({ }) { if (schema === 'ecs') { return new K8sEntity(schema, { - 'entity.type': 'cron_job', + 'entity.definition_id': 'cron_job', + 'entity.type': 'cronjob', 'kubernetes.cronjob.name': name, - 'kubernetes.cronjob.uid': uid, 'kubernetes.namespace': clusterName, 'entity.id': entityId, ...others, @@ -37,7 +37,8 @@ export function k8sCronJobEntity({ } return new K8sEntity(schema, { - 'entity.type': 'cron_job', + 'entity.definition_id': 'cron_job', + 'entity.type': 'cronjob', 'k8s.cronjob.name': name, 'k8s.cronjob.uid': uid, 'k8s.cluster.name': clusterName, diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/daemon_set_entity.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/daemon_set_entity.ts index 7e20b1c6d506f..59fe25dedf5a5 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/daemon_set_entity.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/daemon_set_entity.ts @@ -27,7 +27,8 @@ export function k8sDaemonSetEntity({ }) { if (schema === 'ecs') { return new K8sEntity(schema, { - 'entity.type': 'daemon_set', + 'entity.definition_id': 'daemon_set', + 'entity.type': 'daemonset', 'kubernetes.daemonset.name': name, 'kubernetes.daemonset.uid': uid, 'kubernetes.namespace': clusterName, @@ -37,7 +38,8 @@ export function k8sDaemonSetEntity({ } return new K8sEntity(schema, { - 'entity.type': 'daemon_set', + 'entity.definition_id': 'daemon_set', + 'entity.type': 'daemonset', 'k8s.daemonset.name': name, 'k8s.daemonset.uid': uid, 'k8s.cluster.name': clusterName, diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/deployment_entity.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/deployment_entity.ts index 7eabdd0827325..bc266d554f6df 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/deployment_entity.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/deployment_entity.ts @@ -27,9 +27,9 @@ export function k8sDeploymentEntity({ }) { if (schema === 'ecs') { return new K8sEntity(schema, { + 'entity.definition_id': 'deployment', 'entity.type': 'deployment', 'kubernetes.deployment.name': name, - 'kubernetes.deployment.uid': uid, 'kubernetes.namespace': clusterName, 'entity.id': entityId, ...others, @@ -37,6 +37,7 @@ export function k8sDeploymentEntity({ } return new K8sEntity(schema, { + 'entity.definition_id': 'deployment', 'entity.type': 'deployment', 'k8s.deployment.name': name, 'k8s.deployment.uid': uid, diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/index.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/index.ts index 6da1decaab9ab..ba6cb1f892f47 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/index.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/index.ts @@ -12,27 +12,28 @@ import { Serializable } from '../../serializable'; const identityFieldsMap: Record> = { ecs: { - pod: ['kubernetes.pod.name'], + pod: ['kubernetes.pod.uid'], cluster: ['orchestrator.cluster.name'], - cron_job: ['kubernetes.cronjob.name'], - daemon_set: ['kubernetes.daemonset.name'], + cronjob: ['kubernetes.cronjob.name'], + daemonset: ['kubernetes.daemonset.name'], deployment: ['kubernetes.deployment.name'], job: ['kubernetes.job.name'], node: ['kubernetes.node.name'], - replica_set: ['kubernetes.replicaset.name'], - stateful_set: ['kubernetes.statefulset.name'], + replicaset: ['kubernetes.replicaset.name'], + statefulset: ['kubernetes.statefulset.name'], + service: ['kubernetes.service.name'], container: ['kubernetes.container.id'], }, - semconv: { - pod: ['k8s.pod.name'], + otel: { + pod: ['k8s.pod.uid'], cluster: ['k8s.cluster.uid'], - cron_job: ['k8s.cronjob.name'], - daemon_set: ['k8s.daemonset.name'], - deployment: ['k8s.deployment.name'], - job: ['k8s.job.name'], + cronjob: ['k8s.cronjob.uid'], + daemonset: ['k8s.daemonset.uid'], + deployment: ['k8s.deployment.uid'], + job: ['k8s.job.uid'], node: ['k8s.node.uid'], - replica_set: ['k8s.replicaset.name'], - stateful_set: ['k8s.statefulset.name'], + replicaset: ['k8s.replicaset.uid'], + statefulset: ['k8s.statefulset.uid'], container: ['container.id'], }, }; @@ -41,10 +42,17 @@ export class K8sEntity extends Serializable { constructor(schema: Schema, fields: EntityFields) { const entityType = fields['entity.type']; if (entityType === undefined) { - throw new Error(`Entity type not defined: ${entityType}`); + throw new Error(`Entity type not defined`); } - const entityTypeWithSchema = `kubernetes_${entityType}_${schema}`; + const entityDefinitionId = fields['entity.definition_id']; + if (entityDefinitionId === undefined) { + throw new Error(`Entity definition id not defined`); + } + + const entityDefinitionWithSchema = `kubernetes_${entityDefinitionId}_${ + schema === 'ecs' ? schema : 'semconv' + }`; const identityFields = identityFieldsMap[schema][entityType]; if (identityFields === undefined || identityFields.length === 0) { throw new Error( @@ -54,8 +62,8 @@ export class K8sEntity extends Serializable { super({ ...fields, - 'entity.type': entityTypeWithSchema, - 'entity.definition_id': `builtin_${entityTypeWithSchema}`, + 'entity.type': `k8s.${entityType}.${schema}`, + 'entity.definition_id': `builtin_${entityDefinitionWithSchema}`, 'entity.identity_fields': identityFields, 'entity.display_name': getDisplayName({ identityFields, fields }), 'entity.definition_version': '1.0.0', diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/job_set_entity.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/job_entity.ts similarity index 91% rename from packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/job_set_entity.ts rename to packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/job_entity.ts index e0383563c7266..007f74d8a5bba 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/job_set_entity.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/job_entity.ts @@ -10,7 +10,7 @@ import { Schema } from '..'; import { K8sEntity } from '.'; -export function k8sJobSetEntity({ +export function k8sJobEntity({ schema, name, uid, @@ -27,9 +27,9 @@ export function k8sJobSetEntity({ }) { if (schema === 'ecs') { return new K8sEntity(schema, { + 'entity.definition_id': 'job', 'entity.type': 'job', 'kubernetes.job.name': name, - 'kubernetes.job.uid': uid, 'kubernetes.namespace': clusterName, 'entity.id': entityId, ...others, @@ -37,6 +37,7 @@ export function k8sJobSetEntity({ } return new K8sEntity(schema, { + 'entity.definition_id': 'job', 'entity.type': 'job', 'k8s.job.name': name, 'k8s.job.uid': uid, diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/node_entity.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/node_entity.ts index 283df5250d41d..4ab3441d7b82b 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/node_entity.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/node_entity.ts @@ -27,9 +27,9 @@ export function k8sNodeEntity({ }) { if (schema === 'ecs') { return new K8sEntity(schema, { + 'entity.definition_id': 'node', 'entity.type': 'node', 'kubernetes.node.name': name, - 'kubernetes.node.uid': uid, 'kubernetes.namespace': clusterName, 'entity.id': entityId, ...others, @@ -37,6 +37,7 @@ export function k8sNodeEntity({ } return new K8sEntity(schema, { + 'entity.definition_id': 'node', 'entity.type': 'node', 'k8s.node.uid': uid, 'k8s.cluster.name': clusterName, diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/pod_entity.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/pod_entity.ts index 1b71c4e39a4fc..47c24b01144f1 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/pod_entity.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/pod_entity.ts @@ -27,6 +27,7 @@ export function k8sPodEntity({ }) { if (schema === 'ecs') { return new K8sEntity(schema, { + 'entity.definition_id': 'pod', 'entity.type': 'pod', 'kubernetes.pod.name': name, 'kubernetes.pod.uid': uid, @@ -37,6 +38,7 @@ export function k8sPodEntity({ } return new K8sEntity(schema, { + 'entity.definition_id': 'pod', 'entity.type': 'pod', 'k8s.pod.name': name, 'k8s.pod.uid': uid, diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/replica_set.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/replica_set.ts index fcf20c0530c30..b98397d2bee9b 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/replica_set.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/replica_set.ts @@ -27,9 +27,9 @@ export function k8sReplicaSetEntity({ }) { if (schema === 'ecs') { return new K8sEntity(schema, { - 'entity.type': 'replica_set', + 'entity.definition_id': 'replica_set', + 'entity.type': 'replicaset', 'kubernetes.replicaset.name': name, - 'kubernetes.replicaset.uid': uid, 'kubernetes.namespace': clusterName, 'entity.id': entityId, ...others, @@ -37,7 +37,8 @@ export function k8sReplicaSetEntity({ } return new K8sEntity(schema, { - 'entity.type': 'replica_set', + 'entity.definition_id': 'replica_set', + 'entity.type': 'replicaset', 'k8s.replicaset.name': name, 'k8s.replicaset.uid': uid, 'k8s.cluster.name': clusterName, diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/service.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/service.ts new file mode 100644 index 0000000000000..4793048aeee02 --- /dev/null +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/service.ts @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { Schema } from '..'; +import { K8sEntity } from '.'; + +export function k8sServiceEntity({ + schema, + name, + uid, + clusterName, + entityId, + ...others +}: { + schema: Schema; + name: string; + uid?: string; + clusterName?: string; + entityId: string; + [key: string]: any; +}) { + if (schema !== 'ecs') { + throw new Error('Schema not supported for service entity: ' + schema); + } + return new K8sEntity(schema, { + 'entity.definition_id': 'service', + 'entity.type': 'service', + 'kubernetes.service.name': name, + 'kubernetes.namespace': clusterName, + 'entity.id': entityId, + ...others, + }); +} diff --git a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/stateful_set.ts b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/stateful_set.ts index 58c603704ebc0..1857471c15635 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/stateful_set.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/stateful_set.ts @@ -27,9 +27,9 @@ export function k8sStatefulSetEntity({ }) { if (schema === 'ecs') { return new K8sEntity(schema, { - 'entity.type': 'stateful_set', + 'entity.definition_id': 'stateful_set', + 'entity.type': 'statefulset', 'kubernetes.statefulset.name': name, - 'kubernetes.statefulset.uid': uid, 'kubernetes.namespace': clusterName, 'entity.id': entityId, ...others, @@ -37,7 +37,8 @@ export function k8sStatefulSetEntity({ } return new K8sEntity(schema, { - 'entity.type': 'stateful_set', + 'entity.definition_id': 'stateful_set', + 'entity.type': 'statefulset', 'k8s.statefulset.name': name, 'k8s.statefulset.uid': uid, 'k8s.cluster.name': clusterName, diff --git a/packages/kbn-apm-synthtrace/src/lib/entities/entities_synthtrace_es_client.ts b/packages/kbn-apm-synthtrace/src/lib/entities/entities_synthtrace_es_client.ts index 4c5d17111fca6..624b44eab0887 100644 --- a/packages/kbn-apm-synthtrace/src/lib/entities/entities_synthtrace_es_client.ts +++ b/packages/kbn-apm-synthtrace/src/lib/entities/entities_synthtrace_es_client.ts @@ -75,15 +75,13 @@ function getRoutingTransform() { return new Transform({ objectMode: true, transform(document: ESDocumentWithOperation, encoding, callback) { - const entityType: string | undefined = document['entity.type']; - if (entityType === undefined) { - throw new Error(`entity.type was not defined: ${JSON.stringify(document)}`); + const definitionId: string | undefined = document['entity.definition_id']; + if (definitionId === undefined) { + throw new Error(`entity.definition_id was not defined: ${JSON.stringify(document)}`); } - const entityIndexName = `${entityType}s`; document._action = { index: { - _index: - `.entities.v1.latest.builtin_${entityIndexName}_from_ecs_data`.toLocaleLowerCase(), + _index: `.entities.v1.latest.${definitionId}`.toLocaleLowerCase(), _id: document['entity.id'], }, }; diff --git a/packages/kbn-apm-synthtrace/src/scenarios/k8s_entities.ts b/packages/kbn-apm-synthtrace/src/scenarios/k8s_entities.ts index 7d94cc3180a7e..8300d20589827 100644 --- a/packages/kbn-apm-synthtrace/src/scenarios/k8s_entities.ts +++ b/packages/kbn-apm-synthtrace/src/scenarios/k8s_entities.ts @@ -31,6 +31,7 @@ const CRON_JOB_ENTITY_ID = generateShortId(); const CRON_JOB_UID = generateShortId(); const NODE_ENTITY_ID = generateShortId(); const NODE_UID = generateShortId(); +const SERVICE_UID = generateShortId(); const scenario: Scenario> = async (runOptions) => { const { logger } = runOptions; @@ -45,7 +46,7 @@ const scenario: Scenario> = async (runOptions) => { .interval('1m') .rate(1) .generator((timestamp) => { - return [ + const commonEntities = [ entities.k8s .k8sClusterJobEntity({ schema, @@ -99,7 +100,7 @@ const scenario: Scenario> = async (runOptions) => { }) .timestamp(timestamp), entities.k8s - .k8sJobSetEntity({ + .k8sJobEntity({ clusterName: CLUSTER_NAME, name: 'job_set_foo', schema, @@ -133,10 +134,26 @@ const scenario: Scenario> = async (runOptions) => { }) .timestamp(timestamp), ]; + + if (schema === 'ecs') { + return [ + ...commonEntities, + entities.k8s + .k8sServiceEntity({ + schema, + clusterName: CLUSTER_NAME, + name: 'my_service', + entityId: SERVICE_UID, + }) + .timestamp(timestamp), + ]; + } + + return commonEntities; }); const ecsEntities = getK8sEntitiesEvents('ecs'); - const otelEntities = getK8sEntitiesEvents('semconv'); + const otelEntities = getK8sEntitiesEvents('otel'); return [ withClient( diff --git a/packages/kbn-apm-synthtrace/src/scenarios/many_entities.ts b/packages/kbn-apm-synthtrace/src/scenarios/many_entities.ts index 8b0d2afa5a971..4aa59d3ee8409 100644 --- a/packages/kbn-apm-synthtrace/src/scenarios/many_entities.ts +++ b/packages/kbn-apm-synthtrace/src/scenarios/many_entities.ts @@ -100,7 +100,7 @@ const scenario: Scenario> = async (runOptions) => { }) .timestamp(timestamp), entities.k8s - .k8sJobSetEntity({ + .k8sJobEntity({ clusterName: CLUSTER_NAME, name: 'job_set_foo', schema, @@ -137,7 +137,7 @@ const scenario: Scenario> = async (runOptions) => { }); const ecsEntities = getK8sEntitiesEvents('ecs'); - const otelEntities = getK8sEntitiesEvents('semconv'); + const otelEntities = getK8sEntitiesEvents('otel'); const synthJavaTraces = entities.serviceEntity({ serviceName: 'synth_java', agentName: ['java'], diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/cron_job.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/cron_job.ts index 7849dcdc73f5b..06bc9dba9fce7 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/cron_job.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/cron_job.ts @@ -13,7 +13,7 @@ import { commonEcsMetadata } from '../common/ecs_metadata'; export const builtInKubernetesCronJobEcsEntityDefinition: EntityDefinition = entityDefinitionSchema.parse({ id: `${BUILT_IN_ID_PREFIX}kubernetes_cron_job_ecs`, - filter: 'kubernetes.cronjob.uid : *', + filter: 'kubernetes.cronjob.name : *', managed: true, version: '0.1.0', name: 'Kubernetes CronJob from ECS data', @@ -21,7 +21,7 @@ export const builtInKubernetesCronJobEcsEntityDefinition: EntityDefinition = 'This definition extracts Kubernetes cron job entities from the Kubernetes integration data streams', type: 'k8s.cronjob.ecs', indexPatterns: commonEcsIndexPatterns, - identityFields: ['kubernetes.cronjob.uid'], + identityFields: ['kubernetes.cronjob.name'], displayNameTemplate: '{{kubernetes.cronjob.name}}', latest: { timestampField: '@timestamp', diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/daemon_set.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/daemon_set.ts index 5b57cdd6ae2f8..c69a1c5c7e625 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/daemon_set.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/daemon_set.ts @@ -13,7 +13,7 @@ import { commonEcsMetadata } from '../common/ecs_metadata'; export const builtInKubernetesDaemonSetEcsEntityDefinition: EntityDefinition = entityDefinitionSchema.parse({ id: `${BUILT_IN_ID_PREFIX}kubernetes_daemon_set_ecs`, - filter: 'kubernetes.daemonset.uid : *', + filter: 'kubernetes.daemonset.name : *', managed: true, version: '0.1.0', name: 'Kubernetes DaemonSet from ECS data', diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/deployment.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/deployment.ts index d33c14db7e2c9..f8e8f920e2f47 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/deployment.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/deployment.ts @@ -13,7 +13,7 @@ import { commonEcsIndexPatterns } from '../common/ecs_index_patterns'; export const builtInKubernetesDeploymentEcsEntityDefinition: EntityDefinition = entityDefinitionSchema.parse({ id: `${BUILT_IN_ID_PREFIX}kubernetes_deployment_ecs`, - filter: 'kubernetes.deployment.uid : *', + filter: 'kubernetes.deployment.name : *', managed: true, version: '0.1.0', name: 'Kubernetes Deployment from ECS data', @@ -21,7 +21,7 @@ export const builtInKubernetesDeploymentEcsEntityDefinition: EntityDefinition = 'This definition extracts Kubernetes deployment entities from the Kubernetes integration data streams', type: 'k8s.deployment.ecs', indexPatterns: commonEcsIndexPatterns, - identityFields: ['kubernetes.deployment.uid'], + identityFields: ['kubernetes.deployment.name'], displayNameTemplate: '{{kubernetes.deployment.name}}', latest: { timestampField: '@timestamp', diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/job.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/job.ts index 92c6d13251553..4efc41dc9ea81 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/job.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/job.ts @@ -13,7 +13,7 @@ import { commonEcsMetadata } from '../common/ecs_metadata'; export const builtInKubernetesJobEcsEntityDefinition: EntityDefinition = entityDefinitionSchema.parse({ id: `${BUILT_IN_ID_PREFIX}kubernetes_job_ecs`, - filter: 'kubernetes.job.uid : *', + filter: 'kubernetes.job.name : *', managed: true, version: '0.1.0', name: 'Kubernetes Job from ECS data', @@ -21,7 +21,7 @@ export const builtInKubernetesJobEcsEntityDefinition: EntityDefinition = 'This definition extracts Kubernetes job entities from the Kubernetes integration data streams', type: 'k8s.job.ecs', indexPatterns: commonEcsIndexPatterns, - identityFields: ['kubernetes.job.uid'], + identityFields: ['kubernetes.job.name'], displayNameTemplate: '{{kubernetes.job.name}}', latest: { timestampField: '@timestamp', diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/node.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/node.ts index f3fdcdfaf04b4..033bd8313928d 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/node.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/node.ts @@ -13,7 +13,7 @@ import { commonEcsMetadata } from '../common/ecs_metadata'; export const builtInKubernetesNodeEcsEntityDefinition: EntityDefinition = entityDefinitionSchema.parse({ id: `${BUILT_IN_ID_PREFIX}kubernetes_node_ecs`, - filer: 'kubernetes.node.uid : *', + filer: 'kubernetes.node.name : *', managed: true, version: '0.1.0', name: 'Kubernetes Node from ECS data', @@ -21,7 +21,7 @@ export const builtInKubernetesNodeEcsEntityDefinition: EntityDefinition = 'This definition extracts Kubernetes node entities from the Kubernetes integration data streams', type: 'k8s.node.ecs', indexPatterns: commonEcsIndexPatterns, - identityFields: ['kubernetes.node.uid'], + identityFields: ['kubernetes.node.name'], displayNameTemplate: '{{kubernetes.node.name}}', latest: { timestampField: '@timestamp', diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/pod.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/pod.ts index 7aa53da6e5a7d..32029617d992c 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/pod.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/pod.ts @@ -21,7 +21,7 @@ export const builtInKubernetesPodEcsEntityDefinition: EntityDefinition = 'This definition extracts Kubernetes pod entities from the Kubernetes integration data streams', type: 'k8s.pod.ecs', indexPatterns: commonEcsIndexPatterns, - identityFields: ['kubernetes.pod.name'], + identityFields: ['kubernetes.pod.uid'], displayNameTemplate: '{{kubernetes.pod.name}}', latest: { timestampField: '@timestamp', @@ -30,5 +30,12 @@ export const builtInKubernetesPodEcsEntityDefinition: EntityDefinition = frequency: '5m', }, }, - metadata: commonEcsMetadata, + metadata: [ + ...commonEcsMetadata, + { + source: 'kubernetes.pod.name', + destination: 'kubernetes.pod.name', + aggregation: { type: 'top_value', sort: { '@timestamp': 'desc' } }, + }, + ], }); diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/replica_set.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/replica_set.ts index cc059c14979d0..e9f534be8f1db 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/replica_set.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/replica_set.ts @@ -13,6 +13,7 @@ import { commonEcsIndexPatterns } from '../common/ecs_index_patterns'; export const builtInKubernetesReplicaSetEcsEntityDefinition: EntityDefinition = entityDefinitionSchema.parse({ id: `${BUILT_IN_ID_PREFIX}kubernetes_replica_set_ecs`, + filer: 'kubernetes.replicaset.name : *', managed: true, version: '0.1.0', name: 'Kubernetes ReplicaSet from ECS data', @@ -20,7 +21,7 @@ export const builtInKubernetesReplicaSetEcsEntityDefinition: EntityDefinition = 'This definition extracts Kubernetes replica set entities from the Kubernetes integration data streams', type: 'k8s.replicaset.ecs', indexPatterns: commonEcsIndexPatterns, - identityFields: ['kubernetes.replicaset.uid'], + identityFields: ['kubernetes.replicaset.name'], displayNameTemplate: '{{kubernetes.replicaset.name}}', latest: { timestampField: '@timestamp', diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/stateful_set.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/stateful_set.ts index 79f9d4489216f..927c8a259276d 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/stateful_set.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/ecs/stateful_set.ts @@ -13,7 +13,7 @@ import { commonEcsIndexPatterns } from '../common/ecs_index_patterns'; export const builtInKubernetesStatefulSetEcsEntityDefinition: EntityDefinition = entityDefinitionSchema.parse({ id: `${BUILT_IN_ID_PREFIX}kubernetes_stateful_set_ecs`, - filter: 'kubernetes.statefulset.uid : *', + filter: 'kubernetes.statefulset.name : *', managed: true, version: '0.1.0', name: 'Kubernetes StatefulSet from ECS data', @@ -21,7 +21,7 @@ export const builtInKubernetesStatefulSetEcsEntityDefinition: EntityDefinition = 'This definition extracts Kubernetes stateful set entities from the Kubernetes integration data streams', type: 'k8s.statefulset.ecs', indexPatterns: commonEcsIndexPatterns, - identityFields: ['kubernetes.statefulset.uid'], + identityFields: ['kubernetes.statefulset.name'], displayNameTemplate: '{{kubernetes.statefulset.name}}', latest: { timestampField: '@timestamp', diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/cluster.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/cluster.ts index 0ec244ec617f3..71024cfb166f2 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/cluster.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/cluster.ts @@ -30,5 +30,12 @@ export const builtInKubernetesClusterSemConvEntityDefinition: EntityDefinition = frequency: '5m', }, }, - metadata: commonOtelMetadata, + metadata: [ + ...commonOtelMetadata, + { + source: 'k8s.cluster.name', + destination: 'k8s.cluster.name', + aggregation: { type: 'top_value', sort: { '@timestamp': 'desc' } }, + }, + ], }); diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/cron_job.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/cron_job.ts index 6d677943976d1..fff257bcf8e57 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/cron_job.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/cron_job.ts @@ -30,5 +30,12 @@ export const builtInKubernetesCronJobSemConvEntityDefinition: EntityDefinition = frequency: '5m', }, }, - metadata: commonOtelMetadata, + metadata: [ + ...commonOtelMetadata, + { + source: 'k8s.cronjob.name', + destination: 'k8s.cronjob.name', + aggregation: { type: 'top_value', sort: { '@timestamp': 'desc' } }, + }, + ], }); diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/daemon_set.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/daemon_set.ts index a4b61933ad316..cf89dcc30e671 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/daemon_set.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/daemon_set.ts @@ -30,5 +30,12 @@ export const builtInKubernetesDaemonSetSemConvEntityDefinition: EntityDefinition frequency: '5m', }, }, - metadata: commonOtelMetadata, + metadata: [ + ...commonOtelMetadata, + { + source: 'k8s.daemonset.name', + destination: 'k8s.daemonset.name', + aggregation: { type: 'top_value', sort: { '@timestamp': 'desc' } }, + }, + ], }); diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/deployment.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/deployment.ts index bdb3cb1cef59b..05a89d67ead33 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/deployment.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/deployment.ts @@ -30,5 +30,12 @@ export const builtInKubernetesDeploymentSemConvEntityDefinition: EntityDefinitio frequency: '5m', }, }, - metadata: commonOtelMetadata, + metadata: [ + ...commonOtelMetadata, + { + source: 'k8s.deployment.name', + destination: 'k8s.deployment.name', + aggregation: { type: 'top_value', sort: { '@timestamp': 'desc' } }, + }, + ], }); diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/job.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/job.ts index b2e48cf7494fb..557afa54ca55e 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/job.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/job.ts @@ -30,5 +30,12 @@ export const builtInKubernetesJobSemConvEntityDefinition: EntityDefinition = frequency: '5m', }, }, - metadata: commonOtelMetadata, + metadata: [ + ...commonOtelMetadata, + { + source: 'k8s.job.name', + destination: 'k8s.job.name', + aggregation: { type: 'top_value', sort: { '@timestamp': 'desc' } }, + }, + ], }); diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/node.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/node.ts index 456f030421075..35bbed42e6a4a 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/node.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/node.ts @@ -22,7 +22,7 @@ export const builtInKubernetesNodeSemConvEntityDefinition: EntityDefinition = type: 'k8s.node.otel', indexPatterns: commonOtelIndexPatterns, identityFields: ['k8s.node.uid'], - displayNameTemplate: '{{k8s.node.uid}}', + displayNameTemplate: '{{k8s.node.name}}', latest: { timestampField: '@timestamp', lookbackPeriod: '10m', @@ -30,5 +30,12 @@ export const builtInKubernetesNodeSemConvEntityDefinition: EntityDefinition = frequency: '5m', }, }, - metadata: commonOtelMetadata, + metadata: [ + ...commonOtelMetadata, + { + source: 'k8s.node.name', + destination: 'k8s.node.name', + aggregation: { type: 'top_value', sort: { '@timestamp': 'desc' } }, + }, + ], }); diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/pod.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/pod.ts index 6dc879d761dd8..05d22163fbacc 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/pod.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/pod.ts @@ -30,5 +30,12 @@ export const builtInKubernetesPodSemConvEntityDefinition: EntityDefinition = frequency: '5m', }, }, - metadata: commonOtelMetadata, + metadata: [ + ...commonOtelMetadata, + { + source: 'k8s.pod.name', + destination: 'k8s.pod.name', + aggregation: { type: 'top_value', sort: { '@timestamp': 'desc' } }, + }, + ], }); diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/replica_set.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/replica_set.ts index 47bad6bf8a641..ff4e33d789da9 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/replica_set.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/replica_set.ts @@ -19,9 +19,9 @@ export const builtInKubernetesReplicaSetSemConvEntityDefinition: EntityDefinitio name: 'Kubernetes ReplicaSet from SemConv data', description: 'This definition extracts Kubernetes replica set entities using data collected with OpenTelemetry', - type: 'kubernetes_replica_set_semconv', + type: 'k8s.replicaset.otel', indexPatterns: commonOtelIndexPatterns, - identityFields: ['k8s.replicaset.name'], + identityFields: ['k8s.replicaset.uid'], displayNameTemplate: '{{k8s.replicaset.name}}', latest: { timestampField: '@timestamp', @@ -30,5 +30,12 @@ export const builtInKubernetesReplicaSetSemConvEntityDefinition: EntityDefinitio frequency: '5m', }, }, - metadata: commonOtelMetadata, + metadata: [ + ...commonOtelMetadata, + { + source: 'k8s.replicaset.name', + destination: 'k8s.replicaset.name', + aggregation: { type: 'top_value', sort: { '@timestamp': 'desc' } }, + }, + ], }); diff --git a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/stateful_set.ts b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/stateful_set.ts index c61d7e5d965cd..9c8b385f05c76 100644 --- a/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/stateful_set.ts +++ b/x-pack/plugins/entity_manager/server/lib/entities/built_in/kubernetes/semconv/stateful_set.ts @@ -30,5 +30,12 @@ export const builtInKubernetesStatefulSetSemConvEntityDefinition: EntityDefiniti frequency: '5m', }, }, - metadata: commonOtelMetadata, + metadata: [ + ...commonOtelMetadata, + { + source: 'k8s.statefulset.name', + destination: 'k8s.statefulset.name', + aggregation: { type: 'top_value', sort: { '@timestamp': 'desc' } }, + }, + ], }); diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_entity_summary.ts b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_entity_summary.ts index e62defaac6d4b..500dd02c63e18 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_entity_summary.ts +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_entity_summary.ts @@ -6,10 +6,16 @@ */ import * as z from '@kbn/zod'; -import { EntityDataStreamType, ENTITY_TYPES } from '@kbn/observability-shared-plugin/common'; +import { + EntityDataStreamType, + BUILT_IN_ENTITY_TYPES, +} from '@kbn/observability-shared-plugin/common'; import { useFetcher } from '../../../hooks/use_fetcher'; -const EntityTypeSchema = z.union([z.literal(ENTITY_TYPES.HOST), z.literal(ENTITY_TYPES.CONTAINER)]); +const EntityTypeSchema = z.union([ + z.literal(BUILT_IN_ENTITY_TYPES.HOST), + z.literal(BUILT_IN_ENTITY_TYPES.CONTAINER), +]); const EntityDataStreamSchema = z.union([ z.literal(EntityDataStreamType.METRICS), z.literal(EntityDataStreamType.LOGS), diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/tabs/processes/processes.tsx b/x-pack/plugins/observability_solution/infra/public/components/asset_details/tabs/processes/processes.tsx index 2177cd0509085..57a07d4dc296e 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/tabs/processes/processes.tsx +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/tabs/processes/processes.tsx @@ -23,7 +23,7 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { getFieldByType } from '@kbn/metrics-data-access-plugin/common'; import { decodeOrThrow } from '@kbn/io-ts-utils'; import useLocalStorage from 'react-use/lib/useLocalStorage'; -import { ENTITY_TYPES } from '@kbn/observability-shared-plugin/common'; +import { BUILT_IN_ENTITY_TYPES } from '@kbn/observability-shared-plugin/common'; import { useSourceContext } from '../../../../containers/metrics_source'; import { isPending, useFetcher } from '../../../../hooks/use_fetcher'; import { parseSearchString } from './parse_search_string'; @@ -58,7 +58,7 @@ export const Processes = () => { const { request$ } = useRequestObservable(); const { isActiveTab } = useTabSwitcherContext(); const { dataStreams, status: dataStreamsStatus } = useEntitySummary({ - entityType: ENTITY_TYPES.HOST, + entityType: BUILT_IN_ENTITY_TYPES.HOST, entityId: asset.name, }); const addMetricsCalloutId: AddMetricsCalloutKey = 'hostProcesses'; diff --git a/x-pack/plugins/observability_solution/infra/server/routes/entities/index.ts b/x-pack/plugins/observability_solution/infra/server/routes/entities/index.ts index 46f2cecf45254..4056faba9427e 100644 --- a/x-pack/plugins/observability_solution/infra/server/routes/entities/index.ts +++ b/x-pack/plugins/observability_solution/infra/server/routes/entities/index.ts @@ -9,7 +9,7 @@ import { schema } from '@kbn/config-schema'; import { METRICS_APP_ID } from '@kbn/deeplinks-observability/constants'; import { entityCentricExperience } from '@kbn/observability-plugin/common'; import { createObservabilityEsClient } from '@kbn/observability-utils-server/es/client/create_observability_es_client'; -import { ENTITY_TYPES } from '@kbn/observability-shared-plugin/common'; +import { BUILT_IN_ENTITY_TYPES } from '@kbn/observability-shared-plugin/common'; import { getInfraMetricsClient } from '../../lib/helpers/get_infra_metrics_client'; import { InfraBackendLibs } from '../../lib/infra_types'; import { getDataStreamTypes } from './get_data_stream_types'; @@ -24,8 +24,8 @@ export const initEntitiesConfigurationRoutes = (libs: InfraBackendLibs) => { validate: { params: schema.object({ entityType: schema.oneOf([ - schema.literal(ENTITY_TYPES.HOST), - schema.literal(ENTITY_TYPES.CONTAINER), + schema.literal(BUILT_IN_ENTITY_TYPES.HOST), + schema.literal(BUILT_IN_ENTITY_TYPES.CONTAINER), ]), entityId: schema.string(), }), diff --git a/x-pack/plugins/observability_solution/inventory/public/components/entity_icon/index.tsx b/x-pack/plugins/observability_solution/inventory/public/components/entity_icon/index.tsx index 4da8fd3103c41..239d441b5d4e6 100644 --- a/x-pack/plugins/observability_solution/inventory/public/components/entity_icon/index.tsx +++ b/x-pack/plugins/observability_solution/inventory/public/components/entity_icon/index.tsx @@ -45,7 +45,7 @@ export function EntityIcon({ entity }: EntityIconProps) { return ; } - if (entity.entityType.startsWith('kubernetes')) { + if (entity.entityType.startsWith('k8s')) { return ; } diff --git a/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.test.ts b/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.test.ts index d0406aa32884d..c5b35b521b3bc 100644 --- a/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.test.ts +++ b/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.test.ts @@ -10,7 +10,7 @@ import { useDetailViewRedirect } from './use_detail_view_redirect'; import { useKibana } from './use_kibana'; import { CONTAINER_ID, - ENTITY_TYPES, + BUILT_IN_ENTITY_TYPES, HOST_NAME, SERVICE_NAME, } from '@kbn/observability-shared-plugin/common'; @@ -134,15 +134,30 @@ describe('useDetailViewRedirect', () => { }); [ - [ENTITY_TYPES.KUBERNETES.CLUSTER.ecs, 'kubernetes-f4dc26db-1b53-4ea2-a78b-1bfab8ea267c'], - [ENTITY_TYPES.KUBERNETES.CLUSTER.semconv, 'kubernetes_otel-cluster-overview'], - [ENTITY_TYPES.KUBERNETES.CRONJOB.ecs, 'kubernetes-0a672d50-bcb1-11ec-b64f-7dd6e8e82013'], - [ENTITY_TYPES.KUBERNETES.DAEMONSET.ecs, 'kubernetes-85879010-bcb1-11ec-b64f-7dd6e8e82013'], - [ENTITY_TYPES.KUBERNETES.DEPLOYMENT.ecs, 'kubernetes-5be46210-bcb1-11ec-b64f-7dd6e8e82013'], - [ENTITY_TYPES.KUBERNETES.JOB.ecs, 'kubernetes-9bf990a0-bcb1-11ec-b64f-7dd6e8e82013'], - [ENTITY_TYPES.KUBERNETES.NODE.ecs, 'kubernetes-b945b7b0-bcb1-11ec-b64f-7dd6e8e82013'], - [ENTITY_TYPES.KUBERNETES.POD.ecs, 'kubernetes-3d4d9290-bcb1-11ec-b64f-7dd6e8e82013'], - [ENTITY_TYPES.KUBERNETES.STATEFULSET.ecs, 'kubernetes-21694370-bcb2-11ec-b64f-7dd6e8e82013'], + [ + BUILT_IN_ENTITY_TYPES.KUBERNETES.CLUSTER.ecs, + 'kubernetes-f4dc26db-1b53-4ea2-a78b-1bfab8ea267c', + ], + [BUILT_IN_ENTITY_TYPES.KUBERNETES.CLUSTER.semconv, 'kubernetes_otel-cluster-overview'], + [ + BUILT_IN_ENTITY_TYPES.KUBERNETES.CRONJOB.ecs, + 'kubernetes-0a672d50-bcb1-11ec-b64f-7dd6e8e82013', + ], + [ + BUILT_IN_ENTITY_TYPES.KUBERNETES.DAEMONSET.ecs, + 'kubernetes-85879010-bcb1-11ec-b64f-7dd6e8e82013', + ], + [ + BUILT_IN_ENTITY_TYPES.KUBERNETES.DEPLOYMENT.ecs, + 'kubernetes-5be46210-bcb1-11ec-b64f-7dd6e8e82013', + ], + [BUILT_IN_ENTITY_TYPES.KUBERNETES.JOB.ecs, 'kubernetes-9bf990a0-bcb1-11ec-b64f-7dd6e8e82013'], + [BUILT_IN_ENTITY_TYPES.KUBERNETES.NODE.ecs, 'kubernetes-b945b7b0-bcb1-11ec-b64f-7dd6e8e82013'], + [BUILT_IN_ENTITY_TYPES.KUBERNETES.POD.ecs, 'kubernetes-3d4d9290-bcb1-11ec-b64f-7dd6e8e82013'], + [ + BUILT_IN_ENTITY_TYPES.KUBERNETES.STATEFULSET.ecs, + 'kubernetes-21694370-bcb2-11ec-b64f-7dd6e8e82013', + ], ].forEach(([entityType, dashboardId]) => { it(`getEntityRedirectUrl should return the correct URL for ${entityType} entity`, () => { const entity: InventoryEntity = { diff --git a/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.ts b/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.ts index 36fa622e74667..02a77b8f2afa1 100644 --- a/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.ts +++ b/x-pack/plugins/observability_solution/inventory/public/hooks/use_detail_view_redirect.ts @@ -6,7 +6,7 @@ */ import { ASSET_DETAILS_LOCATOR_ID, - ENTITY_TYPES, + BUILT_IN_ENTITY_TYPES, SERVICE_OVERVIEW_LOCATOR_ID, type AssetDetailsLocatorParams, type ServiceOverviewParams, @@ -20,15 +20,19 @@ import type { InventoryEntity } from '../../common/entities'; import { useKibana } from './use_kibana'; const KUBERNETES_DASHBOARDS_IDS: Record = { - [ENTITY_TYPES.KUBERNETES.CLUSTER.ecs]: 'kubernetes-f4dc26db-1b53-4ea2-a78b-1bfab8ea267c', - [ENTITY_TYPES.KUBERNETES.CLUSTER.semconv]: 'kubernetes_otel-cluster-overview', - [ENTITY_TYPES.KUBERNETES.CRONJOB.ecs]: 'kubernetes-0a672d50-bcb1-11ec-b64f-7dd6e8e82013', - [ENTITY_TYPES.KUBERNETES.DAEMONSET.ecs]: 'kubernetes-85879010-bcb1-11ec-b64f-7dd6e8e82013', - [ENTITY_TYPES.KUBERNETES.DEPLOYMENT.ecs]: 'kubernetes-5be46210-bcb1-11ec-b64f-7dd6e8e82013', - [ENTITY_TYPES.KUBERNETES.JOB.ecs]: 'kubernetes-9bf990a0-bcb1-11ec-b64f-7dd6e8e82013', - [ENTITY_TYPES.KUBERNETES.NODE.ecs]: 'kubernetes-b945b7b0-bcb1-11ec-b64f-7dd6e8e82013', - [ENTITY_TYPES.KUBERNETES.POD.ecs]: 'kubernetes-3d4d9290-bcb1-11ec-b64f-7dd6e8e82013', - [ENTITY_TYPES.KUBERNETES.STATEFULSET.ecs]: 'kubernetes-21694370-bcb2-11ec-b64f-7dd6e8e82013', + [BUILT_IN_ENTITY_TYPES.KUBERNETES.CLUSTER.ecs]: 'kubernetes-f4dc26db-1b53-4ea2-a78b-1bfab8ea267c', + [BUILT_IN_ENTITY_TYPES.KUBERNETES.CLUSTER.semconv]: 'kubernetes_otel-cluster-overview', + [BUILT_IN_ENTITY_TYPES.KUBERNETES.CRONJOB.ecs]: 'kubernetes-0a672d50-bcb1-11ec-b64f-7dd6e8e82013', + [BUILT_IN_ENTITY_TYPES.KUBERNETES.DAEMONSET.ecs]: + 'kubernetes-85879010-bcb1-11ec-b64f-7dd6e8e82013', + [BUILT_IN_ENTITY_TYPES.KUBERNETES.DEPLOYMENT.ecs]: + 'kubernetes-5be46210-bcb1-11ec-b64f-7dd6e8e82013', + [BUILT_IN_ENTITY_TYPES.KUBERNETES.JOB.ecs]: 'kubernetes-9bf990a0-bcb1-11ec-b64f-7dd6e8e82013', + [BUILT_IN_ENTITY_TYPES.KUBERNETES.NODE.ecs]: 'kubernetes-b945b7b0-bcb1-11ec-b64f-7dd6e8e82013', + [BUILT_IN_ENTITY_TYPES.KUBERNETES.POD.ecs]: 'kubernetes-3d4d9290-bcb1-11ec-b64f-7dd6e8e82013', + [BUILT_IN_ENTITY_TYPES.KUBERNETES.SERVICE.ecs]: 'kubernetes-ff1b3850-bcb1-11ec-b64f-7dd6e8e82013', + [BUILT_IN_ENTITY_TYPES.KUBERNETES.STATEFULSET.ecs]: + 'kubernetes-21694370-bcb2-11ec-b64f-7dd6e8e82013', }; export const useDetailViewRedirect = () => { diff --git a/x-pack/plugins/observability_solution/observability_shared/common/entity/entity_types.ts b/x-pack/plugins/observability_solution/observability_shared/common/entity/entity_types.ts index 4d8be9efc59c6..db3e91fbf493a 100644 --- a/x-pack/plugins/observability_solution/observability_shared/common/entity/entity_types.ts +++ b/x-pack/plugins/observability_solution/observability_shared/common/entity/entity_types.ts @@ -6,11 +6,11 @@ */ const createKubernetesEntity = (base: T) => ({ - ecs: `kubernetes_${base}_ecs` as const, - semconv: `kubernetes_${base}_semconv` as const, + ecs: `k8s.${base}.ecs` as const, + semconv: `k8s.${base}.semconv` as const, }); -export const ENTITY_TYPES = { +export const BUILT_IN_ENTITY_TYPES = { HOST: 'host', CONTAINER: 'container', SERVICE: 'service', @@ -18,12 +18,13 @@ export const ENTITY_TYPES = { CLUSTER: createKubernetesEntity('cluster'), CONTAINER: createKubernetesEntity('container'), CRONJOB: createKubernetesEntity('cron_job'), - DAEMONSET: createKubernetesEntity('daemon_set'), + DAEMONSET: createKubernetesEntity('daemonset'), DEPLOYMENT: createKubernetesEntity('deployment'), JOB: createKubernetesEntity('job'), NAMESPACE: createKubernetesEntity('namespace'), NODE: createKubernetesEntity('node'), POD: createKubernetesEntity('pod'), - STATEFULSET: createKubernetesEntity('stateful_set'), + SERVICE: createKubernetesEntity('service'), + STATEFULSET: createKubernetesEntity('statefulset'), }, } as const; diff --git a/x-pack/plugins/observability_solution/observability_shared/common/entity/index.ts b/x-pack/plugins/observability_solution/observability_shared/common/entity/index.ts index adc07a2931b60..92ae5701f8000 100644 --- a/x-pack/plugins/observability_solution/observability_shared/common/entity/index.ts +++ b/x-pack/plugins/observability_solution/observability_shared/common/entity/index.ts @@ -5,5 +5,5 @@ * 2.0. */ -export { ENTITY_TYPES } from './entity_types'; +export { BUILT_IN_ENTITY_TYPES } from './entity_types'; export { EntityDataStreamType } from './entity_data_stream_types'; diff --git a/x-pack/plugins/observability_solution/observability_shared/common/index.ts b/x-pack/plugins/observability_solution/observability_shared/common/index.ts index f483bcc5dc269..a8e26366ab4b3 100644 --- a/x-pack/plugins/observability_solution/observability_shared/common/index.ts +++ b/x-pack/plugins/observability_solution/observability_shared/common/index.ts @@ -219,4 +219,4 @@ export { export { COMMON_OBSERVABILITY_GROUPING } from './embeddable_grouping'; -export { ENTITY_TYPES, EntityDataStreamType } from './entity'; +export { BUILT_IN_ENTITY_TYPES, EntityDataStreamType } from './entity'; From 61d0320c6422116dcf1c4e26f8f80760d7a3bb81 Mon Sep 17 00:00:00 2001 From: Marco Liberati Date: Tue, 26 Nov 2024 09:34:13 +0100 Subject: [PATCH 63/71] [Lens] Embeddable react refactor (#186642) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary This PR contains the refactor of the Lens embeddable with the new React architecture. fix https://github.com/elastic/kibana/issues/174957 fixes https://github.com/elastic/kibana/issues/180672 **Current status**: ✅ Ready to review ### Notes for testing and reviewers Other than reworking the Lens embeddable with the new architecture this PR contains the following major changes. #### Edit flow The `Edit` flow has changed to in-line first using the new `Edit` API provided by the new system * The impact of this change can be noticed in the code on the `Canvas` case where the Custom Lens component is instructed to avoid the inline editing. In all the other cases in-line editing is enabled by default now. * Another side effect of this has been the replacement of the special `INLINE_EDIT` action id into the regular `EDIT` action. Some tests have been affected by this replacing the `clickEdit` function with the `openEditorFromFlyout` one. * The Inline editing codebase **as been reworked entirely** so make sure to stress test this side of things. #### Attribute service Another important aspect changed in this PR is the `attributeService`: this was tied to the previous Embeddable system and it is now completely skipped. The Lens wrapper around that has been reworked to be thinner and directly call the CM services. * Please make sure to test thoroughly save/load SO flows #### Transformation API (by-value <=> by-reference flow) The new system adopts the new Transformation API (who prevents the panel to fully reload on change). * Please make sure to test thoroughly Visualize library <=> by value flows * In particular moving from one type and another should change how the Panel Settings interpret "default" values to reset #### Message system Also this part of the code was partially rewritten to be more manageable ont he embeddable surface, maintaining the core functionalities. * Please make sure to test thoroughly error messages, warnings and info messages * Some scenarios to test includes * multi-layer errors (i.e. use a broken KQL query for an annotation/multi-layers). Check that the panel recovers correctly from it when resolved * Missing references * Missing dataViews * Wrong formatted SO * Configuration mistakes - check that a broken config is not saveable ### Other areas to check * Change filters in dashboard/viz and check that are correctly handled * Check drilldowns * Check that `Unsaved changes` are correctly detected * Check that the panel updates correctly on `View` mode change ## Main type changes This PR contains also some important `type` changes, here's listed: * the `query` property now explicitly supports ES|QL query type. * in `main` it used to work without type support * `LensEmbeddableInput`/`LensEmbeddableOutput` types have changed, but the type names remained the same. ## Follow ups already planned: Some enhancements have been already collected and will be addressed in a follow up [here](https://github.com/elastic/kibana/issues/195355) ### Tasks
Detailed list of tasks for the refactor * New embeddable factory * [x] Define visualization context * [x] Define observables to track * [x] Basic panel settings * [x] Basic edit api * [x] inspector api * [x] Library services * [x] Unified search api * [x] Basic integrations api * [x] State management api for inline editing * Publish correct observables * [x] `dataViews` * [x] `query` * [x] `filters` * [x] `dataLoading` * [x] `savedObjectId` * Actions * [x] View underlying data api * Custom renderer * [x] Basic implementation * [x] Support callbacks * [x] Support custom styling/paddings * Expose * [x] Handle searchSession * Edit * [x] Open panel in Lens editor * Inline editing * [x] rework references logic * #180726 * integrate the logic to extract filters dataViews from filters as for the first bug in #188545 * DSL flyout * [x] open flyout * [x] save * ES|QL * [x] open flyout on creation * [x] open flyout on editing * [x] save * [x] revisit mounting logic to avoid detach if possible (not possible yet) * [x] explore the integration with the new `onEdit` api method used for the inline editing~~ * [x] created panel management module and sorted it out * [x] open in Editor * [x] fix the save on return to dashboard * ~~migrate by ref to by value on inline editing~~ will do it in a follow up PR * Add from library issues * [x] Fix missing title and tags * Data loading * [x] Compute all required data params for rendering * Render the panel * [x] hook up user messaging system * [x] Merge search context * [x] Expression variables * [x] panel settings * [x] per panel time range * [x] per panel filter * test with both DSL and ES|QL mode * Reload * [x] on unified search updates * [x] on config changes * [x] on drilldown changes? * [x] on view mode change * Attributes service * [x] load from library * [x] save to library
### Pending issues:
Detailed list of issues * [x] Unified histogram does not render in Discover * [x] Saving to library from context menu in dashboard doesn't save the title * [x] When adding a vis from the library the new panel has no title * [x] Vis disappears when opening inline editor and cancel * Create a viz, save and return to dashboard, then edit it and cancel. * Saving an edit inline doesn't apply the changes (i.e. changing the chart type) * [x] Changing the chart type on the layer panel leads to a crash * [x] Changing the chart type won't update the visualization (via both config panel or suggestions) * [x] Edit a dimension will stretch the panel to overflow the fly-out * [x] duplicating a dimension in the inline editor by drag and drop works buggy visually * When duplicating a panel, the new panel gets the same title rather than “title (copy)” * [x] by-value panels * [x] by-reference panels * [x] brushing throughout the timerange doesn’t work * [x] filtering when clicking on value doesn’t work * [x] filtering from legend doesn’t work * [x] for lens table, the sort ascending/descending actions don’t have an effect * [x] filtering doesn’t display on table either * Discover related issues * thanks to @davismcphee investigation the source of the issue seems to be related to the way the `abortController` is managed in the new embeddable implementation as Discover is relying on that. * [x] needs to investigate for a fix that restores the previous behaviour of the `abortController` management * [x] the hits total count is not in sync with the chart/table now * [x] Change chart type via suggestion panel when inline editing in Discover doesn't update the chart * [x] Dirty panel issue (see @nickofthyme 's [comment](https://github.com/elastic/kibana/pull/186642#discussion_r1792659477) ) * [x] `Unsaved changes` issue (see @mbondyra [comment](https://github.com/elastic/kibana/pull/186642#discussion_r1795384587)) * [x] Multiple errors not rendered correctly in panel when blocking (i.e. missing field - `lens-message-list-trigger` related) * [x] recover from a blocker error required 2 renders * Missing SO error should not be handled for the custom render component (legacy behaviour) but should be correctly handled for dashboard (will be handled in a follow up PR given that is broken on `main` too) * [x] Too many requests on Unified Histogram when in Discover (3 vs 2) * [x] Too many request on slow queries for Unified Histogram (2 vs 1) * [x] Annotations preview issues (chart rendering with height `0px`) * [x] `uuid` not propagated correctly * [x] another flavour of this was `id` not propagated correctly into the `data-test-embeddable-id` attribute * [x] Dispatch correctly the `render` events * [x] refresh interval does not propagate thru the Lens custom component in Discover (thanks to @jughosta to sort this out )
--------- Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Marco Vettorello Co-authored-by: Marta Bondyra Co-authored-by: Bhavya RM Co-authored-by: Stratoula Kalafateli --- .../react_embeddable_renderer.tsx | 1 + .../group_preview.test.tsx | 2 +- .../group_editor_flyout/group_preview.tsx | 29 +- .../use_expression_renderer.ts | 2 +- .../navigation/public/{mocks.ts => mocks.tsx} | 28 +- .../public/top_nav_menu/top_nav_menu.test.tsx | 19 +- .../unified_histogram/public/chart/chart.tsx | 31 +- .../public/chart/chart_config_panel.tsx | 9 +- .../public/chart/histogram.test.tsx | 32 +- .../public/chart/histogram.tsx | 43 +- .../container/hooks/use_state_props.test.ts | 8 +- .../public/container/hooks/use_state_props.ts | 11 +- .../container/services/state_service.test.ts | 4 +- .../container/services/state_service.ts | 14 +- .../public/container/utils/state_selectors.ts | 3 +- .../public/layout/layout.tsx | 7 +- .../lens_vis_service.attributes.test.ts | 3 + .../public/services/lens_vis_service.ts | 2 +- src/plugins/unified_histogram/public/types.ts | 14 +- .../public/utils/external_vis_context.ts | 2 +- .../public/utils/lens_vis_from_table.ts | 7 +- src/plugins/unified_histogram/tsconfig.json | 1 + .../dashboard/group6/dashboard_esql_chart.ts | 84 + .../group6/dashboard_esql_no_data.ts | 2 +- .../apps/discover/esql/_esql_view.ts | 3 + .../apps/discover/group3/_request_counts.ts | 22 +- .../visualize/group3/_annotation_listing.ts | 3 +- .../services/dashboard/panel_actions.ts | 16 +- .../embedded_lens_example/public/app.tsx | 3 +- .../public/app.tsx | 248 ++- .../public/embeddable.tsx | 4 +- .../public/mount.tsx | 14 +- .../tsconfig.json | 2 +- .../testing_embedded_lens/public/app.tsx | 495 +++-- .../testing_embedded_lens/public/mount.tsx | 14 +- .../testing_embedded_lens/tsconfig.json | 2 +- .../components/hooks/use_canvas_api.tsx | 2 + .../visualizations/actions/is_compatible.ts | 8 +- .../visualizations/actions/mocks.ts | 18 +- .../visualizations/actions/open_modal.tsx | 6 +- x-pack/plugins/lens/common/constants.ts | 10 +- .../lens/common/embeddable_factory/index.ts | 55 +- x-pack/plugins/lens/common/locator/locator.ts | 6 +- x-pack/plugins/lens/kibana.jsonc | 1 + .../lens/public/app_plugin/app.test.tsx | 1350 ++++++------- x-pack/plugins/lens/public/app_plugin/app.tsx | 326 ++-- .../public/app_plugin/app_helpers.test.ts | 76 + .../lens/public/app_plugin/app_helpers.ts | 207 ++ .../get_application_user_messages.test.tsx | 99 + .../get_application_user_messages.tsx | 42 +- .../app_plugin/lens_document_equality.test.ts | 8 +- .../app_plugin/lens_document_equality.ts | 25 +- .../lens/public/app_plugin/lens_top_nav.tsx | 12 +- .../lens/public/app_plugin/mounter.tsx | 26 +- .../app_plugin/save_modal_container.test.tsx | 407 ++++ .../app_plugin/save_modal_container.tsx | 225 ++- .../save_modal_container_helpers.test.ts | 4 +- .../save_modal_container_helpers.ts | 4 +- .../lens/public/app_plugin/share_action.ts | 8 +- .../get_edit_lens_configuration.tsx | 107 +- .../shared/edit_on_the_fly/helpers.ts | 4 +- .../lens_configuration_flyout.test.tsx | 8 +- .../lens_configuration_flyout.tsx | 44 +- .../shared/edit_on_the_fly/types.ts | 33 +- .../public/app_plugin/show_underlying_data.ts | 6 +- .../plugins/lens/public/app_plugin/types.ts | 16 +- x-pack/plugins/lens/public/async_services.ts | 2 - .../lens/public/chart_info_api.test.ts | 19 +- x-pack/plugins/lens/public/chart_info_api.ts | 22 +- .../datasources/form_based/datapanel.tsx | 5 +- .../datasources/form_based/form_based.test.ts | 3 +- .../datasources/form_based/form_based.tsx | 20 +- .../public/datasources/form_based/mocks.ts | 104 +- .../text_based/text_based_languages.tsx | 2 +- .../editor_frame/easteregg/index.tsx | 9 +- .../editor_frame/state_helpers.ts | 15 +- .../workspace_panel/workspace_panel.tsx | 15 +- .../public/editor_frame_service/service.tsx | 4 +- .../public/embeddable/embeddable.test.tsx | 1373 ------------- .../lens/public/embeddable/embeddable.tsx | 1719 ----------------- .../embeddable/embeddable_component.tsx | 188 -- .../public/embeddable/embeddable_factory.ts | 157 -- .../plugins/lens/public/embeddable/index.ts | 10 - .../public/embeddable/interfaces/lens_api.ts | 45 - x-pack/plugins/lens/public/index.ts | 25 +- .../lens/public/lens_attribute_service.ts | 171 +- .../lens/public/lens_inspector_service.ts | 4 +- .../lens_suggestions_api/helpers.test.ts | 2 +- .../public/lens_suggestions_api/helpers.ts | 2 +- .../lens/public/lens_suggestions_api/index.ts | 2 +- .../lens_suggestions_api.test.ts | 2 +- .../lens/public/mocks/data_plugin_mock.ts | 11 +- .../lens/public/mocks/lens_plugin_mock.tsx | 2 +- .../lens/public/mocks/services_mock.tsx | 90 +- .../plugins/lens/public/mocks/store_mocks.tsx | 38 +- .../public/persistence/saved_object_store.ts | 30 +- x-pack/plugins/lens/public/plugin.ts | 200 +- .../public/react_embeddable/data_loader.ts | 329 ++++ .../expression_wrapper.tsx | 21 +- .../react_embeddable/expressions/callbacks.ts | 51 + .../expressions/expression_params.ts | 238 +++ .../expressions/merged_search_context.ts | 91 + .../expressions/on_event.test.ts | 181 ++ .../react_embeddable/expressions/on_event.ts | 113 ++ .../react_embeddable/expressions/on_render.ts | 112 ++ .../react_embeddable/expressions/telemetry.ts | 18 + .../expressions/update_data_views.ts | 23 + .../react_embeddable/expressions/variables.ts | 36 + .../public/react_embeddable/helper.test.ts | 108 ++ .../lens/public/react_embeddable/helper.ts | 147 ++ .../initializers/initialize_actions.test.ts | 131 ++ .../initializers/initialize_actions.ts | 276 +++ .../initialize_dashboard_service.test.ts | 51 + .../initialize_dashboard_services.ts | 185 ++ .../initializers/initialize_edit.tsx | 237 +++ .../initializers/initialize_inspector.ts | 32 + .../initializers/initialize_integrations.ts | 61 + .../initializers/initialize_internal_api.ts | 91 + .../initializers/initialize_search_context.ts | 80 + .../initialize_state_management.ts | 99 + .../initialize_visualization_context.ts | 32 + .../react_embeddable/inline_editing/mount.tsx | 62 + .../inline_editing/panel_management.tsx | 45 + .../inline_editing/setup_inline_editing.tsx | 143 ++ .../inline_editing/state_management.tsx | 63 + .../react_embeddable/lens_embeddable.tsx | 190 ++ .../lens/public/react_embeddable/logger.ts | 27 + .../public/react_embeddable/mocks/index.tsx | 352 ++++ .../public/react_embeddable/renderer/hooks.ts | 42 + .../lens_custom_renderer_component.tsx | 158 ++ .../lens_embeddable_component.test.tsx | 42 + .../renderer/lens_embeddable_component.tsx | 91 + .../public/react_embeddable/type_guards.ts | 74 + .../lens/public/react_embeddable/types.ts | 494 +++++ .../react_embeddable/user_messages/api.ts | 288 +++ .../react_embeddable/user_messages/checks.tsx | 73 + .../user_messages/container.tsx | 45 + .../user_messages/error_panel.tsx | 67 + .../user_messages/info_badges.scss} | 2 +- .../user_messages/info_badges.test.tsx} | 4 +- .../user_messages/info_badges.tsx} | 15 +- .../user_messages/message_popover.tsx | 36 + .../__snapshots__/load_initial.test.tsx.snap | 11 +- .../state_management/init_middleware/index.ts | 3 +- .../init_middleware/load_initial.ts | 582 +++--- .../public/state_management/lens_slice.ts | 16 +- .../state_management/load_initial.test.tsx | 151 +- .../lens/public/state_management/selectors.ts | 110 +- .../public/state_management/shared_logic.ts | 124 ++ .../lens/public/state_management/types.ts | 8 +- .../trigger_actions/convert_to_lens_action.ts | 36 + .../open_in_discover_action.test.ts | 30 +- .../open_in_discover_action.ts | 4 +- .../open_in_discover_drilldown.test.tsx | 14 +- .../open_in_discover_drilldown.tsx | 2 +- .../open_in_discover_helpers.ts | 2 +- .../open_lens_config/create_action_helpers.ts | 25 +- .../open_lens_config/edit_action.test.tsx | 119 -- .../open_lens_config/edit_action.tsx | 57 - .../open_lens_config/edit_action_helpers.ts | 100 - .../in_app_embeddable_edit_action.test.tsx | 11 +- .../in_app_embeddable_edit_action.tsx | 6 +- .../in_app_embeddable_edit_action_helpers.tsx | 150 +- .../in_app_embeddable_edit/types.ts | 9 +- .../lens/public/trigger_actions/utils.ts | 13 - x-pack/plugins/lens/public/types.ts | 28 +- .../plugins/lens/public/user_messages_ids.ts | 3 + x-pack/plugins/lens/public/utils.ts | 8 +- x-pack/plugins/lens/public/vis_type_alias.ts | 25 +- .../lens/public/visualization_container.scss | 2 +- x-pack/plugins/lens/tsconfig.json | 6 +- .../new_job/job_from_lens/quick_create_job.ts | 6 +- .../components/action_menu/action_menu.tsx | 4 +- .../configurations/lens_attributes.test.ts | 5 +- .../configurations/lens_attributes.ts | 4 +- .../infra/public/hooks/use_lens_attributes.ts | 14 +- .../public/functions/visualize_esql.tsx | 4 +- .../lens/add_to_timeline.test.ts | 42 +- .../add_to_timeline/lens/add_to_timeline.ts | 10 +- .../lens/copy_to_clipboard.test.ts | 40 +- .../public/app/actions/utils.ts | 8 +- .../visualization_actions/lens_embeddable.tsx | 3 +- .../use_embeddable_inspect.tsx | 4 +- .../use_lens_attributes.test.tsx | 3 +- .../risk_summary_flyout/risk_summary.test.tsx | 5 +- .../risk_score_summary.test.ts | 3 +- .../translations/translations/fr-FR.json | 13 +- .../translations/translations/ja-JP.json | 17 +- .../translations/translations/zh-CN.json | 13 +- .../time_to_visualize_security.ts | 4 +- .../group2/dashboard_lens_by_value.ts | 6 +- .../lens_migration_smoke_test.ts | 2 +- .../apps/dashboard/group2/panel_time_range.ts | 2 +- .../apps/dashboard/group2/panel_titles.ts | 9 +- .../apps/discover/visualize_field.ts | 1 + .../apps/lens/group3/add_to_dashboard.ts | 25 +- .../lens/group3/dashboard_inline_editing.ts | 67 +- .../functional/apps/lens/group4/dashboard.ts | 41 +- .../group4/show_underlying_data_dashboard.ts | 54 +- .../apps/lens/group6/error_handling.ts | 2 +- .../apps/lens/group6/lens_tagging.ts | 2 +- .../apps/lens/open_in_lens/tsvb/dashboard.ts | 2 +- .../test/functional/page_objects/lens_page.ts | 11 + .../apps/dashboard/session_sharing/lens.ts | 6 +- .../investigations/alerts/alerts_charts.cy.ts | 3 +- .../common/discover/group3/_request_counts.ts | 24 +- .../group3/open_in_lens/tsvb/dashboard.ts | 2 +- .../search/dashboards/build_dashboard.ts | 2 +- 208 files changed, 8920 insertions(+), 6872 deletions(-) rename src/plugins/navigation/public/{mocks.ts => mocks.tsx} (54%) create mode 100644 x-pack/plugins/lens/public/app_plugin/app_helpers.test.ts create mode 100644 x-pack/plugins/lens/public/app_plugin/app_helpers.ts create mode 100644 x-pack/plugins/lens/public/app_plugin/save_modal_container.test.tsx delete mode 100644 x-pack/plugins/lens/public/embeddable/embeddable.test.tsx delete mode 100644 x-pack/plugins/lens/public/embeddable/embeddable.tsx delete mode 100644 x-pack/plugins/lens/public/embeddable/embeddable_component.tsx delete mode 100644 x-pack/plugins/lens/public/embeddable/embeddable_factory.ts delete mode 100644 x-pack/plugins/lens/public/embeddable/index.ts delete mode 100644 x-pack/plugins/lens/public/embeddable/interfaces/lens_api.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/data_loader.ts rename x-pack/plugins/lens/public/{embeddable => react_embeddable}/expression_wrapper.tsx (88%) create mode 100644 x-pack/plugins/lens/public/react_embeddable/expressions/callbacks.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/expressions/expression_params.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/expressions/merged_search_context.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/expressions/on_event.test.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/expressions/on_event.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/expressions/on_render.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/expressions/telemetry.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/expressions/update_data_views.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/expressions/variables.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/helper.test.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/helper.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.test.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_service.test.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_services.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_edit.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_inspector.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_integrations.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_internal_api.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_search_context.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_state_management.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/initializers/initialize_visualization_context.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/inline_editing/mount.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/inline_editing/panel_management.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/inline_editing/setup_inline_editing.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/inline_editing/state_management.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/lens_embeddable.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/logger.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/mocks/index.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/renderer/hooks.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/renderer/lens_custom_renderer_component.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/renderer/lens_embeddable_component.test.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/renderer/lens_embeddable_component.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/type_guards.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/types.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/user_messages/api.ts create mode 100644 x-pack/plugins/lens/public/react_embeddable/user_messages/checks.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/user_messages/container.tsx create mode 100644 x-pack/plugins/lens/public/react_embeddable/user_messages/error_panel.tsx rename x-pack/plugins/lens/public/{embeddable/embeddable_info_badges.scss => react_embeddable/user_messages/info_badges.scss} (62%) rename x-pack/plugins/lens/public/{embeddable/embeddable_info_badges.test.tsx => react_embeddable/user_messages/info_badges.test.tsx} (97%) rename x-pack/plugins/lens/public/{embeddable/embeddable_info_badges.tsx => react_embeddable/user_messages/info_badges.tsx} (89%) create mode 100644 x-pack/plugins/lens/public/react_embeddable/user_messages/message_popover.tsx create mode 100644 x-pack/plugins/lens/public/state_management/shared_logic.ts create mode 100644 x-pack/plugins/lens/public/trigger_actions/convert_to_lens_action.ts delete mode 100644 x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action.test.tsx delete mode 100644 x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action.tsx delete mode 100644 x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action_helpers.ts delete mode 100644 x-pack/plugins/lens/public/trigger_actions/utils.ts diff --git a/src/plugins/embeddable/public/react_embeddable_system/react_embeddable_renderer.tsx b/src/plugins/embeddable/public/react_embeddable_system/react_embeddable_renderer.tsx index 7cf9d9f203fc3..edf52244c2d4d 100644 --- a/src/plugins/embeddable/public/react_embeddable_system/react_embeddable_renderer.tsx +++ b/src/plugins/embeddable/public/react_embeddable_system/react_embeddable_renderer.tsx @@ -65,6 +65,7 @@ export const ReactEmbeddableRenderer = < | 'hideLoader' | 'hideHeader' | 'hideInspector' + | 'getActions' >; hidePanelChrome?: boolean; /** diff --git a/src/plugins/event_annotation_listing/public/components/group_editor_flyout/group_preview.test.tsx b/src/plugins/event_annotation_listing/public/components/group_editor_flyout/group_preview.test.tsx index 41f1fd16148f4..cac179d45f946 100644 --- a/src/plugins/event_annotation_listing/public/components/group_editor_flyout/group_preview.test.tsx +++ b/src/plugins/event_annotation_listing/public/components/group_editor_flyout/group_preview.test.tsx @@ -20,6 +20,7 @@ import { EmbeddableComponent, FieldBasedIndexPatternColumn, TypedLensByValueInput, + LensByValueInput, } from '@kbn/lens-plugin/public'; import { Datatable } from '@kbn/expressions-plugin/common'; import { render, screen, waitFor } from '@testing-library/react'; @@ -27,7 +28,6 @@ import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; import { I18nProvider } from '@kbn/i18n-react'; import { GroupPreview } from './group_preview'; -import { LensByValueInput } from '@kbn/lens-plugin/public/embeddable'; import { DATA_LAYER_ID, DATE_HISTOGRAM_COLUMN_ID, getCurrentTimeField } from './lens_attributes'; import { EuiSuperDatePickerTestHarness } from '@kbn/test-eui-helpers'; diff --git a/src/plugins/event_annotation_listing/public/components/group_editor_flyout/group_preview.tsx b/src/plugins/event_annotation_listing/public/components/group_editor_flyout/group_preview.tsx index 3f1c47f3a72b7..5f03d67092331 100644 --- a/src/plugins/event_annotation_listing/public/components/group_editor_flyout/group_preview.tsx +++ b/src/plugins/event_annotation_listing/public/components/group_editor_flyout/group_preview.tsx @@ -198,28 +198,25 @@ export const GroupPreview = ({ justifyContent="center" > -
div { height: 400px; width: 100%; } `} - > - - setChartTimeRange({ - from: new Date(range[0]).toISOString(), - to: new Date(range[1]).toISOString(), - }) - } - searchSessionId={searchSessionId} - /> -
+ data-test-subj="chart" + id="annotation-library-preview" + timeRange={chartTimeRange} + attributes={lensAttributes} + onBrushEnd={({ range }) => + setChartTimeRange({ + from: new Date(range[0]).toISOString(), + to: new Date(range[1]).toISOString(), + }) + } + searchSessionId={searchSessionId} + />
) : ( diff --git a/src/plugins/expressions/public/react_expression_renderer/use_expression_renderer.ts b/src/plugins/expressions/public/react_expression_renderer/use_expression_renderer.ts index 2d5f5d6ddd493..06d588263869f 100644 --- a/src/plugins/expressions/public/react_expression_renderer/use_expression_renderer.ts +++ b/src/plugins/expressions/public/react_expression_renderer/use_expression_renderer.ts @@ -26,7 +26,7 @@ export interface ExpressionRendererParams extends IExpressionLoaderParams { debounce?: number; expression: string | ExpressionAstExpression; hasCustomErrorRenderer?: boolean; - onData$?( + onData$?( data: TData, adapters?: TInspectorAdapters, partial?: boolean diff --git a/src/plugins/navigation/public/mocks.ts b/src/plugins/navigation/public/mocks.tsx similarity index 54% rename from src/plugins/navigation/public/mocks.ts rename to src/plugins/navigation/public/mocks.tsx index b9977daf56223..5f9f1476b4648 100644 --- a/src/plugins/navigation/public/mocks.ts +++ b/src/plugins/navigation/public/mocks.tsx @@ -6,13 +6,24 @@ * your election, the "Elastic License 2.0", the "GNU Affero General Public * License v3.0 only", or the "Server Side Public License, v 1". */ - +import React from 'react'; import { of } from 'rxjs'; +import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { Plugin } from '.'; +import { createTopNav } from './top_nav_menu'; export type Setup = jest.Mocked>; export type Start = jest.Mocked>; +// mock mountPointPortal +jest.mock('@kbn/react-kibana-mount', () => { + const original = jest.requireActual('@kbn/react-kibana-mount'); + return { + ...original, + MountPointPortal: jest.fn(({ children }) => children), + }; +}); + const createSetupContract = (): jest.Mocked => { const setupContract = { registerMenuItem: jest.fn(), @@ -21,12 +32,21 @@ const createSetupContract = (): jest.Mocked => { return setupContract; }; +export const unifiedSearchMock = { + ui: { + SearchBar: () =>
, + AggregateQuerySearchBar: () =>
, + }, +} as unknown as UnifiedSearchPublicPluginStart; + const createStartContract = (): jest.Mocked => { const startContract = { ui: { - TopNavMenu: jest.fn(), - createTopNavWithCustomContext: jest.fn().mockImplementation(() => jest.fn()), - AggregateQueryTopNavMenu: jest.fn(), + TopNavMenu: jest.fn().mockImplementation(createTopNav(unifiedSearchMock, [])), + AggregateQueryTopNavMenu: jest.fn().mockImplementation(createTopNav(unifiedSearchMock, [])), + createTopNavWithCustomContext: jest + .fn() + .mockImplementation(createTopNav(unifiedSearchMock, [])), }, addSolutionNavigation: jest.fn(), isSolutionNavEnabled$: of(false), diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx index dff09fa0bac38..5ad6e2bbe5dd4 100644 --- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx +++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx @@ -14,16 +14,9 @@ import { MountPoint } from '@kbn/core/public'; import { TopNavMenu } from './top_nav_menu'; import { TopNavMenuData } from './top_nav_menu_data'; import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; -import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { EuiToolTipProps } from '@elastic/eui'; import type { TopNavMenuBadgeProps } from './top_nav_menu_badges'; - -const unifiedSearch = { - ui: { - SearchBar: () =>
, - AggregateQuerySearchBar: () =>
, - }, -} as unknown as UnifiedSearchPublicPluginStart; +import { unifiedSearchMock } from '../mocks'; describe('TopNavMenu', () => { const WRAPPER_SELECTOR = '.kbnTopNavMenu__wrapper'; @@ -97,7 +90,7 @@ describe('TopNavMenu', () => { it('Should render search bar', () => { const component = mountWithIntl( - + ); expect(component.find(WRAPPER_SELECTOR).length).toBe(1); expect(component.find(TOP_NAV_ITEM_SELECTOR).length).toBe(0); @@ -110,7 +103,7 @@ describe('TopNavMenu', () => { appName={'test'} config={menuItems} showSearchBar={true} - unifiedSearch={unifiedSearch} + unifiedSearch={unifiedSearchMock} /> ); expect(component.find(WRAPPER_SELECTOR).length).toBe(1); @@ -124,7 +117,7 @@ describe('TopNavMenu', () => { appName={'test'} config={menuItems} showSearchBar={true} - unifiedSearch={unifiedSearch} + unifiedSearch={unifiedSearchMock} className={'myCoolClass'} /> ); @@ -172,7 +165,7 @@ describe('TopNavMenu', () => { appName={'test'} config={menuItems} showSearchBar={true} - unifiedSearch={unifiedSearch} + unifiedSearch={unifiedSearchMock} setMenuMountPoint={setMountPoint} /> ); @@ -195,7 +188,7 @@ describe('TopNavMenu', () => { appName={'test'} badges={badges} showSearchBar={true} - unifiedSearch={unifiedSearch} + unifiedSearch={unifiedSearchMock} setMenuMountPoint={setMountPoint} /> ); diff --git a/src/plugins/unified_histogram/public/chart/chart.tsx b/src/plugins/unified_histogram/public/chart/chart.tsx index 4fb1b9cbe6471..164d1eb539e3c 100644 --- a/src/plugins/unified_histogram/public/chart/chart.tsx +++ b/src/plugins/unified_histogram/public/chart/chart.tsx @@ -8,7 +8,6 @@ */ import React, { memo, ReactElement, useCallback, useEffect, useMemo, useState } from 'react'; -import type { Observable } from 'rxjs'; import { Subject } from 'rxjs'; import useObservable from 'react-use/lib/useObservable'; import { IconButtonGroup, type IconButtonGroupProps } from '@kbn/shared-ux-button-toolbar'; @@ -70,7 +69,7 @@ export interface ChartProps { disabledActions?: LensEmbeddableInput['disabledActions']; input$?: UnifiedHistogramInput$; lensAdapters?: UnifiedHistogramChartLoadEvent['adapters']; - lensEmbeddableOutput$?: Observable; + dataLoading$?: LensEmbeddableOutput['dataLoading']; isChartLoading?: boolean; onChartHiddenChange?: (chartHidden: boolean) => void; onTimeIntervalChange?: (timeInterval: string) => void; @@ -105,7 +104,7 @@ export function Chart({ disabledActions, input$: originalInput$, lensAdapters, - lensEmbeddableOutput$, + dataLoading$, isChartLoading, onChartHiddenChange, onTimeIntervalChange, @@ -383,9 +382,7 @@ export function Chart({ )} {canSaveVisualization && isSaveModalVisible && visContext.attributes && ( {}} onClose={() => setIsSaveModalVisible(false)} isSaveable={false} @@ -393,18 +390,16 @@ export function Chart({ )} {isFlyoutVisible && !!visContext && !!lensVisServiceCurrentSuggestionContext && ( )} diff --git a/src/plugins/unified_histogram/public/chart/chart_config_panel.tsx b/src/plugins/unified_histogram/public/chart/chart_config_panel.tsx index f2d080fcf0e6c..edcd831d3f7ac 100644 --- a/src/plugins/unified_histogram/public/chart/chart_config_panel.tsx +++ b/src/plugins/unified_histogram/public/chart/chart_config_panel.tsx @@ -8,7 +8,6 @@ */ import React, { ComponentProps, useCallback, useEffect, useRef, useState } from 'react'; -import type { Observable } from 'rxjs'; import type { AggregateQuery, Query } from '@kbn/es-query'; import { isEqual, isObject } from 'lodash'; import type { LensEmbeddableOutput, Suggestion } from '@kbn/lens-plugin/public'; @@ -29,7 +28,7 @@ export function ChartConfigPanel({ services, visContext, lensAdapters, - lensEmbeddableOutput$, + dataLoading$, currentSuggestionContext, isFlyoutVisible, setIsFlyoutVisible, @@ -42,7 +41,7 @@ export function ChartConfigPanel({ isFlyoutVisible: boolean; setIsFlyoutVisible: (flag: boolean) => void; lensAdapters?: UnifiedHistogramChartLoadEvent['adapters']; - lensEmbeddableOutput$?: Observable; + dataLoading$?: LensEmbeddableOutput['dataLoading']; currentSuggestionContext: UnifiedHistogramSuggestionContext; isPlainRecord?: boolean; query?: Query | AggregateQuery; @@ -108,7 +107,7 @@ export function ChartConfigPanel({ updateSuggestion={updateSuggestion} updatePanelState={updatePanelState} lensAdapters={lensAdapters} - output$={lensEmbeddableOutput$} + dataLoading$={dataLoading$} displayFlyoutHeader closeFlyout={() => { setIsFlyoutVisible(false); @@ -141,7 +140,7 @@ export function ChartConfigPanel({ isFlyoutVisible, setIsFlyoutVisible, lensAdapters, - lensEmbeddableOutput$, + dataLoading$, currentSuggestionType, ]); diff --git a/src/plugins/unified_histogram/public/chart/histogram.test.tsx b/src/plugins/unified_histogram/public/chart/histogram.test.tsx index 72b5c0cc0b791..7bef5d4f85554 100644 --- a/src/plugins/unified_histogram/public/chart/histogram.test.tsx +++ b/src/plugins/unified_histogram/public/chart/histogram.test.tsx @@ -10,7 +10,7 @@ import { mountWithIntl } from '@kbn/test-jest-helpers'; import { Histogram } from './histogram'; import React from 'react'; -import { of, Subject } from 'rxjs'; +import { BehaviorSubject, Subject } from 'rxjs'; import { unifiedHistogramServicesMock } from '../__mocks__/services'; import { getLensVisMock } from '../__mocks__/lens_vis'; import { dataViewWithTimefieldMock } from '../__mocks__/data_view_with_timefield'; @@ -101,7 +101,7 @@ describe('Histogram', () => { searchSessionId: props.request.searchSessionId, getTimeRange: props.getTimeRange, attributes: (await getMockLensAttributes())!.attributes, - onLoad: lensProps.onLoad, + onLoad: lensProps.onLoad!, }); expect(lensProps).toMatchObject(expect.objectContaining(originalProps)); component.setProps({ request: { ...props.request, searchSessionId: '321' } }).update(); @@ -120,7 +120,7 @@ describe('Histogram', () => { it('should execute onLoad correctly', async () => { const { component, props } = await mountComponent(); const embeddable = unifiedHistogramServicesMock.lens.EmbeddableComponent; - const onLoad = component.find(embeddable).props().onLoad; + const onLoad = component.find(embeddable).props().onLoad!; const adapters = createDefaultInspectorAdapters(); adapters.tables.tables.unifiedHistogram = { meta: { statistics: { totalCount: 100 } } } as any; const rawResponse = { @@ -172,25 +172,25 @@ describe('Histogram', () => { jest .spyOn(adapters.requests, 'getRequests') .mockReturnValue([{ response: { json: { rawResponse } } } as any]); - const embeddableOutput$ = jest.fn().mockReturnValue(of('output$')); - onLoad(true, undefined, embeddableOutput$); + const dataLoading$ = new BehaviorSubject(false); + onLoad(true, undefined, dataLoading$); expect(props.onTotalHitsChange).toHaveBeenLastCalledWith( UnifiedHistogramFetchStatus.loading, undefined ); - expect(props.onChartLoad).toHaveBeenLastCalledWith({ adapters: {}, embeddableOutput$ }); + expect(props.onChartLoad).toHaveBeenLastCalledWith({ adapters: {}, dataLoading$ }); expect(buildBucketInterval.buildBucketInterval).not.toHaveBeenCalled(); expect(useTimeRange.useTimeRange).toHaveBeenLastCalledWith( expect.objectContaining({ bucketInterval: undefined }) ); act(() => { - onLoad(false, adapters, embeddableOutput$); + onLoad?.(false, adapters, dataLoading$); }); expect(props.onTotalHitsChange).toHaveBeenLastCalledWith( UnifiedHistogramFetchStatus.complete, 100 ); - expect(props.onChartLoad).toHaveBeenLastCalledWith({ adapters, embeddableOutput$ }); + expect(props.onChartLoad).toHaveBeenLastCalledWith({ adapters, dataLoading$ }); expect(buildBucketInterval.buildBucketInterval).toHaveBeenCalled(); expect(useTimeRange.useTimeRange).toHaveBeenLastCalledWith( expect.objectContaining({ bucketInterval: mockBucketInterval }) @@ -200,12 +200,12 @@ describe('Histogram', () => { it('should execute onLoad correctly when the request has a failure status', async () => { const { component, props } = await mountComponent(); const embeddable = unifiedHistogramServicesMock.lens.EmbeddableComponent; - const onLoad = component.find(embeddable).props().onLoad; + const onLoad = component.find(embeddable).props().onLoad!; const adapters = createDefaultInspectorAdapters(); jest .spyOn(adapters.requests, 'getRequests') .mockReturnValue([{ status: RequestStatus.ERROR } as any]); - onLoad(false, adapters); + onLoad?.(false, adapters); expect(props.onTotalHitsChange).toHaveBeenLastCalledWith( UnifiedHistogramFetchStatus.error, undefined @@ -216,7 +216,7 @@ describe('Histogram', () => { it('should execute onLoad correctly when the response has shard failures', async () => { const { component, props } = await mountComponent(); const embeddable = unifiedHistogramServicesMock.lens.EmbeddableComponent; - const onLoad = component.find(embeddable).props().onLoad; + const onLoad = component.find(embeddable).props().onLoad!; const adapters = createDefaultInspectorAdapters(); adapters.tables.tables.unifiedHistogram = { meta: { statistics: { totalCount: 100 } } } as any; const rawResponse = { @@ -237,7 +237,7 @@ describe('Histogram', () => { .spyOn(adapters.requests, 'getRequests') .mockReturnValue([{ response: { json: { rawResponse } } } as any]); act(() => { - onLoad(false, adapters); + onLoad?.(false, adapters); }); expect(props.onTotalHitsChange).toHaveBeenLastCalledWith( UnifiedHistogramFetchStatus.error, @@ -249,7 +249,7 @@ describe('Histogram', () => { it('should execute onLoad correctly for textbased language and no Lens suggestions', async () => { const { component, props } = await mountComponent(true, false); const embeddable = unifiedHistogramServicesMock.lens.EmbeddableComponent; - const onLoad = component.find(embeddable).props().onLoad; + const onLoad = component.find(embeddable).props().onLoad!; const adapters = createDefaultInspectorAdapters(); adapters.tables.tables.layerId = { meta: { type: 'es_ql' }, @@ -273,7 +273,7 @@ describe('Histogram', () => { ], } as any; act(() => { - onLoad(false, adapters); + onLoad?.(false, adapters); }); expect(props.onTotalHitsChange).toHaveBeenLastCalledWith( UnifiedHistogramFetchStatus.complete, @@ -285,7 +285,7 @@ describe('Histogram', () => { it('should execute onLoad correctly for textbased language and Lens suggestions', async () => { const { component, props } = await mountComponent(true, true); const embeddable = unifiedHistogramServicesMock.lens.EmbeddableComponent; - const onLoad = component.find(embeddable).props().onLoad; + const onLoad = component.find(embeddable).props().onLoad!; const adapters = createDefaultInspectorAdapters(); adapters.tables.tables.layerId = { meta: { type: 'es_ql' }, @@ -309,7 +309,7 @@ describe('Histogram', () => { ], } as any; act(() => { - onLoad(false, adapters); + onLoad?.(false, adapters); }); expect(props.onTotalHitsChange).toHaveBeenLastCalledWith( UnifiedHistogramFetchStatus.complete, diff --git a/src/plugins/unified_histogram/public/chart/histogram.tsx b/src/plugins/unified_histogram/public/chart/histogram.tsx index 7e8c6ea382bd4..8e3aa78da8d9d 100644 --- a/src/plugins/unified_histogram/public/chart/histogram.tsx +++ b/src/plugins/unified_histogram/public/chart/histogram.tsx @@ -10,18 +10,15 @@ import { useEuiTheme } from '@elastic/eui'; import { css } from '@emotion/react'; import React, { useState } from 'react'; -import type { DataView, DataViewSpec } from '@kbn/data-views-plugin/public'; +import type { DataView } from '@kbn/data-views-plugin/public'; import type { DefaultInspectorAdapters, Datatable } from '@kbn/expressions-plugin/common'; import type { IKibanaSearchResponse } from '@kbn/search-types'; import type { estypes } from '@elastic/elasticsearch'; import type { TimeRange } from '@kbn/es-query'; -import { - EmbeddableComponentProps, - LensEmbeddableInput, - LensEmbeddableOutput, -} from '@kbn/lens-plugin/public'; +import type { EmbeddableComponentProps, LensEmbeddableInput } from '@kbn/lens-plugin/public'; import { RequestStatus } from '@kbn/inspector-plugin/public'; import type { Observable } from 'rxjs'; +import { PublishingSubject } from '@kbn/presentation-publishing'; import { UnifiedHistogramBucketInterval, UnifiedHistogramChartContext, @@ -59,32 +56,6 @@ export interface HistogramProps { withDefaultActions: EmbeddableComponentProps['withDefaultActions']; } -/** - * To prevent flakiness in the chart, we need to ensure that the data view config is valid. - * This requires that there are not multiple different data view ids in the given configuration. - * @param dataView - * @param visContext - * @param adHocDataViews - */ -const checkValidDataViewConfig = ( - dataView: DataView, - visContext: UnifiedHistogramVisContext, - adHocDataViews: { [key: string]: DataViewSpec } | undefined -) => { - if (!dataView.id) { - return false; - } - - if (!dataView.isPersisted() && !adHocDataViews?.[dataView.id]) { - return false; - } - - if (dataView.id !== visContext.requestData.dataViewId) { - return false; - } - return true; -}; - const computeTotalHits = ( hasLensSuggestions: boolean, adapterTables: @@ -147,7 +118,7 @@ export function Histogram({ ( isLoading: boolean, adapters: Partial | undefined, - lensEmbeddableOutput$?: Observable + dataLoading$?: PublishingSubject ) => { const lensRequest = adapters?.requests?.getRequests()[0]; const requestFailed = lensRequest?.status === RequestStatus.ERROR; @@ -186,7 +157,7 @@ export function Histogram({ setBucketInterval(newBucketInterval); } - onChartLoad?.({ adapters: adapters ?? {}, embeddableOutput$: lensEmbeddableOutput$ }); + onChartLoad?.({ adapters: adapters ?? {}, dataLoading$ }); } ); @@ -230,10 +201,6 @@ export function Histogram({ } `; - if (!checkValidDataViewConfig(dataView, visContext, lensProps.attributes.state.adHocDataViews)) { - return <>; - } - return ( <>
{ "hidden": false, "timeInterval": "auto", }, + "dataLoading$": undefined, "hits": Object { "status": "uninitialized", "total": undefined, @@ -120,7 +121,6 @@ describe('useStateProps', () => { }, }, }, - "lensEmbeddableOutput$": undefined, "onBreakdownFieldChange": [Function], "onChartHiddenChange": [Function], "onChartLoad": [Function], @@ -164,6 +164,7 @@ describe('useStateProps', () => { "hidden": false, "timeInterval": "auto", }, + "dataLoading$": undefined, "hits": Object { "status": "uninitialized", "total": undefined, @@ -204,7 +205,6 @@ describe('useStateProps', () => { }, }, }, - "lensEmbeddableOutput$": undefined, "onBreakdownFieldChange": [Function], "onChartHiddenChange": [Function], "onChartLoad": [Function], @@ -348,6 +348,7 @@ describe('useStateProps', () => { Object { "breakdown": undefined, "chart": undefined, + "dataLoading$": undefined, "hits": Object { "status": "uninitialized", "total": undefined, @@ -388,7 +389,6 @@ describe('useStateProps', () => { }, }, }, - "lensEmbeddableOutput$": undefined, "onBreakdownFieldChange": [Function], "onChartHiddenChange": [Function], "onChartLoad": [Function], @@ -427,6 +427,7 @@ describe('useStateProps', () => { Object { "breakdown": undefined, "chart": undefined, + "dataLoading$": undefined, "hits": Object { "status": "uninitialized", "total": undefined, @@ -467,7 +468,6 @@ describe('useStateProps', () => { }, }, }, - "lensEmbeddableOutput$": undefined, "onBreakdownFieldChange": [Function], "onChartHiddenChange": [Function], "onChartLoad": [Function], diff --git a/src/plugins/unified_histogram/public/container/hooks/use_state_props.ts b/src/plugins/unified_histogram/public/container/hooks/use_state_props.ts index fcc19fcd78a00..660e47f33cf0c 100644 --- a/src/plugins/unified_histogram/public/container/hooks/use_state_props.ts +++ b/src/plugins/unified_histogram/public/container/hooks/use_state_props.ts @@ -27,7 +27,7 @@ import { totalHitsResultSelector, totalHitsStatusSelector, lensAdaptersSelector, - lensEmbeddableOutputSelector$, + lensDataLoadingSelector$, } from '../utils/state_selectors'; import { useStateSelector } from '../utils/use_state_selector'; @@ -52,10 +52,7 @@ export const useStateProps = ({ const totalHitsResult = useStateSelector(stateService?.state$, totalHitsResultSelector); const totalHitsStatus = useStateSelector(stateService?.state$, totalHitsStatusSelector); const lensAdapters = useStateSelector(stateService?.state$, lensAdaptersSelector); - const lensEmbeddableOutput$ = useStateSelector( - stateService?.state$, - lensEmbeddableOutputSelector$ - ); + const lensDataLoading$ = useStateSelector(stateService?.state$, lensDataLoadingSelector$); /** * Contexts */ @@ -162,7 +159,7 @@ export const useStateProps = ({ // We need to store the Lens request adapter in order to inspect its requests stateService?.setLensRequestAdapter(event.adapters.requests); stateService?.setLensAdapters(event.adapters); - stateService?.setLensEmbeddableOutput$(event.embeddableOutput$); + stateService?.setLensDataLoading$(event.dataLoading$); }, [stateService] ); @@ -199,7 +196,7 @@ export const useStateProps = ({ request, isPlainRecord, lensAdapters, - lensEmbeddableOutput$, + dataLoading$: lensDataLoading$, onTopPanelHeightChange, onTimeIntervalChange, onTotalHitsChange, diff --git a/src/plugins/unified_histogram/public/container/services/state_service.test.ts b/src/plugins/unified_histogram/public/container/services/state_service.test.ts index dcce90037ec99..66f0549e9571f 100644 --- a/src/plugins/unified_histogram/public/container/services/state_service.test.ts +++ b/src/plugins/unified_histogram/public/container/services/state_service.test.ts @@ -139,8 +139,8 @@ describe('UnifiedHistogramStateService', () => { stateService.setLensAdapters(undefined); newState = { ...newState, lensAdapters: undefined }; expect(state).toEqual(newState); - stateService.setLensEmbeddableOutput$(undefined); - newState = { ...newState, lensEmbeddableOutput$: undefined }; + stateService.setLensDataLoading$(undefined); + newState = { ...newState, dataLoading$: undefined }; expect(state).toEqual(newState); stateService.setTotalHits({ totalHitsStatus: UnifiedHistogramFetchStatus.complete, diff --git a/src/plugins/unified_histogram/public/container/services/state_service.ts b/src/plugins/unified_histogram/public/container/services/state_service.ts index 551773cfe1892..c3cf82bf94578 100644 --- a/src/plugins/unified_histogram/public/container/services/state_service.ts +++ b/src/plugins/unified_histogram/public/container/services/state_service.ts @@ -8,8 +8,8 @@ */ import type { RequestAdapter } from '@kbn/inspector-plugin/common'; -import type { LensEmbeddableOutput } from '@kbn/lens-plugin/public'; import { BehaviorSubject, Observable } from 'rxjs'; +import { PublishingSubject } from '@kbn/presentation-publishing'; import { UnifiedHistogramFetchStatus } from '../..'; import type { UnifiedHistogramServices, UnifiedHistogramChartLoadEvent } from '../../types'; import { @@ -49,7 +49,7 @@ export interface UnifiedHistogramState { /** * Lens embeddable output observable */ - lensEmbeddableOutput$?: Observable; + dataLoading$?: PublishingSubject; /** * The current time interval of the chart */ @@ -124,9 +124,7 @@ export interface UnifiedHistogramStateService { * Sets the current Lens adapters */ setLensAdapters: (lensAdapters: UnifiedHistogramChartLoadEvent['adapters'] | undefined) => void; - setLensEmbeddableOutput$: ( - lensEmbeddableOutput$: Observable | undefined - ) => void; + setLensDataLoading$: (dataLoading$: PublishingSubject | undefined) => void; /** * Sets the current total hits status and result */ @@ -214,10 +212,8 @@ export const createStateService = ( setLensAdapters: (lensAdapters: UnifiedHistogramChartLoadEvent['adapters'] | undefined) => { updateState({ lensAdapters }); }, - setLensEmbeddableOutput$: ( - lensEmbeddableOutput$: Observable | undefined - ) => { - updateState({ lensEmbeddableOutput$ }); + setLensDataLoading$: (dataLoading$: PublishingSubject | undefined) => { + updateState({ dataLoading$ }); }, setTotalHits: (totalHits: { diff --git a/src/plugins/unified_histogram/public/container/utils/state_selectors.ts b/src/plugins/unified_histogram/public/container/utils/state_selectors.ts index 6eacbaaef9500..9274c4fabd301 100644 --- a/src/plugins/unified_histogram/public/container/utils/state_selectors.ts +++ b/src/plugins/unified_histogram/public/container/utils/state_selectors.ts @@ -16,5 +16,4 @@ export const topPanelHeightSelector = (state: UnifiedHistogramState) => state.to export const totalHitsResultSelector = (state: UnifiedHistogramState) => state.totalHitsResult; export const totalHitsStatusSelector = (state: UnifiedHistogramState) => state.totalHitsStatus; export const lensAdaptersSelector = (state: UnifiedHistogramState) => state.lensAdapters; -export const lensEmbeddableOutputSelector$ = (state: UnifiedHistogramState) => - state.lensEmbeddableOutput$; +export const lensDataLoadingSelector$ = (state: UnifiedHistogramState) => state.dataLoading$; diff --git a/src/plugins/unified_histogram/public/layout/layout.tsx b/src/plugins/unified_histogram/public/layout/layout.tsx index 3e34cf4ee69b3..b9d9f6fbc446f 100644 --- a/src/plugins/unified_histogram/public/layout/layout.tsx +++ b/src/plugins/unified_histogram/public/layout/layout.tsx @@ -9,7 +9,6 @@ import { EuiSpacer, useEuiTheme, useIsWithinBreakpoints } from '@elastic/eui'; import React, { PropsWithChildren, ReactElement, useEffect, useMemo, useState } from 'react'; -import { Observable } from 'rxjs'; import useObservable from 'react-use/lib/useObservable'; import { createHtmlPortalNode, InPortal, OutPortal } from 'react-reverse-portal'; import { css } from '@emotion/css'; @@ -99,7 +98,7 @@ export interface UnifiedHistogramLayoutProps extends PropsWithChildren */ hits?: UnifiedHistogramHitsContext; lensAdapters?: UnifiedHistogramChartLoadEvent['adapters']; - lensEmbeddableOutput$?: Observable; + dataLoading$?: LensEmbeddableOutput['dataLoading']; /** * Context object for the chart -- leave undefined to hide the chart */ @@ -214,7 +213,7 @@ export const UnifiedHistogramLayout = ({ request, hits, lensAdapters, - lensEmbeddableOutput$, + dataLoading$, chart: originalChart, breakdown, container, @@ -372,7 +371,7 @@ export const UnifiedHistogramLayout = ({ onFilter={onFilter} onBrushEnd={onBrushEnd} lensAdapters={lensAdapters} - lensEmbeddableOutput$={lensEmbeddableOutput$} + dataLoading$={dataLoading$} withDefaultActions={withDefaultActions} columns={columns} /> diff --git a/src/plugins/unified_histogram/public/services/lens_vis_service.attributes.test.ts b/src/plugins/unified_histogram/public/services/lens_vis_service.attributes.test.ts index babea0335e1c3..f338ef955c01e 100644 --- a/src/plugins/unified_histogram/public/services/lens_vis_service.attributes.test.ts +++ b/src/plugins/unified_histogram/public/services/lens_vis_service.attributes.test.ts @@ -108,6 +108,7 @@ describe('LensVisService attributes', () => { "sourceField": "timestamp", }, }, + "indexPatternId": "index-pattern-with-timefield-id", }, }, }, @@ -284,6 +285,7 @@ describe('LensVisService attributes', () => { "sourceField": "timestamp", }, }, + "indexPatternId": "index-pattern-with-timefield-id", }, }, }, @@ -434,6 +436,7 @@ describe('LensVisService attributes', () => { "sourceField": "timestamp", }, }, + "indexPatternId": "index-pattern-with-timefield-id", }, }, }, diff --git a/src/plugins/unified_histogram/public/services/lens_vis_service.ts b/src/plugins/unified_histogram/public/services/lens_vis_service.ts index 1f119ee5b1c92..5342ef4723b13 100644 --- a/src/plugins/unified_histogram/public/services/lens_vis_service.ts +++ b/src/plugins/unified_histogram/public/services/lens_vis_service.ts @@ -403,7 +403,7 @@ export class LensVisService { const datasourceState = { layers: { - [UNIFIED_HISTOGRAM_LAYER_ID]: { columnOrder, columns }, + [UNIFIED_HISTOGRAM_LAYER_ID]: { columnOrder, columns, indexPatternId: dataView.id }, }, }; diff --git a/src/plugins/unified_histogram/public/types.ts b/src/plugins/unified_histogram/public/types.ts index b777fe89a348e..a64000da11df0 100644 --- a/src/plugins/unified_histogram/public/types.ts +++ b/src/plugins/unified_histogram/public/types.ts @@ -10,19 +10,15 @@ import type { IUiSettingsClient, Capabilities } from '@kbn/core/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; -import type { - LensEmbeddableOutput, - LensPublicStart, - TypedLensByValueInput, - Suggestion, -} from '@kbn/lens-plugin/public'; +import type { LensPublicStart, TypedLensByValueInput, Suggestion } from '@kbn/lens-plugin/public'; import type { DataViewField } from '@kbn/data-views-plugin/public'; import type { RequestAdapter } from '@kbn/inspector-plugin/public'; import type { DefaultInspectorAdapters } from '@kbn/expressions-plugin/common'; -import type { Observable, Subject } from 'rxjs'; +import type { Subject } from 'rxjs'; import type { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import type { Storage } from '@kbn/kibana-utils-plugin/public'; import type { ExpressionsStart } from '@kbn/expressions-plugin/public'; +import { PublishingSubject } from '@kbn/presentation-publishing'; /** * The fetch status of a Unified Histogram request @@ -72,9 +68,9 @@ export interface UnifiedHistogramChartLoadEvent { */ adapters: UnifiedHistogramAdapters; /** - * Observable of the lens embeddable output + * Observable for the data change subscription */ - embeddableOutput$?: Observable; + dataLoading$?: PublishingSubject; } /** diff --git a/src/plugins/unified_histogram/public/utils/external_vis_context.ts b/src/plugins/unified_histogram/public/utils/external_vis_context.ts index ef5788b4b25ba..29e393d145087 100644 --- a/src/plugins/unified_histogram/public/utils/external_vis_context.ts +++ b/src/plugins/unified_histogram/public/utils/external_vis_context.ts @@ -43,7 +43,7 @@ export const exportVisContext = ( ? { suggestionType: visContext.suggestionType, requestData: visContext.requestData, - attributes: removeTablesFromLensAttributes(visContext.attributes), + attributes: removeTablesFromLensAttributes(visContext.attributes).attributes, } : undefined; diff --git a/src/plugins/unified_histogram/public/utils/lens_vis_from_table.ts b/src/plugins/unified_histogram/public/utils/lens_vis_from_table.ts index 95693851db52e..bc618343a0a70 100644 --- a/src/plugins/unified_histogram/public/utils/lens_vis_from_table.ts +++ b/src/plugins/unified_histogram/public/utils/lens_vis_from_table.ts @@ -10,6 +10,7 @@ import type { Datatable } from '@kbn/expressions-plugin/common'; import type { LensAttributes } from '@kbn/lens-embeddable-utils'; import type { TextBasedPersistedState } from '@kbn/lens-plugin/public/datasources/text_based/types'; +import type { TypedLensByValueInput } from '@kbn/lens-plugin/public'; export const enrichLensAttributesWithTablesData = ({ attributes, @@ -53,6 +54,8 @@ export const enrichLensAttributesWithTablesData = ({ return updatedAttributes; }; -export const removeTablesFromLensAttributes = (attributes: LensAttributes): LensAttributes => { - return enrichLensAttributesWithTablesData({ attributes, table: undefined }); +export const removeTablesFromLensAttributes = ( + attributes: LensAttributes +): TypedLensByValueInput => { + return { attributes: enrichLensAttributesWithTablesData({ attributes, table: undefined }) }; }; diff --git a/src/plugins/unified_histogram/tsconfig.json b/src/plugins/unified_histogram/tsconfig.json index d14adf53889b9..68c096665eb79 100644 --- a/src/plugins/unified_histogram/tsconfig.json +++ b/src/plugins/unified_histogram/tsconfig.json @@ -33,6 +33,7 @@ "@kbn/discover-utils", "@kbn/visualization-utils", "@kbn/search-types", + "@kbn/presentation-publishing", "@kbn/data-view-utils", ], "exclude": [ diff --git a/test/functional/apps/dashboard/group6/dashboard_esql_chart.ts b/test/functional/apps/dashboard/group6/dashboard_esql_chart.ts index 35b7db4fabfc6..faaacc48fe97c 100644 --- a/test/functional/apps/dashboard/group6/dashboard_esql_chart.ts +++ b/test/functional/apps/dashboard/group6/dashboard_esql_chart.ts @@ -18,6 +18,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const monacoEditor = getService('monacoEditor'); const dashboardAddPanel = getService('dashboardAddPanel'); + const dashboardPanelActions = getService('dashboardPanelActions'); + const log = getService('log'); describe('dashboard add ES|QL chart', function () { before(async () => { @@ -30,6 +32,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); + after(async () => { + await dashboard.navigateToApp(); + await testSubjects.click('discard-unsaved-New-Dashboard'); + }); + it('should add an ES|QL datatable chart when the ES|QL panel action is clicked', async () => { await dashboard.navigateToApp(); await dashboard.clickNewDashboard(); @@ -57,6 +64,47 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); + it('should reset to the previous state on edit inline', async () => { + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAddNewPanelFromUIActionLink('ES|QL'); + await dashboardAddPanel.expectEditorMenuClosed(); + await dashboard.waitForRenderComplete(); + + // Save the panel and close the flyout + log.debug('Applies the changes'); + await testSubjects.click('applyFlyoutButton'); + + // now edit the panel and click on Cancel + await dashboardPanelActions.clickInlineEdit(); + + const metricsConfigured = await testSubjects.findAll( + 'lnsDatatable_metrics > lnsLayerPanel-dimensionLink' + ); + // remove the first metric from the configuration + // Lens is x-pack so not available here, make things manually + await testSubjects.moveMouseTo(`lnsDatatable_metrics > indexPattern-dimension-remove`); + await testSubjects.click(`lnsDatatable_metrics > indexPattern-dimension-remove`); + const beforeCancelMetricsConfigured = await testSubjects.findAll( + 'lnsDatatable_metrics > lnsLayerPanel-dimensionLink' + ); + expect(beforeCancelMetricsConfigured.length).to.eql(metricsConfigured.length - 1); + + // now click cancel + await testSubjects.click('cancelFlyoutButton'); + await dashboard.waitForRenderComplete(); + + // re open the inline editor and check that the configured metrics are still the original ones + await dashboardPanelActions.clickInlineEdit(); + const afterCancelMetricsConfigured = await testSubjects.findAll( + 'lnsDatatable_metrics > lnsLayerPanel-dimensionLink' + ); + expect(afterCancelMetricsConfigured.length).to.eql(metricsConfigured.length); + // delete the panel + await testSubjects.click('cancelFlyoutButton'); + const panels = await dashboard.getDashboardPanels(); + await dashboardPanelActions.removePanel(panels[0]); + }); + it('should be able to edit the query and render another chart', async () => { await dashboardAddPanel.clickEditorMenuButton(); await dashboardAddPanel.clickAddNewPanelFromUIActionLink('ES|QL'); @@ -70,5 +118,41 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.click('applyFlyoutButton'); expect(await testSubjects.exists('mtrVis')).to.be(true); }); + + it('should add a second panel and remove when hitting cancel', async () => { + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAddNewPanelFromUIActionLink('ES|QL'); + await dashboardAddPanel.expectEditorMenuClosed(); + await dashboard.waitForRenderComplete(); + // Cancel + await testSubjects.click('cancelFlyoutButton'); + // Test that there's only 1 panel left + await dashboard.waitForRenderComplete(); + await retry.try(async () => { + const panelCount = await dashboard.getPanelCount(); + expect(panelCount).to.eql(1); + }); + }); + + it('should not remove the first panel of two when editing and cancelling', async () => { + // add a second panel + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAddNewPanelFromUIActionLink('ES|QL'); + await dashboardAddPanel.expectEditorMenuClosed(); + await dashboard.waitForRenderComplete(); + // save it + await testSubjects.click('applyFlyoutButton'); + await dashboard.waitForRenderComplete(); + + // now edit the first one + const [firstPanel] = await dashboard.getDashboardPanels(); + await dashboardPanelActions.clickInlineEdit(firstPanel); + await testSubjects.click('cancelFlyoutButton'); + await dashboard.waitForRenderComplete(); + await retry.try(async () => { + const panelCount = await dashboard.getPanelCount(); + expect(panelCount).to.eql(2); + }); + }); }); } diff --git a/test/functional/apps/dashboard/group6/dashboard_esql_no_data.ts b/test/functional/apps/dashboard/group6/dashboard_esql_no_data.ts index 333ac7f015397..4298ccdfb5886 100644 --- a/test/functional/apps/dashboard/group6/dashboard_esql_no_data.ts +++ b/test/functional/apps/dashboard/group6/dashboard_esql_no_data.ts @@ -31,7 +31,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.expectOnDashboard('New Dashboard'); expect(await testSubjects.exists('lnsVisualizationContainer')).to.be(true); - await panelActions.clickInlineEdit(); + await panelActions.clickEdit(); const editorValue = await monacoEditor.getCodeEditorValue(); expect(editorValue).to.eql(`FROM logs* | LIMIT 10`); }); diff --git a/test/functional/apps/discover/esql/_esql_view.ts b/test/functional/apps/discover/esql/_esql_view.ts index d27df2244b18b..65d8b7ce698b6 100644 --- a/test/functional/apps/discover/esql/_esql_view.ts +++ b/test/functional/apps/discover/esql/_esql_view.ts @@ -383,6 +383,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); await testSubjects.click('querySubmitButton'); await header.waitUntilLoadingHasFinished(); + // for some reason the chart query is taking a very long time to return (3x the delay) + // so wait for the chart to be loaded + await discover.waitForChartLoadingComplete(1); await browser.execute(() => { window.ELASTIC_ESQL_DELAY_SECONDS = undefined; }); diff --git a/test/functional/apps/discover/group3/_request_counts.ts b/test/functional/apps/discover/group3/_request_counts.ts index 8a029928af0cb..32f1be5a62e79 100644 --- a/test/functional/apps/discover/group3/_request_counts.ts +++ b/test/functional/apps/discover/group3/_request_counts.ts @@ -97,7 +97,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expectedRequests?: number; expectedRefreshRequest?: number; }) => { - it(`should send ${expectedRequests} search requests (documents + chart) on page load`, async () => { + it(`should send no more than ${expectedRequests} search requests (documents + chart) on page load`, async () => { await browser.refresh(); await browser.execute(async () => { performance.setResourceTimingBufferSize(Number.MAX_SAFE_INTEGER); @@ -107,20 +107,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(searchCount).to.be(expectedRequests); }); - it(`should send ${expectedRequests} requests (documents + chart) when refreshing`, async () => { + it(`should send no more than ${expectedRequests} requests (documents + chart) when refreshing`, async () => { await expectSearches(type, expectedRequests, async () => { await queryBar.clickQuerySubmitButton(); }); }); - it(`should send ${expectedRequests} requests (documents + chart) when changing the query`, async () => { + it(`should send no more than ${expectedRequests} requests (documents + chart) when changing the query`, async () => { await expectSearches(type, expectedRequests, async () => { await setQuery(query1); await queryBar.clickQuerySubmitButton(); }); }); - it(`should send ${expectedRequests} requests (documents + chart) when changing the time range`, async () => { + it(`should send no more than ${expectedRequests} requests (documents + chart) when changing the time range`, async () => { await expectSearches(type, expectedRequests, async () => { await timePicker.setAbsoluteRange( 'Sep 21, 2015 @ 06:31:44.000', @@ -174,7 +174,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { setQuery: (query) => queryBar.setQuery(query), }); - it(`should send 2 requests (documents + chart) when toggling the chart visibility`, async () => { + it(`should send no more than 2 requests (documents + chart) when toggling the chart visibility`, async () => { await expectSearches(type, 2, async () => { await discover.toggleChartVisibility(); }); @@ -183,7 +183,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - it('should send 2 requests (documents + chart) when adding a filter', async () => { + it('should send no more than 2 requests (documents + chart) when adding a filter', async () => { await expectSearches(type, 2, async () => { await filterBar.addFilter({ field: 'extension', @@ -193,31 +193,31 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - it('should send 2 requests (documents + chart) when sorting', async () => { + it('should send no more than 2 requests (documents + chart) when sorting', async () => { await expectSearches(type, 2, async () => { await discover.clickFieldSort('@timestamp', 'Sort Old-New'); }); }); - it('should send 2 requests (documents + chart) when changing to a breakdown field without an other bucket', async () => { + it('should send no more than 2 requests (documents + chart) when changing to a breakdown field without an other bucket', async () => { await expectSearches(type, 2, async () => { await discover.chooseBreakdownField('type'); }); }); - it('should send 3 requests (documents + chart + other bucket) when changing to a breakdown field with an other bucket', async () => { + it('should send no more than 3 requests (documents + chart + other bucket) when changing to a breakdown field with an other bucket', async () => { await expectSearches(type, 3, async () => { await discover.chooseBreakdownField('extension.raw'); }); }); - it('should send 2 requests (documents + chart) when changing the chart interval', async () => { + it('should send no more than 2 requests (documents + chart) when changing the chart interval', async () => { await expectSearches(type, 2, async () => { await discover.setChartInterval('Day'); }); }); - it('should send 2 requests (documents + chart) when changing the data view', async () => { + it('should send no more than 2 requests (documents + chart) when changing the data view', async () => { await expectSearches(type, 2, async () => { await discover.selectIndexPattern('long-window-logstash-*'); }); diff --git a/test/functional/apps/visualize/group3/_annotation_listing.ts b/test/functional/apps/visualize/group3/_annotation_listing.ts index a6a1743430092..1ec8fb8cdea97 100644 --- a/test/functional/apps/visualize/group3/_annotation_listing.ts +++ b/test/functional/apps/visualize/group3/_annotation_listing.ts @@ -177,7 +177,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { dataView: 'logs*', }); expect(await annotationEditor.showingMissingDataViewPrompt()).to.be(false); - expect(await find.byCssSelector('canvas')).to.be.ok(); + // @TODO: re-enable this once the error bubbling issue is fixed at Lens custom component level + // expect(await find.byCssSelector('canvas')).to.be.ok(); }); await annotationEditor.saveGroup(); diff --git a/test/functional/services/dashboard/panel_actions.ts b/test/functional/services/dashboard/panel_actions.ts index 75474fef41655..31890d4c4c478 100644 --- a/test/functional/services/dashboard/panel_actions.ts +++ b/test/functional/services/dashboard/panel_actions.ts @@ -12,7 +12,6 @@ import { FtrService } from '../../ftr_provider_context'; const REMOVE_PANEL_DATA_TEST_SUBJ = 'embeddablePanelAction-deletePanel'; const EDIT_PANEL_DATA_TEST_SUBJ = 'embeddablePanelAction-editPanel'; -const INLINE_EDIT_PANEL_DATA_TEST_SUBJ = 'embeddablePanelAction-ACTION_CONFIGURE_IN_LENS'; const EDIT_IN_LENS_EDITOR_DATA_TEST_SUBJ = 'navigateToLensEditorLink'; const CLONE_PANEL_DATA_TEST_SUBJ = 'embeddablePanelAction-clonePanel'; const TOGGLE_EXPAND_PANEL_DATA_TEST_SUBJ = 'embeddablePanelAction-togglePanel'; @@ -128,7 +127,9 @@ export class DashboardPanelActionsService extends FtrService { async navigateToEditorFromFlyout(wrapper?: WebElementWrapper) { this.log.debug('navigateToEditorFromFlyout'); - await this.clickPanelAction(INLINE_EDIT_PANEL_DATA_TEST_SUBJ, wrapper); + // make sure the context menu is open before proceeding + await this.openContextMenu(); + await this.clickPanelAction(EDIT_PANEL_DATA_TEST_SUBJ); await this.header.waitUntilLoadingHasFinished(); await this.testSubjects.clickWhenNotDisabledWithoutRetry(EDIT_IN_LENS_EDITOR_DATA_TEST_SUBJ); const isConfirmModalVisible = await this.testSubjects.exists('confirmModalConfirmButton'); @@ -139,9 +140,9 @@ export class DashboardPanelActionsService extends FtrService { } } - async clickInlineEdit() { + async clickInlineEdit(wrapper?: WebElementWrapper) { this.log.debug('clickInlineEditAction'); - await this.clickPanelAction(INLINE_EDIT_PANEL_DATA_TEST_SUBJ); + await this.clickPanelAction(EDIT_PANEL_DATA_TEST_SUBJ, wrapper); await this.header.waitUntilLoadingHasFinished(); await this.common.waitForTopNavToBeVisible(); } @@ -307,12 +308,9 @@ export class DashboardPanelActionsService extends FtrService { await this.expectExistsPanelAction(REMOVE_PANEL_DATA_TEST_SUBJ, title); } - async expectExistsEditPanelAction(title = '', allowsInlineEditing?: boolean) { + async expectExistsEditPanelAction(title = '') { this.log.debug('expectExistsEditPanelAction'); - let testSubj = EDIT_PANEL_DATA_TEST_SUBJ; - if (allowsInlineEditing) { - testSubj = INLINE_EDIT_PANEL_DATA_TEST_SUBJ; - } + const testSubj = EDIT_PANEL_DATA_TEST_SUBJ; await this.expectExistsPanelAction(testSubj, title); } diff --git a/x-pack/examples/embedded_lens_example/public/app.tsx b/x-pack/examples/embedded_lens_example/public/app.tsx index bebcb0aa88301..04f90dfbb96d4 100644 --- a/x-pack/examples/embedded_lens_example/public/app.tsx +++ b/x-pack/examples/embedded_lens_example/public/app.tsx @@ -23,7 +23,6 @@ import type { TypedLensByValueInput, PersistedIndexPatternLayer, XYState, - LensEmbeddableInput, FormulaPublicApi, DateHistogramIndexPatternColumn, } from '@kbn/lens-plugin/public'; @@ -288,7 +287,7 @@ export const App = (props: { /> {isSaveModalVisible && ( {}} onClose={() => setIsSaveModalVisible(false)} /> diff --git a/x-pack/examples/lens_embeddable_inline_editing_example/public/app.tsx b/x-pack/examples/lens_embeddable_inline_editing_example/public/app.tsx index 055050de3f4c6..68d7140badb30 100644 --- a/x-pack/examples/lens_embeddable_inline_editing_example/public/app.tsx +++ b/x-pack/examples/lens_embeddable_inline_editing_example/public/app.tsx @@ -24,7 +24,6 @@ import type { CoreStart } from '@kbn/core/public'; import { LensConfigBuilder } from '@kbn/lens-embeddable-utils/config_builder/config_builder'; import type { DataView } from '@kbn/data-views-plugin/public'; import type { LensPublicStart } from '@kbn/lens-plugin/public'; -import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import type { StartDependencies } from './plugin'; import { LensChart } from './embeddable'; import { MultiPaneFlyout } from './flyout'; @@ -46,137 +45,128 @@ export const App = (props: { ); return ( - - - - - - - - - - - - - - + + + + + + + + + + + + + - -

#3: Embeddable inside a flyout

-
- - -

- In case you do not want to use a push flyout, you can check this example.{' '} -
- In this example, we have a Lens embeddable inside a flyout and we want to - render the inline editing Component in a second slot of the same flyout. -

-
- - - - { - setIsFlyoutVisible(true); - setPanelActive(3); +

#3: Embeddable inside a flyout

+
+ + +

+ In case you do not want to use a push flyout, you can check this example.
+ In this example, we have a Lens embeddable inside a flyout and we want to render + the inline editing Component in a second slot of the same flyout. +

+
+ + + + { + setIsFlyoutVisible(true); + setPanelActive(3); + }} + > + Show flyout + + {isFlyoutVisible ? ( + { + setIsinlineEditingVisible(false); + if (container) { + ReactDOM.unmountComponentAtNode(container); + } + }} + onCancelCb={() => { + setIsinlineEditingVisible(false); + if (container) { + ReactDOM.unmountComponentAtNode(container); + } + }} + isESQL + isActive + /> + ), + }} + inlineEditingContent={{ + visible: isInlineEditingVisible, + }} + setContainer={setContainer} + onClose={() => { + setIsFlyoutVisible(false); + setIsinlineEditingVisible(false); + setPanelActive(null); + if (container) { + ReactDOM.unmountComponentAtNode(container); + } }} - > - Show flyout - - {isFlyoutVisible ? ( - { - setIsinlineEditingVisible(false); - if (container) { - ReactDOM.unmountComponentAtNode(container); - } - }} - onCancelCb={() => { - setIsinlineEditingVisible(false); - if (container) { - ReactDOM.unmountComponentAtNode(container); - } - }} - isESQL - isActive - /> - ), - }} - inlineEditingContent={{ - visible: isInlineEditingVisible, - }} - setContainer={setContainer} - onClose={() => { - setIsFlyoutVisible(false); - setIsinlineEditingVisible(false); - setPanelActive(null); - if (container) { - ReactDOM.unmountComponentAtNode(container); - } - }} - /> - ) : null} - - -
-
-
-
-
-
-
+ /> + ) : null} + + + + + + + + ); }; diff --git a/x-pack/examples/lens_embeddable_inline_editing_example/public/embeddable.tsx b/x-pack/examples/lens_embeddable_inline_editing_example/public/embeddable.tsx index 717a8b2d20f8e..a63264485bf53 100644 --- a/x-pack/examples/lens_embeddable_inline_editing_example/public/embeddable.tsx +++ b/x-pack/examples/lens_embeddable_inline_editing_example/public/embeddable.tsx @@ -64,13 +64,13 @@ export const LensChart = (props: { ( isLoading: boolean, adapters: InlineEditLensEmbeddableContext['lensEvent']['adapters'] | undefined, - lensEmbeddableOutput$?: InlineEditLensEmbeddableContext['lensEvent']['embeddableOutput$'] + dataLoading$?: InlineEditLensEmbeddableContext['lensEvent']['dataLoading$'] ) => { const adapterTables = adapters?.tables?.tables; if (adapterTables && !isLoading) { setLensLoadEvent({ adapters, - embeddableOutput$: lensEmbeddableOutput$, + dataLoading$, }); } }, diff --git a/x-pack/examples/lens_embeddable_inline_editing_example/public/mount.tsx b/x-pack/examples/lens_embeddable_inline_editing_example/public/mount.tsx index 411538e2df2ca..86bf0757220d4 100644 --- a/x-pack/examples/lens_embeddable_inline_editing_example/public/mount.tsx +++ b/x-pack/examples/lens_embeddable_inline_editing_example/public/mount.tsx @@ -10,6 +10,7 @@ import { render, unmountComponentAtNode } from 'react-dom'; import { EuiCallOut } from '@elastic/eui'; import type { CoreSetup, AppMountParameters } from '@kbn/core/public'; +import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; import type { StartDependencies } from './plugin'; export const mount = @@ -21,10 +22,15 @@ export const mount = const dataView = await plugins.dataViews.getDefaultDataView(); const stateHelpers = await plugins.lens.stateHelperApi(); - const i18nCore = core.i18n; - const reactElement = ( - + {dataView ? ( You need at least one dataview for this demo to work

)} -
+ ); render(reactElement, element); diff --git a/x-pack/examples/lens_embeddable_inline_editing_example/tsconfig.json b/x-pack/examples/lens_embeddable_inline_editing_example/tsconfig.json index e4727650106bd..104bfbeeacd7e 100644 --- a/x-pack/examples/lens_embeddable_inline_editing_example/tsconfig.json +++ b/x-pack/examples/lens_embeddable_inline_editing_example/tsconfig.json @@ -19,8 +19,8 @@ "@kbn/developer-examples-plugin", "@kbn/data-views-plugin", "@kbn/ui-actions-plugin", - "@kbn/kibana-react-plugin", "@kbn/lens-embeddable-utils", "@kbn/ui-theme", + "@kbn/react-kibana-context-render", ] } diff --git a/x-pack/examples/testing_embedded_lens/public/app.tsx b/x-pack/examples/testing_embedded_lens/public/app.tsx index 9aa6a40fe20cf..699db0d0dc644 100644 --- a/x-pack/examples/testing_embedded_lens/public/app.tsx +++ b/x-pack/examples/testing_embedded_lens/public/app.tsx @@ -29,7 +29,6 @@ import type { TypedLensByValueInput, PersistedIndexPatternLayer, XYState, - LensEmbeddableInput, DateHistogramIndexPatternColumn, DatatableVisualizationState, HeatmapVisualizationState, @@ -42,7 +41,6 @@ import type { MetricVisualizationState, } from '@kbn/lens-plugin/public'; import type { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; -import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { CodeEditor, HJsonLang } from '@kbn/code-editor'; import type { StartDependencies } from './plugin'; import { @@ -496,269 +494,256 @@ export const App = (props: { const [overrides, setOverrides] = useState(); return ( - - - - - - - - - - -

- This app embeds a Lens visualization by specifying the configuration. Data - fetching and rendering is completely managed by Lens itself. -

-

- The editor on the right hand side make it possible to paste a Lens - attributes configuration, and have it rendered. Presets are available to - have a starting configuration, and new presets can be saved as well (not - persisted). -

-

- The Open with Lens button will take the current configuration and navigate - to a prefilled editor. -

- - - - - - - - - - - + + + + + + + + + +

+ This app embeds a Lens visualization by specifying the configuration. Data + fetching and rendering is completely managed by Lens itself. +

+

+ The editor on the right hand side make it possible to paste a Lens attributes + configuration, and have it rendered. Presets are available to have a starting + configuration, and new presets can be saved as well (not persisted). +

+

+ The Open with Lens button will take the current configuration and navigate to + a prefilled editor. +

+ + + + + + + + + + + + + { + setIsSaveModalVisible(true); + }} + > + Save Visualization + + + {props.defaultDataView?.isTimeBased() ? ( { - setIsSaveModalVisible(true); - }} - > - Save Visualization - - - {props.defaultDataView?.isTimeBased() ? ( - - { - setTime( - time.to === 'now' - ? { - from: '2015-09-18T06:31:44.000Z', - to: '2015-09-23T18:31:44.000Z', - } - : { - from: 'now-5d', - to: 'now', - } - ); - }} - > - {time.to === 'now' ? 'Change time range' : 'Reset time range'} - - - ) : null} - - { - props.plugins.lens.navigateToPrefilledEditor( - { - id: '', - timeRange: time, - attributes: currentAttributes, - }, - { - openInNewTab: true, - } + setTime( + time.to === 'now' + ? { + from: '2015-09-18T06:31:44.000Z', + to: '2015-09-23T18:31:44.000Z', + } + : { + from: 'now-5d', + to: 'now', + } ); }} > - Open in Lens (new tab) + {time.to === 'now' ? 'Change time range' : 'Reset time range'} - -

State: {isLoading ? 'Loading...' : 'Rendered'}

-
-
- - - { - setIsLoading(val); - }} - onBrushEnd={({ range }) => { - setTime({ - from: new Date(range[0]).toISOString(), - to: new Date(range[1]).toISOString(), - }); - }} - onFilter={(_data) => { - // call back event for on filter event - }} - onTableRowClick={(_data) => { - // call back event for on table row click event - }} - disableTriggers={!enableTriggers} - viewMode={ViewMode.VIEW} - withDefaultActions={enableDefaultAction} - extraActions={ - enableExtraAction - ? [ - { - id: 'testAction', - type: 'link', - getIconType: () => 'save', - async isCompatible( - context: ActionExecutionContext - ): Promise { - return true; - }, - execute: async (context: ActionExecutionContext) => { - alert('I am an extra action'); - return; - }, - getDisplayName: () => 'Extra action', - }, - ] - : undefined - } - /> - - - - {isSaveModalVisible && ( - {}} - onClose={() => setIsSaveModalVisible(false)} - /> - )} - - - - - - -

Paste or edit here your Lens document

-
-
-
- - - ({ value: i, text: id }))} - value={undefined} - onChange={(e) => switchChartPreset(+e.target.value)} - aria-label="Load from a preset" - prepend={'Load preset'} - /> - - - { - const attributes = checkAndParseSO(currentSO.current); - if (attributes) { - const label = `custom-chart-${chartCounter}`; - addChartConfiguration([ - ...loadedCharts, + ) : null} + + { + props.plugins.lens.navigateToPrefilledEditor( + { + id: '', + timeRange: time, + attributes: currentAttributes, + }, + { + openInNewTab: true, + } + ); + }} + > + Open in Lens (new tab) + + + +

State: {isLoading ? 'Loading...' : 'Rendered'}

+
+
+ + + { + setIsLoading(val); + }} + onBrushEnd={({ range }) => { + setTime({ + from: new Date(range[0]).toISOString(), + to: new Date(range[1]).toISOString(), + }); + }} + onFilter={(_data) => { + // call back event for on filter event + }} + onTableRowClick={(_data) => { + // call back event for on table row click event + }} + disableTriggers={!enableTriggers} + viewMode={ViewMode.VIEW} + withDefaultActions={enableDefaultAction} + extraActions={ + enableExtraAction + ? [ { - id: label, - attributes, + id: 'testAction', + type: 'link', + getIconType: () => 'save', + async isCompatible( + context: ActionExecutionContext + ): Promise { + return true; + }, + execute: async (context: ActionExecutionContext) => { + alert('I am an extra action'); + return; + }, + getDisplayName: () => 'Extra action', }, - ]); - chartCounter++; - alert(`The preset has been saved as "${label}"`); - } - }} - > - Save as preset - - - {hasParsingErrorDebounced && currentSO.current !== currentValid && ( - -

Check the spec

-
- )} - - - - { - const isValid = Boolean(checkAndParseSO(newSO)); - setErrorFlag(!isValid); - currentSO.current = newSO; - if (isValid) { - // reset the debounced error - setErrorDebounced(isValid); - saveValidSO(newSO); - } - }} - /> - - - - - - - - - - - + ] + : undefined + } + /> + + + + {isSaveModalVisible && ( + {}} + onClose={() => setIsSaveModalVisible(false)} + /> + )} + + + + + + +

Paste or edit here your Lens document

+
+
+
+ + + ({ value: i, text: id }))} + value={undefined} + onChange={(e) => switchChartPreset(+e.target.value)} + aria-label="Load from a preset" + prepend={'Load preset'} + /> + + + { + const attributes = checkAndParseSO(currentSO.current); + if (attributes) { + const label = `custom-chart-${chartCounter}`; + addChartConfiguration([ + ...loadedCharts, + { + id: label, + attributes, + }, + ]); + chartCounter++; + alert(`The preset has been saved as "${label}"`); + } + }} + > + Save as preset + + + {hasParsingErrorDebounced && currentSO.current !== currentValid && ( + +

Check the spec

+
+ )} +
+ + + { + const isValid = Boolean(checkAndParseSO(newSO)); + setErrorFlag(!isValid); + currentSO.current = newSO; + if (isValid) { + // reset the debounced error + setErrorDebounced(isValid); + saveValidSO(newSO); + } + }} + /> + + +
+
+ + + + + + ); }; diff --git a/x-pack/examples/testing_embedded_lens/public/mount.tsx b/x-pack/examples/testing_embedded_lens/public/mount.tsx index d0f58eb6050b7..04099e125b968 100644 --- a/x-pack/examples/testing_embedded_lens/public/mount.tsx +++ b/x-pack/examples/testing_embedded_lens/public/mount.tsx @@ -11,6 +11,7 @@ import { EuiCallOut } from '@elastic/eui'; import type { CoreSetup, AppMountParameters } from '@kbn/core/public'; import type { TypedLensByValueInput } from '@kbn/lens-plugin/public'; +import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; import type { StartDependencies } from './plugin'; export const mount = @@ -24,10 +25,15 @@ export const mount = const dataView = await plugins.data.indexPatterns.getDefault(); const stateHelpers = await plugins.lens.stateHelperApi(); - const i18nCore = core.i18n; - const reactElement = ( - + {dataView ? ( This demo only works if your default index pattern is set and time based

)} -
+ ); render(reactElement, element); diff --git a/x-pack/examples/testing_embedded_lens/tsconfig.json b/x-pack/examples/testing_embedded_lens/tsconfig.json index 90cf691a3529c..efa0ebd803d93 100644 --- a/x-pack/examples/testing_embedded_lens/tsconfig.json +++ b/x-pack/examples/testing_embedded_lens/tsconfig.json @@ -21,8 +21,8 @@ "@kbn/developer-examples-plugin", "@kbn/data-views-plugin", "@kbn/ui-actions-plugin", - "@kbn/kibana-react-plugin", "@kbn/core-ui-settings-browser", "@kbn/code-editor", + "@kbn/react-kibana-context-render", ] } diff --git a/x-pack/plugins/canvas/public/components/hooks/use_canvas_api.tsx b/x-pack/plugins/canvas/public/components/hooks/use_canvas_api.tsx index fa302c57ead8c..d815864fb4a60 100644 --- a/x-pack/plugins/canvas/public/components/hooks/use_canvas_api.tsx +++ b/x-pack/plugins/canvas/public/components/hooks/use_canvas_api.tsx @@ -49,6 +49,8 @@ export const useCanvasApi: () => CanvasContainerApi = () => { createNewEmbeddable(panelType, initialState); }, disableTriggers: true, + // this is required to disable inline editing now enabled by default + canEditInline: false, type: 'canvas', /** * getSerializedStateForChild is left out here because we cannot access the state here. That method diff --git a/x-pack/plugins/cases/public/components/visualizations/actions/is_compatible.ts b/x-pack/plugins/cases/public/components/visualizations/actions/is_compatible.ts index 64becf44e266e..90347cb8d4067 100644 --- a/x-pack/plugins/cases/public/components/visualizations/actions/is_compatible.ts +++ b/x-pack/plugins/cases/public/components/visualizations/actions/is_compatible.ts @@ -7,7 +7,7 @@ import type { CoreStart } from '@kbn/core-lifecycle-browser'; import { isLensApi } from '@kbn/lens-plugin/public'; -import { hasBlockingError } from '@kbn/presentation-publishing'; +import { apiPublishesTimeRange, hasBlockingError } from '@kbn/presentation-publishing'; import { canUseCases } from '../../../client/helpers/can_use_cases'; import { getCaseOwnerByAppId } from '../../../../common/utils/owner'; @@ -20,7 +20,11 @@ export function isCompatible( if (!embeddable.getFullAttributes()) { return false; } - const timeRange = embeddable.timeRange$?.value ?? embeddable.parentApi?.timeRange$?.value; + const timeRange = + embeddable.timeRange$?.value ?? + (embeddable.parentApi && apiPublishesTimeRange(embeddable.parentApi) + ? embeddable.parentApi?.timeRange$?.value + : undefined); if (!timeRange) { return false; } diff --git a/x-pack/plugins/cases/public/components/visualizations/actions/mocks.ts b/x-pack/plugins/cases/public/components/visualizations/actions/mocks.ts index dea0c1ace09a7..94c7e5a1c939a 100644 --- a/x-pack/plugins/cases/public/components/visualizations/actions/mocks.ts +++ b/x-pack/plugins/cases/public/components/visualizations/actions/mocks.ts @@ -7,11 +7,11 @@ import { createBrowserHistory } from 'history'; import { BehaviorSubject } from 'rxjs'; - +import { getLensApiMock } from '@kbn/lens-plugin/public/react_embeddable/mocks'; import type { PublicAppInfo } from '@kbn/core/public'; import { coreMock } from '@kbn/core/public/mocks'; import type { LensApi, LensSavedObjectAttributes } from '@kbn/lens-plugin/public'; -import type { AggregateQuery, Filter, Query, TimeRange } from '@kbn/es-query'; +import type { TimeRange } from '@kbn/es-query'; import type { Services } from './types'; const coreStart = coreMock.createStart(); @@ -39,24 +39,16 @@ export const mockLensAttributes = { export const getMockLensApi = ( { from, to = 'now' }: { from: string; to: string } = { from: 'now-24h', to: 'now' } ): LensApi => - ({ - type: 'lens', - getSavedVis: () => {}, - canViewUnderlyingData$: new BehaviorSubject(true), - getViewUnderlyingDataArgs: () => {}, + getLensApiMock({ getFullAttributes: () => { return mockLensAttributes; }, - panelTitle: new BehaviorSubject('myPanel'), - hidePanelTitle: new BehaviorSubject(false), - timeslice$: new BehaviorSubject<[number, number] | undefined>(undefined), + panelTitle: new BehaviorSubject('myPanel'), timeRange$: new BehaviorSubject({ from, to, }), - filters$: new BehaviorSubject(undefined), - query$: new BehaviorSubject(undefined), - } as unknown as LensApi); + }); export const getMockCurrentAppId$ = () => new BehaviorSubject('securitySolutionUI'); export const getMockApplications$ = () => diff --git a/x-pack/plugins/cases/public/components/visualizations/actions/open_modal.tsx b/x-pack/plugins/cases/public/components/visualizations/actions/open_modal.tsx index 0542a13b1ef2d..c781098b44b57 100644 --- a/x-pack/plugins/cases/public/components/visualizations/actions/open_modal.tsx +++ b/x-pack/plugins/cases/public/components/visualizations/actions/open_modal.tsx @@ -9,7 +9,7 @@ import React, { useEffect, useMemo } from 'react'; import { unmountComponentAtNode } from 'react-dom'; import type { LensApi } from '@kbn/lens-plugin/public'; import { toMountPoint } from '@kbn/react-kibana-mount'; -import { useStateFromPublishingSubject } from '@kbn/presentation-publishing'; +import { apiPublishesTimeRange, useStateFromPublishingSubject } from '@kbn/presentation-publishing'; import { ActionWrapper } from './action_wrapper'; import type { CasesActionContextProps, Services } from './types'; import type { CaseUI } from '../../../../common'; @@ -30,7 +30,9 @@ const AddExistingCaseModalWrapper: React.FC = ({ lensApi, onClose, onSucc }); const timeRange = useStateFromPublishingSubject(lensApi.timeRange$); - const parentTimeRange = useStateFromPublishingSubject(lensApi.parentApi?.timeRange$); + const parentTimeRange = useStateFromPublishingSubject( + apiPublishesTimeRange(lensApi.parentApi) ? lensApi.parentApi?.timeRange$ : undefined + ); const absoluteTimeRange = convertToAbsoluteTimeRange(timeRange); const absoluteParentTimeRange = convertToAbsoluteTimeRange(parentTimeRange); diff --git a/x-pack/plugins/lens/common/constants.ts b/x-pack/plugins/lens/common/constants.ts index 955d260abe8a6..b8154c4bc5431 100644 --- a/x-pack/plugins/lens/common/constants.ts +++ b/x-pack/plugins/lens/common/constants.ts @@ -10,13 +10,17 @@ import type { RefreshInterval, TimeRange } from '@kbn/data-plugin/common/query'; import type { Filter } from '@kbn/es-query'; export const PLUGIN_ID = 'lens'; -export const APP_ID = 'lens'; -export const LENS_APP_NAME = 'lens'; -export const LENS_EMBEDDABLE_TYPE = 'lens'; +export const APP_ID = PLUGIN_ID; export const DOC_TYPE = 'lens'; +export const LENS_APP_NAME = APP_ID; +export const LENS_EMBEDDABLE_TYPE = DOC_TYPE; export const NOT_INTERNATIONALIZED_PRODUCT_NAME = 'Lens Visualizations'; export const BASE_API_URL = '/api/lens'; export const LENS_EDIT_BY_VALUE = 'edit_by_value'; +export const LENS_ICON = 'lensApp'; +export const STAGE_ID = 'production'; + +export const INDEX_PATTERN_TYPE = 'index-pattern'; export const PieChartTypes = { PIE: 'pie', diff --git a/x-pack/plugins/lens/common/embeddable_factory/index.ts b/x-pack/plugins/lens/common/embeddable_factory/index.ts index 68e6c77e9daeb..62cd68e15e9d1 100644 --- a/x-pack/plugins/lens/common/embeddable_factory/index.ts +++ b/x-pack/plugins/lens/common/embeddable_factory/index.ts @@ -6,47 +6,52 @@ */ import { cloneDeep } from 'lodash'; -import type { SerializableRecord, Serializable } from '@kbn/utility-types'; +import type { SerializableRecord } from '@kbn/utility-types'; import type { SavedObjectReference } from '@kbn/core/types'; -import type { - EmbeddableStateWithType, +import { EmbeddableRegistryDefinition, + EmbeddableStateWithType, } from '@kbn/embeddable-plugin/common'; +import type { LensRuntimeState } from '../../public'; export type LensEmbeddablePersistableState = EmbeddableStateWithType & { attributes: SerializableRecord; }; -export const inject: EmbeddableRegistryDefinition['inject'] = (state, references) => { - // We need to clone the state because we can not modify the original state object. - const typedState = cloneDeep(state) as LensEmbeddablePersistableState; +export const inject: NonNullable = ( + state, + references +): EmbeddableStateWithType => { + const typedState = cloneDeep(state) as unknown as LensRuntimeState; - if ('attributes' in typedState && typedState.attributes !== undefined) { - // match references based on name, so only references associated with this lens panel are injected. - const matchedReferences: SavedObjectReference[] = []; - - if (Array.isArray(typedState.attributes.references)) { - typedState.attributes.references.forEach((serializableRef) => { - const internalReference = serializableRef as unknown as SavedObjectReference; - const matchedReference = references.find( - (reference) => reference.name === internalReference.name - ); - if (matchedReference) matchedReferences.push(matchedReference); - }); - } - - typedState.attributes.references = matchedReferences as unknown as Serializable[]; + if (typedState.savedObjectId) { + return typedState as unknown as EmbeddableStateWithType; } - return typedState; + // match references based on name, so only references associated with this lens panel are injected. + const matchedReferences: SavedObjectReference[] = []; + + if (Array.isArray(typedState.attributes.references)) { + typedState.attributes.references.forEach((serializableRef) => { + const internalReference = serializableRef; + const matchedReference = references.find( + (reference) => reference.name === internalReference.name + ); + if (matchedReference) matchedReferences.push(matchedReference); + }); + } + + typedState.attributes.references = matchedReferences; + + return typedState as unknown as EmbeddableStateWithType; }; -export const extract: EmbeddableRegistryDefinition['extract'] = (state) => { +export const extract: NonNullable = (state) => { let references: SavedObjectReference[] = []; - const typedState = state as LensEmbeddablePersistableState; + const typedState = state as unknown as LensRuntimeState; if ('attributes' in typedState && typedState.attributes !== undefined) { - references = typedState.attributes.references as unknown as SavedObjectReference[]; + references = typedState.attributes.references; } return { state, references }; diff --git a/x-pack/plugins/lens/common/locator/locator.ts b/x-pack/plugins/lens/common/locator/locator.ts index ea0e54136ffc9..7b0b12416f145 100644 --- a/x-pack/plugins/lens/common/locator/locator.ts +++ b/x-pack/plugins/lens/common/locator/locator.ts @@ -9,7 +9,7 @@ import rison from '@kbn/rison'; import type { SerializableRecord } from '@kbn/utility-types'; import type { GlobalQueryStateFromUrl } from '@kbn/data-plugin/public'; import type { LocatorDefinition, LocatorPublic } from '@kbn/share-plugin/common'; -import type { Filter, Query } from '@kbn/es-query'; +import type { AggregateQuery, Filter, Query } from '@kbn/es-query'; import type { DataViewSpec, SavedQuery } from '@kbn/data-plugin/common'; import { SavedObjectReference } from '@kbn/core-saved-objects-common'; import type { DateRange } from '../types'; @@ -26,7 +26,7 @@ interface LensShareableState { /** * Optionally set a query. */ - query?: Query; + query?: Query | AggregateQuery; /** * Optionally set the date range in the date picker. @@ -88,7 +88,7 @@ export interface LensAppLocatorParams extends SerializableRecord { /** * Optionally set a query. */ - query?: Query; + query?: Query | AggregateQuery; /** * Optionally set the date range in the date picker. diff --git a/x-pack/plugins/lens/kibana.jsonc b/x-pack/plugins/lens/kibana.jsonc index 4b0b14141474f..012a077abb122 100644 --- a/x-pack/plugins/lens/kibana.jsonc +++ b/x-pack/plugins/lens/kibana.jsonc @@ -45,6 +45,7 @@ "expressionLegacyMetricVis", "expressionPartitionVis", "usageCollection", + "embeddableEnhanced", "taskManager", "globalSearch", "savedObjectsTagging", diff --git a/x-pack/plugins/lens/public/app_plugin/app.test.tsx b/x-pack/plugins/lens/public/app_plugin/app.test.tsx index 8aebc4778e201..73fb52bbe6683 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.test.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.test.tsx @@ -5,23 +5,20 @@ * 2.0. */ -import React, { PropsWithChildren } from 'react'; +import React from 'react'; import { Observable, Subject } from 'rxjs'; -import { ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { App } from './app'; import { LensAppProps, LensAppServices } from './types'; -import { EditorFrameInstance, EditorFrameProps } from '../types'; -import { Document, SavedObjectIndexStore } from '../persistence'; +import { LensDocument, SavedObjectIndexStore } from '../persistence'; import { visualizationMap, datasourceMap, makeDefaultServices, - mountWithProvider, + renderWithReduxStore, mockStoreDeps, + defaultDoc, } from '../mocks'; -import { I18nProvider } from '@kbn/i18n-react'; -import { SavedObjectSaveModal } from '@kbn/saved-objects-plugin/public'; import { checkForDuplicateTitle } from '../persistence'; import { createMemoryHistory } from 'history'; import type { Query } from '@kbn/es-query'; @@ -29,55 +26,52 @@ import { FilterManager } from '@kbn/data-plugin/public'; import type { DataView } from '@kbn/data-views-plugin/public'; import { buildExistsFilter, FilterStateStore } from '@kbn/es-query'; import type { FieldSpec } from '@kbn/data-plugin/common'; -import { TopNavMenuData } from '@kbn/navigation-plugin/public'; -import { LensByValueInput } from '../embeddable/embeddable'; -import { SavedObjectReference } from '@kbn/core/types'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { serverlessMock } from '@kbn/serverless/public/mocks'; +import { cloneDeep } from 'lodash'; import moment from 'moment'; - import { setState, LensAppState } from '../state_management'; import { coreMock } from '@kbn/core/public/mocks'; -jest.mock('../editor_frame_service/editor_frame/expression_helpers'); -jest.mock('@kbn/core/public'); +import { LensSerializedState } from '..'; +import { createMockedField, createMockedIndexPattern } from '../datasources/form_based/mocks'; +import faker from 'faker'; +import { screen, waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { VisualizeEditorContext } from '../types'; +import { setMockedPresentationUtilServices } from '@kbn/presentation-util-plugin/public/mocks'; + jest.mock('../persistence/saved_objects_utils/check_for_duplicate_title', () => ({ checkForDuplicateTitle: jest.fn(), })); +jest.mock('lodash', () => ({ + ...jest.requireActual('lodash'), + debounce: (fn: unknown) => fn, +})); -jest.mock('lodash', () => { - const original = jest.requireActual('lodash'); - - return { - ...original, - debounce: (fn: unknown) => fn, - }; -}); +const defaultSavedObjectId: string = faker.random.uuid(); -// const navigationStartMock = navigationPluginMock.createStartContract(); +const waitToLoad = async () => + await act(async () => new Promise((resolve) => setTimeout(resolve, 0))); -const sessionIdSubject = new Subject(); +function getLensDocumentMock(propsOverrides?: Partial) { + return cloneDeep({ ...defaultDoc, ...propsOverrides }); +} describe('Lens App', () => { - let defaultDoc: Document; - let defaultSavedObjectId: string; - - function createMockFrame(): jest.Mocked { - return { - EditorFrameContainer: jest.fn((props: EditorFrameProps) =>
), - datasourceMap, - visualizationMap, - }; - } - - const navMenuItems = { - expectedSaveButton: { emphasize: true, testId: 'lnsApp_saveButton' }, - expectedSaveAsButton: { emphasize: false, testId: 'lnsApp_saveButton' }, - expectedSaveAndReturnButton: { emphasize: true, testId: 'lnsApp_saveAndReturnButton' }, - }; + let props: jest.Mocked; + let services: jest.Mocked = makeDefaultServices( + new Subject(), + 'sessionId-1' + ); + beforeAll(() => setMockedPresentationUtilServices()); - function makeDefaultProps(): jest.Mocked { - return { - editorFrame: createMockFrame(), + beforeEach(() => { + props = { + editorFrame: { + EditorFrameContainer: jest.fn((_) =>
Editor frame
), + datasourceMap, + visualizationMap, + }, history: createMemoryHistory(), redirectTo: jest.fn(), redirectToOrigin: jest.fn(), @@ -94,93 +88,60 @@ describe('Lens App', () => { search: jest.fn(), } as unknown as SavedObjectIndexStore, }; - } - const makeDefaultServicesForApp = () => makeDefaultServices(sessionIdSubject, 'sessionId-1'); + services = makeDefaultServices(new Subject(), 'sessionId-1'); + }); + + afterEach(() => { + jest.clearAllMocks(); + }); - async function mountWith({ - props = makeDefaultProps(), - services = makeDefaultServicesForApp(), + async function renderApp({ preloadedState, }: { - props?: jest.Mocked; - services?: jest.Mocked; preloadedState?: Partial; - }) { - const wrappingComponent: React.FC> = ({ children }) => { - return ( - - {children} - - ); - }; - const storeDeps = mockStoreDeps({ lensServices: services }); - const { instance, lensStore } = await mountWithProvider( + } = {}) { + const Wrapper = ({ children }: { children: React.ReactNode }) => ( + {children} + ); + + const { + store, + render: renderRtl, + rerender, + ...rest + } = renderWithReduxStore( , + { wrapper: Wrapper }, { - storeDeps, + storeDeps: mockStoreDeps({ lensServices: services }), preloadedState, - }, - { wrappingComponent } + } ); - const frame = props.editorFrame as ReturnType; - lensStore.dispatch(setState({ ...preloadedState })); - return { instance, frame, props, services, lensStore }; - } + const rerenderWithProps = (newProps: Partial) => { + rerender(, { + wrapper: Wrapper, + }); + }; - beforeEach(() => { - defaultSavedObjectId = '1234'; - defaultDoc = { - savedObjectId: defaultSavedObjectId, - visualizationType: 'testVis', - type: 'lens', - title: 'An extremely cool default document!', - expression: 'definitely a valid expression', - state: { - query: 'lucene', - filters: [{ query: { match_phrase: { src: 'test' } }, meta: { index: 'index-pattern-0' } }], - }, - references: [{ type: 'index-pattern', id: '1', name: 'index-pattern-0' }], - } as unknown as Document; - }); + await act(async () => await store.dispatch(setState({ ...preloadedState }))); + return { props, lensStore: store, rerender: rerenderWithProps, ...rest }; + } it('renders the editor frame', async () => { - const { frame } = await mountWith({}); - expect(frame.EditorFrameContainer).toHaveBeenLastCalledWith( - { - indexPatternService: expect.any(Object), - getUserMessages: expect.any(Function), - addUserMessages: expect.any(Function), - lensInspector: { - adapters: { - expression: expect.any(Object), - requests: expect.any(Object), - tables: expect.any(Object), - }, - close: expect.any(Function), - inspect: expect.any(Function), - }, - showNoDataPopover: expect.any(Function), - }, - {} - ); + await renderApp(); + expect(screen.getByText('Editor frame')).toBeInTheDocument(); }); it('updates global filters with store state', async () => { - const services = makeDefaultServicesForApp(); - const indexPattern = { id: 'index1', isPersisted: () => true } as unknown as DataView; - const pinnedField = { name: 'pinnedField' } as unknown as FieldSpec; + const pinnedField = createMockedField({ name: 'pinnedField', type: '' }); + const indexPattern = createMockedIndexPattern({ id: 'index1' }, [pinnedField]); const pinnedFilter = buildExistsFilter(pinnedField, indexPattern); - services.data.query.filterManager.getFilters = jest.fn().mockImplementation(() => { - return []; - }); - services.data.query.filterManager.getGlobalFilters = jest.fn().mockImplementation(() => { - return [pinnedFilter]; - }); - const { instance, lensStore } = await mountWith({ services }); + services.data.query.filterManager.getFilters = jest.fn().mockReturnValue([]); + services.data.query.filterManager.getGlobalFilters = jest.fn().mockReturnValue([pinnedFilter]); + const { lensStore } = await renderApp(); - instance.update(); expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ query: { query: '', language: 'lucene' }, @@ -198,22 +159,19 @@ describe('Lens App', () => { describe('extra nav menu entries', () => { it('shows custom menu entry', async () => { const runFn = jest.fn(); - const { instance, services } = await mountWith({ - props: { - ...makeDefaultProps(), - topNavMenuEntryGenerators: [ - () => ({ - label: 'My entry', - run: runFn, - }), - ], - }, - }); - const navigationComponent = services.navigation.ui - .AggregateQueryTopNavMenu as unknown as React.ReactElement; - const extraEntry = instance.find(navigationComponent).prop('config')[0]; - expect(extraEntry.label).toEqual('My entry'); - expect(extraEntry.run).toBe(runFn); + props.topNavMenuEntryGenerators = [ + () => ({ + label: 'My entry', + run: runFn, + }), + ]; + await renderApp(); + expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( + expect.objectContaining({ + config: expect.arrayContaining([{ label: 'My entry', run: runFn }]), + }), + {} + ); }); it('passes current state, filter, query timerange and initial context into getter', async () => { @@ -244,15 +202,12 @@ describe('Lens App', () => { }, ], }; - await mountWith({ - props: { - ...makeDefaultProps(), - topNavMenuEntryGenerators: [getterFn], - initialContext: { - fieldName: 'a', - dataViewSpec: { id: '1' }, - }, - }, + props.topNavMenuEntryGenerators = [getterFn]; + props.initialContext = { + fieldName: 'a', + dataViewSpec: { id: '1' }, + }; + await renderApp({ preloadedState, }); @@ -278,19 +233,14 @@ describe('Lens App', () => { }); describe('breadcrumbs', () => { - const breadcrumbDocSavedObjectId = defaultSavedObjectId; - const breadcrumbDoc = { + const breadcrumbDocSavedObjectId = faker.random.uuid(); + const breadcrumbDoc = getLensDocumentMock({ savedObjectId: breadcrumbDocSavedObjectId, title: 'Daaaaaaadaumching!', - state: { - query: 'fake query', - filters: [], - }, - references: [], - } as unknown as Document; + }); it('sets breadcrumbs when the document title changes', async () => { - const { instance, services, lensStore } = await mountWith({}); + const { lensStore } = await renderApp(); expect(services.chrome.setBreadcrumbs).toHaveBeenCalledWith([ { @@ -302,8 +252,7 @@ describe('Lens App', () => { ]); await act(async () => { - instance.setProps({ initialInput: { savedObjectId: breadcrumbDocSavedObjectId } }); - lensStore.dispatch( + await lensStore.dispatch( setState({ persistedDoc: breadcrumbDoc, }) @@ -321,17 +270,10 @@ describe('Lens App', () => { }); it('sets originatingApp breadcrumb when the document title changes', async () => { - const props = makeDefaultProps(); - const services = makeDefaultServicesForApp(); - props.incomingState = { originatingApp: 'coolContainer' }; + props.incomingState = { originatingApp: 'dashboards' }; services.getOriginatingAppName = jest.fn(() => 'The Coolest Container Ever Made'); - - const { instance, lensStore } = await mountWith({ - props, - services, - preloadedState: { - isLinkedToOriginatingApp: false, - }, + const { lensStore, rerender } = await renderApp({ + preloadedState: { isLinkedToOriginatingApp: false }, }); expect(services.chrome.setBreadcrumbs).toHaveBeenCalledWith([ @@ -344,12 +286,7 @@ describe('Lens App', () => { ]); await act(async () => { - instance.setProps({ - initialInput: { savedObjectId: breadcrumbDocSavedObjectId }, - preloadedState: { - isLinkedToOriginatingApp: true, - }, - }); + await rerender({ initialInput: { savedObjectId: breadcrumbDocSavedObjectId } }); lensStore.dispatch( setState({ @@ -370,17 +307,13 @@ describe('Lens App', () => { it('sets serverless breadcrumbs when the document title changes when serverless service is available', async () => { const serverless = serverlessMock.createStart(); - const { instance, services, lensStore } = await mountWith({ - services: { - ...makeDefaultServices(), - serverless, - }, - }); + services.serverless = serverless; + const { lensStore, rerender } = await renderApp(); expect(services.chrome.setBreadcrumbs).not.toHaveBeenCalled(); expect(serverless.setBreadcrumbs).toHaveBeenCalledWith({ text: 'Create' }); await act(async () => { - instance.setProps({ initialInput: { savedObjectId: breadcrumbDocSavedObjectId } }); + rerender({ initialInput: { savedObjectId: breadcrumbDocSavedObjectId } }); lensStore.dispatch( setState({ persistedDoc: breadcrumbDoc, @@ -395,43 +328,40 @@ describe('Lens App', () => { describe('TopNavMenu#showDatePicker', () => { it('shows date picker if any used index pattern isTimeBased', async () => { - const customServices = makeDefaultServicesForApp(); - customServices.dataViews.get = jest + services.dataViews.get = jest .fn() - .mockImplementation((id) => - Promise.resolve({ id, isTimeBased: () => true, isPersisted: () => true } as DataView) + .mockImplementation( + async (id) => ({ id, isTimeBased: () => true, isPersisted: () => true } as DataView) ); - const { services } = await mountWith({ services: customServices }); + await renderApp(); expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ showDatePicker: true }), {} ); }); it('shows date picker if active datasource isTimeBased', async () => { - const customServices = makeDefaultServicesForApp(); - customServices.dataViews.get = jest + services.dataViews.get = jest .fn() - .mockImplementation((id) => - Promise.resolve({ id, isTimeBased: () => true, isPersisted: () => true } as DataView) + .mockImplementation( + async (id) => ({ id, isTimeBased: () => true, isPersisted: () => true } as DataView) ); - const customProps = makeDefaultProps(); - customProps.datasourceMap.testDatasource.isTimeBased = () => true; - const { services } = await mountWith({ props: customProps, services: customServices }); + + props.datasourceMap.testDatasource.isTimeBased = () => true; + await renderApp(); expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ showDatePicker: true }), {} ); }); it('does not show date picker if index pattern nor active datasource is not time based', async () => { - const customServices = makeDefaultServicesForApp(); - customServices.dataViews.get = jest + services.dataViews.get = jest .fn() - .mockImplementation((id) => - Promise.resolve({ id, isTimeBased: () => true, isPersisted: () => true } as DataView) + .mockImplementation( + async (id) => ({ id, isTimeBased: () => true, isPersisted: () => true } as DataView) ); - const customProps = makeDefaultProps(); - customProps.datasourceMap.testDatasource.isTimeBased = () => false; - const { services } = await mountWith({ props: customProps, services: customServices }); + + props.datasourceMap.testDatasource.isTimeBased = () => false; + await renderApp(); expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ showDatePicker: false }), {} @@ -441,7 +371,7 @@ describe('Lens App', () => { describe('TopNavMenu#dataViewPickerProps', () => { it('calls the nav component with the correct dataview picker props if permissions are given', async () => { - const { instance, lensStore, services } = await mountWith({ preloadedState: {} }); + const { lensStore } = await renderApp(); services.dataViewEditor.userPermissions.editDataView = () => true; const document = { savedObjectId: defaultSavedObjectId, @@ -450,8 +380,9 @@ describe('Lens App', () => { filters: [{ query: { match_phrase: { src: 'test' } } }], }, references: [{ type: 'index-pattern', id: '1', name: 'index-pattern-0' }], - } as unknown as Document; + } as unknown as LensDocument; + (services.navigation.ui.AggregateQueryTopNavMenu as jest.Mock).mockClear(); act(() => { lensStore.dispatch( setState({ @@ -460,46 +391,44 @@ describe('Lens App', () => { }) ); }); - instance.update(); - const props = instance - .find('[data-test-subj="lnsApp_topNav"]') - .prop('dataViewPickerComponentProps') as TopNavMenuData[]; - expect(props).toEqual( + expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ - currentDataViewId: 'mockip', - onChangeDataView: expect.any(Function), - onDataViewCreated: expect.any(Function), - onAddField: expect.any(Function), - }) + dataViewPickerComponentProps: expect.objectContaining({ + currentDataViewId: 'mockip', + onChangeDataView: expect.any(Function), + onDataViewCreated: expect.any(Function), + onAddField: expect.any(Function), + }), + }), + {} ); }); }); describe('persistence', () => { it('passes query and indexPatterns to TopNavMenu', async () => { - const { instance, lensStore, services } = await mountWith({ preloadedState: {} }); - const document = { + const { lensStore } = await renderApp(); + const query = { query: 'fake query', language: 'kuery' }; + const document = getLensDocumentMock({ savedObjectId: defaultSavedObjectId, state: { - query: 'fake query', - filters: [{ query: { match_phrase: { src: 'test' } } }], + ...defaultDoc.state, + query, + filters: [{ query: { match_phrase: { src: 'test' } }, meta: {} }], }, references: [{ type: 'index-pattern', id: '1', name: 'index-pattern-0' }], - } as unknown as Document; - - act(() => { - lensStore.dispatch( - setState({ - query: 'fake query' as unknown as Query, - persistedDoc: document, - }) - ); }); - instance.update(); + + await lensStore.dispatch( + setState({ + query, + persistedDoc: document, + }) + ); expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ - query: 'fake query', + query, indexPatterns: [ { id: 'mockip', @@ -514,240 +443,155 @@ describe('Lens App', () => { ); }); it('handles rejected index pattern', async () => { - const customServices = makeDefaultServicesForApp(); - customServices.dataViews.get = jest + services.dataViews.get = jest .fn() - .mockImplementation((id) => Promise.reject({ reason: 'Could not locate that data view' })); - const customProps = makeDefaultProps(); - const { services } = await mountWith({ props: customProps, services: customServices }); + .mockResolvedValue(Promise.reject({ reason: 'Could not locate that data view' })); + await renderApp(); expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ indexPatterns: [] }), {} ); }); - describe('save buttons', () => { - interface SaveProps { - newCopyOnSave: boolean; - returnToOrigin?: boolean; - newTitle: string; - } - function getButton(inst: ReactWrapper): TopNavMenuData { - return ( - inst.find('[data-test-subj="lnsApp_topNav"]').prop('config') as TopNavMenuData[] - ).find((button) => button.testId === 'lnsApp_saveButton')!; - } + describe('save buttons', () => { + const querySaveButton = () => screen.queryByTestId('lnsApp_saveButton'); + const clickSaveButton = async () => + await act(async () => await userEvent.click(screen.getByTestId('lnsApp_saveButton'))); - async function testSave(inst: ReactWrapper, saveProps: SaveProps) { - getButton(inst).run(inst.getDOMNode()); - // wait a tick since SaveModalContainer initializes asynchronously - await new Promise(process.nextTick); - const handler = inst.update().find('SavedObjectSaveModalOrigin').prop('onSave') as ( - p: unknown - ) => void; - handler(saveProps); - } + const querySaveAndReturnButton = () => screen.queryByTestId('lnsApp_saveAndReturnButton'); + const waitForModalVisible = async () => + await waitFor(() => screen.getByTestId('savedObjectTitle')); async function save({ preloadedState, - initialSavedObjectId, - ...saveProps - }: SaveProps & { + savedObjectId = defaultSavedObjectId, + prevSavedObjectId = undefined, + newTitle = 'hello there', + newCopyOnSave = false, + comesFromDashboard = true, + switchToAddToDashboardNone = false, + }: { + newCopyOnSave?: boolean; + newTitle?: string; preloadedState?: Partial; - initialSavedObjectId?: string; + prevSavedObjectId?: string; + savedObjectId?: string; + comesFromDashboard?: boolean; + switchToAddToDashboardNone?: boolean; }) { - const props = { - ...makeDefaultProps(), - initialInput: initialSavedObjectId - ? { savedObjectId: initialSavedObjectId, id: '5678' } - : undefined, - }; - - props.incomingState = { - originatingApp: 'ultraDashboard', - }; - - const services = makeDefaultServicesForApp(); - services.attributeService.wrapAttributes = jest - .fn() - .mockImplementation(async ({ savedObjectId }) => ({ - savedObjectId: savedObjectId || 'aaa', - })); - services.attributeService.unwrapAttributes = jest.fn().mockResolvedValue({ - metaInfo: { - sharingSavedObjectProps: { - outcome: 'exactMatch', - }, + services.attributeService.saveToLibrary = jest.fn().mockResolvedValue(savedObjectId); + services.attributeService.loadFromLibrary = jest.fn().mockResolvedValue({ + sharingSavedObjectProps: { + outcome: 'exactMatch', }, attributes: { - savedObjectId: initialSavedObjectId ?? 'aaa', + savedObjectId, references: [], state: { - query: 'fake query', + query: { query: 'fake query', language: 'kuery' }, filters: [], }, }, - } as jest.ResolvedValue); + managed: false, + }); + + props = { + ...props, + initialInput: prevSavedObjectId ? { savedObjectId: prevSavedObjectId } : undefined, + }; - const { frame, instance, lensStore } = await mountWith({ - services, - props, + if (comesFromDashboard) { + props.incomingState = { originatingApp: 'dashboards' }; + } + + const { lensStore } = await renderApp({ preloadedState: { isSaveable: true, - isLinkedToOriginatingApp: true, + isLinkedToOriginatingApp: comesFromDashboard, ...preloadedState, }, }); - expect(getButton(instance).disableButton).toEqual(false); - await act(async () => { - testSave(instance, { ...saveProps }); + await clickSaveButton(); + await waitForModalVisible(); + if (newCopyOnSave) { + await userEvent.click(screen.getByTestId('saveAsNewCheckbox')); + } + if (switchToAddToDashboardNone) { + await userEvent.click(screen.getByLabelText('None')); + } + await waitFor(async () => { + await userEvent.clear(screen.getByTestId('savedObjectTitle')); + expect(screen.getByTestId('savedObjectTitle')).toHaveValue(''); }); - return { props, services, instance, frame, lensStore }; + await userEvent.type(screen.getByTestId('savedObjectTitle'), `${newTitle}`); + await userEvent.click(screen.getByTestId('confirmSaveSavedObjectButton')); + await waitToLoad(); + return { props, lensStore }; } it('shows a disabled save button when the user does not have permissions', async () => { - const services = makeDefaultServicesForApp(); - services.application = { - ...services.application, - capabilities: { - ...services.application.capabilities, - visualize: { save: false, saveQuery: false, show: true }, + services.application.capabilities = { + ...services.application.capabilities, + visualize: { save: false, saveQuery: false, show: true }, + dashboard: { + showWriteControls: false, }, }; - const { instance, lensStore } = await mountWith({ services }); - expect(getButton(instance).disableButton).toEqual(true); - act(() => { - lensStore.dispatch( - setState({ - isSaveable: true, - }) - ); - }); - instance.update(); - expect(getButton(instance).disableButton).toEqual(true); + await renderApp({ preloadedState: { isSaveable: true } }); + expect(querySaveButton()).toBeDisabled(); }); it('shows a save button that is enabled when the frame has provided its state and does not show save and return or save as', async () => { - const { instance, lensStore, services } = await mountWith({}); - expect(getButton(instance).disableButton).toEqual(true); - act(() => { - lensStore.dispatch( - setState({ - isSaveable: true, - }) - ); + await renderApp({ + preloadedState: { isSaveable: true }, }); - instance.update(); - expect(getButton(instance).disableButton).toEqual(false); - await act(async () => { - const topNavMenuConfig = instance - .find(services.navigation.ui.AggregateQueryTopNavMenu) - .prop('config'); - expect(topNavMenuConfig).not.toContainEqual( - expect.objectContaining(navMenuItems.expectedSaveAndReturnButton) - ); - expect(topNavMenuConfig).not.toContainEqual( - expect.objectContaining(navMenuItems.expectedSaveAsButton) - ); - expect(topNavMenuConfig).toContainEqual( - expect.objectContaining(navMenuItems.expectedSaveButton) - ); - }); + expect(querySaveButton()).toHaveTextContent('Save'); + expect(querySaveAndReturnButton()).toBeFalsy(); }); - it('Shows Save and Return and Save As buttons in create by value mode with originating app', async () => { - const props = makeDefaultProps(); - const services = makeDefaultServicesForApp(); + it('Shows Save and Return and Save to library buttons in create by value mode with originating app', async () => { props.incomingState = { - originatingApp: 'ultraDashboard', + originatingApp: 'dashboards', valueInput: { id: 'whatchaGonnaDoWith', attributes: { title: 'whatcha gonna do with all these references? All these references in your value Input', - references: [] as SavedObjectReference[], + references: [], }, - } as LensByValueInput, + } as unknown as LensSerializedState, }; - - const { instance } = await mountWith({ - props, - services, + await renderApp({ preloadedState: { isLinkedToOriginatingApp: true, + isSaveable: true, }, }); - await act(async () => { - const topNavMenuConfig = instance - .find(services.navigation.ui.AggregateQueryTopNavMenu) - .prop('config'); - expect(topNavMenuConfig).toContainEqual( - expect.objectContaining(navMenuItems.expectedSaveAndReturnButton) - ); - expect(topNavMenuConfig).toContainEqual( - expect.objectContaining(navMenuItems.expectedSaveAsButton) - ); - expect(topNavMenuConfig).not.toContainEqual( - expect.objectContaining(navMenuItems.expectedSaveButton) - ); - }); + expect(querySaveAndReturnButton()).toBeEnabled(); + expect(querySaveButton()).toHaveTextContent('Save to library'); }); it('Shows Save and Return and Save As buttons in edit by reference mode', async () => { - const props = makeDefaultProps(); - props.initialInput = { savedObjectId: defaultSavedObjectId, id: '5678' }; props.incomingState = { - originatingApp: 'ultraDashboard', + originatingApp: 'dashboards', }; - - const { instance, services } = await mountWith({ - props, + props.initialInput = { savedObjectId: defaultSavedObjectId, id: '5678' }; + await renderApp({ preloadedState: { + isSaveable: true, isLinkedToOriginatingApp: true, }, }); - await act(async () => { - const topNavMenuConfig = instance - .find(services.navigation.ui.AggregateQueryTopNavMenu) - .prop('config'); - expect(topNavMenuConfig).toContainEqual( - expect.objectContaining(navMenuItems.expectedSaveAndReturnButton) - ); - expect(topNavMenuConfig).toContainEqual( - expect.objectContaining(navMenuItems.expectedSaveAsButton) - ); - expect(topNavMenuConfig).not.toContainEqual( - expect.objectContaining(navMenuItems.expectedSaveButton) - ); - }); - }); - - it('saves new docs', async () => { - const { props, services } = await save({ - initialSavedObjectId: undefined, - newCopyOnSave: false, - newTitle: 'hello there', - }); - expect(services.attributeService.wrapAttributes).toHaveBeenCalledWith( - expect.objectContaining({ - savedObjectId: undefined, - title: 'hello there', - }), - true, - undefined - ); - expect(props.redirectTo).toHaveBeenCalledWith('aaa'); - expect(services.notifications.toasts.addSuccess).toHaveBeenCalledWith( - "Saved 'hello there'" - ); + expect(querySaveAndReturnButton()).toBeEnabled(); + expect(querySaveButton()).toHaveTextContent('Save as'); }); it('applies all changes on-save', async () => { const { lensStore } = await save({ - initialSavedObjectId: undefined, + savedObjectId: undefined, newCopyOnSave: false, newTitle: 'hello there', preloadedState: { @@ -756,120 +600,91 @@ describe('Lens App', () => { }); expect(lensStore.getState().lens.applyChangesCounter).toBe(1); }); - it('adds to the recently accessed list on save', async () => { - const { services } = await save({ - initialSavedObjectId: undefined, - newCopyOnSave: false, - newTitle: 'hello there', - }); + const savedObjectId = faker.random.uuid(); + await save({ savedObjectId, prevSavedObjectId: 'prevId', comesFromDashboard: false }); expect(services.chrome.recentlyAccessed.add).toHaveBeenCalledWith( - '/app/lens#/edit/aaa', + `/app/lens#/edit/${savedObjectId}`, 'hello there', - 'aaa' + savedObjectId ); }); - it('saves the latest doc as a copy', async () => { - const { props, services, instance } = await save({ - initialSavedObjectId: defaultSavedObjectId, - newCopyOnSave: true, + it('saves new docs', async () => { + await save({ + prevSavedObjectId: undefined, + savedObjectId: defaultSavedObjectId, newTitle: 'hello there', - preloadedState: { persistedDoc: defaultDoc }, + comesFromDashboard: false, + switchToAddToDashboardNone: true, }); - expect(services.attributeService.wrapAttributes).toHaveBeenCalledWith( + expect(services.attributeService.saveToLibrary).toHaveBeenCalledWith( expect.objectContaining({ title: 'hello there', }), - true, + // from mocks + [ + { + id: 'mockip', + name: 'mockip', + type: 'index-pattern', + }, + ], undefined ); expect(props.redirectTo).toHaveBeenCalledWith(defaultSavedObjectId); - await act(async () => { - instance.setProps({ initialInput: { savedObjectId: defaultSavedObjectId } }); - }); - expect(services.attributeService.wrapAttributes).toHaveBeenCalledTimes(1); expect(services.notifications.toasts.addSuccess).toHaveBeenCalledWith( "Saved 'hello there'" ); }); - it('saves existing docs', async () => { - const { props, services, instance } = await save({ - initialSavedObjectId: defaultSavedObjectId, - newCopyOnSave: false, + it('saves existing docs as a copy', async () => { + const doc = getLensDocumentMock(); + await save({ + savedObjectId: doc.savedObjectId, + newCopyOnSave: true, newTitle: 'hello there', - preloadedState: { persistedDoc: defaultDoc }, + preloadedState: { persistedDoc: doc }, + prevSavedObjectId: 'prevId', + comesFromDashboard: false, }); - expect(services.attributeService.wrapAttributes).toHaveBeenCalledWith( + expect(services.attributeService.saveToLibrary).toHaveBeenCalledWith( expect.objectContaining({ - savedObjectId: defaultSavedObjectId, title: 'hello there', }), - true, - { id: '5678', savedObjectId: defaultSavedObjectId } + [{ id: 'mockip', name: 'mockip', type: 'index-pattern' }], + undefined ); - expect(props.redirectTo).not.toHaveBeenCalled(); - await act(async () => { - instance.setProps({ initialInput: { savedObjectId: defaultSavedObjectId } }); - }); + // new copy gets a new SO id + expect(props.redirectTo).toHaveBeenCalledWith(doc.savedObjectId); + expect(services.attributeService.saveToLibrary).toHaveBeenCalledTimes(1); expect(services.notifications.toasts.addSuccess).toHaveBeenCalledWith( "Saved 'hello there'" ); }); - it('handles save failure by showing a warning, but still allows another save', async () => { - const mockedConsoleDir = jest.spyOn(console, 'dir'); // mocked console.dir to avoid messages in the console when running tests - mockedConsoleDir.mockImplementation(() => {}); - - const props = makeDefaultProps(); - - props.incomingState = { - originatingApp: 'ultraDashboard', - }; - - const services = makeDefaultServicesForApp(); - services.attributeService.wrapAttributes = jest - .fn() - .mockRejectedValue({ message: 'failed' }); - const { instance } = await mountWith({ - props, - services, - preloadedState: { - isSaveable: true, - isLinkedToOriginatingApp: true, - }, - }); - - await act(async () => { - testSave(instance, { newCopyOnSave: false, newTitle: 'hello there' }); - }); - expect(props.redirectTo).not.toHaveBeenCalled(); - expect(getButton(instance).disableButton).toEqual(false); - // eslint-disable-next-line no-console - expect(console.dir).toHaveBeenCalledTimes(1); - mockedConsoleDir.mockRestore(); - }); - - it('saves new doc and redirects to originating app', async () => { - const { props, services } = await save({ - initialSavedObjectId: undefined, - returnToOrigin: true, + it('saves existing docs', async () => { + await save({ + savedObjectId: defaultSavedObjectId, + prevSavedObjectId: defaultSavedObjectId, newCopyOnSave: false, newTitle: 'hello there', + comesFromDashboard: false, + preloadedState: { + persistedDoc: getLensDocumentMock({ savedObjectId: defaultSavedObjectId }), + }, }); - expect(services.attributeService.wrapAttributes).toHaveBeenCalledWith( + expect(services.attributeService.saveToLibrary).toHaveBeenCalledWith( expect.objectContaining({ - savedObjectId: undefined, title: 'hello there', }), - true, - undefined + [{ id: 'mockip', name: 'mockip', type: 'index-pattern' }], + defaultSavedObjectId + ); + expect(props.redirectTo).not.toHaveBeenCalled(); + expect(services.notifications.toasts.addSuccess).toHaveBeenCalledWith( + "Saved 'hello there'" ); - expect(props.redirectToOrigin).toHaveBeenCalledWith({ - input: { savedObjectId: 'aaa' }, - isCopied: false, - }); }); it('saves app filters and does not save pinned filters', async () => { @@ -881,229 +696,227 @@ describe('Lens App', () => { await act(async () => { FilterManager.setFiltersStore([pinned], FilterStateStore.GLOBAL_STATE); }); - const { services } = await save({ - initialSavedObjectId: defaultSavedObjectId, - newCopyOnSave: false, - newTitle: 'hello there2', + + await save({ + savedObjectId: defaultSavedObjectId, + prevSavedObjectId: defaultSavedObjectId, preloadedState: { - persistedDoc: defaultDoc, + isSaveable: true, + persistedDoc: getLensDocumentMock({ savedObjectId: defaultSavedObjectId }), + isLinkedToOriginatingApp: true, filters: [pinned, unpinned], }, }); const { state: expectedFilters } = services.data.query.filterManager.extract([unpinned]); - expect(services.attributeService.wrapAttributes).toHaveBeenCalledWith( + expect(services.attributeService.saveToLibrary).toHaveBeenCalledWith( expect.objectContaining({ - savedObjectId: defaultSavedObjectId, - title: 'hello there2', + title: 'hello there', state: expect.objectContaining({ filters: expectedFilters }), }), - true, - { id: '5678', savedObjectId: defaultSavedObjectId } + [{ id: 'mockip', name: 'mockip', type: 'index-pattern' }], + undefined ); }); it('checks for duplicate title before saving', async () => { - const props = makeDefaultProps(); - props.incomingState = { originatingApp: 'coolContainer' }; - const services = makeDefaultServicesForApp(); - services.attributeService.wrapAttributes = jest - .fn() - .mockReturnValue(Promise.resolve({ savedObjectId: '123' })); - const { instance } = await mountWith({ - props, - services, + await save({ + savedObjectId: defaultSavedObjectId, + prevSavedObjectId: defaultSavedObjectId, preloadedState: { isSaveable: true, - persistedDoc: { savedObjectId: '123' } as unknown as Document, + persistedDoc: { savedObjectId: defaultSavedObjectId } as unknown as LensDocument, isLinkedToOriginatingApp: true, }, }); - await act(async () => { - instance.setProps({ initialInput: { savedObjectId: '123' } }); - getButton(instance).run(instance.getDOMNode()); - }); - instance.update(); - const onTitleDuplicate = jest.fn(); - await act(async () => { - instance.find(SavedObjectSaveModal).prop('onSave')({ - onTitleDuplicate, - isTitleDuplicateConfirmed: false, - newCopyOnSave: false, - newDescription: '', - newTitle: 'test', - }); - }); + expect(checkForDuplicateTitle).toHaveBeenCalledWith( - expect.objectContaining({ id: '123', isTitleDuplicateConfirmed: false }), - onTitleDuplicate, + { + copyOnSave: true, + displayName: 'Lens visualization', + isTitleDuplicateConfirmed: false, + lastSavedTitle: '', + title: 'hello there', + }, + expect.any(Function), expect.anything() ); }); + it('saves new doc and redirects to originating app', async () => { + await save({ + savedObjectId: undefined, + newCopyOnSave: false, + newTitle: 'hello there', + }); + expect(services.attributeService.saveToLibrary).toHaveBeenCalledWith( + expect.objectContaining({ + title: 'hello there', + }), + [{ id: 'mockip', name: 'mockip', type: 'index-pattern' }], + undefined + ); + expect(props.redirectToOrigin).toHaveBeenCalledWith({ + state: expect.objectContaining({ savedObjectId: defaultSavedObjectId }), + isCopied: false, + }); + }); + + it('handles save failure by showing a warning, but still allows another save', async () => { + const mockedConsoleDir = jest.spyOn(console, 'dir').mockImplementation(() => {}); // mocked console.dir to avoid messages in the console when running tests + + services.attributeService.saveToLibrary = jest + .fn() + .mockRejectedValue({ message: 'failed' }); + + props.incomingState = { + originatingApp: 'dashboards', + }; + + await renderApp({ + preloadedState: { + isSaveable: true, + isLinkedToOriginatingApp: true, + }, + }); + await clickSaveButton(); + await userEvent.type(screen.getByTestId('savedObjectTitle'), 'hello there'); + await userEvent.click(screen.getByTestId('confirmSaveSavedObjectButton')); + await waitToLoad(); + + expect(props.redirectTo).not.toHaveBeenCalled(); + expect(services.attributeService.saveToLibrary).toHaveBeenCalled(); + // eslint-disable-next-line no-console + expect(console.dir).toHaveBeenCalledTimes(1); + mockedConsoleDir.mockRestore(); + }); + it('does not show the copy button on first save', async () => { - const props = makeDefaultProps(); - props.incomingState = { originatingApp: 'coolContainer' }; - const { instance } = await mountWith({ - props, + props.incomingState = { + originatingApp: 'dashboards', + }; + + await renderApp({ preloadedState: { isSaveable: true, isLinkedToOriginatingApp: true }, }); - await act(async () => getButton(instance).run(instance.getDOMNode())); - instance.update(); - expect(instance.find(SavedObjectSaveModal).prop('showCopyOnSave')).toEqual(false); + await clickSaveButton(); + await waitForModalVisible(); + expect(screen.queryByTestId('saveAsNewCheckbox')).not.toBeInTheDocument(); }); it('enables Save Query UI when user has app-level permissions', async () => { - const services = makeDefaultServicesForApp(); - services.application = { - ...services.application, - capabilities: { - ...services.application.capabilities, - visualize: { saveQuery: true }, - }, + services.application.capabilities = { + ...services.application.capabilities, + visualize: { saveQuery: true }, }; - const { instance } = await mountWith({ services }); - await act(async () => { - const topNavMenu = instance.find(services.navigation.ui.AggregateQueryTopNavMenu); - expect(topNavMenu.props().saveQueryMenuVisibility).toBe('allowed_by_app_privilege'); - }); + + await renderApp(); + expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenLastCalledWith( + expect.objectContaining({ saveQueryMenuVisibility: 'allowed_by_app_privilege' }), + {} + ); }); it('checks global save query permission when user does not have app-level permissions', async () => { - const services = makeDefaultServicesForApp(); - services.application = { - ...services.application, - capabilities: { - ...services.application.capabilities, - visualize: { saveQuery: false }, - }, + services.application.capabilities = { + ...services.application.capabilities, + visualize: { saveQuery: false }, }; - const { instance } = await mountWith({ services }); - await act(async () => { - const topNavMenu = instance.find(services.navigation.ui.AggregateQueryTopNavMenu); - expect(topNavMenu.props().saveQueryMenuVisibility).toBe('globally_managed'); - }); + await renderApp(); + expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenLastCalledWith( + expect.objectContaining({ saveQueryMenuVisibility: 'globally_managed' }), + {} + ); }); }); }); describe('share button', () => { - function getShareButton(inst: ReactWrapper): TopNavMenuData { - return ( - inst.find('[data-test-subj="lnsApp_topNav"]').prop('config') as TopNavMenuData[] - ).find((button) => button.testId === 'lnsApp_shareButton')!; - } + const getShareButton = () => screen.getByTestId('lnsApp_shareButton'); it('should be disabled when no data is available', async () => { - const { instance } = await mountWith({ preloadedState: { isSaveable: true } }); - expect(getShareButton(instance).disableButton).toEqual(true); + await renderApp({ preloadedState: { isSaveable: true } }); + expect(getShareButton()).toBeDisabled(); }); it('should not disable share when not saveable', async () => { - const { instance } = await mountWith({ + await renderApp({ preloadedState: { isSaveable: false, activeData: { layer1: { type: 'datatable', columns: [], rows: [] } }, }, }); - expect(getShareButton(instance).disableButton).toEqual(false); + expect(getShareButton()).toBeEnabled(); }); it('should still be enabled even if the user is missing save permissions', async () => { - const services = makeDefaultServicesForApp(); - services.application = { - ...services.application, - capabilities: { - ...services.application.capabilities, - visualize: { save: false, saveQuery: false, show: true, createShortUrl: true }, - }, + services.application.capabilities = { + ...services.application.capabilities, + visualize: { save: false, saveQuery: false, show: true, createShortUrl: true }, }; - const { instance } = await mountWith({ - services, + await renderApp({ preloadedState: { isSaveable: true, activeData: { layer1: { type: 'datatable', columns: [], rows: [] } }, }, }); - expect(getShareButton(instance).disableButton).toEqual(false); + expect(getShareButton()).toBeEnabled(); }); it('should still be enabled even if the user is missing shortUrl permissions', async () => { - const services = makeDefaultServicesForApp(); - services.application = { - ...services.application, - capabilities: { - ...services.application.capabilities, - visualize: { save: true, saveQuery: false, show: true, createShortUrl: false }, - }, + services.application.capabilities = { + ...services.application.capabilities, + visualize: { save: true, saveQuery: false, show: true, createShortUrl: false }, }; - const { instance } = await mountWith({ - services, + await renderApp({ preloadedState: { isSaveable: true, activeData: { layer1: { type: 'datatable', columns: [], rows: [] } }, }, }); - expect(getShareButton(instance).disableButton).toEqual(false); + + expect(getShareButton()).toBeEnabled(); }); it('should be disabled if the user is missing shortUrl permissions and visualization is not saveable', async () => { - const services = makeDefaultServicesForApp(); - services.application = { - ...services.application, - capabilities: { - ...services.application.capabilities, - visualize: { save: false, saveQuery: false, show: true, createShortUrl: false }, - }, + services.application.capabilities = { + ...services.application.capabilities, + visualize: { save: false, saveQuery: false, show: true, createShortUrl: false }, }; - const { instance } = await mountWith({ - services, + await renderApp({ preloadedState: { isSaveable: false, activeData: { layer1: { type: 'datatable', columns: [], rows: [] } }, }, }); - expect(getShareButton(instance).disableButton).toEqual(true); + expect(getShareButton()).toBeDisabled(); }); }); describe('inspector', () => { - function getButton(inst: ReactWrapper): TopNavMenuData { - return ( - inst.find('[data-test-subj="lnsApp_topNav"]').prop('config') as TopNavMenuData[] - ).find((button) => button.testId === 'lnsApp_inspectButton')!; - } - - async function runInspect(inst: ReactWrapper) { - await getButton(inst).run(inst.getDOMNode()); - await inst.update(); - } - it('inspector button should be available', async () => { - const { instance } = await mountWith({ preloadedState: { isSaveable: true } }); - const button = getButton(instance); - - expect(button.disableButton).toEqual(false); + await renderApp({ + preloadedState: { isSaveable: true }, + }); + expect(screen.getByTestId('lnsApp_inspectButton')).toBeEnabled(); }); - it('should open inspect panel', async () => { - const services = makeDefaultServicesForApp(); - const { instance } = await mountWith({ services, preloadedState: { isSaveable: true } }); - - await runInspect(instance); - + await renderApp({ + preloadedState: { isSaveable: true }, + }); + await userEvent.click(screen.getByTestId('lnsApp_inspectButton')); expect(services.inspector.inspect).toHaveBeenCalledTimes(1); }); }); describe('query bar state management', () => { it('uses the default time and query language settings', async () => { - const { lensStore, services } = await mountWith({}); + const { lensStore } = await renderApp(); expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ query: { query: '', language: 'lucene' }, @@ -1125,18 +938,20 @@ describe('Lens App', () => { }); it('updates the editor frame when the user changes query or time in the search bar', async () => { - const { instance, services, lensStore } = await mountWith({}); + const { lensStore } = await renderApp(); (services.data.query.timefilter.timefilter.calculateBounds as jest.Mock).mockReturnValue({ min: moment('2021-01-09T04:00:00.000Z'), max: moment('2021-01-09T08:00:00.000Z'), }); + const onQuerySubmit = (services.navigation.ui.AggregateQueryTopNavMenu as jest.Mock).mock + .calls[0][0].onQuerySubmit; await act(async () => - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onQuerySubmit')!({ + onQuerySubmit({ dateRange: { from: 'now-14d', to: 'now-7d' }, query: { query: 'new', language: 'lucene' }, }) ); - instance.update(); + expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ query: { query: 'new', language: 'lucene' }, @@ -1162,7 +977,7 @@ describe('Lens App', () => { }); it('updates the filters when the user changes them', async () => { - const { instance, services, lensStore } = await mountWith({}); + const { lensStore } = await renderApp(); const indexPattern = { id: 'index1', isPersisted: () => true } as unknown as DataView; const field = { name: 'myfield' } as unknown as FieldSpec; expect(lensStore.getState()).toEqual({ @@ -1170,10 +985,9 @@ describe('Lens App', () => { filters: [], }), }); - act(() => - services.data.query.filterManager.setFilters([buildExistsFilter(field, indexPattern)]) - ); - instance.update(); + + services.data.query.filterManager.setFilters([buildExistsFilter(field, indexPattern)]); + expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ filters: [buildExistsFilter(field, indexPattern)], @@ -1182,7 +996,7 @@ describe('Lens App', () => { }); it('updates the searchSessionId when the user changes query or time in the search bar', async () => { - const { instance, services, lensStore } = await mountWith({}); + const { lensStore } = await renderApp(); expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ @@ -1190,13 +1004,14 @@ describe('Lens App', () => { }), }); + const AggregateQueryTopNavMenu = services.navigation.ui.AggregateQueryTopNavMenu as jest.Mock; + const onQuerySubmit = AggregateQueryTopNavMenu.mock.calls[0][0].onQuerySubmit; act(() => - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onQuerySubmit')!({ + onQuerySubmit({ dateRange: { from: 'now-14d', to: 'now-7d' }, query: { query: '', language: 'lucene' }, }) ); - instance.update(); expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ @@ -1205,12 +1020,12 @@ describe('Lens App', () => { }); // trigger again, this time changing just the query act(() => - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onQuerySubmit')!({ + onQuerySubmit({ dateRange: { from: 'now-14d', to: 'now-7d' }, query: { query: 'new', language: 'lucene' }, }) ); - instance.update(); + expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ searchSessionId: `sessionId-3`, @@ -1221,7 +1036,7 @@ describe('Lens App', () => { act(() => services.data.query.filterManager.setFilters([buildExistsFilter(field, indexPattern)]) ); - instance.update(); + expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ searchSessionId: `sessionId-4`, @@ -1232,15 +1047,11 @@ describe('Lens App', () => { describe('saved query handling', () => { it('does not allow saving when the user is missing the saveQuery permission', async () => { - const services = makeDefaultServicesForApp(); - services.application = { - ...services.application, - capabilities: { - ...services.application.capabilities, - visualize: { save: false, saveQuery: false, show: true }, - }, + services.application.capabilities = { + ...services.application.capabilities, + visualize: { save: false, saveQuery: false, show: true }, }; - await mountWith({ services }); + await renderApp(); expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ saveQueryMenuVisibility: 'globally_managed' }), {} @@ -1248,7 +1059,8 @@ describe('Lens App', () => { }); it('persists the saved query ID when the query is saved', async () => { - const { instance, services } = await mountWith({}); + await renderApp(); + expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ saveQueryMenuVisibility: 'allowed_by_app_privilege', @@ -1259,8 +1071,11 @@ describe('Lens App', () => { }), {} ); + + const onSaved = (services.navigation.ui.AggregateQueryTopNavMenu as jest.Mock).mock + .calls[0][0].onSaved; act(() => { - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onSaved')!({ + onSaved({ id: '1', attributes: { title: '', @@ -1287,9 +1102,12 @@ describe('Lens App', () => { }); it('changes the saved query ID when the query is updated', async () => { - const { instance, services } = await mountWith({}); + await renderApp(); + const { onSaved, onSavedQueryUpdated } = ( + services.navigation.ui.AggregateQueryTopNavMenu as jest.Mock + ).mock.calls[0][0]; act(() => { - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onSaved')!({ + onSaved({ id: '1', attributes: { title: '', @@ -1300,17 +1118,15 @@ describe('Lens App', () => { }); }); act(() => { - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onSavedQueryUpdated')!( - { - id: '2', - attributes: { - title: 'new title', - description: '', - query: { query: '', language: 'lucene' }, - }, - namespaces: ['default'], - } - ); + onSavedQueryUpdated({ + id: '2', + attributes: { + title: 'new title', + description: '', + query: { query: '', language: 'lucene' }, + }, + namespaces: ['default'], + }); }); expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ @@ -1329,19 +1145,19 @@ describe('Lens App', () => { }); it('updates the query if saved query is selected', async () => { - const { instance, services } = await mountWith({}); + await renderApp(); + const { onSavedQueryUpdated } = (services.navigation.ui.AggregateQueryTopNavMenu as jest.Mock) + .mock.calls[0][0]; act(() => { - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onSavedQueryUpdated')!( - { - id: '2', - attributes: { - title: 'new title', - description: '', - query: { query: 'abc:def', language: 'lucene' }, - }, - namespaces: ['default'], - } - ); + onSavedQueryUpdated({ + id: '2', + attributes: { + title: 'new title', + description: '', + query: { query: 'abc:def', language: 'lucene' }, + }, + namespaces: ['default'], + }); }); expect(services.navigation.ui.AggregateQueryTopNavMenu).toHaveBeenCalledWith( expect.objectContaining({ @@ -1352,9 +1168,12 @@ describe('Lens App', () => { }); it('clears all existing unpinned filters when the active saved query is cleared', async () => { - const { instance, services, lensStore } = await mountWith({}); + const { lensStore } = await renderApp(); + const { onQuerySubmit, onClearSavedQuery } = ( + services.navigation.ui.AggregateQueryTopNavMenu as jest.Mock + ).mock.calls[0][0]; act(() => - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onQuerySubmit')!({ + onQuerySubmit({ dateRange: { from: 'now-14d', to: 'now-7d' }, query: { query: 'new', language: 'lucene' }, }) @@ -1366,11 +1185,7 @@ describe('Lens App', () => { const pinned = buildExistsFilter(pinnedField, indexPattern); FilterManager.setFiltersStore([pinned], FilterStateStore.GLOBAL_STATE); act(() => services.data.query.filterManager.setFilters([pinned, unpinned])); - instance.update(); - act(() => - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onClearSavedQuery')!() - ); - instance.update(); + act(() => onClearSavedQuery()); expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ filters: [pinned], @@ -1381,9 +1196,12 @@ describe('Lens App', () => { describe('search session id management', () => { it('updates the searchSessionId when the query is updated', async () => { - const { instance, lensStore, services } = await mountWith({}); + const { lensStore } = await renderApp(); + const { onSaved, onSavedQueryUpdated } = ( + services.navigation.ui.AggregateQueryTopNavMenu as jest.Mock + ).mock.calls[0][0]; act(() => { - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onSaved')!({ + onSaved({ id: '1', attributes: { title: '', @@ -1394,19 +1212,16 @@ describe('Lens App', () => { }); }); act(() => { - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onSavedQueryUpdated')!( - { - id: '2', - attributes: { - title: 'new title', - description: '', - query: { query: '', language: 'lucene' }, - }, - namespaces: ['default'], - } - ); + onSavedQueryUpdated({ + id: '2', + attributes: { + title: 'new title', + description: '', + query: { query: '', language: 'lucene' }, + }, + namespaces: ['default'], + }); }); - instance.update(); expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ searchSessionId: `sessionId-2`, @@ -1415,9 +1230,12 @@ describe('Lens App', () => { }); it('updates the searchSessionId when the active saved query is cleared', async () => { - const { instance, services, lensStore } = await mountWith({}); + const { lensStore } = await renderApp(); + const { onQuerySubmit, onClearSavedQuery } = ( + services.navigation.ui.AggregateQueryTopNavMenu as jest.Mock + ).mock.calls[0][0]; act(() => - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onQuerySubmit')!({ + onQuerySubmit({ dateRange: { from: 'now-14d', to: 'now-7d' }, query: { query: 'new', language: 'lucene' }, }) @@ -1429,11 +1247,7 @@ describe('Lens App', () => { const pinned = buildExistsFilter(pinnedField, indexPattern); FilterManager.setFiltersStore([pinned], FilterStateStore.GLOBAL_STATE); act(() => services.data.query.filterManager.setFilters([pinned, unpinned])); - instance.update(); - act(() => - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onClearSavedQuery')!() - ); - instance.update(); + act(() => onClearSavedQuery()); expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ searchSessionId: `sessionId-4`, @@ -1442,14 +1256,14 @@ describe('Lens App', () => { }); it('dispatches update to searchSessionId and dateRange when the user hits refresh', async () => { - const { instance, services, lensStore } = await mountWith({}); + const { lensStore } = await renderApp(); + const { onQuerySubmit } = (services.navigation.ui.AggregateQueryTopNavMenu as jest.Mock).mock + .calls[0][0]; act(() => - instance.find(services.navigation.ui.AggregateQueryTopNavMenu).prop('onQuerySubmit')!({ + onQuerySubmit({ dateRange: { from: 'now-7d', to: 'now' }, }) ); - - instance.update(); expect(lensStore.dispatch).toHaveBeenCalledWith({ type: 'lens/setState', payload: { @@ -1464,15 +1278,12 @@ describe('Lens App', () => { it('updates the state if session id changes from the outside', async () => { const sessionIdS = new Subject(); - const services = makeDefaultServices(sessionIdS, 'sessionId-1'); - const { lensStore } = await mountWith({ props: undefined, services }); + services = makeDefaultServices(sessionIdS, 'sessionId-1'); + const { lensStore } = await renderApp(); - act(() => { - sessionIdS.next('new-session-id'); - }); - await act(async () => { - await new Promise((r) => setTimeout(r, 0)); - }); + act(() => sessionIdS.next('new-session-id')); + + await waitToLoad(); expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ searchSessionId: `new-session-id`, @@ -1481,7 +1292,7 @@ describe('Lens App', () => { }); it('does not update the searchSessionId when the state changes', async () => { - const { lensStore } = await mountWith({ preloadedState: { isSaveable: true } }); + const { lensStore } = await renderApp({ preloadedState: { isSaveable: true } }); expect(lensStore.getState()).toEqual({ lens: expect.objectContaining({ searchSessionId: `sessionId-1`, @@ -1491,40 +1302,37 @@ describe('Lens App', () => { }); describe('showing a confirm message when leaving', () => { - let defaultLeave: jest.Mock; - let confirmLeave: jest.Mock; + const defaultLeave = jest.fn(); + const confirmLeave = jest.fn(); beforeEach(() => { - defaultLeave = jest.fn(); - confirmLeave = jest.fn(); + jest.clearAllMocks(); }); it('should not show a confirm message if there is no expression to save', async () => { - const { props } = await mountWith({}); - const lastCall = props.onAppLeave.mock.calls[props.onAppLeave.mock.calls.length - 1][0]; + await renderApp(); + const lastCall = (props.onAppLeave as jest.Mock).mock.lastCall![0]; lastCall({ default: defaultLeave, confirm: confirmLeave }); expect(defaultLeave).toHaveBeenCalled(); expect(confirmLeave).not.toHaveBeenCalled(); }); it('does not confirm if the user is missing save permissions', async () => { - const services = makeDefaultServicesForApp(); - services.application = { - ...services.application, - capabilities: { - ...services.application.capabilities, - visualize: { save: false, saveQuery: false, show: true }, - }, + services.application.capabilities = { + ...services.application.capabilities, + visualize: { save: false, saveQuery: false, show: true }, }; - const { props } = await mountWith({ services, preloadedState: { isSaveable: true } }); - const lastCall = props.onAppLeave.mock.calls[props.onAppLeave.mock.calls.length - 1][0]; + await renderApp({ + preloadedState: { isSaveable: true }, + }); + const lastCall = (props.onAppLeave as jest.Mock).mock.lastCall![0]; lastCall({ default: defaultLeave, confirm: confirmLeave }); expect(defaultLeave).toHaveBeenCalled(); expect(confirmLeave).not.toHaveBeenCalled(); }); it('should confirm when leaving with an unsaved doc', async () => { - const { props } = await mountWith({ + await renderApp({ preloadedState: { visualization: { activeId: 'testVis', @@ -1533,16 +1341,18 @@ describe('Lens App', () => { isSaveable: true, }, }); - const lastCall = props.onAppLeave.mock.calls[props.onAppLeave.mock.calls.length - 1][0]; + const lastCall = (props.onAppLeave as jest.Mock).mock.calls[ + (props.onAppLeave as jest.Mock).mock.calls.length - 1 + ][0]; lastCall({ default: defaultLeave, confirm: confirmLeave }); expect(confirmLeave).toHaveBeenCalled(); expect(defaultLeave).not.toHaveBeenCalled(); }); it('should confirm when leaving with unsaved changes to an existing doc', async () => { - const { props } = await mountWith({ + await renderApp({ preloadedState: { - persistedDoc: defaultDoc, + persistedDoc: getLensDocumentMock(), visualization: { activeId: 'testVis', state: {}, @@ -1550,73 +1360,45 @@ describe('Lens App', () => { isSaveable: true, }, }); - const lastCall = props.onAppLeave.mock.calls[props.onAppLeave.mock.calls.length - 1][0]; + const lastCall = (props.onAppLeave as jest.Mock).mock.lastCall![0]; lastCall({ default: defaultLeave, confirm: confirmLeave }); expect(confirmLeave).toHaveBeenCalled(); expect(defaultLeave).not.toHaveBeenCalled(); }); it('should confirm when leaving from a context initial doc with changes made in lens', async () => { - const initialProps = { - ...makeDefaultProps(), - contextOriginatingApp: 'TSVB', - initialContext: { - layers: [ - { - indexPatternId: 'ff959d40-b880-11e8-a6d9-e546fe2bba5f', - xFieldName: 'order_date', - xMode: 'date_histogram', - chartType: 'area', - axisPosition: 'left', - palette: { - type: 'palette', - name: 'default', - }, - metrics: [ - { - agg: 'count', - isFullReference: false, - fieldName: 'document', - params: {}, - color: '#68BC00', - }, - ], - timeInterval: 'auto', - }, - ], - type: 'lnsXY', - configuration: { - fill: 0.5, - legend: { - isVisible: true, - position: 'right', - shouldTruncate: true, - maxLines: 1, - }, - gridLinesVisibility: { - x: true, - yLeft: true, - yRight: true, + props.contextOriginatingApp = 'TSVB'; + props.initialContext = { + layers: [ + { + indexPatternId: 'indexPatternId', + chartType: 'area', + axisPosition: 'left', + palette: { + type: 'palette', + name: 'default', }, - extents: { - yLeftExtent: { - mode: 'full', - }, - yRightExtent: { - mode: 'full', + metrics: [ + { + agg: 'count', + isFullReference: false, + fieldName: 'document', + params: {}, + color: '#68BC00', }, - }, + ], + timeInterval: 'auto', }, - savedObjectId: '', - vizEditorOriginatingAppUrl: '#/tsvb-link', - isVisualizeAction: true, - }, - }; + ], + type: 'lnsXY', + savedObjectId: '', + vizEditorOriginatingAppUrl: '#/tsvb-link', + isVisualizeAction: true, + } as unknown as VisualizeEditorContext; - const mountedApp = await mountWith({ - props: initialProps as unknown as jest.Mocked, + await renderApp({ preloadedState: { - persistedDoc: defaultDoc, + persistedDoc: getLensDocumentMock(), visualization: { activeId: 'testVis', state: {}, @@ -1624,76 +1406,72 @@ describe('Lens App', () => { isSaveable: true, }, }); - const lastCall = - mountedApp.props.onAppLeave.mock.calls[ - mountedApp.props.onAppLeave.mock.calls.length - 1 - ][0]; + const lastCall = (props.onAppLeave as jest.Mock).mock.lastCall![0]; lastCall({ default: defaultLeave, confirm: confirmLeave }); expect(defaultLeave).not.toHaveBeenCalled(); expect(confirmLeave).toHaveBeenCalled(); }); it('should not confirm when changes are saved', async () => { + const localDoc = getLensDocumentMock(); const preloadedState = { persistedDoc: { - ...defaultDoc, + ...localDoc, state: { - ...defaultDoc.state, - datasourceStates: { testDatasource: {} }, + ...localDoc.state, + datasourceStates: { + testDatasource: 'datasource', + }, visualization: {}, }, }, isSaveable: true, - ...(defaultDoc.state as Partial), + ...(localDoc.state as Partial), visualization: { activeId: 'testVis', state: {}, }, }; - const customProps = makeDefaultProps(); - customProps.datasourceMap.testDatasource.isEqual = () => true; // if this returns false, the documents won't be accounted equal + props.datasourceMap.testDatasource.isEqual = jest.fn().mockReturnValue(true); // if this returns false, the documents won't be accounted equal - const { props } = await mountWith({ preloadedState, props: customProps }); + await renderApp({ preloadedState }); - const lastCall = props.onAppLeave.mock.calls[props.onAppLeave.mock.calls.length - 1][0]; - lastCall({ default: defaultLeave, confirm: confirmLeave }); + const lastCallArg = props.onAppLeave.mock.lastCall![0]; + lastCallArg?.({ default: defaultLeave, confirm: confirmLeave }); expect(defaultLeave).toHaveBeenCalled(); expect(confirmLeave).not.toHaveBeenCalled(); }); - // not sure how to test it it('should confirm when the latest doc is invalid', async () => { - const { lensStore, props } = await mountWith({}); - act(() => { - lensStore.dispatch( + const { lensStore } = await renderApp(); + await act(async () => { + await lensStore.dispatch( setState({ - persistedDoc: defaultDoc, + persistedDoc: getLensDocumentMock(), isSaveable: true, }) ); }); - const lastCall = props.onAppLeave.mock.calls[props.onAppLeave.mock.calls.length - 1][0]; + const lastCall = (props.onAppLeave as jest.Mock).mock.lastCall![0]; lastCall({ default: defaultLeave, confirm: confirmLeave }); expect(confirmLeave).toHaveBeenCalled(); expect(defaultLeave).not.toHaveBeenCalled(); }); }); + it('should display a conflict callout if saved object conflicts', async () => { const history = createMemoryHistory(); - const { services } = await mountWith({ - props: { - ...makeDefaultProps(), - history: { - ...history, - location: { - ...history.location, - search: '?_g=test', - }, - }, + props.history = { + ...history, + location: { + ...history.location, + search: '?_g=test', }, + }; + await renderApp({ preloadedState: { - persistedDoc: defaultDoc, + persistedDoc: getLensDocumentMock({ savedObjectId: defaultSavedObjectId }), sharingSavedObjectProps: { outcome: 'conflict', aliasTargetId: '2', @@ -1701,7 +1479,7 @@ describe('Lens App', () => { }, }); expect(services.spaces?.ui.components.getLegacyUrlConflict).toHaveBeenCalledWith({ - currentObjectId: '1234', + currentObjectId: defaultSavedObjectId, objectNoun: 'Lens visualization', otherObjectId: '2', otherObjectPath: '#/edit/2?_g=test', diff --git a/x-pack/plugins/lens/public/app_plugin/app.tsx b/x-pack/plugins/lens/public/app_plugin/app.tsx index 60e1b0dfdb668..b8903bde1af0f 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.tsx @@ -9,16 +9,14 @@ import './app.scss'; import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react'; import { i18n } from '@kbn/i18n'; import type { TimeRange } from '@kbn/es-query'; -import { EuiBreadcrumb, EuiConfirmModal } from '@elastic/eui'; +import { EuiConfirmModal } from '@elastic/eui'; import { useExecutionContext, useKibana } from '@kbn/kibana-react-plugin/public'; import { OnSaveProps } from '@kbn/saved-objects-plugin/public'; import type { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public'; -import type { LensAppLocatorParams } from '../../common/locator/locator'; import { LensAppProps, LensAppServices } from './types'; import { LensTopNavMenu } from './lens_top_nav'; -import { LensByReferenceInput } from '../embeddable'; -import { AddUserMessages, EditorFrameInstance, UserMessagesGetter } from '../types'; -import { Document } from '../persistence/saved_object_store'; +import { AddUserMessages, EditorFrameInstance, Simplify, UserMessagesGetter } from '../types'; +import { LensDocument } from '../persistence/saved_object_store'; import { setState, @@ -43,15 +41,24 @@ import { import { replaceIndexpattern } from '../state_management/lens_slice'; import { useApplicationUserMessages } from './get_application_user_messages'; import { trackSaveUiCounterEvents } from '../lens_ui_telemetry'; - -export type SaveProps = Omit & { - returnToOrigin: boolean; - dashboardId?: string | null; - onTitleDuplicate?: OnSaveProps['onTitleDuplicate']; - newDescription?: string; - newTags?: string[]; - panelTimeRange?: TimeRange; -}; +import { + getCurrentTitle, + isLegacyEditorEmbeddable, + setBreadcrumbsTitle, + useNavigateBackToApp, + useShortUrlService, +} from './app_helpers'; + +export type SaveProps = Simplify< + Omit & { + returnToOrigin: boolean; + dashboardId?: string | null; + onTitleDuplicate?: OnSaveProps['onTitleDuplicate']; + newDescription?: string; + newTags?: string[]; + panelTimeRange?: TimeRange; + } +>; export function App({ history, @@ -127,18 +134,26 @@ export function App({ selectSavedObjectFormat(state, selectorDependencies) ); - const shortUrls = useMemo(() => share?.url.shortUrls.get(null), [share]); - // Used to show a popover that guides the user towards changing the date range when no data is available. const [indicateNoData, setIndicateNoData] = useState(false); const [isSaveModalVisible, setIsSaveModalVisible] = useState(false); - const [lastKnownDoc, setLastKnownDoc] = useState(undefined); - const [initialDocFromContext, setInitialDocFromContext] = useState( + const [lastKnownDoc, setLastKnownDoc] = useState(undefined); + const [initialDocFromContext, setInitialDocFromContext] = useState( undefined ); - const [isGoBackToVizEditorModalVisible, setIsGoBackToVizEditorModalVisible] = useState(false); const [shouldCloseAndSaveTextBasedQuery, setShouldCloseAndSaveTextBasedQuery] = useState(false); - const savedObjectId = (initialInput as LensByReferenceInput)?.savedObjectId; + const savedObjectId = initialInput?.savedObjectId; + + const isFromLegacyEditorEmbeddable = isLegacyEditorEmbeddable(initialContext); + const legacyEditorAppName = + initialContext && 'originatingApp' in initialContext + ? initialContext.originatingApp + : undefined; + const legacyEditorAppUrl = + initialContext && 'vizEditorOriginatingAppUrl' in initialContext + ? initialContext.vizEditorOriginatingAppUrl + : undefined; + const initialContextIsEmbedded = Boolean(legacyEditorAppName); useEffect(() => { if (currentDoc) { @@ -167,18 +182,27 @@ export function App({ [isLinkedToOriginatingApp, savedObjectId] ); + // Wrap the isEqual call to avoid to carry all the static references + // around all the time. + const isLensEqualWrapper = useCallback( + (refDoc: LensDocument | undefined) => { + return isLensEqual( + refDoc, + lastKnownDoc, + data.query.filterManager.inject.bind(data.query.filterManager), + datasourceMap, + visualizationMap, + annotationGroups + ); + }, + [annotationGroups, data.query.filterManager, datasourceMap, lastKnownDoc, visualizationMap] + ); + useEffect(() => { onAppLeave((actions) => { if ( application.capabilities.visualize.save && - !isLensEqual( - persistedDoc, - lastKnownDoc, - data.query.filterManager.inject.bind(data.query.filterManager), - datasourceMap, - visualizationMap, - annotationGroups - ) && + !isLensEqualWrapper(persistedDoc) && (isSaveable || persistedDoc) ) { return actions.confirm( @@ -208,6 +232,7 @@ export function App({ datasourceMap, visualizationMap, annotationGroups, + isLensEqualWrapper, ]); const getLegacyUrlConflictCallout = useCallback(() => { @@ -235,66 +260,17 @@ export function App({ // Sync Kibana breadcrumbs any time the saved document's title changes useEffect(() => { const isByValueMode = getIsByValueMode(); - const comesFromVizEditorDashboard = - initialContext && 'originatingApp' in initialContext && initialContext.originatingApp; - const breadcrumbs: EuiBreadcrumb[] = []; - if ( - (isLinkedToOriginatingApp || comesFromVizEditorDashboard) && - getOriginatingAppName() && - redirectToOrigin - ) { - breadcrumbs.push({ - onClick: () => { - redirectToOrigin(); - }, - text: getOriginatingAppName(), - }); - } - if (!isByValueMode) { - breadcrumbs.push({ - href: application.getUrlForApp('visualize'), - onClick: (e) => { - application.navigateToApp('visualize', { path: '/' }); - e.preventDefault(); - }, - text: i18n.translate('xpack.lens.breadcrumbsTitle', { - defaultMessage: 'Visualize Library', - }), - }); - } - let currentDocTitle = i18n.translate('xpack.lens.breadcrumbsCreate', { - defaultMessage: 'Create', - }); - if (persistedDoc) { - currentDocTitle = isByValueMode - ? i18n.translate('xpack.lens.breadcrumbsByValue', { defaultMessage: 'Edit visualization' }) - : persistedDoc.title; - } - if ( - !persistedDoc?.title && - initialContext && - 'isEmbeddable' in initialContext && - initialContext.isEmbeddable - ) { - currentDocTitle = i18n.translate('xpack.lens.breadcrumbsEditInLensFromDashboard', { - defaultMessage: 'Converting {title} visualization', - values: { - title: initialContext.title ? `"${initialContext.title}"` : initialContext.visTypeTitle, - }, - }); - } - - const currentDocBreadcrumb: EuiBreadcrumb = { text: currentDocTitle }; - breadcrumbs.push(currentDocBreadcrumb); - if (serverless?.setBreadcrumbs) { - // TODO: https://github.com/elastic/kibana/issues/163488 - // for now, serverless breadcrumbs only set the title, - // the rest of the breadcrumbs are handled by the serverless navigation - // the serverless navigation is not yet aware of the byValue/originatingApp context - serverless.setBreadcrumbs(currentDocBreadcrumb); - } else { - chrome.setBreadcrumbs(breadcrumbs); - } + const currentDocTitle = getCurrentTitle(persistedDoc, isByValueMode, initialContext); + setBreadcrumbsTitle( + { application, chrome, serverless }, + { + isByValueMode, + currentDocTitle, + redirectToOrigin, + isFromLegacyEditor: Boolean(isLinkedToOriginatingApp || legacyEditorAppName), + originatingAppName: getOriginatingAppName(), + } + ); }, [ getOriginatingAppName, redirectToOrigin, @@ -303,8 +279,10 @@ export function App({ chrome, isLinkedToOriginatingApp, persistedDoc, - initialContext, + isFromLegacyEditorEmbeddable, + legacyEditorAppName, serverless, + initialContext, ]); const switchDatasource = useCallback(() => { @@ -314,12 +292,13 @@ export function App({ }, []); const runSave = useCallback( - (saveProps: SaveProps, options: { saveToLibrary: boolean }) => { + async (saveProps: SaveProps, options: { saveToLibrary: boolean }) => { dispatch(applyChanges()); const prevVisState = persistedDoc?.visualizationType === visualization.activeId ? persistedDoc?.state.visualization : undefined; + const telemetryEvents = activeVisualization?.getTelemetryEventsOnSave?.( visualization.state, prevVisState @@ -327,36 +306,33 @@ export function App({ if (telemetryEvents && telemetryEvents.length) { trackSaveUiCounterEvents(telemetryEvents); } - return runSaveLensVisualization( - { - lastKnownDoc, - getIsByValueMode, - savedObjectsTagging, - initialInput, - redirectToOrigin, - persistedDoc, - onAppLeave, - redirectTo, - switchDatasource, - originatingApp: incomingState?.originatingApp, - textBasedLanguageSave: shouldCloseAndSaveTextBasedQuery, - ...lensAppServices, - }, - saveProps, - options - ).then( - (newState) => { - if (newState) { - dispatchSetState(newState); - setIsSaveModalVisible(false); - setShouldCloseAndSaveTextBasedQuery(false); - } - }, - () => { - // error is handled inside the modal - // so ignoring it here + try { + const newState = await runSaveLensVisualization( + { + lastKnownDoc, + savedObjectsTagging, + initialInput, + redirectToOrigin, + persistedDoc, + onAppLeave, + redirectTo, + switchDatasource, + originatingApp: incomingState?.originatingApp, + textBasedLanguageSave: shouldCloseAndSaveTextBasedQuery, + ...lensAppServices, + }, + saveProps, + options + ); + if (newState) { + dispatchSetState(newState); + setIsSaveModalVisible(false); + setShouldCloseAndSaveTextBasedQuery(false); } - ); + } catch (e) { + // error is handled inside the modal + // so ignoring it here + } }, [ visualization.activeId, @@ -364,7 +340,6 @@ export function App({ activeVisualization, dispatch, lastKnownDoc, - getIsByValueMode, savedObjectsTagging, initialInput, redirectToOrigin, @@ -386,67 +361,20 @@ export function App({ } }, [lastKnownDoc, initialDocFromContext]); - // if users comes to Lens from the Viz editor, they should have the option to navigate back - const goBackToOriginatingApp = useCallback(() => { - if ( - initialContext && - 'vizEditorOriginatingAppUrl' in initialContext && - initialContext.vizEditorOriginatingAppUrl - ) { - const [initialDocFromContextUnchanged, currentDocHasBeenSavedInLens] = [ - initialDocFromContext, - persistedDoc, - ].map((refDoc) => - isLensEqual( - refDoc, - lastKnownDoc, - data.query.filterManager.inject, - datasourceMap, - visualizationMap, - annotationGroups - ) - ); - if (initialDocFromContextUnchanged || currentDocHasBeenSavedInLens) { - onAppLeave((actions) => { - return actions.default(); - }); - application.navigateToApp('visualize', { path: initialContext.vizEditorOriginatingAppUrl }); - } else { - setIsGoBackToVizEditorModalVisible(true); - } - } - }, [ - annotationGroups, + const { + shouldShowGoBackToVizEditorModal, + goBackToOriginatingApp, + navigateToVizEditor, + closeGoBackToVizEditorModal, + } = useNavigateBackToApp({ application, - data.query.filterManager.inject, - datasourceMap, - initialContext, - initialDocFromContext, - lastKnownDoc, onAppLeave, + legacyEditorAppName, + legacyEditorAppUrl, + initialDocFromContext, persistedDoc, - visualizationMap, - ]); - - const navigateToVizEditor = useCallback(() => { - setIsGoBackToVizEditorModalVisible(false); - if ( - initialContext && - 'vizEditorOriginatingAppUrl' in initialContext && - initialContext.vizEditorOriginatingAppUrl - ) { - onAppLeave((actions) => { - return actions.default(); - }); - application.navigateToApp('visualize', { path: initialContext.vizEditorOriginatingAppUrl }); - } - }, [application, initialContext, onAppLeave]); - - const initialContextIsEmbedded = useMemo(() => { - return Boolean( - initialContext && 'originatingApp' in initialContext && initialContext.originatingApp - ); - }, [initialContext]); + isLensEqual: isLensEqualWrapper, + }); const indexPatternService = useMemo( () => @@ -471,35 +399,12 @@ export function App({ [dataViews, uiActions, http, notifications, uiSettings, initialContext, dispatch] ); - // remember latest URL based on the configuration - // url_panel_content has a similar logic - const shareURLCache = useRef({ params: '', url: '' }); - - const shortUrlService = useCallback( - async (params: LensAppLocatorParams) => { - const cacheKey = JSON.stringify(params); - if (shareURLCache.current.params === cacheKey) { - return shareURLCache.current.url; - } - if (locator && shortUrls) { - // This is a stripped down version of what the share URL plugin is doing - const shortUrl = await shortUrls.createWithLocator({ locator, params }); - const absoluteShortUrl = await shortUrl.locator.getUrl(shortUrl.params, { absolute: true }); - shareURLCache.current = { params: cacheKey, url: absoluteShortUrl }; - return absoluteShortUrl; - } - return ''; - }, - [locator, shortUrls] - ); + const shortUrlService = useShortUrlService(locator, share); const isManaged = useLensSelector(selectIsManaged); const returnToOriginSwitchLabelForContext = - initialContext && - 'isEmbeddable' in initialContext && - initialContext.isEmbeddable && - !persistedDoc + isFromLegacyEditorEmbeddable && !persistedDoc ? i18n.translate('xpack.lens.app.replacePanel', { defaultMessage: 'Replace panel on {originatingApp}', values: { @@ -547,16 +452,7 @@ export function App({ title={persistedDoc?.title} lensInspector={lensInspector} currentDoc={currentDoc} - isCurrentStateDirty={ - !isLensEqual( - persistedDoc, - lastKnownDoc, - data.query.filterManager.inject.bind(data.query.filterManager), - datasourceMap, - visualizationMap, - annotationGroups - ) - } + isCurrentStateDirty={!isLensEqualWrapper(persistedDoc)} goBackToOriginatingApp={goBackToOriginatingApp} contextOriginatingApp={contextOriginatingApp} initialContextIsEmbedded={initialContextIsEmbedded} @@ -612,13 +508,13 @@ export function App({ } /> )} - {isGoBackToVizEditorModalVisible && ( + {shouldShowGoBackToVizEditorModal && ( setIsGoBackToVizEditorModalVisible(false)} + onCancel={closeGoBackToVizEditorModal} onConfirm={navigateToVizEditor} cancelButtonText={i18n.translate('xpack.lens.app.goBackModalCancelBtn', { defaultMessage: 'Cancel', diff --git a/x-pack/plugins/lens/public/app_plugin/app_helpers.test.ts b/x-pack/plugins/lens/public/app_plugin/app_helpers.test.ts new file mode 100644 index 0000000000000..7dc4e8cfda78c --- /dev/null +++ b/x-pack/plugins/lens/public/app_plugin/app_helpers.test.ts @@ -0,0 +1,76 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { renderHook, act } from '@testing-library/react-hooks'; +import faker from 'faker'; +import { UseNavigateBackToAppProps, useNavigateBackToApp } from './app_helpers'; +import { defaultDoc, makeDefaultServices } from '../mocks/services_mock'; +import { cloneDeep } from 'lodash'; +import { LensDocument } from '../persistence'; + +function getLensDocumentMock(someProps?: Partial) { + return cloneDeep({ ...defaultDoc, ...someProps }); +} + +const getApplicationMock = () => makeDefaultServices().application; + +describe('App helpers', () => { + function getDefaultProps( + someProps?: Partial + ): UseNavigateBackToAppProps { + return { + application: getApplicationMock(), + onAppLeave: jest.fn(), + legacyEditorAppName: faker.lorem.word(), + legacyEditorAppUrl: faker.internet.url(), + isLensEqual: jest.fn(() => true), + initialDocFromContext: undefined, + persistedDoc: getLensDocumentMock(), + ...someProps, + }; + } + describe('useNavigateBackToApp', () => { + it('navigates back to originating app if documents has not changed', () => { + const props = getDefaultProps(); + const { result } = renderHook(() => useNavigateBackToApp(props)); + + act(() => { + result.current.goBackToOriginatingApp(); + }); + + expect(props.application.navigateToApp).toHaveBeenCalledWith(props.legacyEditorAppName, { + path: props.legacyEditorAppUrl, + }); + }); + + it('shows modal if documents are not equal', () => { + const props = getDefaultProps({ isLensEqual: jest.fn().mockReturnValue(false) }); + const { result } = renderHook(() => useNavigateBackToApp(props)); + + act(() => { + result.current.goBackToOriginatingApp(); + }); + + expect(props.application.navigateToApp).not.toHaveBeenCalled(); + expect(result.current.shouldShowGoBackToVizEditorModal).toBe(true); + }); + + it('navigateToVizEditor hides modal and navigates back to Viz editor', () => { + const props = getDefaultProps(); + const { result } = renderHook(() => useNavigateBackToApp(props)); + + act(() => { + result.current.navigateToVizEditor(); + }); + + expect(result.current.shouldShowGoBackToVizEditorModal).toBe(false); + expect(props.application.navigateToApp).toHaveBeenCalledWith(props.legacyEditorAppName, { + path: props.legacyEditorAppUrl, + }); + }); + }); +}); diff --git a/x-pack/plugins/lens/public/app_plugin/app_helpers.ts b/x-pack/plugins/lens/public/app_plugin/app_helpers.ts new file mode 100644 index 0000000000000..4e240ac17159a --- /dev/null +++ b/x-pack/plugins/lens/public/app_plugin/app_helpers.ts @@ -0,0 +1,207 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public'; +import { EuiBreadcrumb } from '@elastic/eui'; +import { AppLeaveHandler, ApplicationStart } from '@kbn/core-application-browser'; +import { ChromeStart } from '@kbn/core-chrome-browser'; +import { ServerlessPluginStart } from '@kbn/serverless/public'; +import { useRef, useCallback, useMemo, useState } from 'react'; +import { SharePublicStart } from '@kbn/share-plugin/public/plugin'; +import { LensAppLocator, LensAppLocatorParams } from '../../common/locator/locator'; +import { VisualizeEditorContext } from '../types'; +import { LensDocument } from '../persistence'; +import { RedirectToOriginProps } from './types'; + +const VISUALIZE_APP_ID = 'visualize'; + +export function isLegacyEditorEmbeddable( + initialContext: VisualizeEditorContext | VisualizeFieldContext | undefined +): initialContext is VisualizeEditorContext { + return Boolean(initialContext && 'isEmbeddable' in initialContext && initialContext.isEmbeddable); +} + +export function getCurrentTitle( + persistedDoc: LensDocument | undefined, + isByValueMode: boolean, + initialContext: VisualizeEditorContext | VisualizeFieldContext | undefined +) { + if (persistedDoc) { + if (isByValueMode) { + return i18n.translate('xpack.lens.breadcrumbsByValue', { + defaultMessage: 'Edit visualization', + }); + } + if (persistedDoc.title) { + return persistedDoc.title; + } + } + if (!persistedDoc?.title && isLegacyEditorEmbeddable(initialContext)) { + return i18n.translate('xpack.lens.breadcrumbsEditInLensFromDashboard', { + defaultMessage: 'Converting {title} visualization', + values: { + title: initialContext.title ? `"${initialContext.title}"` : initialContext.visTypeTitle, + }, + }); + } + return i18n.translate('xpack.lens.breadcrumbsCreate', { + defaultMessage: 'Create', + }); +} + +export function setBreadcrumbsTitle( + { + application, + serverless, + chrome, + }: { + application: ApplicationStart; + serverless: ServerlessPluginStart | undefined; + chrome: ChromeStart; + }, + { + isByValueMode, + originatingAppName, + redirectToOrigin, + isFromLegacyEditor, + currentDocTitle, + }: { + isByValueMode: boolean; + originatingAppName: string | undefined; + redirectToOrigin: ((props?: RedirectToOriginProps | undefined) => void) | undefined; + isFromLegacyEditor: boolean; + currentDocTitle: string; + } +) { + const breadcrumbs: EuiBreadcrumb[] = []; + if (isFromLegacyEditor && originatingAppName && redirectToOrigin) { + breadcrumbs.push({ + onClick: () => { + redirectToOrigin(); + }, + text: originatingAppName, + }); + } + if (!isByValueMode) { + breadcrumbs.push({ + href: application.getUrlForApp(VISUALIZE_APP_ID), + onClick: (e) => { + application.navigateToApp(VISUALIZE_APP_ID, { path: '/' }); + e.preventDefault(); + }, + text: i18n.translate('xpack.lens.breadcrumbsTitle', { + defaultMessage: 'Visualize Library', + }), + }); + } + + const currentDocBreadcrumb: EuiBreadcrumb = { text: currentDocTitle }; + breadcrumbs.push(currentDocBreadcrumb); + if (serverless?.setBreadcrumbs) { + // TODO: https://github.com/elastic/kibana/issues/163488 + // for now, serverless breadcrumbs only set the title, + // the rest of the breadcrumbs are handled by the serverless navigation + // the serverless navigation is not yet aware of the byValue/originatingApp context + serverless.setBreadcrumbs(currentDocBreadcrumb); + } else { + chrome.setBreadcrumbs(breadcrumbs); + } +} + +export function useShortUrlService( + locator: LensAppLocator | undefined, + share: SharePublicStart | undefined +) { + const shortUrls = useMemo(() => share?.url.shortUrls.get(null), [share]); + // remember latest URL based on the configuration + // url_panel_content has a similar logic + const shareURLCache = useRef({ params: '', url: '' }); + + return useCallback( + async (params: LensAppLocatorParams) => { + const cacheKey = JSON.stringify(params); + if (shareURLCache.current.params === cacheKey) { + return shareURLCache.current.url; + } + if (locator && shortUrls) { + // This is a stripped down version of what the share URL plugin is doing + const shortUrl = await shortUrls.createWithLocator({ locator, params }); + const absoluteShortUrl = await shortUrl.locator.getUrl(shortUrl.params, { absolute: true }); + shareURLCache.current = { params: cacheKey, url: absoluteShortUrl }; + return absoluteShortUrl; + } + return ''; + }, + [locator, shortUrls] + ); +} + +export interface UseNavigateBackToAppProps { + application: ApplicationStart; + onAppLeave: (handler: AppLeaveHandler) => void; + legacyEditorAppName: string | undefined; + legacyEditorAppUrl: string | undefined; + initialDocFromContext: LensDocument | undefined; + persistedDoc: LensDocument | undefined; + isLensEqual: (refDoc: LensDocument | undefined) => boolean; +} + +export function useNavigateBackToApp({ + application, + onAppLeave, + legacyEditorAppName, + legacyEditorAppUrl, + initialDocFromContext, + persistedDoc, + isLensEqual, +}: UseNavigateBackToAppProps) { + const [shouldShowGoBackToVizEditorModal, setIsGoBackToVizEditorModalVisible] = useState(false); + /** Shared logic to navigate back to the originating viz editor app */ + const navigateBackToVizEditor = useCallback(() => { + if (legacyEditorAppUrl) { + onAppLeave((actions) => { + return actions.default(); + }); + application.navigateToApp(legacyEditorAppName || VISUALIZE_APP_ID, { + path: legacyEditorAppUrl, + }); + } + }, [application, legacyEditorAppName, legacyEditorAppUrl, onAppLeave]); + + // if users comes to Lens from the Viz editor, they should have the option to navigate back + // used for TopNavMenu + const goBackToOriginatingApp = useCallback(() => { + if (legacyEditorAppUrl) { + if ([initialDocFromContext, persistedDoc].some(isLensEqual)) { + navigateBackToVizEditor(); + } else { + setIsGoBackToVizEditorModalVisible(true); + } + } + }, [ + legacyEditorAppUrl, + initialDocFromContext, + persistedDoc, + isLensEqual, + navigateBackToVizEditor, + setIsGoBackToVizEditorModalVisible, + ]); + + // Used for Saving Modal + const navigateToVizEditor = useCallback(() => { + setIsGoBackToVizEditorModalVisible(false); + navigateBackToVizEditor(); + }, [navigateBackToVizEditor, setIsGoBackToVizEditorModalVisible]); + + return { + shouldShowGoBackToVizEditorModal, + goBackToOriginatingApp, + navigateToVizEditor, + closeGoBackToVizEditorModal: () => setIsGoBackToVizEditorModalVisible(false), + }; +} diff --git a/x-pack/plugins/lens/public/app_plugin/get_application_user_messages.test.tsx b/x-pack/plugins/lens/public/app_plugin/get_application_user_messages.test.tsx index 1afa1974de351..a470cf41cf837 100644 --- a/x-pack/plugins/lens/public/app_plugin/get_application_user_messages.test.tsx +++ b/x-pack/plugins/lens/public/app_plugin/get_application_user_messages.test.tsx @@ -15,9 +15,12 @@ import { UserMessageGetterProps, filterAndSortUserMessages, getApplicationUserMessages, + handleMessageOverwriteFromConsumer, } from './get_application_user_messages'; import { cleanup, render, screen } from '@testing-library/react'; import { I18nProvider } from '@kbn/i18n-react'; +import { FIELD_NOT_FOUND, FIELD_WRONG_TYPE } from '../user_messages_ids'; +import { LensPublicCallbacks } from '../react_embeddable/types'; import { getLongMessage } from '../user_messages_utils'; jest.mock('@kbn/shared-ux-link-redirect-app', () => { @@ -388,4 +391,100 @@ describe('filtering user messages', () => { ] `); }); + + describe('override messages with custom callback', () => { + it('should override embeddableBadge message', async () => { + const getBadgeMessage = jest.fn( + (): ReturnType> => [ + { + uniqueId: FIELD_NOT_FOUND, + severity: 'warning', + fixableInEditor: true, + displayLocations: [ + { id: 'embeddableBadge' }, + { id: 'dimensionButton', dimensionId: '1' }, + ], + longMessage: 'custom', + shortMessage: '', + hidePopoverIcon: true, + }, + ] + ); + + expect( + handleMessageOverwriteFromConsumer( + [ + { + uniqueId: FIELD_NOT_FOUND, + severity: 'error', + fixableInEditor: true, + displayLocations: [ + { id: 'embeddableBadge' }, + { id: 'dimensionButton', dimensionId: '1' }, + ], + longMessage: 'original', + shortMessage: '', + }, + { + uniqueId: FIELD_WRONG_TYPE, + severity: 'error', + fixableInEditor: true, + displayLocations: [{ id: 'visualization' }], + longMessage: 'original', + shortMessage: '', + }, + ], + getBadgeMessage + ) + ).toEqual( + expect.arrayContaining([ + { + uniqueId: FIELD_WRONG_TYPE, + severity: 'error', + fixableInEditor: true, + displayLocations: [{ id: 'visualization' }], + longMessage: 'original', + shortMessage: '', + }, + { + uniqueId: FIELD_NOT_FOUND, + severity: 'warning', + fixableInEditor: true, + displayLocations: [ + { id: 'embeddableBadge' }, + { id: 'dimensionButton', dimensionId: '1' }, + ], + longMessage: 'custom', + shortMessage: '', + hidePopoverIcon: true, + }, + ]) + ); + }); + + it('should not override embeddableBadge message if callback is not provided', async () => { + const messages: UserMessage[] = [ + { + uniqueId: FIELD_NOT_FOUND, + severity: 'error', + fixableInEditor: true, + displayLocations: [ + { id: 'embeddableBadge' }, + { id: 'dimensionButton', dimensionId: '1' }, + ], + longMessage: 'original', + shortMessage: '', + }, + { + uniqueId: FIELD_WRONG_TYPE, + severity: 'error', + fixableInEditor: true, + displayLocations: [{ id: 'visualization' }], + longMessage: 'original', + shortMessage: '', + }, + ]; + expect(handleMessageOverwriteFromConsumer(messages)).toEqual(messages); + }); + }); }); diff --git a/x-pack/plugins/lens/public/app_plugin/get_application_user_messages.tsx b/x-pack/plugins/lens/public/app_plugin/get_application_user_messages.tsx index d7d04a837e08a..b2755a411e719 100644 --- a/x-pack/plugins/lens/public/app_plugin/get_application_user_messages.tsx +++ b/x-pack/plugins/lens/public/app_plugin/get_application_user_messages.tsx @@ -11,6 +11,7 @@ import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app'; import { FormattedMessage } from '@kbn/i18n-react'; import type { CoreStart } from '@kbn/core/public'; import { Dispatch } from '@reduxjs/toolkit'; +import { partition } from 'lodash'; import { updateDatasourceState, type DataViewsState, @@ -35,6 +36,8 @@ import { EDITOR_UNKNOWN_DATASOURCE_TYPE, EDITOR_UNKNOWN_VIS_TYPE, } from '../user_messages_ids'; +import { nonNullable } from '../utils'; +import type { LensPublicCallbacks } from '../react_embeddable/types'; export interface UserMessageGetterProps { visualizationType: string | null | undefined; @@ -203,21 +206,38 @@ function getMissingIndexPatternsErrors( ]; } +export const handleMessageOverwriteFromConsumer = ( + messages: UserMessage[], + onBeforeBadgesRender?: LensPublicCallbacks['onBeforeBadgesRender'] +) => { + if (onBeforeBadgesRender) { + // we need something else to better identify those errors + const [messagesToHandle, originalMessages] = partition(messages, (message) => + message.displayLocations.some((location) => location.id === 'embeddableBadge') + ); + + if (messagesToHandle.length > 0) { + const customBadgeMessages = onBeforeBadgesRender(messagesToHandle); + return originalMessages.concat(customBadgeMessages); + } + } + + return messages; +}; + export const filterAndSortUserMessages = ( userMessages: UserMessage[], locationId?: UserMessagesDisplayLocationId | UserMessagesDisplayLocationId[], { dimensionId, severity }: UserMessageFilters = {} ) => { - const locationIds = Array.isArray(locationId) - ? locationId - : typeof locationId === 'string' - ? [locationId] - : []; + const locationIds = new Set( + (Array.isArray(locationId) ? locationId : [locationId]).filter(nonNullable) + ); const filteredMessages = userMessages.filter((message) => { - if (locationIds.length) { + if (locationIds.size) { const hasMatch = message.displayLocations.some((location) => { - if (!locationIds.includes(location.id)) { + if (!locationIds.has(location.id)) { return false; } @@ -229,11 +249,7 @@ export const filterAndSortUserMessages = ( } } - if (severity && message.severity !== severity) { - return false; - } - - return true; + return !severity || message.severity === severity; }); return filteredMessages.sort(bySeverity); @@ -329,7 +345,7 @@ export const useApplicationUserMessages = ({ const getUserMessages: UserMessagesGetter = (locationId, filterArgs) => filterAndSortUserMessages( - [...userMessages, ...Object.values(additionalUserMessages)], + userMessages.concat(Object.values(additionalUserMessages)), locationId, filterArgs ?? {} ); diff --git a/x-pack/plugins/lens/public/app_plugin/lens_document_equality.test.ts b/x-pack/plugins/lens/public/app_plugin/lens_document_equality.test.ts index babde51e39f27..8371a77793ea3 100644 --- a/x-pack/plugins/lens/public/app_plugin/lens_document_equality.test.ts +++ b/x-pack/plugins/lens/public/app_plugin/lens_document_equality.test.ts @@ -7,7 +7,7 @@ import { Filter, FilterStateStore } from '@kbn/es-query'; import { isLensEqual } from './lens_document_equality'; -import { Document } from '../persistence/saved_object_store'; +import { LensDocument } from '../persistence/saved_object_store'; import { AnnotationGroups, Datasource, @@ -18,7 +18,7 @@ import { const visualizationType = 'lnsSomeVis'; -const defaultDoc: Document = { +const defaultDoc: LensDocument = { title: 'some-title', visualizationType, state: { @@ -105,7 +105,7 @@ describe('lens document equality', () => { expect( isLensEqual( undefined, - {} as Document, + {} as LensDocument, mockInjectFilterReferences, {}, mockVisualizationMap, @@ -114,7 +114,7 @@ describe('lens document equality', () => { ).toBeFalsy(); expect( isLensEqual( - {} as Document, + {} as LensDocument, undefined, mockInjectFilterReferences, {}, diff --git a/x-pack/plugins/lens/public/app_plugin/lens_document_equality.ts b/x-pack/plugins/lens/public/app_plugin/lens_document_equality.ts index 60316802ca5ea..4fc97882fd926 100644 --- a/x-pack/plugins/lens/public/app_plugin/lens_document_equality.ts +++ b/x-pack/plugins/lens/public/app_plugin/lens_document_equality.ts @@ -7,7 +7,7 @@ import { isEqual, intersection, union } from 'lodash'; import { FilterManager } from '@kbn/data-plugin/public'; -import { Document } from '../persistence/saved_object_store'; +import { LensDocument } from '../persistence/saved_object_store'; import { AnnotationGroups, DatasourceMap, VisualizationMap } from '../types'; import { removePinnedFilters } from './save_modal_container'; @@ -15,8 +15,8 @@ const removeNonSerializable = (obj: Parameters[0]) => JSON.parse(JSON.stringify(obj)); export const isLensEqual = ( - doc1In: Document | undefined, - doc2In: Document | undefined, + doc1In: LensDocument | undefined, + doc2In: LensDocument | undefined, injectFilterReferences: FilterManager['inject'], datasourceMap: DatasourceMap, visualizationMap: VisualizationMap, @@ -54,6 +54,7 @@ export const isLensEqual = ( } })() : isEqual(doc1.state.visualization, doc2.state.visualization); + if (!visualizationStateIsEqual) { return false; } @@ -68,16 +69,14 @@ export const isLensEqual = ( if (datasourcesEqual) { // equal so far, so actually check - datasourcesEqual = availableDatasourceTypes1 - .map((type) => - datasourceMap[type].isEqual( - doc1.state.datasourceStates[type], - [...doc1.references, ...(doc1.state.internalReferences || [])], - doc2.state.datasourceStates[type], - [...doc2.references, ...(doc2.state.internalReferences || [])] - ) + datasourcesEqual = availableDatasourceTypes1.every((type) => + datasourceMap[type].isEqual( + doc1.state.datasourceStates[type], + doc1.references.concat(doc1.state.internalReferences || []), + doc2.state.datasourceStates[type], + doc2.references.concat(doc2.state.internalReferences || []) ) - .every((res) => res); + ); } if (!datasourcesEqual) { @@ -96,7 +95,7 @@ export const isLensEqual = ( function injectDocFilterReferences( injectFilterReferences: FilterManager['inject'], - doc?: Document + doc?: LensDocument ) { if (!doc) return undefined; return { diff --git a/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx b/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx index 399c849b6ebcf..cf76df44eefc0 100644 --- a/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx +++ b/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx @@ -37,7 +37,6 @@ import { } from '../utils'; import { combineQueryAndFilters, getLayerMetaInfo } from './show_underlying_data'; import { changeIndexPattern } from '../state_management/lens_slice'; -import { LensByReferenceInput } from '../embeddable'; import { DEFAULT_LENS_LAYOUT_DIMENSIONS, getShareURL } from './share_action'; import { getDatasourceLayers } from '../state_management/utils'; @@ -291,7 +290,6 @@ export const LensTopNavMenu = ({ navigation, uiSettings, application, - attributeService, share, dataViewFieldEditor, dataViewEditor, @@ -529,11 +527,9 @@ export const LensTopNavMenu = ({ const topNavConfig = useMemo(() => { const showReplaceInDashboard = - initialContext?.originatingApp === 'dashboards' && - !(initialInput as LensByReferenceInput)?.savedObjectId; + initialContext?.originatingApp === 'dashboards' && !initialInput?.savedObjectId; const showReplaceInCanvas = - initialContext?.originatingApp === 'canvas' && - !(initialInput as LensByReferenceInput)?.savedObjectId; + initialContext?.originatingApp === 'canvas' && !initialInput?.savedObjectId; const contextFromEmbeddable = initialContext && 'isEmbeddable' in initialContext && initialContext.isEmbeddable; @@ -690,8 +686,7 @@ export const LensTopNavMenu = ({ panelTimeRange: contextFromEmbeddable ? initialContext.panelTimeRange : undefined, }, { - saveToLibrary: - (initialInput && attributeService.inputIsRefType(initialInput)) ?? false, + saveToLibrary: Boolean(initialInput?.savedObjectId), } ); } @@ -801,7 +796,6 @@ export const LensTopNavMenu = ({ defaultLensTitle, onAppLeave, runSave, - attributeService, setIsSaveModalVisible, goBackToOriginatingApp, redirectToOrigin, diff --git a/x-pack/plugins/lens/public/app_plugin/mounter.tsx b/x-pack/plugins/lens/public/app_plugin/mounter.tsx index 7f91943eade30..c431f48f0c403 100644 --- a/x-pack/plugins/lens/public/app_plugin/mounter.tsx +++ b/x-pack/plugins/lens/public/app_plugin/mounter.tsx @@ -33,12 +33,7 @@ import { EditorFrameStart, LensTopNavMenuEntryGenerator, VisualizeEditorContext import { addHelpMenuToAppChrome } from '../help_menu_util'; import { LensPluginStartDependencies } from '../plugin'; import { LENS_EMBEDDABLE_TYPE, LENS_EDIT_BY_VALUE, APP_ID } from '../../common/constants'; -import { - LensEmbeddableInput, - LensByReferenceInput, - LensByValueInput, -} from '../embeddable/embeddable'; -import { LensAttributeService } from '../lens_attribute_service'; +import { LensAttributesService } from '../lens_attribute_service'; import { LensAppServices, RedirectToOriginProps, HistoryLocationState } from './types'; import { makeConfigureStore, @@ -55,6 +50,7 @@ import { MainHistoryLocationState, } from '../../common/locator/locator'; import { SavedObjectIndexStore } from '../persistence'; +import { LensSerializedState } from '../react_embeddable/types'; function getInitialContext(history: AppMountParameters['history']) { const historyLocationState = history.location.state as @@ -83,7 +79,7 @@ function getInitialContext(history: AppMountParameters['history']) { export async function getLensServices( coreStart: CoreStart, startDependencies: LensPluginStartDependencies, - attributeService: LensAttributeService, + attributeService: LensAttributesService, initialContext?: VisualizeFieldContext | VisualizeEditorContext, locator?: LensAppLocator ): Promise { @@ -146,7 +142,7 @@ export async function mountApp( params: AppMountParameters, mountProps: { createEditorFrame: EditorFrameStart['createInstance']; - attributeService: LensAttributeService; + attributeService: LensAttributesService; topNavMenuEntryGenerators: LensTopNavMenuEntryGenerator[]; locator?: LensAppLocator; } @@ -188,12 +184,12 @@ export async function mountApp( i18n.translate('xpack.lens.pageTitle', { defaultMessage: 'Lens' }) ); - const getInitialInput = (id?: string, editByValue?: boolean): LensEmbeddableInput | undefined => { + const getInitialInput = (id?: string, editByValue?: boolean): LensSerializedState | undefined => { if (editByValue) { - return embeddableEditorIncomingState?.valueInput as LensByValueInput; + return embeddableEditorIncomingState?.valueInput as LensSerializedState; } if (id) { - return { savedObjectId: id } as LensByReferenceInput; + return { savedObjectId: id } as LensSerializedState; } }; @@ -220,14 +216,14 @@ export async function mountApp( if (initialContext && 'embeddableId' in initialContext) { embeddableId = initialContext.embeddableId; } - if (stateTransfer && props?.input) { - const { input, isCopied } = props; + if (stateTransfer && props?.state) { + const { state, isCopied } = props; stateTransfer.navigateToWithEmbeddablePackage(mergedOriginatingApp, { path: embeddableEditorIncomingState?.originatingPath, state: { embeddableId: isCopied ? undefined : embeddableId, type: LENS_EMBEDDABLE_TYPE, - input, + input: { ...state, savedObject: state.savedObjectId }, searchSessionId: data.search.session.getSessionId(), }, }); @@ -426,7 +422,7 @@ export async function mountApp( return () => { data.search.session.clear(); unmountComponentAtNode(params.element); - lensServices.inspector.close(); + lensServices.inspector.closeInspector(); unlistenParentHistory(); lensStore.dispatch(navigateAway()); stateTransfer.clearEditorState?.(APP_ID); diff --git a/x-pack/plugins/lens/public/app_plugin/save_modal_container.test.tsx b/x-pack/plugins/lens/public/app_plugin/save_modal_container.test.tsx new file mode 100644 index 0000000000000..987b320b3abf1 --- /dev/null +++ b/x-pack/plugins/lens/public/app_plugin/save_modal_container.test.tsx @@ -0,0 +1,407 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { SaveProps } from './app'; +import { type SaveVisualizationProps, runSaveLensVisualization } from './save_modal_container'; +import { defaultDoc, makeDefaultServices } from '../mocks'; +import faker from 'faker'; +import { makeAttributeService } from '../mocks/services_mock'; + +jest.mock('../persistence/saved_objects_utils/check_for_duplicate_title', () => ({ + checkForDuplicateTitle: jest.fn(async () => false), +})); + +describe('runSaveLensVisualization', () => { + // Need to call reset here as makeDefaultServices() reuses some mocks from core + const resetMocks = () => + beforeEach(() => { + jest.resetAllMocks(); + }); + + function getDefaultArgs( + servicesOverrides: Partial = {}, + { saveToLibrary, ...propsOverrides }: Partial = {} + ) { + const redirectToOrigin = jest.fn(); + const redirectTo = jest.fn(); + const onAppLeave = jest.fn(); + const switchDatasource = jest.fn(); + const props: SaveVisualizationProps = { + ...makeDefaultServices(), + // start with both the initial input and lastKnownDoc synced + lastKnownDoc: defaultDoc, + initialInput: { attributes: defaultDoc, savedObjectId: defaultDoc.savedObjectId }, + redirectToOrigin, + redirectTo, + onAppLeave, + switchDatasource, + ...servicesOverrides, + }; + const saveProps: SaveProps = { + newTitle: faker.lorem.word(), + newDescription: faker.lorem.sentence(), + newTags: [faker.lorem.word(), faker.lorem.word()], + isTitleDuplicateConfirmed: false, + returnToOrigin: false, + dashboardId: undefined, + newCopyOnSave: false, + ...propsOverrides, + }; + const options = { + saveToLibrary: Boolean(saveToLibrary), + }; + + return { + props, + saveProps, + options, + // convenience shortcuts + /** + * This function will be called when a fresh chart is saved + * and in the modal the user chooses to add the chart into a specific dashboard. Make sure to pass the "dashboardId" prop as well to simulate this scenario. + * This is used to test indirectly the redirectToDashboard call + */ + redirectToDashboardFn: props.stateTransfer.navigateToWithEmbeddablePackage, + /** + * This function will be called before reloading the editor after saving a a new document/new copy of the document + */ + cleanupEditor: props.stateTransfer.clearEditorState, + saveToLibraryFn: props.attributeService.saveToLibrary, + toasts: props.notifications.toasts, + }; + } + + describe('from dashboard', () => { + describe('as by value', () => { + const defaultByValueDoc = { ...defaultDoc, savedObjectId: undefined }; + + describe('Save and return', () => { + resetMocks(); + + // Test the "Save and return" button + it('should get back to dashboard', async () => { + const { props, saveProps, options, redirectToDashboardFn, saveToLibraryFn } = + getDefaultArgs( + { + lastKnownDoc: defaultByValueDoc, + initialInput: { attributes: defaultByValueDoc }, + }, + { returnToOrigin: true } + ); + await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(props.onAppLeave).toHaveBeenCalled(); + expect(props.redirectToOrigin).toHaveBeenCalled(); + + // callback not called + expect(redirectToDashboardFn).not.toHaveBeenCalled(); + expect(saveToLibraryFn).not.toHaveBeenCalled(); + expect(props.notifications.toasts.addSuccess).not.toHaveBeenCalled(); + }); + + it('should get back to dashboard preserving the original panel settings', async () => { + const { props, saveProps, options } = getDefaultArgs( + { + lastKnownDoc: defaultByValueDoc, + initialInput: { + attributes: defaultByValueDoc, + title: 'blah', + timeRange: { from: 'now-7d', to: 'now' }, + }, + }, + { returnToOrigin: true } + ); + await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(props.onAppLeave).toHaveBeenCalled(); + expect(props.redirectToOrigin).toHaveBeenCalledWith( + expect.objectContaining({ + state: expect.objectContaining({ + title: 'blah', + timeRange: { from: 'now-7d', to: 'now' }, + }), + }) + ); + }); + }); + + describe('Save to library', () => { + resetMocks(); + + // Test the "Save to library" flow + it('should save to library without redirect', async () => { + const { props, saveProps, options, redirectToDashboardFn, saveToLibraryFn } = + getDefaultArgs( + { + lastKnownDoc: defaultByValueDoc, + initialInput: { attributes: defaultByValueDoc }, + }, + { + saveToLibrary: true, + // do not get back at dashboard once saved + returnToOrigin: false, + } + ); + await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(saveToLibraryFn).toHaveBeenCalled(); + expect(props.notifications.toasts.addSuccess).toHaveBeenCalled(); + + // not called + expect(props.onAppLeave).not.toHaveBeenCalled(); + expect(props.redirectToOrigin).not.toHaveBeenCalled(); + expect(redirectToDashboardFn).not.toHaveBeenCalled(); + }); + + it('should save to library and redirect', async () => { + const { props, saveProps, options, redirectToDashboardFn, saveToLibraryFn } = + getDefaultArgs( + { + lastKnownDoc: defaultByValueDoc, + initialInput: { attributes: defaultByValueDoc }, + }, + { + saveToLibrary: true, + // return to dashboard once saved + returnToOrigin: true, + } + ); + await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(props.onAppLeave).toHaveBeenCalled(); + expect(props.redirectToOrigin).toHaveBeenCalled(); + expect(saveToLibraryFn).toHaveBeenCalled(); + + // not called + expect(redirectToDashboardFn).not.toHaveBeenCalled(); + expect(props.notifications.toasts.addSuccess).not.toHaveBeenCalled(); + }); + }); + }); + + describe('as by reference', () => { + resetMocks(); + // There are 4 possibilities here: + // save the current document overwriting the existing one + it('should overwrite and show a success toast', async () => { + const { props, saveProps, options, redirectToDashboardFn, saveToLibraryFn, toasts } = + getDefaultArgs( + { + // defaultDoc is by reference + }, + { newCopyOnSave: false, saveToLibrary: true } + ); + await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(saveToLibraryFn).toHaveBeenCalledWith( + expect.anything(), + expect.anything(), + defaultDoc.savedObjectId + ); + expect(toasts.addSuccess).toHaveBeenCalled(); + + // not called + expect(props.onAppLeave).not.toHaveBeenCalled(); + expect(props.redirectToOrigin).not.toHaveBeenCalled(); + expect(redirectToDashboardFn).not.toHaveBeenCalled(); + }); + + // save the current document as a new by-ref copy in the library + it('should save as a new copy and show a success toast', async () => { + const { props, saveProps, options, redirectToDashboardFn, saveToLibraryFn, toasts } = + getDefaultArgs( + { + // defaultDoc is by reference + }, + { newCopyOnSave: true, saveToLibrary: true } + ); + await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(saveToLibraryFn).toHaveBeenCalledWith( + expect.anything(), + expect.anything(), + undefined + ); + expect(toasts.addSuccess).toHaveBeenCalled(); + + // not called + expect(props.onAppLeave).not.toHaveBeenCalled(); + expect(props.redirectToOrigin).not.toHaveBeenCalled(); + expect(redirectToDashboardFn).not.toHaveBeenCalled(); + }); + // save the current document as a new by-value copy and add it to a dashboard + it('should save as a new by-value copy and redirect to the dashboard', async () => { + const dashboardId = faker.random.uuid(); + const { props, saveProps, options, redirectToDashboardFn, saveToLibraryFn, toasts } = + getDefaultArgs( + { + // defaultDoc is by reference + }, + { newCopyOnSave: true, saveToLibrary: false, dashboardId } + ); + await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(props.onAppLeave).toHaveBeenCalled(); + + // not called + expect(props.redirectToOrigin).not.toHaveBeenCalled(); + expect(redirectToDashboardFn).toHaveBeenCalledWith( + 'dashboards', + // make sure the new savedObject id is removed from the new input + expect.objectContaining({ + state: expect.objectContaining({ + input: expect.objectContaining({ savedObjectId: undefined }), + }), + }) + ); + expect(saveToLibraryFn).not.toHaveBeenCalled(); + expect(toasts.addSuccess).not.toHaveBeenCalled(); + }); + + // save the current document as a new by-ref copy and add it to a dashboard + it('should save as a new by-ref copy and redirect to the dashboard', async () => { + const dashboardId = faker.random.uuid(); + const { props, saveProps, options, redirectToDashboardFn, saveToLibraryFn, toasts } = + getDefaultArgs( + { + // defaultDoc is by reference + }, + { newCopyOnSave: true, saveToLibrary: true, dashboardId } + ); + await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(props.onAppLeave).toHaveBeenCalled(); + expect(redirectToDashboardFn).toHaveBeenCalledWith( + 'dashboards', + // make sure the new savedObject id is passed with the new input + expect.objectContaining({ + state: expect.objectContaining({ + input: expect.objectContaining({ savedObjectId: '1234' }), + }), + }) + ); + expect(saveToLibraryFn).toHaveBeenCalled(); + + // not called + expect(props.redirectToOrigin).not.toHaveBeenCalled(); + expect(toasts.addSuccess).not.toHaveBeenCalled(); + }); + }); + }); + + describe('fresh editor start', () => { + resetMocks(); + + it('should reload the editor if it has been saved as new copy', async () => { + const { props, saveProps, options, saveToLibraryFn, cleanupEditor, toasts } = getDefaultArgs( + {}, + { + saveToLibrary: true, + newCopyOnSave: true, + } + ); + const result = await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(saveToLibraryFn).toHaveBeenCalled(); + expect(toasts.addSuccess).toHaveBeenCalled(); + expect(cleanupEditor).toHaveBeenCalled(); + expect(props.redirectTo).toHaveBeenCalledWith(defaultDoc.savedObjectId); + expect(result?.isLinkedToOriginatingApp).toBeFalsy(); + + // not called + expect(props.onAppLeave).not.toHaveBeenCalled(); + }); + + it('should show a notification toast and reload as first save of the document', async () => { + const { props, saveProps, options, saveToLibraryFn, toasts } = getDefaultArgs( + { + lastKnownDoc: { ...defaultDoc, savedObjectId: undefined }, + persistedDoc: undefined, + initialInput: undefined, + }, + { saveToLibrary: true } + ); + await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(saveToLibraryFn).toHaveBeenCalled(); + expect(toasts.addSuccess).toHaveBeenCalled(); + expect(props.redirectTo).toHaveBeenCalled(); + + // not called + expect(props.application.navigateToApp).not.toHaveBeenCalledWith('lens', { path: '/' }); + expect(props.redirectToOrigin).not.toHaveBeenCalled(); + }); + + it('should throw if something goes wrong when saving', async () => { + const attributeServiceMock = { + ...makeAttributeService(defaultDoc), + saveToLibrary: jest.fn().mockImplementation(() => Promise.reject(Error('failed to save'))), + }; + const { props, saveProps, options, toasts } = getDefaultArgs( + { + lastKnownDoc: { ...defaultDoc, savedObjectId: undefined }, + attributeService: attributeServiceMock, + }, + { saveToLibrary: true } + ); + try { + await runSaveLensVisualization(props, saveProps, options); + } catch (error) { + expect(toasts.addDanger).toHaveBeenCalled(); + expect(toasts.addSuccess).not.toHaveBeenCalled(); + expect(error.message).toEqual('failed to save'); + } + }); + }); + + // While this is technically a virtual option as for now, it's still worth testing to not break it in the future + describe('Textbased version', () => { + resetMocks(); + + it('should have a dedicated flow for textbased saving by-ref', async () => { + // simulate a new save + const attributeServiceMock = makeAttributeService({ + ...defaultDoc, + savedObjectId: faker.random.uuid(), + }); + + const { props, saveProps, options, saveToLibraryFn, cleanupEditor } = getDefaultArgs( + { + textBasedLanguageSave: true, + attributeService: attributeServiceMock, + // give a document without a savedObjectId + lastKnownDoc: { ...defaultDoc, savedObjectId: undefined }, + persistedDoc: undefined, + // simulate a fresh start in the editor + initialInput: undefined, + }, + { + saveToLibrary: true, + } + ); + + await runSaveLensVisualization(props, saveProps, options); + + // callback called + expect(saveToLibraryFn).toHaveBeenCalled(); + expect(cleanupEditor).toHaveBeenCalled(); + expect(props.switchDatasource).toHaveBeenCalled(); + expect(props.redirectTo).not.toHaveBeenCalled(); + expect(props.application.navigateToApp).toHaveBeenCalledWith('lens', { path: '/' }); + }); + }); +}); diff --git a/x-pack/plugins/lens/public/app_plugin/save_modal_container.tsx b/x-pack/plugins/lens/public/app_plugin/save_modal_container.tsx index 354bf0888259c..f1ccacc37db53 100644 --- a/x-pack/plugins/lens/public/app_plugin/save_modal_container.tsx +++ b/x-pack/plugins/lens/public/app_plugin/save_modal_container.tsx @@ -11,25 +11,29 @@ import { isFilterPinned } from '@kbn/es-query'; import { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public'; import type { SavedObjectReference } from '@kbn/core/public'; import { EuiLoadingSpinner } from '@elastic/eui'; +import { omit } from 'lodash'; import { SaveModal } from './save_modal'; import type { LensAppProps, LensAppServices } from './types'; import type { SaveProps } from './app'; -import { Document, checkForDuplicateTitle, SavedObjectIndexStore } from '../persistence'; -import type { LensByReferenceInput, LensEmbeddableInput } from '../embeddable'; +import { checkForDuplicateTitle, SavedObjectIndexStore, LensDocument } from '../persistence'; import { APP_ID, getFullPath } from '../../common/constants'; import type { LensAppState } from '../state_management'; -import { getPersisted } from '../state_management/init_middleware/load_initial'; -import { VisualizeEditorContext } from '../types'; +import { getFromPreloaded } from '../state_management/init_middleware/load_initial'; +import { Simplify, VisualizeEditorContext } from '../types'; import { redirectToDashboard } from './save_modal_container_helpers'; +import { LensSerializedState } from '../react_embeddable/types'; +import { isLegacyEditorEmbeddable } from './app_helpers'; -type ExtraProps = Pick & - Partial>; +type ExtraProps = Simplify< + Pick & + Partial> +>; export type SaveModalContainerProps = { originatingApp?: string; getOriginatingPath?: (dashboardId: string) => string; - persistedDoc?: Document; - lastKnownDoc?: Document; + persistedDoc?: LensDocument; + lastKnownDoc?: LensDocument; returnToOriginSwitchLabel?: string; onClose: () => void; onSave?: (saveProps: SaveProps) => void; @@ -78,19 +82,14 @@ export function SaveModalContainer({ let description; let savedObjectId; const [initializing, setInitializing] = useState(true); - const [lastKnownDoc, setLastKnownDoc] = useState(initLastKnownDoc); + const [lastKnownDoc, setLastKnownDoc] = useState(initLastKnownDoc); if (lastKnownDoc) { title = lastKnownDoc.title; description = lastKnownDoc.description; savedObjectId = lastKnownDoc.savedObjectId; } - if ( - !lastKnownDoc?.title && - initialContext && - 'isEmbeddable' in initialContext && - initialContext.isEmbeddable - ) { + if (!lastKnownDoc?.title && isLegacyEditorEmbeddable(initialContext)) { title = i18n.translate('xpack.lens.app.convertedLabel', { defaultMessage: '{title} (converted)', values: { @@ -109,7 +108,7 @@ export function SaveModalContainer({ let isMounted = true; if (initialInput) { - getPersisted({ + getFromPreloaded({ initialInput, lensServices, }) @@ -133,12 +132,13 @@ export function SaveModalContainer({ ? savedObjectsTagging.ui.getTagIdsFromReferences(persistedDoc.references) : []; - const runLensSave = (saveProps: SaveProps, options: { saveToLibrary: boolean }) => { + const runLensSave = async (saveProps: SaveProps, options: { saveToLibrary: boolean }) => { if (runSave) { // inside lens, we use the function that's passed to it - runSave(saveProps, options); - } else if (attributeService && lastKnownDoc) { - runSaveLensVisualization( + return runSave(saveProps, options); + } + if (attributeService && lastKnownDoc) { + await runSaveLensVisualization( { ...lensServices, lastKnownDoc, @@ -147,16 +147,14 @@ export function SaveModalContainer({ redirectToOrigin, originatingApp, getOriginatingPath, - getIsByValueMode: () => false, onAppLeave: () => {}, ...lensServices, }, saveProps, options - ).then(() => { - onSave?.(saveProps); - onClose(); - }); + ); + onSave?.(saveProps); + onClose(); } }; @@ -188,11 +186,24 @@ export function SaveModalContainer({ ); } +function fromDocumentToSerializedState( + doc: LensDocument, + panelSettings: Partial, + originalInput?: LensAppProps['initialInput'] +): LensSerializedState { + return { + ...originalInput, + attributes: omit(doc, 'savedObjectId'), + savedObjectId: doc.savedObjectId, + ...panelSettings, + }; +} + const getDocToSave = ( - lastKnownDoc: Document, + lastKnownDoc: LensDocument, saveProps: SaveProps, references: SavedObjectReference[] -) => { +): LensDocument => { const docToSave = { ...removePinnedFilters(lastKnownDoc)!, references, @@ -209,11 +220,10 @@ const getDocToSave = ( return docToSave; }; -export const runSaveLensVisualization = async ( - props: { - lastKnownDoc?: Document; - getIsByValueMode: () => boolean; - persistedDoc?: Document; +export type SaveVisualizationProps = Simplify< + { + lastKnownDoc?: LensDocument; + persistedDoc?: LensDocument; originatingApp?: string; getOriginatingPath?: (dashboardId: string) => string; textBasedLanguageSave?: boolean; @@ -232,7 +242,11 @@ export const runSaveLensVisualization = async ( | 'stateTransfer' | 'attributeService' | 'savedObjectsTagging' - >, + > +>; + +export const runSaveLensVisualization = async ( + props: SaveVisualizationProps, saveProps: SaveProps, options: { saveToLibrary: boolean } ): Promise | undefined> => { @@ -245,7 +259,6 @@ export const runSaveLensVisualization = async ( stateTransfer, attributeService, savedObjectsTagging, - getIsByValueMode, redirectToOrigin, onAppLeave, redirectTo, @@ -262,7 +275,7 @@ export const runSaveLensVisualization = async ( return; } - let references = lastKnownDoc.references; + let references = lastKnownDoc.references || initialInput?.attributes?.references; if (savedObjectsTagging) { const tagsIds = @@ -277,68 +290,90 @@ export const runSaveLensVisualization = async ( const docToSave = getDocToSave(lastKnownDoc, saveProps, references); - // Required to serialize filters in by value mode until - // https://github.com/elastic/kibana/issues/77588 is fixed - if (getIsByValueMode()) { - docToSave.state.filters.forEach((filter) => { - if (typeof filter.meta.value === 'function') { - delete filter.meta.value; - } - }); - } - const originalInput = saveProps.newCopyOnSave ? undefined : initialInput; - const originalSavedObjectId = (originalInput as LensByReferenceInput)?.savedObjectId; + const originalSavedObjectId = originalInput?.savedObjectId; if (options.saveToLibrary) { - try { - await checkForDuplicateTitle( - { - id: originalSavedObjectId, - title: docToSave.title, - displayName: i18n.translate('xpack.lens.app.saveModalType', { - defaultMessage: 'Lens visualization', - }), - lastSavedTitle: lastKnownDoc.title, - copyOnSave: saveProps.newCopyOnSave, - isTitleDuplicateConfirmed: saveProps.isTitleDuplicateConfirmed, - }, - saveProps.onTitleDuplicate, - { - client: savedObjectStore, - ...startServices, - } - ); - } catch (e) { - // ignore duplicate title failure, user notified in save modal - throw e; - } + // this is a lower level call that the Lens attribute service one + // @TODO: check if it's worth to replace it witht he attribute service one + await checkForDuplicateTitle( + { + id: originalSavedObjectId, + title: docToSave.title, + displayName: i18n.translate('xpack.lens.app.saveModalType', { + defaultMessage: 'Lens visualization', + }), + lastSavedTitle: lastKnownDoc.title, + copyOnSave: saveProps.newCopyOnSave, + isTitleDuplicateConfirmed: saveProps.isTitleDuplicateConfirmed, + }, + saveProps.onTitleDuplicate, + { + client: savedObjectStore, + ...startServices, + } + ); + // ignore duplicate title failure, user notified in save modal } + try { - let newInput = (await attributeService.wrapAttributes( + // wrap the doc into a serializable state + const newDoc = fromDocumentToSerializedState( docToSave, - options.saveToLibrary, + { + timeRange: saveProps.panelTimeRange ?? originalInput?.timeRange, + savedObjectId: options.saveToLibrary ? originalSavedObjectId : undefined, + }, originalInput - )) as LensEmbeddableInput; - if (saveProps.panelTimeRange) { - newInput = { - ...newInput, - timeRange: saveProps.panelTimeRange, - }; + ); + + let savedObjectId: string | undefined; + try { + savedObjectId = + newDoc.attributes && options.saveToLibrary + ? await attributeService.saveToLibrary( + newDoc.attributes, + newDoc.attributes.references || [], + originalSavedObjectId + ) + : undefined; + } catch (error) { + notifications.toasts.addDanger({ + title: i18n.translate('xpack.lens.app.saveVisualization.errorNotificationText', { + defaultMessage: `An error occurred while saving. Error: {errorMessage}`, + values: { + errorMessage: error.message, + }, + }), + }); + // trigger a reject to jump to the final catch clause + throw error; } - if (saveProps.returnToOrigin && redirectToOrigin) { + + const shouldNavigateBackToOrigin = saveProps.returnToOrigin && redirectToOrigin; + const hasRedirect = shouldNavigateBackToOrigin || saveProps.dashboardId; + + // if a redirect was set, prevent the validation on app leave + if (hasRedirect) { // disabling the validation on app leave because the document has been saved. onAppLeave?.((actions) => { return actions.default(); }); - redirectToOrigin({ input: newInput, isCopied: saveProps.newCopyOnSave }); - return; - } else if (saveProps.dashboardId) { - // disabling the validation on app leave because the document has been saved. - onAppLeave?.((actions) => { - return actions.default(); + } + + if (shouldNavigateBackToOrigin) { + redirectToOrigin({ + state: { ...newDoc, savedObjectId }, + isCopied: saveProps.newCopyOnSave, }); + return; + } + // should we make it more robust here and better check the context of the saving + // or keep the responsability of the consumer of the function to provide the right set + // of args here in case the user is within a by value chart AND want's to save it in the library + // without redirect? + if (saveProps.dashboardId) { redirectToDashboard({ - embeddableInput: newInput, + embeddableInput: { ...newDoc, savedObjectId }, dashboardId: saveProps.dashboardId, stateTransfer, originatingApp: props.originatingApp, @@ -356,15 +391,8 @@ export const runSaveLensVisualization = async ( }) ); - if ( - attributeService.inputIsRefType(newInput) && - newInput.savedObjectId !== originalSavedObjectId - ) { - chrome.recentlyAccessed.add( - getFullPath(newInput.savedObjectId), - docToSave.title, - newInput.savedObjectId - ); + if (savedObjectId && savedObjectId !== originalSavedObjectId) { + chrome.recentlyAccessed.add(getFullPath(savedObjectId), docToSave.title, savedObjectId); // remove editor state so the connection is still broken after reload stateTransfer.clearEditorState?.(APP_ID); @@ -372,18 +400,13 @@ export const runSaveLensVisualization = async ( switchDatasource?.(); application.navigateToApp('lens', { path: '/' }); } else { - redirectTo?.(newInput.savedObjectId); + redirectTo?.(savedObjectId); } return { isLinkedToOriginatingApp: false }; } - const newDoc = { - ...docToSave, - ...newInput, - }; - return { - persistedDoc: newDoc, + persistedDoc: newDoc.attributes, isLinkedToOriginatingApp: false, }; } catch (e) { @@ -393,7 +416,7 @@ export const runSaveLensVisualization = async ( } }; -export function removePinnedFilters(doc?: Document) { +export function removePinnedFilters(doc?: LensDocument) { if (!doc) return undefined; return { ...doc, diff --git a/x-pack/plugins/lens/public/app_plugin/save_modal_container_helpers.test.ts b/x-pack/plugins/lens/public/app_plugin/save_modal_container_helpers.test.ts index 1f4e255c54414..9415ab2e323cd 100644 --- a/x-pack/plugins/lens/public/app_plugin/save_modal_container_helpers.test.ts +++ b/x-pack/plugins/lens/public/app_plugin/save_modal_container_helpers.test.ts @@ -5,14 +5,14 @@ * 2.0. */ import { makeDefaultServices } from '../mocks'; -import type { LensEmbeddableInput } from '../embeddable'; import type { LensAppServices } from './types'; import { redirectToDashboard } from './save_modal_container_helpers'; +import { LensSerializedState } from '..'; describe('redirectToDashboard', () => { const embeddableInput = { test: 'test', - } as unknown as LensEmbeddableInput; + } as unknown as LensSerializedState; const mockServices = makeDefaultServices(); it('should call the navigateToWithEmbeddablePackage with the correct args if originatingApp is given', () => { diff --git a/x-pack/plugins/lens/public/app_plugin/save_modal_container_helpers.ts b/x-pack/plugins/lens/public/app_plugin/save_modal_container_helpers.ts index 98b2d0bdc2aba..44b879c7f27cb 100644 --- a/x-pack/plugins/lens/public/app_plugin/save_modal_container_helpers.ts +++ b/x-pack/plugins/lens/public/app_plugin/save_modal_container_helpers.ts @@ -6,8 +6,8 @@ */ import type { LensAppServices } from './types'; -import type { LensEmbeddableInput } from '../embeddable'; import { LENS_EMBEDDABLE_TYPE } from '../../common/constants'; +import { LensSerializedState } from '../react_embeddable/types'; export const redirectToDashboard = ({ embeddableInput, @@ -16,7 +16,7 @@ export const redirectToDashboard = ({ getOriginatingPath, stateTransfer, }: { - embeddableInput: LensEmbeddableInput; + embeddableInput: LensSerializedState; dashboardId: string; originatingApp?: string; getOriginatingPath?: (dashboardId: string) => string | undefined; diff --git a/x-pack/plugins/lens/public/app_plugin/share_action.ts b/x-pack/plugins/lens/public/app_plugin/share_action.ts index c9ec3a11ef5e7..dbb5d9d61eda9 100644 --- a/x-pack/plugins/lens/public/app_plugin/share_action.ts +++ b/x-pack/plugins/lens/public/app_plugin/share_action.ts @@ -11,7 +11,7 @@ import { DataViewSpec } from '@kbn/data-views-plugin/common'; import type { LensAppLocatorParams } from '../../common/locator/locator'; import type { LensAppState } from '../state_management'; import type { LensAppServices } from './types'; -import type { Document } from '../persistence/saved_object_store'; +import type { LensDocument } from '../persistence/saved_object_store'; import type { DatasourceMap, VisualizationMap } from '../types'; import { extractReferencesFromState, getResolvedDateRange } from '../utils'; import { getEditPath } from '../../common/constants'; @@ -23,7 +23,7 @@ interface ShareableConfiguration > { datasourceMap: DatasourceMap; visualizationMap: VisualizationMap; - currentDoc: Document | undefined; + currentDoc: LensDocument | undefined; adHocDataViews?: DataViewSpec[]; } @@ -37,7 +37,7 @@ export const DEFAULT_LENS_LAYOUT_DIMENSIONS = { function getShareURLForSavedObject( { application, data }: Pick, - currentDoc: Document | undefined + currentDoc: LensDocument | undefined ) { return new URL( `${application.getUrlForApp('lens', { absolute: true })}${ @@ -89,7 +89,7 @@ export function getLocatorParams( const serializableDatasourceStates = datasourceStates as LensAppState['datasourceStates'] & SerializableRecord; - const snapshotParams = { + const snapshotParams: LensAppLocatorParams = { filters, query, resolvedDateRange: getResolvedDateRange(data.query.timefilter.timefilter), diff --git a/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/get_edit_lens_configuration.tsx b/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/get_edit_lens_configuration.tsx index 205aa74aaee24..dedd34c24cb53 100644 --- a/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/get_edit_lens_configuration.tsx +++ b/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/get_edit_lens_configuration.tsx @@ -16,6 +16,7 @@ import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; import { isEqual } from 'lodash'; import { RootDragDropProvider } from '@kbn/dom-drag-drop'; +import { TypedLensSerializedState } from '../../../react_embeddable/types'; import type { LensPluginStartDependencies } from '../../../plugin'; import { makeConfigureStore, @@ -28,8 +29,7 @@ import { generateId } from '../../../id_generator'; import type { DatasourceMap, VisualizationMap } from '../../../types'; import { LensEditConfigurationFlyout } from './lens_configuration_flyout'; import type { EditConfigPanelProps } from './types'; -import { SavedObjectIndexStore, type Document } from '../../../persistence'; -import type { TypedLensByValueInput } from '../../../embeddable/embeddable_component'; +import { SavedObjectIndexStore, type LensDocument } from '../../../persistence'; import { DOC_TYPE } from '../../../../common/constants'; export type EditLensConfigurationProps = Omit< @@ -87,6 +87,41 @@ export const updatingMiddleware = } }; +const MaybeWrapper = ({ + wrapInFlyout, + closeFlyout, + children, +}: { + wrapInFlyout?: boolean; + children: JSX.Element; + closeFlyout?: () => void; +}) => { + if (!wrapInFlyout) { + return children; + } + return ( + { + closeFlyout?.(); + }} + aria-labelledby={i18n.translate('xpack.lens.config.editLabel', { + defaultMessage: 'Edit configuration', + })} + size="s" + hideCloseButton + css={css` + clip-path: polygon(-100% 0, 100% 0, 100% 100%, -100% 100%); + `} + > + {children} + + ); +}; + export async function getEditLensConfiguration( coreStart: CoreStart, startDependencies: LensPluginStartDependencies, @@ -109,30 +144,29 @@ export async function getEditLensConfiguration( datasourceId, panelId, savedObjectId, - output$, + dataLoading$, lensAdapters, updateByRefInput, navigateToLensEditor, displayFlyoutHeader, canEditTextBasedQuery, isNewPanel, - deletePanel, hidesSuggestions, - onApplyCb, - onCancelCb, + onApply, + onCancel, hideTimeFilterInfo, }: EditLensConfigurationProps) => { if (!lensServices || !datasourceMap || !visualizationMap) { return ; } const [currentAttributes, setCurrentAttributes] = - useState(attributes); + useState(attributes); /** * During inline editing of a by reference panel, the panel is converted to a by value one. * When the user applies the changes we save them to the Lens SO */ const saveByRef = useCallback( - async (attrs: Document) => { + async (attrs: LensDocument) => { const savedObjectStore = new SavedObjectIndexStore(lensServices.contentManagement); await savedObjectStore.save({ ...attrs, @@ -167,34 +201,6 @@ export async function getEditLensConfiguration( }) ); - const getWrapper = (children: JSX.Element) => { - if (wrapInFlyout) { - return ( - { - closeFlyout?.(); - }} - aria-labelledby={i18n.translate('xpack.lens.config.editLabel', { - defaultMessage: 'Edit configuration', - })} - size="s" - hideCloseButton - css={css` - clip-path: polygon(-100% 0, 100% 0, 100% 100%, -100% 100%); - `} - > - {children} - - ); - } else { - return children; - } - }; - const configPanelProps = { attributes: currentAttributes, updatePanelState, @@ -204,7 +210,7 @@ export async function getEditLensConfiguration( coreStart, startDependencies, visualizationMap, - output$, + dataLoading$, lensAdapters, datasourceMap, saveByRef, @@ -216,22 +222,23 @@ export async function getEditLensConfiguration( hidesSuggestions, setCurrentAttributes, isNewPanel, - deletePanel, - onApplyCb, - onCancelCb, + onApply, + onCancel, hideTimeFilterInfo, }; - return getWrapper( - - - - - - - - - + return ( + + + + + + + + + + + ); }; } diff --git a/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/helpers.ts b/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/helpers.ts index 1274008d0de88..c0280af595041 100644 --- a/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/helpers.ts +++ b/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/helpers.ts @@ -18,7 +18,7 @@ import type { DataView } from '@kbn/data-views-plugin/common'; import type { DatatableColumn } from '@kbn/expressions-plugin/common'; import { getTime } from '@kbn/data-plugin/common'; import { type DataPublicPluginStart } from '@kbn/data-plugin/public'; -import type { TypedLensByValueInput } from '../../../embeddable/embeddable_component'; +import { TypedLensSerializedState } from '../../../react_embeddable/types'; import type { LensPluginStartDependencies } from '../../../plugin'; import type { DatasourceMap, VisualizationMap } from '../../../types'; import { suggestionsApi } from '../../../lens_suggestions_api'; @@ -123,7 +123,7 @@ export const getSuggestions = async ( query, suggestion: firstSuggestion, dataView, - }) as TypedLensByValueInput['attributes']; + }) as TypedLensSerializedState['attributes']; return attrs; } catch (e) { setErrors([e]); diff --git a/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.test.tsx b/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.test.tsx index 85c7036a3e9df..474d5cc69c188 100644 --- a/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.test.tsx +++ b/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.test.tsx @@ -13,9 +13,9 @@ import { coreMock } from '@kbn/core/public/mocks'; import { mockVisualizationMap, mockDatasourceMap, mockDataPlugin } from '../../../mocks'; import type { LensPluginStartDependencies } from '../../../plugin'; import { createMockStartDependencies } from '../../../editor_frame_service/mocks'; -import type { TypedLensByValueInput } from '../../../embeddable/embeddable_component'; import { LensEditConfigurationFlyout } from './lens_configuration_flyout'; import type { EditConfigPanelProps } from './types'; +import { TypedLensSerializedState } from '../../../react_embeddable/types'; jest.mock('@kbn/esql-utils', () => { return { @@ -93,7 +93,7 @@ const lensAttributes = { esql: 'from index1 | limit 10', }, references: [], -} as unknown as TypedLensByValueInput['attributes']; +} as unknown as TypedLensSerializedState['attributes']; const mockStartDependencies = createMockStartDependencies() as unknown as LensPluginStartDependencies; @@ -139,6 +139,8 @@ describe('LensEditConfigurationFlyout', () => { visualizationMap={visualizationMap} closeFlyout={jest.fn()} datasourceId={'testDatasource' as EditConfigPanelProps['datasourceId']} + onApply={jest.fn()} + onCancel={jest.fn()} {...propsOverrides} />, {}, @@ -234,7 +236,7 @@ describe('LensEditConfigurationFlyout', () => { await renderConfigFlyout( { closeFlyout: jest.fn(), - onApplyCb: onApplyCbSpy, + onApply: onApplyCbSpy, }, { esql: 'from index1 | limit 10' } ); diff --git a/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.tsx b/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.tsx index fd3bcdc8bed8a..8c8693cd7c76d 100644 --- a/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.tsx +++ b/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.tsx @@ -30,6 +30,7 @@ import { import type { AggregateQuery, Query } from '@kbn/es-query'; import { ESQLLangEditor } from '@kbn/esql/public'; import { DefaultInspectorAdapters } from '@kbn/expressions-plugin/common'; +import type { TypedLensSerializedState } from '../../../react_embeddable/types'; import { buildExpression } from '../../../editor_frame_service/editor_frame/expression_helpers'; import { MAX_NUM_OF_COLUMNS } from '../../../datasources/text_based/utils'; import { @@ -38,7 +39,6 @@ import { onActiveDataChange, useLensDispatch, } from '../../../state_management'; -import type { TypedLensByValueInput } from '../../../embeddable/embeddable_component'; import { EXPRESSION_BUILD_ERROR_ID, extractReferencesFromState, @@ -67,20 +67,19 @@ export function LensEditConfigurationFlyout({ saveByRef, savedObjectId, updateByRefInput, - output$, + dataLoading$, lensAdapters, navigateToLensEditor, displayFlyoutHeader, canEditTextBasedQuery, isNewPanel, - deletePanel, hidesSuggestions, - onApplyCb, - onCancelCb, + onApply: onApplyCallback, + onCancel: onCancelCallback, hideTimeFilterInfo, }: EditConfigPanelProps) { const euiTheme = useEuiTheme(); - const previousAttributes = useRef(attributes); + const previousAttributes = useRef(attributes); const previousAdapters = useRef | undefined>(lensAdapters); const prevQuery = useRef(attributes.state.query); const [query, setQuery] = useState(attributes.state.query); @@ -117,7 +116,11 @@ export function LensEditConfigurationFlyout({ const dispatch = useLensDispatch(); useEffect(() => { - const s = output$?.subscribe(() => { + const s = dataLoading$?.subscribe((isDataLoading) => { + // go thru only when the loading is complete + if (isDataLoading) { + return; + } const activeData: Record = {}; const adaptersTables = previousAdapters.current?.tables?.tables; const [table] = Object.values(adaptersTables || {}); @@ -134,7 +137,7 @@ export function LensEditConfigurationFlyout({ } }); return () => s?.unsubscribe(); - }, [dispatch, output$, layers]); + }, [dispatch, dataLoading$, layers]); useEffect(() => { const abortController = new AbortController(); @@ -217,16 +220,10 @@ export function LensEditConfigurationFlyout({ updateByRefInput?.(savedObjectId); } } - // for a newly created chart, I want cancelling to also remove the panel - if (isNewPanel && deletePanel) { - deletePanel(); - } - onCancelCb?.(); + onCancelCallback?.(); closeFlyout?.(); }, [ attributesChanged, - isNewPanel, - deletePanel, closeFlyout, visualization.activeId, savedObjectId, @@ -235,7 +232,7 @@ export function LensEditConfigurationFlyout({ updatePanelState, updateSuggestion, updateByRefInput, - onCancelCb, + onCancelCallback, ]); const textBasedMode = useMemo( @@ -244,6 +241,9 @@ export function LensEditConfigurationFlyout({ ); const onApply = useCallback(() => { + if (visualization.activeId == null) { + return; + } const dsStates = Object.fromEntries( Object.entries(datasourceStates).map(([id, ds]) => { const dsState = ds.state; @@ -265,7 +265,7 @@ export function LensEditConfigurationFlyout({ activeVisualization, }) : []; - const attrs = { + const attrs: TypedLensSerializedState['attributes'] = { ...attributes, state: { ...attributes.state, @@ -293,18 +293,18 @@ export function LensEditConfigurationFlyout({ trackSaveUiCounterEvents(telemetryEvents); } - onApplyCb?.(attrs as TypedLensByValueInput['attributes']); + onApplyCallback?.(attrs); closeFlyout?.(); }, [ + visualization.activeId, + savedObjectId, + closeFlyout, + onApplyCallback, datasourceStates, textBasedMode, visualization.state, - visualization.activeId, activeVisualization, attributes, - savedObjectId, - onApplyCb, - closeFlyout, datasourceMap, saveByRef, updateByRefInput, diff --git a/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/types.ts b/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/types.ts index d2aceb323773a..d31a518cf80e8 100644 --- a/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/types.ts +++ b/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/types.ts @@ -4,9 +4,9 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import type { Observable } from 'rxjs'; import type { CoreStart } from '@kbn/core/public'; -import type { TypedLensByValueInput } from '../../../embeddable/embeddable_component'; +import type { PublishingSubject } from '@kbn/presentation-publishing'; +import type { TypedLensSerializedState } from '../../../react_embeddable/types'; import type { LensPluginStartDependencies } from '../../../plugin'; import type { DatasourceMap, @@ -14,9 +14,8 @@ import type { FramePublicAPI, UserMessagesGetter, } from '../../../types'; -import type { LensEmbeddableOutput } from '../../../embeddable'; import type { LensInspector } from '../../../lens_inspector_service'; -import type { Document } from '../../../persistence'; +import type { LensDocument } from '../../../persistence'; export interface FlyoutWrapperProps { children: JSX.Element; @@ -37,22 +36,22 @@ export interface EditConfigPanelProps { visualizationMap: VisualizationMap; datasourceMap: DatasourceMap; /** The attributes of the Lens embeddable */ - attributes: TypedLensByValueInput['attributes']; + attributes: TypedLensSerializedState['attributes']; /** Callback for updating the visualization and datasources state.*/ updatePanelState: ( datasourceState: unknown, visualizationState: unknown, - visualizationType?: string + visualizationId?: string ) => void; - updateSuggestion?: (attrs: TypedLensByValueInput['attributes']) => void; + updateSuggestion?: (attrs: TypedLensSerializedState['attributes']) => void; /** Set the attributes state */ - setCurrentAttributes?: (attrs: TypedLensByValueInput['attributes']) => void; + setCurrentAttributes?: (attrs: TypedLensSerializedState['attributes']) => void; /** Lens visualizations can be either created from ESQL (textBased) or from dataviews (formBased) */ datasourceId: 'formBased' | 'textBased'; /** Embeddable output observable, useful for dashboard flyout */ - output$?: Observable; + dataLoading$?: PublishingSubject; /** Contains the active data, necessary for some panel configuration such as coloring */ - lensAdapters?: LensInspector['adapters']; + lensAdapters?: ReturnType; /** Optional callback called when updating the by reference embeddable */ updateByRefInput?: (soId: string) => void; /** Callback for closing the edit flyout */ @@ -69,7 +68,7 @@ export interface EditConfigPanelProps { */ savedObjectId?: string; /** Callback for saving the embeddable as a SO */ - saveByRef?: (attrs: Document) => void; + saveByRef?: (attrs: LensDocument) => void; /** Optional callback for navigation from the header of the flyout */ navigateToLensEditor?: () => void; /** If set to true it displays a header on the flyout */ @@ -78,21 +77,19 @@ export interface EditConfigPanelProps { canEditTextBasedQuery?: boolean; /** The flyout is used for adding a new panel by scratch */ isNewPanel?: boolean; - /** Handler for deleting the embeddable, used in case a user cancels a newly created chart */ - deletePanel?: () => void; /** If set to true the layout changes to accordion and the text based query (i.e. ES|QL) can be edited */ hidesSuggestions?: boolean; - /** Optional callback for apply flyout button */ - onApplyCb?: (input: TypedLensByValueInput['attributes']) => void; - /** Optional callback for cancel flyout button */ - onCancelCb?: () => void; + /** Apply button handler */ + onApply?: (attrs: TypedLensSerializedState['attributes']) => void; + /** Cancel button handler */ + onCancel?: () => void; // in cases where the embeddable is not filtered by time // (e.g. through unified search) set this property to true hideTimeFilterInfo?: boolean; } export interface LayerConfigurationProps { - attributes: TypedLensByValueInput['attributes']; + attributes: TypedLensSerializedState['attributes']; coreStart: CoreStart; startDependencies: LensPluginStartDependencies; visualizationMap: VisualizationMap; diff --git a/x-pack/plugins/lens/public/app_plugin/show_underlying_data.ts b/x-pack/plugins/lens/public/app_plugin/show_underlying_data.ts index fa9268c0374eb..f35443a510147 100644 --- a/x-pack/plugins/lens/public/app_plugin/show_underlying_data.ts +++ b/x-pack/plugins/lens/public/app_plugin/show_underlying_data.ts @@ -16,6 +16,7 @@ import { EsQueryConfig, isOfQueryType, AggregateQuery, + isOfAggregateQueryType, } from '@kbn/es-query'; import { i18n } from '@kbn/i18n'; import { RecursiveReadonly } from '@kbn/utility-types'; @@ -219,8 +220,9 @@ export function combineQueryAndFilters( }; const allQueries = Array.isArray(query) ? query : query && isOfQueryType(query) ? [query] : []; - const nonEmptyQueries = allQueries.filter((q) => - Boolean(typeof q.query === 'string' ? q.query.trim() : q.query) + const nonEmptyQueries = allQueries.filter( + (q) => + !isOfAggregateQueryType(q) && Boolean(typeof q.query === 'string' ? q.query.trim() : q.query) ); [queries.lucene, queries.kuery] = partition(nonEmptyQueries, (q) => q.language === 'lucene'); diff --git a/x-pack/plugins/lens/public/app_plugin/types.ts b/x-pack/plugins/lens/public/app_plugin/types.ts index 317efd5be507f..4791dc89d446f 100644 --- a/x-pack/plugins/lens/public/app_plugin/types.ts +++ b/x-pack/plugins/lens/public/app_plugin/types.ts @@ -55,15 +55,15 @@ import type { UserMessagesGetter, StartServices, } from '../types'; -import type { LensAttributeService } from '../lens_attribute_service'; -import type { LensEmbeddableInput } from '../embeddable/embeddable'; +import type { LensAttributesService } from '../lens_attribute_service'; import type { LensInspector } from '../lens_inspector_service'; import type { IndexPatternServiceAPI } from '../data_views_service/service'; -import type { Document, SavedObjectIndexStore } from '../persistence/saved_object_store'; +import type { LensDocument, SavedObjectIndexStore } from '../persistence/saved_object_store'; import type { LensAppLocator, LensAppLocatorParams } from '../../common/locator/locator'; +import { LensSerializedState } from '../react_embeddable/types'; export interface RedirectToOriginProps { - input?: LensEmbeddableInput; + state?: LensSerializedState; isCopied?: boolean; } @@ -76,7 +76,7 @@ export interface LensAppProps { redirectToOrigin?: (props?: RedirectToOriginProps) => void; // The initial input passed in by the container when editing. Can be either by reference or by value. - initialInput?: LensEmbeddableInput; + initialInput?: LensSerializedState; // State passed in by the container which is used to determine the id of the Originating App. incomingState?: EmbeddableEditorState; @@ -110,7 +110,7 @@ export interface LensTopNavMenuProps { redirectToOrigin?: (props?: RedirectToOriginProps) => void; // The initial input passed in by the container when editing. Can be either by reference or by value. - initialInput?: LensEmbeddableInput; + initialInput?: LensSerializedState; getIsByValueMode: () => boolean; indicateNoData: boolean; setIsSaveModalVisible: React.Dispatch>; @@ -124,7 +124,7 @@ export interface LensTopNavMenuProps { initialContextIsEmbedded?: boolean; topNavMenuEntryGenerators: LensTopNavMenuEntryGenerator[]; initialContext?: VisualizeFieldContext | VisualizeEditorContext; - currentDoc: Document | undefined; + currentDoc: LensDocument | undefined; indexPatternService: IndexPatternServiceAPI; getUserMessages: UserMessagesGetter; shortUrlService: (params: LensAppLocatorParams) => Promise; @@ -156,7 +156,7 @@ export interface LensAppServices extends StartServices { usageCollection?: UsageCollectionStart; stateTransfer: EmbeddableStateTransfer; navigation: NavigationPublicPluginStart; - attributeService: LensAttributeService; + attributeService: LensAttributesService; contentManagement: ContentManagementPublicStart; savedObjectsTagging?: SavedObjectTaggingPluginStart; getOriginatingAppName: () => string | undefined; diff --git a/x-pack/plugins/lens/public/async_services.ts b/x-pack/plugins/lens/public/async_services.ts index 28becae5e6071..e5523b38b525d 100644 --- a/x-pack/plugins/lens/public/async_services.ts +++ b/x-pack/plugins/lens/public/async_services.ts @@ -43,13 +43,11 @@ export * from './lens_ui_telemetry'; export * from './lens_ui_errors'; export * from './editor_frame_service/editor_frame'; export * from './editor_frame_service'; -export * from './embeddable'; export * from './app_plugin/mounter'; export * from './lens_attribute_service'; export * from './app_plugin/save_modal_container'; export * from './chart_info_api'; export * from './trigger_actions/open_in_discover_helpers'; -export * from './trigger_actions/open_lens_config/edit_action_helpers'; export * from './trigger_actions/open_lens_config/create_action_helpers'; export * from './trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action_helpers'; diff --git a/x-pack/plugins/lens/public/chart_info_api.test.ts b/x-pack/plugins/lens/public/chart_info_api.test.ts index c302d4e934eba..f647e2289c5bf 100644 --- a/x-pack/plugins/lens/public/chart_info_api.test.ts +++ b/x-pack/plugins/lens/public/chart_info_api.test.ts @@ -6,9 +6,9 @@ */ import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; -import type { EditorFrameService } from './editor_frame_service'; import { createChartInfoApi } from './chart_info_api'; -import type { LensSavedObjectAttributes } from '.'; +import { LensDocument } from './persistence'; +import { DatasourceMap, VisualizationMap } from './types'; const mockGetVisualizationInfo = jest.fn().mockReturnValue({ layers: [ @@ -37,18 +37,19 @@ const mockGetDatasourceInfo = jest.fn().mockResolvedValue([ describe('createChartInfoApi', () => { const dataViews = dataViewPluginMocks.createStartContract(); test('get correct chart info', async () => { - const chartInfoApi = await createChartInfoApi(dataViews, { - loadVisualizations: () => ({ + const chartInfoApi = await createChartInfoApi( + dataViews, + { lnsXY: { getVisualizationInfo: mockGetVisualizationInfo, }, - }), - loadDatasources: () => ({ + } as unknown as VisualizationMap, + { from_based: { getDatasourceInfo: mockGetDatasourceInfo, }, - }), - } as unknown as EditorFrameService); + } as unknown as DatasourceMap + ); const vis = { title: 'xy', visualizationType: 'lnsXY', @@ -69,7 +70,7 @@ describe('createChartInfoApi', () => { query: '', }, references: [], - } as LensSavedObjectAttributes; + } as LensDocument; const chartInfo = await chartInfoApi.getChartInfo(vis); diff --git a/x-pack/plugins/lens/public/chart_info_api.ts b/x-pack/plugins/lens/public/chart_info_api.ts index d2661226cdf1f..ace9ab445dba6 100644 --- a/x-pack/plugins/lens/public/chart_info_api.ts +++ b/x-pack/plugins/lens/public/chart_info_api.ts @@ -5,23 +5,22 @@ * 2.0. */ -import type { Filter, Query } from '@kbn/es-query'; +import type { AggregateQuery, Filter, Query } from '@kbn/es-query'; import type { IconType } from '@elastic/eui/src/components/icon/icon'; import type { DataView, DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import { getActiveDatasourceIdFromDoc } from './utils'; -import type { EditorFrameService as EditorFrameServiceType } from './editor_frame_service'; -import type { OperationDescriptor } from './types'; -import type { LensSavedObjectAttributes } from '.'; +import type { DatasourceMap, OperationDescriptor, VisualizationMap } from './types'; +import { LensDocument } from './persistence'; export type ChartInfoApi = Promise<{ - getChartInfo: (vis: LensSavedObjectAttributes) => Promise; + getChartInfo: (vis: LensDocument) => Promise; }>; export interface ChartInfo { layers: ChartLayerDescriptor[]; visualizationType: string; filters: Filter[]; - query: Query; + query: Query | AggregateQuery; } export interface ChartLayerDescriptor { @@ -42,17 +41,14 @@ export interface ChartLayerDescriptor { export const createChartInfoApi = async ( dataViews: DataViewsPublicPluginStart, - editorFrameService?: EditorFrameServiceType + visualizationMap: VisualizationMap, + datasourceMap: DatasourceMap ): ChartInfoApi => { - const [visualizationMap, datasourceMap] = await Promise.all([ - editorFrameService!.loadVisualizations(), - editorFrameService!.loadDatasources(), - ]); return { - async getChartInfo(vis: LensSavedObjectAttributes): Promise { + async getChartInfo(vis: LensDocument): Promise { const lensVis = vis; const activeDatasourceId = getActiveDatasourceIdFromDoc(lensVis); - if (!activeDatasourceId || !lensVis?.visualizationType) { + if (!activeDatasourceId || lensVis?.visualizationType == null) { return undefined; } diff --git a/x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx b/x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx index e356a59956f06..ff51014f548d3 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx @@ -12,6 +12,7 @@ import { EuiCallOut, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import type { CoreStart } from '@kbn/core/public'; +import { Query } from '@kbn/es-query'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { type DataView, DataViewField, FieldSpec } from '@kbn/data-plugin/common'; import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; @@ -42,7 +43,7 @@ import { IndexPatternServiceAPI } from '../../data_views_service/service'; import { FieldItem } from '../common/field_item'; export type FormBasedDataPanelProps = Omit< - DatasourceDataPanelProps, + DatasourceDataPanelProps, 'core' | 'onChangeIndexPattern' > & { data: DataPublicPluginStart; @@ -185,7 +186,7 @@ export const InnerFormBasedDataPanel = function InnerFormBasedDataPanel({ showNoDataPopover, activeIndexPatterns, }: Omit< - DatasourceDataPanelProps, + DatasourceDataPanelProps, 'state' | 'setState' | 'core' | 'onChangeIndexPattern' | 'usedIndexPatterns' > & { data: DataPublicPluginStart; diff --git a/x-pack/plugins/lens/public/datasources/form_based/form_based.test.ts b/x-pack/plugins/lens/public/datasources/form_based/form_based.test.ts index b399f8eaa7b54..cd26abe0fdd86 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/form_based.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/form_based.test.ts @@ -51,6 +51,7 @@ import { Datatable, DatatableColumn } from '@kbn/expressions-plugin/common'; import { filterAndSortUserMessages } from '../../app_plugin/get_application_user_messages'; import { createMockFramePublicAPI } from '../../mocks'; import { createMockDataViewsState } from '../../data_views_service/mocks'; +import { Query } from '@kbn/es-query'; jest.mock('./loader'); jest.mock('../../id_generator'); @@ -193,7 +194,7 @@ const dateRange = { describe('IndexPattern Data Source', () => { let baseState: FormBasedPrivateState; - let FormBasedDatasource: Datasource; + let FormBasedDatasource: Datasource; beforeEach(() => { const data = dataPluginMock.createStartContract(); diff --git a/x-pack/plugins/lens/public/datasources/form_based/form_based.tsx b/x-pack/plugins/lens/public/datasources/form_based/form_based.tsx index da893707ab2bc..ebe98c56adebf 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/form_based.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/form_based.tsx @@ -8,7 +8,7 @@ import React from 'react'; import type { CoreStart, SavedObjectReference } from '@kbn/core/public'; import { i18n } from '@kbn/i18n'; -import { TimeRange } from '@kbn/es-query'; +import { Query, TimeRange } from '@kbn/es-query'; import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import { flatten, isEqual } from 'lodash'; @@ -28,7 +28,6 @@ import memoizeOne from 'memoize-one'; import type { DatasourceDimensionEditorProps, DatasourceDimensionTriggerProps, - DatasourceDataPanelProps, DatasourceLayerPanelProps, PublicAPIProps, OperationDescriptor, @@ -40,6 +39,7 @@ import type { UserMessage, StateSetter, IndexPatternMap, + DatasourceDataPanelProps, } from '../../types'; import { changeIndexPattern, @@ -217,7 +217,7 @@ export function getFormBasedDatasource({ const ALIAS_IDS = ['indexpattern']; // Not stateful. State is persisted to the frame - const formBasedDatasource: Datasource = { + const formBasedDatasource: Datasource = { id: DATASOURCE_ID, alias: ALIAS_IDS, @@ -464,7 +464,7 @@ export function getFormBasedDatasource({ LayerSettingsComponent(props) { return ; }, - DataPanelComponent(props: DatasourceDataPanelProps) { + DataPanelComponent(props: DatasourceDataPanelProps) { const { onChangeIndexPattern, ...otherProps } = props; const layerFields = formBasedDatasource?.getSelectedFields?.(props.state); return ( @@ -869,13 +869,11 @@ export function getFormBasedDatasource({ getDatasourceInfo: async (state, references, dataViewsService) => { const layers = references ? injectReferences(state, references).layers : state.layers; - const indexPatterns: DataView[] = []; - for (const { indexPatternId } of Object.values(layers)) { - const dataView = await dataViewsService?.get(indexPatternId); - if (dataView) { - indexPatterns.push(dataView); - } - } + const indexPatterns: DataView[] = await Promise.all( + Object.values(layers) + .map(({ indexPatternId }) => dataViewsService?.get(indexPatternId)) + .filter(nonNullable) + ); return Object.entries(layers).reduce((acc, [key, layer]) => { const dataView = indexPatterns?.find( (indexPattern) => indexPattern.id === layer.indexPatternId diff --git a/x-pack/plugins/lens/public/datasources/form_based/mocks.ts b/x-pack/plugins/lens/public/datasources/form_based/mocks.ts index fcefa97ecd4b1..f98107eebbcca 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/mocks.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/mocks.ts @@ -8,101 +8,83 @@ import { getFieldByNameFactory } from './pure_helpers'; import type { IndexPattern, IndexPatternField } from '../../types'; +export function createMockedField( + someProps: Partial & Pick +) { + return { + displayName: someProps.name, + aggregatable: true, + searchable: true, + ...someProps, + }; +} + export const createMockedIndexPattern = ( someProps?: Partial, customFields: IndexPatternField[] = [] ): IndexPattern => { const fields = [ - { + createMockedField({ name: 'timestamp', displayName: 'timestampLabel', type: 'date', - aggregatable: true, - searchable: true, - }, - { + }), + createMockedField({ name: 'start_date', - displayName: 'start_date', type: 'date', - aggregatable: true, - searchable: true, - }, - { + }), + createMockedField({ name: 'bytes', - displayName: 'bytes', type: 'number', - aggregatable: true, - searchable: true, - }, - { + }), + createMockedField({ name: 'memory', - displayName: 'memory', type: 'number', - aggregatable: true, - searchable: true, esTypes: ['float'], - }, - { + }), + createMockedField({ name: 'source', - displayName: 'source', type: 'string', - aggregatable: true, - searchable: true, esTypes: ['keyword'], - }, - { + }), + createMockedField({ name: 'unsupported', - displayName: 'unsupported', type: 'geo', - aggregatable: true, - searchable: true, - }, - { + }), + createMockedField({ name: 'dest', - displayName: 'dest', type: 'string', - aggregatable: true, - searchable: true, esTypes: ['keyword'], - }, - { + }), + createMockedField({ name: 'geo.src', - displayName: 'geo.src', type: 'string', - aggregatable: true, - searchable: true, esTypes: ['keyword'], - }, - { + }), + createMockedField({ name: 'scripted', displayName: 'Scripted', type: 'string', - searchable: true, - aggregatable: true, scripted: true, lang: 'painless' as const, script: '1234', - }, - { + }), + createMockedField({ name: 'runtime-keyword', displayName: 'Runtime keyword field', type: 'string', - searchable: true, - aggregatable: true, runtime: true, lang: 'painless' as const, script: 'emit("123")', - }, - { + }), + createMockedField({ name: 'runtime-number', displayName: 'Runtime number field', type: 'number', - searchable: true, - aggregatable: true, runtime: true, lang: 'painless' as const, script: 'emit(123)', - }, + }), ...(customFields || []), ]; return { @@ -120,31 +102,23 @@ export const createMockedIndexPattern = ( export const createMockedRestrictedIndexPattern = () => { const fields = [ - { + createMockedField({ name: 'timestamp', displayName: 'timestampLabel', type: 'date', - aggregatable: true, - searchable: true, - }, - { + }), + createMockedField({ name: 'bytes', - displayName: 'bytes', type: 'number', - aggregatable: true, - searchable: true, - }, - { + }), + createMockedField({ name: 'source', - displayName: 'source', type: 'string', - aggregatable: true, - searchable: true, scripted: true, esTypes: ['keyword'], lang: 'painless' as const, script: '1234', - }, + }), ]; return { id: '2', diff --git a/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx b/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx index 411583d88ef13..6a9471e174e80 100644 --- a/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx @@ -362,7 +362,7 @@ export function getTextBasedDatasource({ getUsedDataViews: (state) => { return Object.values(state.layers) .map(({ index }) => index) - .filter((index) => index !== undefined) as string[]; + .filter(nonNullable); }, getPersistableState({ layers }: TextBasedPrivateState) { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/easteregg/index.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/easteregg/index.tsx index 7bfd7c666079a..3372625ff2830 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/easteregg/index.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/easteregg/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ import React from 'react'; -import type { Query } from '@kbn/es-query'; +import { AggregateQuery, isOfAggregateQueryType, Query } from '@kbn/es-query'; import { EuiErrorBoundary } from '@elastic/eui'; const Bee = React.lazy(() => import('./bee')); @@ -34,11 +34,14 @@ function Bees({ query }: { query?: Query }) { ); } -export function Easteregg(props: { query?: Query }) { +export function Easteregg(props: { query?: Query | AggregateQuery }) { + if (isOfAggregateQueryType(props.query)) { + return null; + } return ( // Do not break Lens for an easteregg - + ); } diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts index 466773ec1c6b2..efe3ccc84f560 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts @@ -33,7 +33,7 @@ import type { SuggestionRequest, } from '../../types'; import { buildExpression } from './expression_helpers'; -import { Document } from '../../persistence/saved_object_store'; +import { LensDocument } from '../../persistence/saved_object_store'; import { getActiveDatasourceIdFromDoc, sortDataViewRefs } from '../../utils'; import type { DatasourceState, DatasourceStates, VisualizationState } from '../../state_management'; import { readFromStorage } from '../../settings_storage'; @@ -353,12 +353,13 @@ export interface DocumentToExpressionReturnType { indexPatterns: IndexPatternMap; indexPatternRefs: IndexPatternRef[]; activeVisualizationState: unknown; + activeDatasourceState: unknown; } export async function persistedStateToExpression( datasourceMap: DatasourceMap, visualizations: VisualizationMap, - doc: Document, + doc: LensDocument, services: { uiSettings: IUiSettingsClient; storage: IStorageWrapper; @@ -381,7 +382,13 @@ export async function persistedStateToExpression( description, } = doc; if (!visualizationType) { - return { ast: null, indexPatterns: {}, indexPatternRefs: [], activeVisualizationState: null }; + return { + ast: null, + indexPatterns: {}, + indexPatternRefs: [], + activeVisualizationState: null, + activeDatasourceState: null, + }; } const annotationGroups = await initializeEventAnnotationGroups( @@ -435,6 +442,7 @@ export async function persistedStateToExpression( indexPatterns, indexPatternRefs, activeVisualizationState, + activeDatasourceState: null, }; } @@ -454,6 +462,7 @@ export async function persistedStateToExpression( nowInstant: services.nowProvider.get(), }), activeVisualizationState, + activeDatasourceState: datasourceStates[datasourceId]?.state, indexPatterns, indexPatternRefs, }; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx index b32d7456bd2b5..5775748da8cee 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx @@ -248,7 +248,7 @@ export const InnerWorkspacePanel = React.memo(function InnerWorkspacePanel({ const removeExpressionBuildErrorsRef = useRef<() => void>(); const onData$ = useCallback( - (_data: unknown, adapters?: Partial) => { + (_data: unknown, adapters?: DefaultInspectorAdapters) => { if (renderDeps.current) { dataReceivedTime.current = performance.now(); @@ -283,10 +283,11 @@ export const InnerWorkspacePanel = React.memo(function InnerWorkspacePanel({ dispatchLens( onActiveDataChange({ activeData: Object.entries(adapters.tables?.tables).reduce>( - (acc, [key, value], _index, tables) => ({ - ...acc, - [tables.length === 1 ? defaultLayerId : key]: value, - }), + (acc, [key, value], _index, tables) => { + const id = tables.length === 1 ? defaultLayerId : key; + acc[id] = value as Datatable; + return acc; + }, {} ), }) @@ -726,7 +727,7 @@ export const VisualizationWrapper = ({ ExpressionRendererComponent: ReactExpressionRendererType; core: CoreStart; onRender$: () => void; - onData$: (data: unknown, adapters?: Partial) => void; + onData$: (data: unknown, adapters?: DefaultInspectorAdapters) => void; onComponentRendered: () => void; displayOptions: VisualizationDisplayOptions | undefined; }) => { @@ -788,7 +789,7 @@ export const VisualizationWrapper = ({ // @ts-expect-error upgrade typescript v4.9.5 onData$={onData$} onRender$={onRenderHandler} - inspectorAdapters={lensInspector.adapters} + inspectorAdapters={lensInspector.getInspectorAdapters()} executionContext={executionContext} renderMode="edit" renderError={(errorMessage?: string | null, error?: ExpressionRenderError | null) => { diff --git a/x-pack/plugins/lens/public/editor_frame_service/service.tsx b/x-pack/plugins/lens/public/editor_frame_service/service.tsx index 71cf62d02d388..a677e0c6105b8 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/service.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/service.tsx @@ -24,7 +24,7 @@ import { DataViewsPublicPluginStart, } from '@kbn/data-views-plugin/public'; import { EventAnnotationServiceType } from '@kbn/event-annotation-plugin/public'; -import { Document } from '../persistence/saved_object_store'; +import { LensDocument } from '../persistence/saved_object_store'; import { Datasource, Visualization, @@ -93,7 +93,7 @@ export class EditorFrameService { * This is an asynchronous process. * @param doc parsed Lens saved object */ - public documentToExpression = async (doc: Document, services: EditorFramePlugins) => { + public documentToExpression = async (doc: LensDocument, services: EditorFramePlugins) => { const [resolvedDatasources, resolvedVisualizations] = await Promise.all([ this.loadDatasources(), this.loadVisualizations(), diff --git a/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx b/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx deleted file mode 100644 index 3dda0daf25760..0000000000000 --- a/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx +++ /dev/null @@ -1,1373 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import React from 'react'; -import { - Embeddable, - LensByValueInput, - LensUnwrapMetaInfo, - LensEmbeddableInput, - LensByReferenceInput, - LensSavedObjectAttributes, - LensUnwrapResult, - LensEmbeddableDeps, -} from './embeddable'; -import { ReactExpressionRendererProps } from '@kbn/expressions-plugin/public'; -import { spacesPluginMock } from '@kbn/spaces-plugin/public/mocks'; -import { Filter, Query, TimeRange } from '@kbn/es-query'; -import { FilterManager } from '@kbn/data-plugin/public'; -import type { DataViewsContract } from '@kbn/data-views-plugin/public'; -import { Document } from '../persistence'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; -import { VIS_EVENT_TO_TRIGGER } from '@kbn/visualizations-plugin/public/embeddable'; -import { coreMock, httpServiceMock } from '@kbn/core/public/mocks'; -import { IBasePath, IUiSettingsClient } from '@kbn/core/public'; -import { AttributeService, ViewMode } from '@kbn/embeddable-plugin/public'; -import { LensAttributeService } from '../lens_attribute_service'; -import { OnSaveProps } from '@kbn/saved-objects-plugin/public/save_modal'; -import { act } from 'react-dom/test-utils'; -import { inspectorPluginMock } from '@kbn/inspector-plugin/public/mocks'; -import { Visualization } from '../types'; -import { createMockDatasource, createMockVisualization } from '../mocks'; -import { FIELD_NOT_FOUND, FIELD_WRONG_TYPE } from '../user_messages_ids'; - -jest.mock('@kbn/inspector-plugin/public', () => ({ - isAvailable: false, - open: false, -})); - -const defaultVisualizationId = 'lnsSomeVisType'; -const defaultDatasourceId = 'someDatasource'; - -const savedVis: Document = { - state: { - visualization: { activeId: defaultVisualizationId }, - datasourceStates: { [defaultDatasourceId]: {} }, - query: { query: '', language: 'lucene' }, - filters: [], - }, - references: [], - title: 'My title', - visualizationType: defaultVisualizationId, -}; - -const defaultVisualizationMap = { - [defaultVisualizationId]: createMockVisualization(), -}; - -const defaultDatasourceMap = { - [defaultDatasourceId]: createMockDatasource(defaultDatasourceId), -}; - -const defaultSaveMethod = ( - _testAttributes: LensSavedObjectAttributes, - _savedObjectId?: string -): Promise<{ id: string }> => { - return new Promise(() => { - return { id: '123' }; - }); -}; -const defaultUnwrapMethod = ( - _savedObjectId: string -): Promise<{ attributes: LensSavedObjectAttributes }> => { - return new Promise(() => { - return { attributes: { ...savedVis } }; - }); -}; -const defaultCheckForDuplicateTitle = (_props: OnSaveProps): Promise => { - return new Promise(() => { - return true; - }); -}; -const options = { - saveMethod: defaultSaveMethod, - unwrapMethod: defaultUnwrapMethod, - checkForDuplicateTitle: defaultCheckForDuplicateTitle, -}; - -const mockInjectFilterReferences: FilterManager['inject'] = (filters, _references) => { - return filters.map((filter) => ({ - ...filter, - meta: { - ...filter.meta, - index: 'injected!', - }, - })); -}; - -const attributeServiceMockFromSavedVis = (document: Document): LensAttributeService => { - const core = coreMock.createStart(); - const service = new AttributeService< - LensSavedObjectAttributes, - LensByValueInput, - LensByReferenceInput, - LensUnwrapMetaInfo - >('lens', core.notifications.toasts, options); - service.unwrapAttributes = jest.fn((_input: LensByValueInput | LensByReferenceInput) => { - return Promise.resolve({ - attributes: { - ...document, - }, - metaInfo: { - sharingSavedObjectProps: { - outcome: 'exactMatch', - }, - }, - } as LensUnwrapResult); - }); - service.wrapAttributes = jest.fn(); - return service; -}; - -const dataMock = dataPluginMock.createStartContract(); - -describe('embeddable', () => { - const coreStart = coreMock.createStart(); - - let mountpoint: HTMLDivElement; - let expressionRenderer: jest.Mock; - let getTrigger: jest.Mock; - let trigger: { exec: jest.Mock }; - let basePath: IBasePath; - let attributeService: AttributeService< - LensSavedObjectAttributes, - LensByValueInput, - LensByReferenceInput, - LensUnwrapMetaInfo - >; - - beforeEach(() => { - mountpoint = document.createElement('div'); - expressionRenderer = jest.fn((_props) => null); - trigger = { exec: jest.fn() }; - getTrigger = jest.fn(() => trigger); - attributeService = attributeServiceMockFromSavedVis(savedVis); - const http = httpServiceMock.createSetupContract({ basePath: '/test' }); - basePath = http.basePath; - }); - - afterEach(() => { - mountpoint.remove(); - }); - - function getEmbeddableProps(props: Partial = {}): LensEmbeddableDeps { - return { - timefilter: dataPluginMock.createSetupContract().query.timefilter.timefilter, - attributeService, - data: dataMock, - uiSettings: { get: () => undefined } as unknown as IUiSettingsClient, - inspector: inspectorPluginMock.createStartContract(), - expressionRenderer, - coreStart, - basePath, - dataViews: { - get: (id: string) => Promise.resolve({ id, isTimeBased: () => false }), - } as unknown as DataViewsContract, - capabilities: { - canSaveDashboards: true, - canSaveVisualizations: true, - canOpenVisualizations: true, - discover: {}, - navLinks: {}, - }, - getTrigger, - visualizationMap: defaultVisualizationMap, - datasourceMap: defaultDatasourceMap, - injectFilterReferences: jest.fn(mockInjectFilterReferences), - documentToExpression: () => - Promise.resolve({ - ast: { - type: 'expression', - chain: [ - { type: 'function', function: 'my', arguments: {} }, - { type: 'function', function: 'expression', arguments: {} }, - ], - }, - indexPatterns: {}, - indexPatternRefs: [], - activeVisualizationState: null, - }), - ...props, - }; - } - - it('should render expression once with expression renderer', async () => { - const embeddable = new Embeddable(getEmbeddableProps(), { - timeRange: { - from: 'now-15m', - to: 'now', - }, - } as LensEmbeddableInput); - embeddable.render(mountpoint); - - // wait one tick to give embeddable time to initialize - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - expect(expressionRenderer.mock.calls[0][0]!.expression).toEqual(`my -| expression`); - }); - - it('should not throw if render is called after destroy', async () => { - const embeddable = new Embeddable(getEmbeddableProps(), { - timeRange: { - from: 'now-15m', - to: 'now', - }, - } as LensEmbeddableInput); - let renderCalled = false; - let renderThrew = false; - // destroying completes output synchronously which might make a synchronous render call - this shouldn't throw - embeddable.getOutput$().subscribe(undefined, undefined, () => { - try { - embeddable.render(mountpoint); - } catch (e) { - renderThrew = true; - } finally { - renderCalled = true; - } - }); - embeddable.destroy(); - expect(renderCalled).toBe(true); - expect(renderThrew).toBe(false); - }); - - it('should render once even if reload is called before embeddable is fully initialized', async () => { - const embeddable = new Embeddable(getEmbeddableProps(), { - timeRange: { - from: 'now-15m', - to: 'now', - }, - } as LensEmbeddableInput); - embeddable.reload(); - expect(expressionRenderer).toHaveBeenCalledTimes(0); - embeddable.render(mountpoint); - expect(expressionRenderer).toHaveBeenCalledTimes(0); - - // wait one tick to give embeddable time to initialize - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - }); - - it('should not render the visualization if any error arises', async () => { - const embeddable = new Embeddable(getEmbeddableProps(), {} as LensEmbeddableInput); - - jest.spyOn(embeddable, 'getUserMessages').mockReturnValue([ - { - uniqueId: 'error', - severity: 'error', - fixableInEditor: true, - displayLocations: [{ id: 'visualization' }], - longMessage: 'lol', - shortMessage: 'lol', - }, - ]); - - await embeddable.initializeSavedVis({} as LensEmbeddableInput); - embeddable.render(mountpoint); - - expect(expressionRenderer).toHaveBeenCalledTimes(0); - }); - - it('should override embeddableBadge message', async () => { - const getBadgeMessage = jest.fn( - (): ReturnType> => [ - { - uniqueId: FIELD_NOT_FOUND, - severity: 'warning', - fixableInEditor: true, - displayLocations: [ - { id: 'embeddableBadge' }, - { id: 'dimensionButton', dimensionId: '1' }, - ], - longMessage: 'custom', - shortMessage: '', - hidePopoverIcon: true, - }, - ] - ); - - const embeddable = new Embeddable( - getEmbeddableProps({ - datasourceMap: { - ...defaultDatasourceMap, - [defaultDatasourceId]: { - ...defaultDatasourceMap[defaultDatasourceId], - getUserMessages: jest.fn(() => [ - { - uniqueId: FIELD_NOT_FOUND, - severity: 'error', - fixableInEditor: true, - displayLocations: [ - { id: 'embeddableBadge' }, - { id: 'dimensionButton', dimensionId: '1' }, - ], - longMessage: 'original', - shortMessage: '', - }, - { - uniqueId: FIELD_WRONG_TYPE, - severity: 'error', - fixableInEditor: true, - displayLocations: [{ id: 'visualization' }], - longMessage: 'original', - shortMessage: '', - }, - ]), - }, - }, - }), - { - onBeforeBadgesRender: getBadgeMessage as LensEmbeddableInput['onBeforeBadgesRender'], - } as LensEmbeddableInput - ); - - const getUserMessagesSpy = jest.spyOn(embeddable, 'getUserMessages'); - await embeddable.initializeSavedVis({} as LensEmbeddableInput); - - embeddable.render(mountpoint); - - expect(getUserMessagesSpy.mock.results.flatMap((r) => r.value)).toEqual( - expect.arrayContaining([ - { - uniqueId: FIELD_WRONG_TYPE, - severity: 'error', - fixableInEditor: true, - displayLocations: [{ id: 'visualization' }], - longMessage: 'original', - shortMessage: '', - }, - { - uniqueId: FIELD_NOT_FOUND, - severity: 'warning', - fixableInEditor: true, - displayLocations: [ - { id: 'embeddableBadge' }, - { id: 'dimensionButton', dimensionId: '1' }, - ], - longMessage: 'custom', - shortMessage: '', - hidePopoverIcon: true, - }, - ]) - ); - }); - - it('should not render the vis if loaded saved object conflicts', async () => { - attributeService.unwrapAttributes = jest.fn( - (_input: LensByValueInput | LensByReferenceInput) => { - return Promise.resolve({ - attributes: { - ...savedVis, - }, - metaInfo: { - sharingSavedObjectProps: { - outcome: 'conflict', - sourceId: '1', - aliasTargetId: '2', - }, - }, - } as LensUnwrapResult); - } - ); - const spacesPluginStart = spacesPluginMock.createStartContract(); - spacesPluginStart.ui.components.getEmbeddableLegacyUrlConflict = jest.fn(() => ( - <>getEmbeddableLegacyUrlConflict - )); - const embeddable = new Embeddable( - getEmbeddableProps({ - spaces: spacesPluginStart, - attributeService, - }), - {} as LensEmbeddableInput - ); - await embeddable.initializeSavedVis({} as LensEmbeddableInput); - embeddable.render(mountpoint); - expect(expressionRenderer).toHaveBeenCalledTimes(0); - expect(spacesPluginStart.ui.components.getEmbeddableLegacyUrlConflict).toHaveBeenCalled(); - }); - - it('should not render if timeRange prop is not passed when a referenced data view is time based', async () => { - const embeddable = new Embeddable( - getEmbeddableProps({ - attributeService: attributeServiceMockFromSavedVis({ - ...savedVis, - references: [ - { type: 'index-pattern', id: '123', name: 'abc' }, - { type: 'index-pattern', id: '123', name: 'def' }, - { type: 'index-pattern', id: '456', name: 'ghi' }, - ], - }), - dataViews: { - get: (id: string) => Promise.resolve({ id, isTimeBased: () => true }), - } as unknown as DataViewsContract, - }), - {} as LensEmbeddableInput - ); - await embeddable.initializeSavedVis({} as LensEmbeddableInput); - embeddable.render(mountpoint); - expect(expressionRenderer).toHaveBeenCalledTimes(0); - }); - - it('should initialize output with deduped list of index patterns', async () => { - const embeddable = new Embeddable( - getEmbeddableProps({ - attributeService: attributeServiceMockFromSavedVis({ - ...savedVis, - references: [ - { type: 'index-pattern', id: '123', name: 'abc' }, - { type: 'index-pattern', id: '123', name: 'def' }, - { type: 'index-pattern', id: '456', name: 'ghi' }, - ], - }), - }), - {} as LensEmbeddableInput - ); - - await embeddable.initializeSavedVis({} as LensEmbeddableInput); - const outputIndexPatterns = embeddable.getOutput().indexPatterns!; - expect(outputIndexPatterns.length).toEqual(2); - expect(outputIndexPatterns[0].id).toEqual('123'); - expect(outputIndexPatterns[1].id).toEqual('456'); - }); - - it('should re-render once on filter change', async () => { - const embeddable = new Embeddable( - { - timefilter: dataPluginMock.createSetupContract().query.timefilter.timefilter, - attributeService, - data: dataMock, - uiSettings: { get: () => undefined } as unknown as IUiSettingsClient, - expressionRenderer, - coreStart, - basePath, - inspector: inspectorPluginMock.createStartContract(), - dataViews: {} as DataViewsContract, - capabilities: { - canSaveDashboards: true, - canSaveVisualizations: true, - canOpenVisualizations: true, - discover: {}, - navLinks: {}, - }, - getTrigger, - visualizationMap: defaultVisualizationMap, - datasourceMap: defaultDatasourceMap, - injectFilterReferences: jest.fn(mockInjectFilterReferences), - documentToExpression: () => - Promise.resolve({ - ast: { - type: 'expression', - chain: [ - { type: 'function', function: 'my', arguments: {} }, - { type: 'function', function: 'expression', arguments: {} }, - ], - }, - indexPatterns: {}, - indexPatternRefs: [], - activeVisualizationState: null, - }), - }, - { id: '123' } as LensEmbeddableInput - ); - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - - embeddable.updateInput({ - filters: [{ meta: { alias: 'test', negate: false, disabled: false } }], - }); - - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(expressionRenderer).toHaveBeenCalledTimes(2); - }); - - it('should re-render once on search session change', async () => { - const embeddable = new Embeddable( - { - timefilter: dataPluginMock.createSetupContract().query.timefilter.timefilter, - attributeService, - data: dataMock, - uiSettings: { get: () => undefined } as unknown as IUiSettingsClient, - expressionRenderer, - coreStart, - basePath, - inspector: inspectorPluginMock.createStartContract(), - dataViews: {} as DataViewsContract, - capabilities: { - canSaveDashboards: true, - canSaveVisualizations: true, - canOpenVisualizations: true, - discover: {}, - navLinks: {}, - }, - getTrigger, - visualizationMap: defaultVisualizationMap, - datasourceMap: defaultDatasourceMap, - injectFilterReferences: jest.fn(mockInjectFilterReferences), - documentToExpression: () => - Promise.resolve({ - ast: { - type: 'expression', - chain: [ - { type: 'function', function: 'my', arguments: {} }, - { type: 'function', function: 'expression', arguments: {} }, - ], - }, - indexPatterns: {}, - indexPatternRefs: [], - activeVisualizationState: null, - }), - }, - { id: '123', searchSessionId: 'firstSession' } as LensEmbeddableInput - ); - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - - embeddable.updateInput({ - searchSessionId: 'nextSession', - }); - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(expressionRenderer).toHaveBeenCalledTimes(2); - }); - - it('should re-render when dashboard view/edit mode changes if dynamic actions are set', async () => { - const sampleInput = { - id: '123', - enhancements: { - dynamicActions: {}, - }, - } as unknown as LensEmbeddableInput; - const embeddable = new Embeddable(getEmbeddableProps(), { id: '123' } as LensEmbeddableInput); - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - - embeddable.updateInput({ - viewMode: ViewMode.VIEW, - }); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - - embeddable.updateInput({ - ...sampleInput, - viewMode: ViewMode.VIEW, - }); - - expect(expressionRenderer).toHaveBeenCalledTimes(2); - }); - - it('should re-render when dynamic actions input changes', async () => { - const embeddable = new Embeddable(getEmbeddableProps(), { id: '123' } as LensEmbeddableInput); - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - - embeddable.updateInput({ - enhancements: { - dynamicActions: {}, - }, - }); - - expect(expressionRenderer).toHaveBeenCalledTimes(2); - }); - - it('should pass context to embeddable', async () => { - const timeRange: TimeRange = { from: 'now-15d', to: 'now' }; - const query: Query = { language: 'kquery', query: '' }; - const filters: Filter[] = [{ meta: { alias: 'test', negate: false, disabled: false } }]; - - const input = { - savedObjectId: '123', - timeRange, - query, - filters, - searchSessionId: 'searchSessionId', - } as LensEmbeddableInput; - - const embeddable = new Embeddable(getEmbeddableProps(), input); - await embeddable.initializeSavedVis(input); - embeddable.render(mountpoint); - - expect(expressionRenderer.mock.calls[0][0].searchContext).toEqual( - expect.objectContaining({ - timeRange, - query: [query, savedVis.state.query], - filters, - }) - ); - - expect(expressionRenderer.mock.calls[0][0].searchSessionId).toBe(input.searchSessionId); - }); - - it('should pass render mode to expression', async () => { - const timeRange: TimeRange = { from: 'now-15d', to: 'now' }; - const query: Query = { language: 'kquery', query: '' }; - const filters: Filter[] = [{ meta: { alias: 'test', negate: false, disabled: false } }]; - - const input = { - savedObjectId: '123', - timeRange, - query, - filters, - renderMode: 'view', - disableTriggers: true, - } as LensEmbeddableInput; - - const embeddable = new Embeddable(getEmbeddableProps(), input); - await embeddable.initializeSavedVis(input); - embeddable.render(mountpoint); - - expect(expressionRenderer.mock.calls[0][0]).toEqual( - expect.objectContaining({ - interactive: false, - renderMode: 'view', - }) - ); - }); - - it('should merge external context with query and filters of the saved object', async () => { - const timeRange: TimeRange = { from: 'now-15d', to: 'now' }; - const query: Query = { language: 'kquery', query: 'external query' }; - const filters: Filter[] = [ - { meta: { alias: 'external filter', negate: false, disabled: false } }, - ]; - - const newSavedVis = { - ...savedVis, - state: { - ...savedVis.state, - query: { language: 'kquery', query: 'saved filter' }, - filters: [{ meta: { alias: 'test', negate: false, disabled: false, index: 'filter-0' } }], - }, - references: [{ type: 'index-pattern', name: 'filter-0', id: 'my-index-pattern-id' }], - }; - - const input = { savedObjectId: '123', timeRange, query, filters } as LensEmbeddableInput; - - const embeddable = new Embeddable( - getEmbeddableProps({ attributeService: attributeServiceMockFromSavedVis(newSavedVis) }), - input - ); - await embeddable.initializeSavedVis(input); - embeddable.render(mountpoint); - - const expectedFilters = [ - ...input.filters!, - ...mockInjectFilterReferences(newSavedVis.state.filters, []), - ]; - expect(expressionRenderer.mock.calls[0][0].searchContext?.timeRange).toEqual(timeRange); - expect(expressionRenderer.mock.calls[0][0].searchContext?.filters).toEqual(expectedFilters); - expect(expressionRenderer.mock.calls[0][0].searchContext?.query).toEqual([ - query, - { language: 'kquery', query: 'saved filter' }, - ]); - }); - - it('should execute trigger on event from expression renderer', async () => { - const embeddable = new Embeddable(getEmbeddableProps(), { id: '123' } as LensEmbeddableInput); - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - const onEvent = expressionRenderer.mock.calls[0][0].onEvent!; - - const eventData = { myData: true, table: { rows: [], columns: [] }, column: 0 }; - onEvent({ name: 'brush', data: eventData }); - - expect(getTrigger).toHaveBeenCalledWith(VIS_EVENT_TO_TRIGGER.brush); - expect(trigger.exec).toHaveBeenCalledWith( - expect.objectContaining({ - data: { ...eventData, timeFieldName: undefined }, - embeddable: expect.anything(), - }) - ); - }); - - it('should execute trigger on row click event from expression renderer', async () => { - const embeddable = new Embeddable(getEmbeddableProps(), { id: '123' } as LensEmbeddableInput); - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - const onEvent = expressionRenderer.mock.calls[0][0].onEvent!; - - onEvent({ name: 'tableRowContextMenuClick', data: {} }); - - expect(getTrigger).toHaveBeenCalledWith(VIS_EVENT_TO_TRIGGER.tableRowContextMenuClick); - }); - - it('should not re-render if only change is in disabled filter', async () => { - const timeRange: TimeRange = { from: 'now-15d', to: 'now' }; - const query: Query = { language: 'kquery', query: '' }; - const filters: Filter[] = [{ meta: { alias: 'test', negate: false, disabled: true } }]; - - const embeddable = new Embeddable(getEmbeddableProps(), { - id: '123', - timeRange, - query, - filters, - } as LensEmbeddableInput); - await embeddable.initializeSavedVis({ - id: '123', - timeRange, - query, - filters, - } as LensEmbeddableInput); - embeddable.render(mountpoint); - - act(() => { - embeddable.updateInput({ - timeRange, - query, - filters: [{ meta: { alias: 'test', negate: true, disabled: true } }], - }); - }); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - }); - - it('should call onload after rerender and onData$ call ', async () => { - const onDataTimeout = 10; - const onLoad = jest.fn(); - const adapters = { tables: {} }; - - expressionRenderer = jest.fn(({ onData$ }) => { - setTimeout(() => { - onData$?.({}, adapters); - }, onDataTimeout); - - return null; - }); - - const embeddable = new Embeddable(getEmbeddableProps({ expressionRenderer }), { - id: '123', - onLoad, - } as unknown as LensEmbeddableInput); - - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - expect(onLoad).toHaveBeenCalledWith(true); - expect(onLoad).toHaveBeenCalledTimes(1); - - await new Promise((resolve) => setTimeout(resolve, onDataTimeout * 1.5)); - - // loading should become false - expect(onLoad).toHaveBeenCalledTimes(2); - expect(onLoad).toHaveBeenNthCalledWith(2, false, adapters, embeddable.getOutput$()); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - - embeddable.updateInput({ - searchSessionId: 'newSession', - }); - - await new Promise((resolve) => setTimeout(resolve, 0)); - - // loading should become again true - expect(onLoad).toHaveBeenCalledTimes(3); - expect(onLoad).toHaveBeenNthCalledWith(3, true); - expect(expressionRenderer).toHaveBeenCalledTimes(2); - - await new Promise((resolve) => setTimeout(resolve, onDataTimeout * 1.5)); - - // loading should again become false - expect(onLoad).toHaveBeenCalledTimes(4); - expect(onLoad).toHaveBeenNthCalledWith(4, false, adapters, embeddable.getOutput$()); - }); - - it('should call onFilter event on filter call ', async () => { - const onFilter = jest.fn(); - - expressionRenderer = jest.fn(({ onEvent }) => { - setTimeout(() => { - onEvent?.({ - name: 'filter', - data: { pings: false, table: { rows: [], columns: [] }, column: 0 }, - }); - }, 10); - - return null; - }); - - const embeddable = new Embeddable(getEmbeddableProps({ expressionRenderer }), { - id: '123', - onFilter, - } as unknown as LensEmbeddableInput); - - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - await new Promise((resolve) => setTimeout(resolve, 20)); - - expect(onFilter).toHaveBeenCalledWith(expect.objectContaining({ pings: false })); - expect(onFilter).toHaveBeenCalledTimes(1); - }); - - it('should prevent the onFilter trigger when calling preventDefault', async () => { - const onFilter = jest.fn(({ preventDefault }) => preventDefault()); - - expressionRenderer = jest.fn(({ onEvent }) => { - setTimeout(() => { - onEvent?.({ - name: 'filter', - data: { pings: false, table: { rows: [], columns: [] }, column: 0 }, - }); - }, 10); - - return null; - }); - - const embeddable = new Embeddable(getEmbeddableProps({ expressionRenderer }), { - id: '123', - onFilter, - } as unknown as LensEmbeddableInput); - - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - await new Promise((resolve) => setTimeout(resolve, 20)); - - expect(getTrigger).not.toHaveBeenCalled(); - }); - - it('should call onBrush event on brushing', async () => { - const onBrushEnd = jest.fn(); - - expressionRenderer = jest.fn(({ onEvent }) => { - setTimeout(() => { - onEvent?.({ - name: 'brush', - data: { range: [0, 1], table: { rows: [], columns: [] }, column: 0 }, - }); - }, 10); - - return null; - }); - - const embeddable = new Embeddable(getEmbeddableProps({ expressionRenderer }), { - id: '123', - onBrushEnd, - } as unknown as LensEmbeddableInput); - - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - await new Promise((resolve) => setTimeout(resolve, 20)); - - expect(onBrushEnd).toHaveBeenCalledWith(expect.objectContaining({ range: [0, 1] })); - expect(onBrushEnd).toHaveBeenCalledTimes(1); - }); - - it('should prevent the onBrush trigger when calling preventDefault', async () => { - const onBrushEnd = jest.fn(({ preventDefault }) => preventDefault()); - - expressionRenderer = jest.fn(({ onEvent }) => { - setTimeout(() => { - onEvent?.({ - name: 'brush', - data: { range: [0, 1], table: { rows: [], columns: [] }, column: 0 }, - }); - }, 10); - - return null; - }); - - const embeddable = new Embeddable(getEmbeddableProps({ expressionRenderer }), { - id: '123', - onBrushEnd, - } as unknown as LensEmbeddableInput); - - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - await new Promise((resolve) => setTimeout(resolve, 20)); - - expect(getTrigger).not.toHaveBeenCalled(); - }); - - it('should call onTableRowClick event ', async () => { - const onTableRowClick = jest.fn(); - - expressionRenderer = jest.fn(({ onEvent }) => { - setTimeout(() => { - onEvent?.({ name: 'tableRowContextMenuClick', data: { name: 'test' } }); - }, 10); - - return null; - }); - - const embeddable = new Embeddable(getEmbeddableProps({ expressionRenderer }), { - id: '123', - onTableRowClick, - } as unknown as LensEmbeddableInput); - - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - await new Promise((resolve) => setTimeout(resolve, 20)); - - expect(onTableRowClick).toHaveBeenCalledWith(expect.objectContaining({ name: 'test' })); - expect(onTableRowClick).toHaveBeenCalledTimes(1); - }); - - it('should prevent onTableRowClick trigger when calling preventDefault ', async () => { - const onTableRowClick = jest.fn(({ preventDefault }) => preventDefault()); - - expressionRenderer = jest.fn(({ onEvent }) => { - setTimeout(() => { - onEvent?.({ name: 'tableRowContextMenuClick', data: { name: 'test' } }); - }, 10); - - return null; - }); - - const embeddable = new Embeddable(getEmbeddableProps({ expressionRenderer }), { - id: '123', - onTableRowClick, - } as unknown as LensEmbeddableInput); - - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - await new Promise((resolve) => setTimeout(resolve, 20)); - - expect(getTrigger).not.toHaveBeenCalled(); - }); - - it('handles edit actions ', async () => { - const editedVisualizationState = { value: 'edited' }; - const onEditActionMock = jest.fn().mockReturnValue(editedVisualizationState); - const documentToExpressionMock = jest.fn().mockImplementation(async (document) => { - const isStateEdited = document.state.visualization.value === 'edited'; - return { - ast: { - type: 'expression', - chain: [ - { - type: 'function', - function: isStateEdited ? 'edited' : 'not_edited', - arguments: {}, - }, - ], - }, - indexPatterns: {}, - indexPatternRefs: [], - }; - }); - - const visDocument: Document = { - state: { - visualization: {}, - datasourceStates: { [defaultDatasourceId]: {} }, - query: { query: '', language: 'lucene' }, - filters: [], - }, - references: [], - title: 'My title', - visualizationType: 'lensDatatable', - }; - - const embeddable = new Embeddable( - getEmbeddableProps({ - attributeService: attributeServiceMockFromSavedVis(visDocument), - visualizationMap: { - [visDocument.visualizationType as string]: { - onEditAction: onEditActionMock, - initialize: () => {}, - } as unknown as Visualization, - }, - documentToExpression: documentToExpressionMock, - }), - { id: '123' } as unknown as LensEmbeddableInput - ); - - // SETUP FRESH STATE - await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); - embeddable.render(mountpoint); - - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - expect(expressionRenderer.mock.calls[0][0]!.expression).toBe(`not_edited`); - - // TEST EDIT EVENT - await embeddable.handleEvent({ name: 'edit' }); - - expect(onEditActionMock).toHaveBeenCalledTimes(1); - expect(documentToExpressionMock).toHaveBeenCalled(); - - const docToExpCalls = documentToExpressionMock.mock.calls; - const editedVisDocument = docToExpCalls[docToExpCalls.length - 1][0]; - expect(editedVisDocument.state.visualization).toEqual(editedVisualizationState); - - expect(expressionRenderer).toHaveBeenCalledTimes(2); - expect(expressionRenderer.mock.calls[1][0]!.expression).toBe(`edited`); - }); - - it('should override noPadding in the display options if noPadding is set in the embeddable input', async () => { - expressionRenderer = jest.fn((_) => null); - - const createEmbeddable = (displayOptions?: { noPadding: boolean }, noPadding?: boolean) => { - return new Embeddable( - { - timefilter: dataPluginMock.createSetupContract().query.timefilter.timefilter, - attributeService: attributeServiceMockFromSavedVis(savedVis), - data: dataMock, - expressionRenderer, - coreStart, - basePath, - dataViews: {} as DataViewsContract, - capabilities: { - canSaveDashboards: true, - canSaveVisualizations: true, - canOpenVisualizations: true, - discover: {}, - navLinks: {}, - }, - inspector: inspectorPluginMock.createStartContract(), - getTrigger, - visualizationMap: { - [savedVis.visualizationType as string]: { - getDisplayOptions: displayOptions ? () => displayOptions : undefined, - initialize: () => {}, - } as unknown as Visualization, - }, - datasourceMap: defaultDatasourceMap, - injectFilterReferences: jest.fn(mockInjectFilterReferences), - documentToExpression: () => - Promise.resolve({ - ast: { - type: 'expression', - chain: [ - { type: 'function', function: 'my', arguments: {} }, - { type: 'function', function: 'expression', arguments: {} }, - ], - }, - indexPatterns: {}, - indexPatternRefs: [], - activeVisualizationState: null, - }), - uiSettings: { get: () => undefined } as unknown as IUiSettingsClient, - }, - { - timeRange: { - from: 'now-15m', - to: 'now', - }, - noPadding, - } as LensEmbeddableInput - ); - }; - - // no display options and no override - let embeddable = createEmbeddable(); - embeddable.render(mountpoint); - - // wait one tick to give embeddable time to initialize - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - expect(expressionRenderer.mock.calls[0][0]!.padding).toBe('s'); - - // display options and no override - embeddable = createEmbeddable({ noPadding: true }); - embeddable.render(mountpoint); - - // wait one tick to give embeddable time to initialize - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(expressionRenderer).toHaveBeenCalledTimes(2); - expect(expressionRenderer.mock.calls[1][0]!.padding).toBe(undefined); - - // no display options and override - embeddable = createEmbeddable(undefined, true); - embeddable.render(mountpoint); - - // wait one tick to give embeddable time to initialize - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(expressionRenderer).toHaveBeenCalledTimes(3); - expect(expressionRenderer.mock.calls[1][0]!.padding).toBe(undefined); - - // display options and override - embeddable = createEmbeddable({ noPadding: false }, true); - embeddable.render(mountpoint); - - // wait one tick to give embeddable time to initialize - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(expressionRenderer).toHaveBeenCalledTimes(4); - expect(expressionRenderer.mock.calls[1][0]!.padding).toBe(undefined); - }); - - it('should reload only once when the attributes or savedObjectId and the search context change at the same time', async () => { - const createEmbeddable = async () => { - const currentExpressionRenderer = jest.fn((_props) => null); - const timeRange: TimeRange = { from: 'now-15d', to: 'now' }; - const query: Query = { language: 'kquery', query: '' }; - const filters: Filter[] = [{ meta: { alias: 'test', negate: false, disabled: true } }]; - const embeddable = new Embeddable( - { - timefilter: dataPluginMock.createSetupContract().query.timefilter.timefilter, - attributeService, - data: dataMock, - uiSettings: { get: () => undefined } as unknown as IUiSettingsClient, - expressionRenderer: currentExpressionRenderer, - coreStart, - basePath, - inspector: inspectorPluginMock.createStartContract(), - dataViews: {} as DataViewsContract, - capabilities: { - canSaveDashboards: true, - canSaveVisualizations: true, - canOpenVisualizations: true, - discover: {}, - navLinks: {}, - }, - getTrigger, - visualizationMap: defaultVisualizationMap, - datasourceMap: defaultDatasourceMap, - injectFilterReferences: jest.fn(mockInjectFilterReferences), - documentToExpression: () => - Promise.resolve({ - ast: { - type: 'expression', - chain: [ - { type: 'function', function: 'my', arguments: {} }, - { type: 'function', function: 'expression', arguments: {} }, - ], - }, - indexPatterns: {}, - indexPatternRefs: [], - activeVisualizationState: null, - }), - }, - { id: '123', timeRange, query, filters } as LensEmbeddableInput - ); - const reload = jest.spyOn(embeddable, 'reload'); - const initializeSavedVis = jest.spyOn(embeddable, 'initializeSavedVis'); - - await embeddable.initializeSavedVis({ - id: '123', - timeRange, - query, - filters, - } as LensEmbeddableInput); - - embeddable.render(mountpoint); - - return { - embeddable, - reload, - initializeSavedVis, - expressionRenderer: currentExpressionRenderer, - }; - }; - - let test = await createEmbeddable(); - - expect(test.reload).toHaveBeenCalledTimes(1); - expect(test.initializeSavedVis).toHaveBeenCalledTimes(1); - expect(test.expressionRenderer).toHaveBeenCalledTimes(1); - - // Test with savedObjectId and searchSessionId change - act(() => { - test.embeddable.updateInput({ savedObjectId: '123', searchSessionId: '456' }); - }); - - // wait one tick to give embeddable time to initialize - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(test.reload).toHaveBeenCalledTimes(2); - expect(test.initializeSavedVis).toHaveBeenCalledTimes(2); - expect(test.expressionRenderer).toHaveBeenCalledTimes(2); - - test = await createEmbeddable(); - - expect(test.reload).toHaveBeenCalledTimes(1); - expect(test.initializeSavedVis).toHaveBeenCalledTimes(1); - expect(test.expressionRenderer).toHaveBeenCalledTimes(1); - - // Test with attributes and timeRange change - act(() => { - test.embeddable.updateInput({ - attributes: { foo: 'bar' } as unknown as LensSavedObjectAttributes, - timeRange: { from: 'now-30d', to: 'now' }, - }); - }); - - // wait one tick to give embeddable time to initialize - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(test.reload).toHaveBeenCalledTimes(2); - expect(test.initializeSavedVis).toHaveBeenCalledTimes(2); - expect(test.expressionRenderer).toHaveBeenCalledTimes(2); - }); - - it('should get full attributes', async () => { - const createEmbeddable = async () => { - const currentExpressionRenderer = jest.fn((_props) => null); - const timeRange: TimeRange = { from: 'now-15d', to: 'now' }; - const query: Query = { language: 'kquery', query: '' }; - const filters: Filter[] = [{ meta: { alias: 'test', negate: false, disabled: true } }]; - const embeddable = new Embeddable( - { - timefilter: dataPluginMock.createSetupContract().query.timefilter.timefilter, - attributeService, - data: dataMock, - uiSettings: { get: () => undefined } as unknown as IUiSettingsClient, - expressionRenderer: currentExpressionRenderer, - coreStart, - basePath, - inspector: inspectorPluginMock.createStartContract(), - dataViews: {} as DataViewsContract, - capabilities: { - canSaveDashboards: true, - canSaveVisualizations: true, - canOpenVisualizations: true, - discover: {}, - navLinks: {}, - }, - getTrigger, - visualizationMap: defaultVisualizationMap, - datasourceMap: defaultDatasourceMap, - injectFilterReferences: jest.fn(mockInjectFilterReferences), - documentToExpression: () => - Promise.resolve({ - ast: { - type: 'expression', - chain: [ - { type: 'function', function: 'my', arguments: {} }, - { type: 'function', function: 'expression', arguments: {} }, - ], - }, - indexPatterns: {}, - indexPatternRefs: [], - activeVisualizationState: null, - }), - }, - { id: '123', timeRange, query, filters } as LensEmbeddableInput - ); - const reload = jest.spyOn(embeddable, 'reload'); - const initializeSavedVis = jest.spyOn(embeddable, 'initializeSavedVis'); - - await embeddable.initializeSavedVis({ - id: '123', - timeRange, - query, - filters, - } as LensEmbeddableInput); - - embeddable.render(mountpoint); - - return { - embeddable, - reload, - initializeSavedVis, - expressionRenderer: currentExpressionRenderer, - }; - }; - - const test = await createEmbeddable(); - - expect(test.embeddable.getFullAttributes()).toEqual(savedVis); - }); - - it('should pass over the overrides as variables', async () => { - const embeddable = new Embeddable( - { - timefilter: dataPluginMock.createSetupContract().query.timefilter.timefilter, - attributeService, - data: dataMock, - expressionRenderer, - coreStart, - basePath, - dataViews: {} as DataViewsContract, - capabilities: { - canSaveDashboards: true, - canSaveVisualizations: true, - canOpenVisualizations: true, - discover: {}, - navLinks: {}, - }, - inspector: inspectorPluginMock.createStartContract(), - getTrigger, - visualizationMap: defaultVisualizationMap, - datasourceMap: defaultDatasourceMap, - injectFilterReferences: jest.fn(mockInjectFilterReferences), - documentToExpression: () => - Promise.resolve({ - ast: { - type: 'expression', - chain: [ - { type: 'function', function: 'my', arguments: {} }, - { type: 'function', function: 'expression', arguments: {} }, - ], - }, - indexPatterns: {}, - indexPatternRefs: [], - activeVisualizationState: null, - }), - uiSettings: { get: () => undefined } as unknown as IUiSettingsClient, - }, - { - timeRange: { - from: 'now-15m', - to: 'now', - }, - overrides: { - settings: { - onBrushEnd: 'ignore', - }, - }, - } as LensEmbeddableInput - ); - embeddable.render(mountpoint); - - // wait one tick to give embeddable time to initialize - await new Promise((resolve) => setTimeout(resolve, 0)); - - expect(expressionRenderer).toHaveBeenCalledTimes(1); - expect(expressionRenderer.mock.calls[0][0]!.variables).toEqual( - expect.objectContaining({ - overrides: { - settings: { - onBrushEnd: 'ignore', - }, - }, - }) - ); - }); - - it('should not be editable for no visualize library privileges', async () => { - const embeddable = new Embeddable( - getEmbeddableProps({ - capabilities: { - canSaveDashboards: false, - canSaveVisualizations: true, - canOpenVisualizations: false, - discover: {}, - navLinks: {}, - }, - }), - { - timeRange: { - from: 'now-15m', - to: 'now', - }, - } as LensEmbeddableInput - ); - expect(embeddable.getOutput().editable).toBeUndefined(); - }); -}); diff --git a/x-pack/plugins/lens/public/embeddable/embeddable.tsx b/x-pack/plugins/lens/public/embeddable/embeddable.tsx deleted file mode 100644 index ce86b896d5fa0..0000000000000 --- a/x-pack/plugins/lens/public/embeddable/embeddable.tsx +++ /dev/null @@ -1,1719 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { partition, uniqBy } from 'lodash'; -import React from 'react'; -import { BehaviorSubject, Observable } from 'rxjs'; -import { css } from '@emotion/react'; -import { i18n } from '@kbn/i18n'; -import { render, unmountComponentAtNode } from 'react-dom'; -import { ENABLE_ESQL } from '@kbn/esql-utils'; -import { reportPerformanceMetricEvent } from '@kbn/ebt-tools'; -import { - DataViewBase, - EsQueryConfig, - Filter, - Query, - AggregateQuery, - TimeRange, - isOfQueryType, - getAggregateQueryMode, - ExecutionContextSearch, - getLanguageDisplayName, - isOfAggregateQueryType, -} from '@kbn/es-query'; -import type { PaletteOutput } from '@kbn/coloring'; -import { - DataPublicPluginStart, - TimefilterContract, - FilterManager, - getEsQueryConfig, - mapAndFlattenFilters, -} from '@kbn/data-plugin/public'; -import type { Start as InspectorStart } from '@kbn/inspector-plugin/public'; - -import { merge, Subscription, switchMap } from 'rxjs'; -import { toExpression } from '@kbn/interpreter'; -import { - Datatable, - DefaultInspectorAdapters, - ErrorLike, - RenderMode, -} from '@kbn/expressions-plugin/common'; -import { map, distinctUntilChanged, skip, debounceTime } from 'rxjs'; -import fastIsEqual from 'fast-deep-equal'; -import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; -import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; -import { - ExpressionRendererEvent, - ReactExpressionRendererType, -} from '@kbn/expressions-plugin/public'; -import { VIS_EVENT_TO_TRIGGER } from '@kbn/visualizations-plugin/public'; - -import { - EmbeddableStateTransfer, - Embeddable as AbstractEmbeddable, - EmbeddableInput, - EmbeddableOutput, - IContainer, - SavedObjectEmbeddableInput, - ReferenceOrValueEmbeddable, - SelfStyledEmbeddable, - FilterableEmbeddable, - cellValueTrigger, - CELL_VALUE_TRIGGER, - type CellValueContext, - shouldFetch$, -} from '@kbn/embeddable-plugin/public'; -import type { Action, UiActionsStart } from '@kbn/ui-actions-plugin/public'; -import type { DataViewsContract, DataView } from '@kbn/data-views-plugin/public'; -import type { - Capabilities, - CoreStart, - IBasePath, - IUiSettingsClient, - KibanaExecutionContext, -} from '@kbn/core/public'; -import type { SpacesPluginStart } from '@kbn/spaces-plugin/public'; -import { - BrushTriggerEvent, - ClickTriggerEvent, - MultiClickTriggerEvent, -} from '@kbn/charts-plugin/public'; -import { DataViewSpec } from '@kbn/data-views-plugin/common'; -import { FormattedMessage } from '@kbn/i18n-react'; -import { useEuiFontSize, useEuiTheme, EuiEmptyPrompt } from '@elastic/eui'; -import { canTrackContentfulRender } from '@kbn/presentation-containers'; -import { getSuccessfulRequestTimings } from '../report_performance_metric_util'; -import { getExecutionContextEvents, trackUiCounterEvents } from '../lens_ui_telemetry'; -import { Document } from '../persistence'; -import { ExpressionWrapper, ExpressionWrapperProps } from './expression_wrapper'; -import { - isLensBrushEvent, - isLensFilterEvent, - isLensMultiFilterEvent, - isLensEditEvent, - isLensTableRowContextMenuClickEvent, - LensTableRowContextMenuEvent, - VisualizationMap, - Visualization, - DatasourceMap, - Datasource, - IndexPatternMap, - GetCompatibleCellValueActions, - UserMessage, - IndexPatternRef, - FramePublicAPI, - AddUserMessages, - UserMessagesGetter, - UserMessagesDisplayLocationId, -} from '../types'; - -import type { - AllowedChartOverrides, - AllowedPartitionOverrides, - AllowedSettingsOverrides, - AllowedGaugeOverrides, - AllowedXYOverrides, -} from '../../common/types'; -import { getEditPath, DOC_TYPE, APP_ID } from '../../common/constants'; -import { LensAttributeService } from '../lens_attribute_service'; -import type { TableInspectorAdapter } from '../editor_frame_service/types'; -import { getLensInspectorService, LensInspector } from '../lens_inspector_service'; -import { SharingSavedObjectProps, VisualizationDisplayOptions } from '../types'; -import { - getActiveDatasourceIdFromDoc, - getActiveVisualizationIdFromDoc, - getIndexPatternsObjects, - getSearchWarningMessages, - inferTimeField, - extractReferencesFromState, -} from '../utils'; -import { getLayerMetaInfo, combineQueryAndFilters } from '../app_plugin/show_underlying_data'; -import { - filterAndSortUserMessages, - getApplicationUserMessages, -} from '../app_plugin/get_application_user_messages'; -import { MessageList } from '../editor_frame_service/editor_frame/workspace_panel/message_list'; -import type { DocumentToExpressionReturnType } from '../editor_frame_service/editor_frame'; -import type { TypedLensByValueInput } from './embeddable_component'; -import type { LensPluginStartDependencies } from '../plugin'; -import { EmbeddableFeatureBadge } from './embeddable_info_badges'; -import { getDatasourceLayers } from '../state_management/utils'; -import type { EditLensConfigurationProps } from '../app_plugin/shared/edit_on_the_fly/get_edit_lens_configuration'; -import { TextBasedPersistedState } from '../datasources/text_based/types'; -import { getLongMessage } from '../user_messages_utils'; - -export type LensSavedObjectAttributes = Omit; - -export interface LensUnwrapMetaInfo { - sharingSavedObjectProps?: SharingSavedObjectProps; - managed?: boolean; -} - -export interface LensUnwrapResult { - attributes: LensSavedObjectAttributes; - metaInfo?: LensUnwrapMetaInfo; -} - -interface PreventableEvent { - preventDefault(): void; -} - -export type Simplify = { [KeyType in keyof T]: T[KeyType] } & {}; - -export interface LensBaseEmbeddableInput extends EmbeddableInput { - filters?: Filter[]; - query?: Query; - timeRange?: TimeRange; - timeslice?: [number, number]; - palette?: PaletteOutput; - renderMode?: RenderMode; - style?: React.CSSProperties; - className?: string; - noPadding?: boolean; - onBrushEnd?: (data: Simplify) => void; - onLoad?: ( - isLoading: boolean, - adapters?: Partial, - output$?: Observable - ) => void; - onFilter?: ( - data: Simplify<(ClickTriggerEvent['data'] | MultiClickTriggerEvent['data']) & PreventableEvent> - ) => void; - onTableRowClick?: ( - data: Simplify - ) => void; - abortController?: AbortController; - onBeforeBadgesRender?: (userMessages: UserMessage[]) => UserMessage[]; -} - -export type LensByValueInput = { - attributes: LensSavedObjectAttributes; - /** - * Overrides can tweak the style of the final embeddable and are executed at the end of the Lens rendering pipeline. - * Each visualization type offers various type of overrides, per component (i.e. 'setting', 'axisX', 'partition', etc...) - * - * While it is not possible to pass function/callback/handlers to the renderer, it is possible to overwrite - * the current behaviour by passing the "ignore" string to the override prop (i.e. onBrushEnd: "ignore" to stop brushing) - */ - overrides?: - | AllowedChartOverrides - | AllowedSettingsOverrides - | AllowedXYOverrides - | AllowedPartitionOverrides - | AllowedGaugeOverrides; -} & LensBaseEmbeddableInput; - -export type LensByReferenceInput = SavedObjectEmbeddableInput & LensBaseEmbeddableInput; -export type LensEmbeddableInput = LensByValueInput | LensByReferenceInput; - -export interface LensEmbeddableOutput extends EmbeddableOutput { - indexPatterns?: DataView[]; -} - -export interface LensEmbeddableDeps { - attributeService: LensAttributeService; - data: DataPublicPluginStart; - documentToExpression: (doc: Document) => Promise; - injectFilterReferences: FilterManager['inject']; - visualizationMap: VisualizationMap; - datasourceMap: DatasourceMap; - dataViews: DataViewsContract; - expressionRenderer: ReactExpressionRendererType; - timefilter: TimefilterContract; - basePath: IBasePath; - inspector: InspectorStart; - getTrigger?: UiActionsStart['getTrigger'] | undefined; - getTriggerCompatibleActions?: UiActionsStart['getTriggerCompatibleActions']; - capabilities: { - canSaveVisualizations: boolean; - canOpenVisualizations: boolean; - canSaveDashboards: boolean; - navLinks: Capabilities['navLinks']; - discover: Capabilities['discover']; - }; - coreStart: CoreStart; - usageCollection?: UsageCollectionSetup; - spaces?: SpacesPluginStart; - uiSettings: IUiSettingsClient; -} - -export interface ViewUnderlyingDataArgs { - dataViewSpec: DataViewSpec; - timeRange: TimeRange; - filters: Filter[]; - query: Query | AggregateQuery | undefined; - columns: string[]; -} - -function VisualizationErrorPanel({ errors, canEdit }: { errors: UserMessage[]; canEdit: boolean }) { - const firstError = errors.at(0); - const canFixInLens = canEdit && errors.some(({ fixableInEditor }) => fixableInEditor); - return ( -
- - {firstError ? ( - <> -

{getLongMessage(firstError)}

- {errors.length > 1 && !canFixInLens ? ( -

- -

- ) : null} - {canFixInLens ? ( -

- -

- ) : null} - - ) : ( -

- -

- )} - - } - /> -
- ); -} - -const getExpressionFromDocument = async ( - document: Document, - documentToExpression: LensEmbeddableDeps['documentToExpression'] -) => { - const { ast, indexPatterns, indexPatternRefs, activeVisualizationState } = - await documentToExpression(document); - return { - ast: ast ? toExpression(ast) : null, - indexPatterns, - indexPatternRefs, - activeVisualizationState, - }; -}; - -function getViewUnderlyingDataArgs({ - activeDatasource, - activeDatasourceState, - activeVisualization, - activeVisualizationState, - activeData, - dataViews, - capabilities, - query, - filters, - timeRange, - esQueryConfig, - indexPatternsCache, -}: { - activeDatasource: Datasource; - activeDatasourceState: unknown; - activeVisualization: Visualization; - activeVisualizationState: unknown; - activeData: TableInspectorAdapter | undefined; - dataViews: DataViewBase[] | undefined; - capabilities: LensEmbeddableDeps['capabilities']; - query: ExecutionContextSearch['query']; - filters: Filter[]; - timeRange: TimeRange; - esQueryConfig: EsQueryConfig; - indexPatternsCache: IndexPatternMap; -}) { - const { error, meta } = getLayerMetaInfo( - activeDatasource, - activeDatasourceState, - activeVisualization, - activeVisualizationState, - activeData, - indexPatternsCache, - timeRange, - capabilities - ); - - if (error || !meta) { - return; - } - const luceneOrKuery: Query[] = []; - const aggregateQuery: AggregateQuery[] = []; - - if (Array.isArray(query)) { - query.forEach((q) => { - if (isOfQueryType(q)) { - luceneOrKuery.push(q); - } else { - aggregateQuery.push(q); - } - }); - } - - const { filters: newFilters, query: newQuery } = combineQueryAndFilters( - luceneOrKuery.length > 0 ? luceneOrKuery : (query as Query), - filters, - meta, - dataViews, - esQueryConfig - ); - - const dataViewSpec = indexPatternsCache[meta.id]!.spec; - - return { - dataViewSpec, - timeRange, - filters: newFilters, - query: aggregateQuery.length > 0 ? aggregateQuery[0] : newQuery, - columns: meta.columns, - }; -} - -const EmbeddableMessagesPopover = ({ messages }: { messages: UserMessage[] }) => { - const { euiTheme } = useEuiTheme(); - const xsFontSize = useEuiFontSize('xs').fontSize; - - if (!messages.length) { - return null; - } - - return ( - * { - gap: ${euiTheme.size.xs}; - } - `} - /> - ); -}; - -const blockingMessageDisplayLocations: UserMessagesDisplayLocationId[] = [ - 'visualization', - 'visualizationOnEmbeddable', -]; - -const MessagesBadge = ({ onMount }: { onMount: (el: HTMLDivElement) => void }) => ( -
{ - if (el) { - onMount(el); - } - }} - /> -); - -export class Embeddable - extends AbstractEmbeddable - implements - ReferenceOrValueEmbeddable, - SelfStyledEmbeddable, - FilterableEmbeddable -{ - type = DOC_TYPE; - - deferEmbeddableLoad = true; - - private expressionRenderer: ReactExpressionRendererType; - private savedVis: Document | undefined; - private expression: string | undefined | null; - private domNode: HTMLElement | Element | undefined; - private isInitialized = false; - private inputReloadSubscriptions: Subscription[]; - private isDestroyed?: boolean; - private lensInspector: LensInspector; - - private logError(type: 'runtime' | 'validation') { - trackUiCounterEvents( - type === 'runtime' ? 'embeddable_runtime_error' : 'embeddable_validation_error', - this.getExecutionContext() - ); - } - - private activeData?: TableInspectorAdapter; - - private internalDataViews: DataView[] = []; - - private viewUnderlyingDataArgs?: ViewUnderlyingDataArgs; - - private activeVisualizationState?: unknown; - - constructor( - private deps: LensEmbeddableDeps, - initialInput: LensEmbeddableInput, - parent?: IContainer - ) { - super( - initialInput, - { - editApp: 'lens', - }, - parent - ); - - this.lensInspector = getLensInspectorService(deps.inspector); - this.expressionRenderer = deps.expressionRenderer; - this.initializeSavedVis(initialInput) - .then(() => { - this.reload(); - }) - .catch((e) => this.onFatalError(e)); - - const input$ = this.getInput$(); - - this.inputReloadSubscriptions = []; - - // Lens embeddable does not re-render when embeddable input changes in - // general, to improve performance. This line makes sure the Lens embeddable - // re-renders when anything in ".dynamicActions" (e.g. drilldowns) changes. - this.inputReloadSubscriptions.push( - input$ - .pipe( - map((input) => input.enhancements?.dynamicActions), - distinctUntilChanged((a, b) => fastIsEqual(a, b)), - skip(1) - ) - .subscribe((_input) => { - this.reload(); - }) - ); - - // Lens embeddable does not re-render when embeddable input changes in - // general, to improve performance. This line makes sure the Lens embeddable - // re-renders when dashboard view mode switches between "view/edit". This is - // needed to see the changes to ".dynamicActions" (e.g. drilldowns) when - // dashboard's mode is toggled. - this.inputReloadSubscriptions.push( - input$ - .pipe( - map((input) => input.viewMode), - distinctUntilChanged(), - skip(1) - ) - .subscribe((_input) => { - // only reload if drilldowns are set - if (this.getInput().enhancements?.dynamicActions) { - this.reload(); - } - }) - ); - - // Use a trigger to distinguish between observables in the subscription - const withTrigger = (trigger: 'attributesOrSavedObjectId' | 'searchContext') => - map((input: LensEmbeddableInput) => ({ trigger, input })); - - // Re-initialize the visualization if either the attributes or the saved object id changes - const attributesOrSavedObjectId$ = input$.pipe( - distinctUntilChanged((a, b) => - fastIsEqual( - [ - 'attributes' in a && a.attributes, - 'savedObjectId' in a && a.savedObjectId, - 'overrides' in a && a.overrides, - 'disableTriggers' in a && a.disableTriggers, - ], - [ - 'attributes' in b && b.attributes, - 'savedObjectId' in b && b.savedObjectId, - 'overrides' in b && b.overrides, - 'disableTriggers' in b && b.disableTriggers, - ] - ) - ), - skip(1), - withTrigger('attributesOrSavedObjectId') - ); - - // Update search context and reload on changes related to search - const searchContext$ = shouldFetch$(input$, () => this.getInput()).pipe( - withTrigger('searchContext') - ); - - // Merge and debounce the observables to avoid multiple reloads - this.inputReloadSubscriptions.push( - merge(searchContext$, attributesOrSavedObjectId$) - .pipe( - debounceTime(0), - switchMap(async ({ trigger, input }) => { - if (trigger === 'attributesOrSavedObjectId') { - await this.initializeSavedVis(input); - } - - // reset removable messages - // Dashboard search/context changes are detected here - this.additionalUserMessages = {}; - - this.reload(); - }) - ) - .subscribe() - ); - } - - private get activeDatasourceId() { - return getActiveDatasourceIdFromDoc(this.savedVis); - } - - private get activeDatasource() { - if (!this.activeDatasourceId) return; - return this.deps.datasourceMap[this.activeDatasourceId]; - } - - private get activeVisualizationId() { - return getActiveVisualizationIdFromDoc(this.savedVis); - } - - private get activeVisualization() { - if (!this.activeVisualizationId) return; - return this.deps.visualizationMap[this.activeVisualizationId]; - } - - private indexPatterns: IndexPatternMap = {}; - - private indexPatternRefs: IndexPatternRef[] = []; - - // TODO - consider getting this from the persistedStateToExpression function - // where it is already computed - private get activeDatasourceState(): undefined | unknown { - if (!this.activeDatasourceId || !this.activeDatasource) return; - - const docDatasourceState = this.savedVis?.state.datasourceStates[this.activeDatasourceId]; - - return this.activeDatasource.initialize( - docDatasourceState, - [...(this.savedVis?.references || []), ...(this.savedVis?.state.internalReferences || [])], - undefined, - undefined, - this.indexPatterns - ); - } - - private fullAttributes: LensSavedObjectAttributes | undefined; - - private handleExternalUserMessage = (messages: UserMessage[]) => { - if (this.input.onBeforeBadgesRender) { - // we need something else to better identify those errors - const [messagesToHandle, originalMessages] = partition(messages, (message) => - message.displayLocations.some((location) => location.id === 'embeddableBadge') - ); - - if (messagesToHandle.length > 0) { - const customBadgeMessages = this.input.onBeforeBadgesRender(messagesToHandle); - return [...originalMessages, ...customBadgeMessages]; - } - } - - return messages; - }; - - public getUserMessages: UserMessagesGetter = (locationId, filters) => { - const userMessages: UserMessage[] = []; - userMessages.push( - ...getApplicationUserMessages({ - visualizationType: this.savedVis?.visualizationType, - visualizationState: { - state: this.activeVisualizationState, - activeId: this.activeVisualizationId, - }, - visualization: - this.activeVisualizationId && this.deps.visualizationMap[this.activeVisualizationId] - ? this.deps.visualizationMap[this.activeVisualizationId] - : undefined, - activeDatasource: this.activeDatasource, - activeDatasourceState: { - isLoading: !this.activeDatasourceState, - state: this.activeDatasourceState, - }, - dataViews: { - indexPatterns: this.indexPatterns, - indexPatternRefs: this.indexPatternRefs, // TODO - are these actually used? - }, - core: this.deps.coreStart, - }) - ); - - if (!this.savedVis) { - return this.handleExternalUserMessage(userMessages); - } - - const mergedSearchContext = this.getMergedSearchContext(); - - const framePublicAPI: FramePublicAPI = { - dataViews: { - indexPatterns: this.indexPatterns, - indexPatternRefs: this.indexPatternRefs, - }, - datasourceLayers: getDatasourceLayers( - { - [this.activeDatasourceId!]: { - isLoading: !this.activeDatasourceState, - state: this.activeDatasourceState, - }, - }, - this.deps.datasourceMap, - this.indexPatterns - ), - query: this.savedVis.state.query, - filters: mergedSearchContext.filters ?? [], - dateRange: { - fromDate: mergedSearchContext.timeRange?.from ?? '', - toDate: mergedSearchContext.timeRange?.to ?? '', - }, - absDateRange: { - fromDate: mergedSearchContext.timeRange?.from ?? '', - toDate: mergedSearchContext.timeRange?.to ?? '', - }, - activeData: this.activeData, - }; - - userMessages.push( - ...(this.activeDatasource?.getUserMessages(this.activeDatasourceState, { - setState: () => {}, - frame: framePublicAPI, - visualizationInfo: this.activeVisualization?.getVisualizationInfo?.( - this.activeVisualizationState, - framePublicAPI - ), - }) ?? []), - ...(this.activeVisualization?.getUserMessages?.(this.activeVisualizationState, { - frame: framePublicAPI, - }) ?? []) - ); - - return this.handleExternalUserMessage( - filterAndSortUserMessages( - [...userMessages, ...Object.values(this.additionalUserMessages)], - locationId, - filters ?? {} - ) - ); - }; - - private additionalUserMessages: Record = {}; - - // used to add warnings and errors from elsewhere in the embeddable - private addUserMessages: AddUserMessages = (messages) => { - const newMessageMap = { - ...this.additionalUserMessages, - }; - - const addedMessageIds: string[] = []; - messages.forEach((message) => { - if (!newMessageMap[message.uniqueId]) { - addedMessageIds.push(message.uniqueId); - newMessageMap[message.uniqueId] = message; - } - }); - - if (addedMessageIds.length) { - this.additionalUserMessages = newMessageMap; - this.renderUserMessages(); - } - - return () => { - messages.forEach(({ uniqueId }) => { - delete this.additionalUserMessages[uniqueId]; - }); - }; - }; - - public reportsEmbeddableLoad() { - return true; - } - - public supportedTriggers() { - if (!this.savedVis || !this.savedVis.visualizationType) { - return []; - } - - return this.deps.visualizationMap[this.savedVis.visualizationType]?.triggers || []; - } - - public getInspectorAdapters() { - return this.lensInspector.adapters; - } - - public getFullAttributes() { - return this.fullAttributes; - } - - public isTextBasedLanguage() { - if (!this.savedVis) { - return; - } - const query = this.savedVis.state.query; - return !isOfQueryType(query); - } - - public getTextBasedLanguage(): string | undefined { - if (!this.isTextBasedLanguage() || !this.savedVis?.state.query) { - return; - } - const query = this.savedVis?.state.query as unknown as AggregateQuery; - const language = getAggregateQueryMode(query); - return getLanguageDisplayName(language).toUpperCase(); - } - - /** - * Gets the Lens embeddable's datasource and visualization states - * updates the embeddable input - */ - async updateVisualization( - datasourceState: unknown, - visualizationState: unknown, - visualizationType?: string - ) { - const viz = this.savedVis; - const activeDatasourceId = (this.activeDatasourceId ?? - 'formBased') as EditLensConfigurationProps['datasourceId']; - if (viz?.state) { - const datasourceStates = { - ...viz.state.datasourceStates, - [activeDatasourceId]: datasourceState, - }; - const references = - activeDatasourceId === 'formBased' - ? extractReferencesFromState({ - activeDatasources: Object.keys(datasourceStates).reduce( - (acc, datasourceId) => ({ - ...acc, - [datasourceId]: this.deps.datasourceMap[datasourceId], - }), - {} - ), - datasourceStates: Object.fromEntries( - Object.entries(datasourceStates).map(([id, state]) => [ - id, - { isLoading: false, state }, - ]) - ), - visualizationState, - activeVisualization: this.activeVisualizationId - ? this.deps.visualizationMap[visualizationType ?? this.activeVisualizationId] - : undefined, - }) - : []; - const attrs = { - ...viz, - state: { - ...viz.state, - visualization: visualizationState, - datasourceStates, - }, - references, - visualizationType: visualizationType ?? viz.visualizationType, - }; - - /** - * SavedObjectId is undefined for by value panels and defined for the by reference ones. - * Here we are converting the by reference panels to by value when user is inline editing - */ - this.updateInput({ attributes: attrs, savedObjectId: undefined }); - /** - * Should load again the user messages, - * otherwise the embeddable state is stuck in an error state - */ - this.renderUserMessages(); - } - } - - async updateSuggestion(attrs: LensSavedObjectAttributes) { - const viz = this.savedVis; - const newViz = { - ...viz, - ...attrs, - }; - this.updateInput({ attributes: newViz }); - } - - /** - * Callback which allows the navigation to the editor. - * Used for the Edit in Lens link inside the inline editing flyout. - */ - private async navigateToLensEditor() { - const appContext = this.getAppContext(); - /** - * The origininating app variable is very important for the Save and Return button - * of the editor to work properly. - */ - const transferState = { - originatingApp: appContext?.currentAppId ?? 'dashboards', - originatingPath: appContext?.getCurrentPath?.(), - valueInput: this.getExplicitInput(), - embeddableId: this.id, - searchSessionId: this.getInput().searchSessionId, - }; - const transfer = new EmbeddableStateTransfer( - this.deps.coreStart.application.navigateToApp, - this.deps.coreStart.application.currentAppId$ - ); - if (transfer) { - await transfer.navigateToEditor(APP_ID, { - path: this.output.editPath, - state: transferState, - skipAppLeave: true, - }); - } - } - - public updateByRefInput(savedObjectId: string) { - const attrs = this.savedVis; - this.updateInput({ attributes: attrs, savedObjectId }); - } - - async openConfigPanel( - startDependencies: LensPluginStartDependencies, - isNewPanel?: boolean, - deletePanel?: () => void - ) { - const { getEditLensConfiguration } = await import('../async_services'); - const Component = await getEditLensConfiguration( - this.deps.coreStart, - startDependencies, - this.deps.visualizationMap, - this.deps.datasourceMap - ); - - const datasourceId = (this.activeDatasourceId ?? - 'formBased') as EditLensConfigurationProps['datasourceId']; - - const attributes = this.savedVis as TypedLensByValueInput['attributes']; - if (attributes) { - return ( - - ); - } - return null; - } - - async initializeSavedVis(input: LensEmbeddableInput) { - const unwrapResult: LensUnwrapResult | false = await this.deps.attributeService - .unwrapAttributes(input) - .catch((e: Error) => { - this.onFatalError(e); - return false; - }); - if (!unwrapResult || this.isDestroyed) { - return; - } - - const { metaInfo, attributes } = unwrapResult; - this.fullAttributes = attributes; - this.savedVis = { - ...attributes, - type: this.type, - savedObjectId: (input as LensByReferenceInput)?.savedObjectId, - }; - - if (this.isTextBasedLanguage()) { - this.updateInput({ - disabledActions: ['OPEN_FLYOUT_ADD_DRILLDOWN'], - }); - } - - try { - const { ast, indexPatterns, indexPatternRefs, activeVisualizationState } = - await getExpressionFromDocument(this.savedVis, this.deps.documentToExpression); - - this.expression = ast; - this.indexPatterns = indexPatterns; - this.indexPatternRefs = indexPatternRefs; - this.activeVisualizationState = activeVisualizationState; - } catch { - // nothing, errors should be reported via getUserMessages - } - - if (metaInfo?.sharingSavedObjectProps?.outcome === 'conflict' && !!this.deps.spaces) { - this.addUserMessages([ - { - uniqueId: 'url-conflict', - severity: 'error', - displayLocations: [{ id: 'visualization' }], - shortMessage: i18n.translate('xpack.lens.embeddable.legacyURLConflict.shortMessage', { - defaultMessage: `You've encountered a URL conflict`, - }), - longMessage: ( - - ), - fixableInEditor: false, - }, - ]); - } - - await this.initializeOutput(); - - // deferred loading of this embeddable is complete - this.setInitializationFinished(); - - this.isInitialized = true; - } - - private getSearchWarningMessages(adapters?: Partial): UserMessage[] { - if (!this.activeDatasource || !this.activeDatasourceId || !adapters?.requests) { - return []; - } - - const docDatasourceState = this.savedVis?.state.datasourceStates[this.activeDatasourceId]; - - const requestWarnings = getSearchWarningMessages( - adapters.requests, - this.activeDatasource, - docDatasourceState, - { - searchService: this.deps.data.search, - } - ); - - return requestWarnings; - } - - private removeActiveDataWarningMessages: () => void = () => {}; - private updateActiveData: ExpressionWrapperProps['onData$'] = (data, adapters) => { - if (this.input.onLoad) { - // once onData$ is get's called from expression renderer, loading becomes false - this.input.onLoad(false, adapters, this.getOutput$()); - } - - const { type, error } = data as { type: string; error: ErrorLike }; - this.updateOutput({ - loading: false, - error: type === 'error' ? error : undefined, - }); - - const newActiveData = adapters?.tables?.tables; - - this.removeActiveDataWarningMessages(); - const searchWarningMessages = this.getSearchWarningMessages(adapters); - this.removeActiveDataWarningMessages = this.addUserMessages(searchWarningMessages); - - this.activeData = newActiveData; - - this.renderUserMessages(); - - this.loadViewUnderlyingDataArgs(); - }; - - private onRender: ExpressionWrapperProps['onRender$'] = () => { - let datasourceEvents: string[] = []; - let visualizationEvents: string[] = []; - - if (this.savedVis) { - datasourceEvents = Object.values(this.deps.datasourceMap).reduce( - (acc, datasource) => [ - ...acc, - ...(datasource.getRenderEventCounters?.( - this.savedVis!.state.datasourceStates[datasource.id] - ) ?? []), - ], - [] - ); - - if (this.savedVis.visualizationType) { - visualizationEvents = - this.deps.visualizationMap[this.savedVis.visualizationType].getRenderEventCounters?.( - this.savedVis!.state.visualization - ) ?? []; - } - } - - const executionContext = this.getExecutionContext(); - - const events = [ - ...datasourceEvents, - ...visualizationEvents, - ...getExecutionContextEvents(executionContext), - ]; - - const adHocDataViews = Object.values(this.savedVis?.state.adHocDataViews || {}); - adHocDataViews.forEach(() => { - events.push('ad_hoc_data_view'); - }); - - trackUiCounterEvents(events, executionContext); - this.trackContentfulRender(); - - this.renderComplete.dispatchComplete(); - this.updateOutput({ - ...this.getOutput(), - rendered: true, - }); - - const inspectorAdapters = this.getInspectorAdapters(); - const timings = getSuccessfulRequestTimings(inspectorAdapters); - if (timings) { - const esRequestMetrics = { - eventName: 'lens_chart_es_request_totals', - duration: timings.requestTimeTotal, - key1: 'es_took_total', - value1: timings.esTookTotal, - }; - reportPerformanceMetricEvent(this.deps.coreStart.analytics, esRequestMetrics); - } - }; - - getExecutionContext() { - if (this.savedVis) { - const parentContext = this.parent?.getInput().executionContext || this.input.executionContext; - const child: KibanaExecutionContext = { - type: 'lens', - name: this.savedVis.visualizationType ?? '', - id: this.id, - description: this.savedVis.title || this.input.title || '', - url: this.output.editUrl, - }; - - return parentContext - ? { - ...parentContext, - child, - } - : child; - } - } - - /** - * - * @param {HTMLElement} domNode - * @param {ContainerState} containerState - */ - render(domNode: HTMLElement | Element) { - this.domNode = domNode; - if (!this.savedVis || !this.isInitialized || this.isDestroyed) { - return; - } - super.render(domNode as HTMLElement); - - if (this.input.onLoad) { - this.input.onLoad(true); - } - - this.domNode.setAttribute('data-shared-item', ''); - - const blockingErrors = this.getUserMessages(blockingMessageDisplayLocations, { - severity: 'error', - }); - - this.updateOutput({ - loading: true, - error: blockingErrors.length - ? new Error( - typeof blockingErrors[0].longMessage === 'string' - ? blockingErrors[0].longMessage - : blockingErrors[0].shortMessage - ) - : undefined, - }); - - if (blockingErrors.length) { - this.renderComplete.dispatchError(); - } else { - this.renderComplete.dispatchInProgress(); - } - - const input = this.getInput(); - - const getInternalTables = (states: Record) => { - const result: Record = {}; - if ('textBased' in states) { - const layers = (states.textBased as TextBasedPersistedState).layers; - for (const layer in layers) { - if (layers[layer] && layers[layer].table) { - result[layer] = layers[layer].table!; - } - } - } - return result; - }; - - if (this.expression && !blockingErrors.length) { - render( - <> - - this.addUserMessages(messages)} - onRuntimeError={(error) => { - this.updateOutput({ error }); - this.logError('runtime'); - }} - noPadding={this.visDisplayOptions.noPadding} - /> - - { - this.badgeDomNode = el; - this.renderBadgeMessages(); - }} - /> - , - domNode - ); - } - - this.renderUserMessages(); - } - - private trackContentfulRender() { - if (!this.activeData || !canTrackContentfulRender(this.parent)) { - return; - } - - const hasData = Object.values(this.activeData).some((table) => { - if (table.meta?.statistics?.totalCount != null) { - // if totalCount is set, refer to total count - return table.meta.statistics.totalCount > 0; - } - // if not, fall back to check the rows of the table - return table.rows.length > 0; - }); - - if (hasData) { - this.parent.trackContentfulRender(); - } - } - - private renderUserMessages() { - const errors = this.getUserMessages(['visualization', 'visualizationOnEmbeddable'], { - severity: 'error', - }); - - if (errors.length && this.domNode) { - render( - <> - - - - { - this.badgeDomNode = el; - this.renderBadgeMessages(); - }} - /> - , - this.domNode - ); - } - - this.renderBadgeMessages(); - } - - badgeDomNode?: HTMLDivElement; - - /** - * This method is called on every render, and also whenever the badges dom node is created - * That happens after either the expression renderer or the visualization error panel is rendered. - * - * You should not call this method on its own. Use renderUserMessages instead. - */ - private renderBadgeMessages = () => { - const messages = this.getUserMessages('embeddableBadge'); - const [warningOrErrorMessages, infoMessages] = partition( - messages, - ({ severity }) => severity !== 'info' - ); - - if (this.badgeDomNode) { - render( - - - - , - this.badgeDomNode - ); - } - }; - - private readonly hasCompatibleActions = async ( - event: ExpressionRendererEvent - ): Promise => { - if ( - isLensTableRowContextMenuClickEvent(event) || - isLensMultiFilterEvent(event) || - isLensFilterEvent(event) - ) { - const { getTriggerCompatibleActions } = this.deps; - if (!getTriggerCompatibleActions) { - return false; - } - const actions = await getTriggerCompatibleActions(VIS_EVENT_TO_TRIGGER[event.name], { - data: event.data, - embeddable: this, - }); - - return actions.length > 0; - } - - return false; - }; - - private readonly getCompatibleCellValueActions: GetCompatibleCellValueActions = async (data) => { - const { getTriggerCompatibleActions } = this.deps; - if (getTriggerCompatibleActions) { - const embeddable = this; - const actions: Array> = (await getTriggerCompatibleActions( - CELL_VALUE_TRIGGER, - { data, embeddable } - )) as Array>; - return actions - .sort((a, b) => (a.order ?? Infinity) - (b.order ?? Infinity)) - .map((action) => ({ - id: action.id, - type: action.type, - iconType: action.getIconType({ embeddable, data, trigger: cellValueTrigger })!, - displayName: action.getDisplayName({ embeddable, data, trigger: cellValueTrigger }), - execute: (cellData) => - action.execute({ embeddable, data: cellData, trigger: cellValueTrigger }), - })); - } - return []; - }; - - /** - * Combines the embeddable context with the saved object context, and replaces - * any references to index patterns - */ - private getMergedSearchContext(): ExecutionContextSearch { - if (!this.savedVis) { - throw new Error('savedVis is required for getMergedSearchContext'); - } - - const input = this.getInput(); - const context: ExecutionContextSearch = { - now: this.deps.data.nowProvider.get().getTime(), - timeRange: - input.timeslice !== undefined - ? { - from: new Date(input.timeslice[0]).toISOString(), - to: new Date(input.timeslice[1]).toISOString(), - mode: 'absolute' as 'absolute', - } - : input.timeRange, - query: [this.savedVis.state.query], - filters: this.deps.injectFilterReferences( - this.savedVis.state.filters, - this.savedVis.references - ), - disableWarningToasts: true, - }; - - if (input.query) { - context.query = [input.query, ...(context.query as Query[])]; - } - - if (input.filters?.length) { - context.filters = [ - ...input.filters.filter((filter) => !filter.meta.disabled), - ...(context.filters as Filter[]), - ]; - } - - return context; - } - - private get onEditAction(): Visualization['onEditAction'] { - const visType = this.savedVis?.visualizationType; - - if (!visType) { - return; - } - - return this.deps.visualizationMap[visType].onEditAction; - } - - handleEvent = async (event: ExpressionRendererEvent) => { - if (!this.deps.getTrigger || this.input.disableTriggers) { - return; - } - - let eventHandler: - | LensBaseEmbeddableInput['onBrushEnd'] - | LensBaseEmbeddableInput['onFilter'] - | LensBaseEmbeddableInput['onTableRowClick']; - let shouldExecuteDefaultTriggers = true; - - if (isLensBrushEvent(event)) { - eventHandler = this.input.onBrushEnd; - } else if (isLensFilterEvent(event) || isLensMultiFilterEvent(event)) { - eventHandler = this.input.onFilter; - } else if (isLensTableRowContextMenuClickEvent(event)) { - eventHandler = this.input.onTableRowClick; - } - // if the embeddable is located in an app where there is the Unified search bar with the ES|QL editor, then use this query - // otherwise use the query from the saved object - let esqlQuery: AggregateQuery | Query | undefined; - if (this.isTextBasedLanguage()) { - const query = this.deps.data.query.queryString.getQuery(); - esqlQuery = isOfAggregateQueryType(query) ? query : this.savedVis?.state.query; - } - - eventHandler?.({ - ...event.data, - preventDefault: () => { - shouldExecuteDefaultTriggers = false; - }, - }); - - if (isLensFilterEvent(event) || isLensMultiFilterEvent(event) || isLensBrushEvent(event)) { - if (shouldExecuteDefaultTriggers) { - this.deps.getTrigger(VIS_EVENT_TO_TRIGGER[event.name]).exec({ - data: { - ...event.data, - timeFieldName: - event.data.timeFieldName || inferTimeField(this.deps.data.datatableUtilities, event), - query: esqlQuery, - }, - embeddable: this, - }); - } - } - - if (isLensTableRowContextMenuClickEvent(event)) { - if (shouldExecuteDefaultTriggers) { - this.deps.getTrigger(VIS_EVENT_TO_TRIGGER[event.name]).exec( - { - data: event.data, - embeddable: this, - }, - true - ); - } - } - - // We allow for edit actions in the Embeddable for display purposes only (e.g. changing the datatable sort order). - // No state changes made here with an edit action are persisted. - if (isLensEditEvent(event) && this.onEditAction) { - if (!this.savedVis) return; - - // have to dance since this.savedVis.state is readonly - const newVis = JSON.parse(JSON.stringify(this.savedVis)) as Document; - newVis.state.visualization = this.onEditAction(newVis.state.visualization, event); - this.savedVis = newVis; - - const { ast } = await getExpressionFromDocument( - this.savedVis, - this.deps.documentToExpression - ); - - this.expression = ast; - - this.reload(); - } - }; - - reload() { - if (!this.savedVis || !this.isInitialized || this.isDestroyed) { - return; - } - - if (this.domNode) { - this.render(this.domNode); - } - } - - private async loadViewUnderlyingDataArgs(): Promise { - if ( - !this.savedVis || - !this.activeData || - !this.activeDatasource || - !this.activeDatasourceState || - !this.activeVisualization || - !this.activeVisualizationState - ) { - this.canViewUnderlyingData$.next(false); - return; - } - - const mergedSearchContext = this.getMergedSearchContext(); - - if (!mergedSearchContext.timeRange) { - this.canViewUnderlyingData$.next(false); - return; - } - - const viewUnderlyingDataArgs = getViewUnderlyingDataArgs({ - activeDatasource: this.activeDatasource, - activeDatasourceState: this.activeDatasourceState, - activeVisualization: this.activeVisualization, - activeVisualizationState: this.activeVisualizationState, - activeData: this.activeData, - dataViews: this.internalDataViews, - capabilities: this.deps.capabilities, - query: mergedSearchContext.query, - filters: mergedSearchContext.filters || [], - timeRange: mergedSearchContext.timeRange, - esQueryConfig: getEsQueryConfig(this.deps.uiSettings), - indexPatternsCache: this.indexPatterns, - }); - - const loaded = typeof viewUnderlyingDataArgs !== 'undefined'; - if (loaded) { - this.viewUnderlyingDataArgs = viewUnderlyingDataArgs; - } - - this.canViewUnderlyingData$.next(loaded); - } - - /** - * Returns the necessary arguments to view the underlying data in discover. - * - * Only makes sense to call this after canViewUnderlyingData has been checked - */ - public getViewUnderlyingDataArgs() { - return this.viewUnderlyingDataArgs; - } - - public canViewUnderlyingData$ = new BehaviorSubject(false); - - async initializeOutput() { - if (!this.savedVis) { - return; - } - - const { indexPatterns } = await getIndexPatternsObjects( - this.savedVis?.references.map(({ id }) => id) || [], - this.deps.dataViews - ); - ( - await Promise.all( - Object.values(this.savedVis?.state.adHocDataViews || {}).map((spec) => - this.deps.dataViews.create(spec) - ) - ) - ).forEach((dataView) => indexPatterns.push(dataView)); - - this.internalDataViews = uniqBy(indexPatterns, 'id'); - - // passing edit url and index patterns to the output of this embeddable for - // the container to pick them up and use them to configure filter bar and - // config dropdown correctly. - const input = this.getInput(); - - // if at least one indexPattern is time based, then the Lens embeddable requires the timeRange prop - // this is necessary for the dataview embeddable but not the ES|QL one - if ( - !Boolean(this.isTextBasedLanguage()) && - input.timeRange == null && - indexPatterns.some((indexPattern) => indexPattern.isTimeBased()) - ) { - this.addUserMessages([ - { - uniqueId: 'missing-time-range-on-embeddable', - severity: 'error', - fixableInEditor: false, - displayLocations: [{ id: 'visualization' }], - shortMessage: i18n.translate('xpack.lens.embeddable.missingTimeRangeParam.shortMessage', { - defaultMessage: `Missing timeRange property`, - }), - longMessage: i18n.translate('xpack.lens.embeddable.missingTimeRangeParam.longMessage', { - defaultMessage: `The timeRange property is required for the given configuration`, - }), - }, - ]); - } - - const blockingErrors = this.getUserMessages(blockingMessageDisplayLocations, { - severity: 'error', - }); - if (blockingErrors.length) { - this.logError('validation'); - } - - const title = input.hidePanelTitles ? '' : input.title ?? this.savedVis.title; - const description = input.hidePanelTitles ? '' : input.description ?? this.savedVis.description; - const savedObjectId = (input as LensByReferenceInput).savedObjectId; - this.updateOutput({ - defaultTitle: this.savedVis.title, - defaultDescription: this.savedVis.description, - /** lens visualizations allow inline editing action - * navigation to the editor is allowed through the flyout - */ - editable: this.getIsEditable(), - inlineEditable: true, - title, - description, - editPath: getEditPath(savedObjectId), - editUrl: this.deps.basePath.prepend(`/app/lens${getEditPath(savedObjectId)}`), - indexPatterns: this.internalDataViews, - }); - } - - public getIsEditable() { - // for ES|QL, editing is allowed only if the advanced setting is on - if (Boolean(this.isTextBasedLanguage()) && !this.deps.uiSettings.get(ENABLE_ESQL)) { - return false; - } - return ( - this.deps.capabilities.canSaveVisualizations || - (!this.inputIsRefType(this.getInput()) && - this.deps.capabilities.canSaveDashboards && - this.deps.capabilities.canOpenVisualizations) - ); - } - - public inputIsRefType = ( - input: LensByValueInput | LensByReferenceInput - ): input is LensByReferenceInput => { - return this.deps.attributeService.inputIsRefType(input); - }; - - public getInputAsRefType = async (): Promise => { - return this.deps.attributeService.getInputAsRefType(this.getExplicitInput(), { - showSaveModal: true, - saveModalTitle: this.getTitle(), - }); - }; - - public getInputAsValueType = async (): Promise => { - return this.deps.attributeService.getInputAsValueType(this.getExplicitInput()); - }; - - /** - * Gets the Lens embeddable's local filters - * @returns Local/panel-level array of filters for Lens embeddable - */ - public getFilters() { - try { - return mapAndFlattenFilters( - this.deps.injectFilterReferences( - this.savedVis?.state.filters ?? [], - this.savedVis?.references ?? [] - ) - ); - } catch (e) { - // if we can't parse the filters, we publish an empty array. - return []; - } - } - - /** - * Gets the Lens embeddable's local query - * @returns Local/panel-level query for Lens embeddable - */ - public getQuery() { - return this.savedVis?.state.query; - } - - public getSavedVis(): Readonly { - if (!this.savedVis) { - return; - } - - // Why are 'type' and 'savedObjectId' keys being removed? - // Prior to removing them, - // this method returned 'Readonly' while consumers typed the results as 'LensSavedObjectAttributes'. - // Removing 'type' and 'savedObjectId' keys to align method results with consumer typing. - const savedVis = { ...this.savedVis }; - delete savedVis.type; - delete savedVis.savedObjectId; - return savedVis; - } - - destroy() { - this.isDestroyed = true; - super.destroy(); - if (this.inputReloadSubscriptions.length > 0) { - this.inputReloadSubscriptions.forEach((reloadSub) => { - reloadSub.unsubscribe(); - }); - } - if (this.domNode) { - unmountComponentAtNode(this.domNode); - } - } - - public getSelfStyledOptions() { - return { - hideTitle: this.visDisplayOptions.noPanelTitle, - }; - } - - private get visDisplayOptions(): VisualizationDisplayOptions { - if (!this.savedVis?.visualizationType) { - return {}; - } - - let displayOptions = - this.deps.visualizationMap[this.savedVis.visualizationType]?.getDisplayOptions?.() ?? {}; - - if (this.input.noPadding !== undefined) { - displayOptions = { - ...displayOptions, - noPadding: this.input.noPadding, - }; - } - - return displayOptions; - } -} diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx deleted file mode 100644 index f433f71d453b8..0000000000000 --- a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { FC, useEffect } from 'react'; -import type { CoreStart } from '@kbn/core/public'; -import type { Action, UiActionsStart } from '@kbn/ui-actions-plugin/public'; -import type { Start as InspectorStartContract } from '@kbn/inspector-plugin/public'; -import { PanelLoader } from '@kbn/panel-loader'; -import { EuiLoadingChart } from '@elastic/eui'; -import { - EmbeddableFactory, - EmbeddableInput, - EmbeddableOutput, - EmbeddablePanel, - EmbeddableRoot, - EmbeddableStart, - IEmbeddable, - useEmbeddableFactory, -} from '@kbn/embeddable-plugin/public'; -import type { LensByReferenceInput, LensByValueInput } from './embeddable'; -import type { Document } from '../persistence'; -import type { FormBasedPersistedState } from '../datasources/form_based/types'; -import type { TextBasedPersistedState } from '../datasources/text_based/types'; -import type { XYState } from '../visualizations/xy/types'; -import type { - PieVisualizationState, - LegacyMetricState, - AllowedGaugeOverrides, - AllowedPartitionOverrides, - AllowedSettingsOverrides, - AllowedXYOverrides, -} from '../../common/types'; -import type { DatatableVisualizationState } from '../visualizations/datatable/visualization'; -import type { MetricVisualizationState } from '../visualizations/metric/types'; -import type { HeatmapVisualizationState } from '../visualizations/heatmap/types'; -import type { GaugeVisualizationState } from '../visualizations/gauge/constants'; - -type LensAttributes = Omit< - Document, - 'savedObjectId' | 'type' | 'state' | 'visualizationType' -> & { - visualizationType: TVisType; - state: Omit & { - datasourceStates: { - formBased?: FormBasedPersistedState; - textBased?: TextBasedPersistedState; - }; - visualization: TVisState; - }; -}; - -/** - * Type-safe variant of by value embeddable input for Lens. - * This can be used to hardcode certain Lens chart configurations within another app. - */ -export type TypedLensByValueInput = Omit & { - attributes: - | LensAttributes<'lnsXY', XYState> - | LensAttributes<'lnsPie', PieVisualizationState> - | LensAttributes<'lnsHeatmap', HeatmapVisualizationState> - | LensAttributes<'lnsGauge', GaugeVisualizationState> - | LensAttributes<'lnsDatatable', DatatableVisualizationState> - | LensAttributes<'lnsLegacyMetric', LegacyMetricState> - | LensAttributes<'lnsMetric', MetricVisualizationState> - | LensAttributes; - - /** - * Overrides can tweak the style of the final embeddable and are executed at the end of the Lens rendering pipeline. - * XY charts offer an override of the Settings ('settings') and Axis ('axisX', 'axisLeft', 'axisRight') components. - * While it is not possible to pass function/callback/handlers to the renderer, it is possible to stop them by passing the - * "ignore" string as override value (i.e. onBrushEnd: "ignore") - */ - overrides?: - | AllowedSettingsOverrides - | AllowedXYOverrides - | AllowedPartitionOverrides - | AllowedGaugeOverrides; -}; - -export type EmbeddableComponentProps = (TypedLensByValueInput | LensByReferenceInput) & { - withDefaultActions?: boolean; - extraActions?: Action[]; - showInspector?: boolean; - abortController?: AbortController; -}; - -export type EmbeddableComponent = React.ComponentType; - -interface PluginsStartDependencies { - uiActions: UiActionsStart; - embeddable: EmbeddableStart; - inspector: InspectorStartContract; -} - -export function getEmbeddableComponent(core: CoreStart, plugins: PluginsStartDependencies) { - const { embeddable: embeddableStart, uiActions } = plugins; - const factory = embeddableStart.getEmbeddableFactory('lens')!; - return (props: EmbeddableComponentProps) => { - const input = { ...props }; - const hasActions = - Boolean(input.withDefaultActions) || (input.extraActions && input.extraActions?.length > 0); - - if (hasActions) { - return ( - hasActions} - input={input} - extraActions={input.extraActions} - showInspector={input.showInspector} - withDefaultActions={input.withDefaultActions} - /> - ); - } - return ; - }; -} - -function EmbeddableRootWrapper({ - factory, - input, -}: { - factory: EmbeddableFactory; - input: EmbeddableComponentProps; -}) { - const [embeddable, loading, error] = useEmbeddableFactory({ factory, input }); - if (loading) { - return ; - } - return ; -} - -interface EmbeddablePanelWrapperProps { - factory: EmbeddableFactory; - uiActions: PluginsStartDependencies['uiActions']; - actionPredicate: (id: string) => boolean; - input: EmbeddableComponentProps; - extraActions?: Action[]; - showInspector?: boolean; - withDefaultActions?: boolean; - abortController?: AbortController; -} - -const EmbeddablePanelWrapper: FC = ({ - factory, - uiActions, - actionPredicate, - input, - extraActions, - showInspector = true, - withDefaultActions, - abortController, -}) => { - const [embeddable, loading] = useEmbeddableFactory({ factory, input }); - useEffect(() => { - if (embeddable) { - embeddable.updateInput(input); - } - }, [embeddable, input]); - - if (loading || !embeddable) { - return ; - } - - return ( - } - getActions={async (triggerId, context) => { - const actions = withDefaultActions - ? await uiActions.getTriggerCompatibleActions(triggerId, context) - : []; - - return [...(extraActions ?? []), ...actions]; - }} - hideInspector={!showInspector} - actionPredicate={actionPredicate} - showNotifications={false} - showShadow={false} - showBadges={false} - /> - ); -}; diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts b/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts deleted file mode 100644 index d84aca319a42b..0000000000000 --- a/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { - Capabilities, - CoreStart, - HttpSetup, - IUiSettingsClient, - ThemeServiceStart, -} from '@kbn/core/public'; -import { i18n } from '@kbn/i18n'; -import { RecursiveReadonly } from '@kbn/utility-types'; -import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; -import { DataPublicPluginStart, FilterManager, TimefilterContract } from '@kbn/data-plugin/public'; -import type { DataViewsContract } from '@kbn/data-views-plugin/public'; -import { ReactExpressionRendererType } from '@kbn/expressions-plugin/public'; -import { - EmbeddableFactoryDefinition, - IContainer, - ErrorEmbeddable, -} from '@kbn/embeddable-plugin/public'; -import type { UiActionsStart } from '@kbn/ui-actions-plugin/public'; -import type { Start as InspectorStart } from '@kbn/inspector-plugin/public'; -import type { SpacesPluginStart } from '@kbn/spaces-plugin/public'; -import type { LensByReferenceInput, LensEmbeddableInput } from './embeddable'; -import type { Document } from '../persistence/saved_object_store'; -import type { LensAttributeService } from '../lens_attribute_service'; -import { DOC_TYPE } from '../../common/constants'; -import { extract, inject } from '../../common/embeddable_factory'; -import type { DatasourceMap, VisualizationMap } from '../types'; -import type { DocumentToExpressionReturnType } from '../editor_frame_service/editor_frame'; - -export interface LensEmbeddableStartServices { - data: DataPublicPluginStart; - timefilter: TimefilterContract; - coreHttp: HttpSetup; - coreStart: CoreStart; - inspector: InspectorStart; - attributeService: LensAttributeService; - capabilities: RecursiveReadonly; - expressionRenderer: ReactExpressionRendererType; - dataViews: DataViewsContract; - uiActions?: UiActionsStart; - usageCollection?: UsageCollectionSetup; - documentToExpression: (doc: Document) => Promise; - injectFilterReferences: FilterManager['inject']; - visualizationMap: VisualizationMap; - datasourceMap: DatasourceMap; - spaces?: SpacesPluginStart; - theme: ThemeServiceStart; - uiSettings: IUiSettingsClient; -} - -export class EmbeddableFactory implements EmbeddableFactoryDefinition { - type = DOC_TYPE; - savedObjectMetaData = { - name: i18n.translate('xpack.lens.lensSavedObjectLabel', { - defaultMessage: 'Lens Visualization', - }), - type: DOC_TYPE, - getIconForSavedObject: () => 'lensApp', - }; - - constructor(private getStartServices: () => Promise) {} - - public isEditable = async () => { - const { capabilities } = await this.getStartServices(); - return Boolean(capabilities.visualize.save || capabilities.dashboard?.showWriteControls); - }; - - canCreateNew() { - return false; - } - - getDisplayName() { - return i18n.translate('xpack.lens.embeddableDisplayName', { - defaultMessage: 'Lens', - }); - } - - createFromSavedObject = async ( - savedObjectId: string, - input: LensEmbeddableInput, - parent?: IContainer - ) => { - if (!(input as LensByReferenceInput).savedObjectId) { - (input as LensByReferenceInput).savedObjectId = savedObjectId; - } - return this.create(input, parent); - }; - - async create(input: LensEmbeddableInput, parent?: IContainer) { - try { - const { - data, - timefilter, - expressionRenderer, - documentToExpression, - injectFilterReferences, - visualizationMap, - datasourceMap, - uiActions, - coreHttp, - coreStart, - attributeService, - dataViews, - capabilities, - usageCollection, - inspector, - spaces, - uiSettings, - } = await this.getStartServices(); - - const { Embeddable } = await import('../async_services'); - - return new Embeddable( - { - attributeService, - data, - dataViews, - timefilter, - inspector, - expressionRenderer, - basePath: coreHttp.basePath, - getTrigger: uiActions?.getTrigger, - getTriggerCompatibleActions: uiActions?.getTriggerCompatibleActions, - documentToExpression, - injectFilterReferences, - visualizationMap, - datasourceMap, - capabilities: { - canSaveDashboards: Boolean(capabilities.dashboard?.showWriteControls), - canSaveVisualizations: Boolean(capabilities.visualize.save), - canOpenVisualizations: Boolean(capabilities.visualize.show), - navLinks: capabilities.navLinks, - discover: capabilities.discover, - }, - coreStart, - usageCollection, - spaces, - uiSettings, - }, - input, - parent - ); - } catch (e) { - return new ErrorEmbeddable(e, input, parent); - } - } - - extract = extract; - inject = inject; -} diff --git a/x-pack/plugins/lens/public/embeddable/index.ts b/x-pack/plugins/lens/public/embeddable/index.ts deleted file mode 100644 index 50ee0f582a2ff..0000000000000 --- a/x-pack/plugins/lens/public/embeddable/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export * from './embeddable'; - -export { type LensApi, isLensApi } from './interfaces/lens_api'; diff --git a/x-pack/plugins/lens/public/embeddable/interfaces/lens_api.ts b/x-pack/plugins/lens/public/embeddable/interfaces/lens_api.ts deleted file mode 100644 index 11b70cd6e7763..0000000000000 --- a/x-pack/plugins/lens/public/embeddable/interfaces/lens_api.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { - HasParentApi, - HasType, - PublishesUnifiedSearch, - PublishesPanelTitle, - PublishingSubject, -} from '@kbn/presentation-publishing'; -import { - apiIsOfType, - apiPublishesUnifiedSearch, - apiPublishesPanelTitle, -} from '@kbn/presentation-publishing'; -import { LensSavedObjectAttributes, ViewUnderlyingDataArgs } from '../embeddable'; - -export type HasLensConfig = HasType<'lens'> & { - getSavedVis: () => Readonly; - canViewUnderlyingData$: PublishingSubject; - getViewUnderlyingDataArgs: () => ViewUnderlyingDataArgs; - getFullAttributes: () => LensSavedObjectAttributes | undefined; -}; - -export type LensApi = HasLensConfig & - PublishesPanelTitle & - PublishesUnifiedSearch & - Partial>>; - -export const isLensApi = (api: unknown): api is LensApi => { - return Boolean( - api && - apiIsOfType(api, 'lens') && - typeof (api as HasLensConfig).getSavedVis === 'function' && - (api as HasLensConfig).canViewUnderlyingData$ && - typeof (api as HasLensConfig).getViewUnderlyingDataArgs === 'function' && - typeof (api as HasLensConfig).getFullAttributes === 'function' && - apiPublishesPanelTitle(api) && - apiPublishesUnifiedSearch(api) - ); -}; diff --git a/x-pack/plugins/lens/public/index.ts b/x-pack/plugins/lens/public/index.ts index 026da7988a303..aea728024b574 100644 --- a/x-pack/plugins/lens/public/index.ts +++ b/x-pack/plugins/lens/public/index.ts @@ -7,12 +7,21 @@ import { LensPlugin } from './plugin'; -export { isLensApi } from './embeddable/interfaces/lens_api'; +export { isLensApi } from './react_embeddable/type_guards'; +export { type EmbeddableComponent } from './react_embeddable/renderer/lens_custom_renderer_component'; export type { - EmbeddableComponentProps, - EmbeddableComponent, + LensApi, + LensSerializedState, + LensRuntimeState, + LensByValueInput, + LensByReferenceInput, TypedLensByValueInput, -} from './embeddable/embeddable_component'; + LensEmbeddableInput, + LensEmbeddableOutput, + LensSavedObjectAttributes, + LensRendererProps as EmbeddableComponentProps, +} from './react_embeddable/types'; + export type { XYState, XYReferenceLineLayerConfig, @@ -110,14 +119,6 @@ export type { export type { InlineEditLensEmbeddableContext } from './trigger_actions/open_lens_config/in_app_embeddable_edit/types'; -export type { - LensApi, - LensEmbeddableInput, - LensSavedObjectAttributes, - Embeddable, - LensEmbeddableOutput, -} from './embeddable'; - export type { ChartInfo } from './chart_info_api'; export { layerTypes } from '../common/layer_types'; diff --git a/x-pack/plugins/lens/public/lens_attribute_service.ts b/x-pack/plugins/lens/public/lens_attribute_service.ts index eb827d87d6416..b5eeaae5d0f54 100644 --- a/x-pack/plugins/lens/public/lens_attribute_service.ts +++ b/x-pack/plugins/lens/public/lens_attribute_service.ts @@ -6,27 +6,52 @@ */ import type { CoreStart } from '@kbn/core/public'; -import type { AttributeService } from '@kbn/embeddable-plugin/public'; +import type { SavedObjectReference } from '@kbn/core/types'; import { OnSaveProps } from '@kbn/saved-objects-plugin/public'; import { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common'; +import { noop } from 'lodash'; +import { EmbeddableStateWithType } from '@kbn/embeddable-plugin/common'; import type { LensPluginStartDependencies } from './plugin'; -import type { LensSavedObjectAttributes as LensSavedObjectAttributesWithoutReferences } from '../common/content_management'; import type { - LensSavedObjectAttributes, - LensByValueInput, - LensUnwrapMetaInfo, - LensUnwrapResult, - LensByReferenceInput, -} from './embeddable/embeddable'; + LensSavedObject, + LensSavedObjectAttributes as LensSavedObjectAttributesWithoutReferences, +} from '../common/content_management'; +import { extract, inject } from '../common/embeddable_factory'; import { SavedObjectIndexStore, checkForDuplicateTitle } from './persistence'; import { DOC_TYPE } from '../common/constants'; +import { SharingSavedObjectProps } from './types'; +import { LensRuntimeState, LensSavedObjectAttributes } from './react_embeddable/types'; -export type LensAttributeService = AttributeService< - LensSavedObjectAttributes, - LensByValueInput, - LensByReferenceInput, - LensUnwrapMetaInfo ->; +type Reference = LensSavedObject['references'][number]; + +type CheckDuplicateTitleProps = OnSaveProps & { + id?: string; + displayName: string; + lastSavedTitle: string; + copyOnSave: boolean; +}; + +export interface LensAttributesService { + loadFromLibrary: (savedObjectId: string) => Promise<{ + attributes: LensSavedObjectAttributes; + sharingSavedObjectProps: SharingSavedObjectProps; + managed: boolean; + }>; + saveToLibrary: ( + attributes: LensSavedObjectAttributesWithoutReferences, + references: Reference[], + savedObjectId?: string + ) => Promise; + checkForDuplicateTitle: (props: CheckDuplicateTitleProps) => Promise<{ isDuplicate: boolean }>; + injectReferences: ( + runtimeState: LensRuntimeState, + references: SavedObjectReference[] | undefined + ) => LensRuntimeState; + extractReferences: (runtimeState: LensRuntimeState) => { + rawState: LensRuntimeState; + references: SavedObjectReference[]; + }; +} export const savedObjectToEmbeddableAttributes = ( savedObject: SavedObjectCommon @@ -41,60 +66,86 @@ export const savedObjectToEmbeddableAttributes = ( export function getLensAttributeService( core: CoreStart, startDependencies: LensPluginStartDependencies -): LensAttributeService { +): LensAttributesService { const savedObjectStore = new SavedObjectIndexStore(startDependencies.contentManagement); - return startDependencies.embeddable.getAttributeService< - LensSavedObjectAttributes, - LensByValueInput, - LensByReferenceInput, - LensUnwrapMetaInfo - >(DOC_TYPE, { - saveMethod: async (attributes: LensSavedObjectAttributes, savedObjectId?: string) => { - const savedDoc = await savedObjectStore.save({ + return { + loadFromLibrary: async ( + savedObjectId: string + ): Promise<{ + attributes: LensSavedObjectAttributes; + sharingSavedObjectProps: SharingSavedObjectProps; + managed: boolean; + }> => { + const { meta, item } = await savedObjectStore.load(savedObjectId); + return { + attributes: { + ...item.attributes, + state: item.attributes.state as LensSavedObjectAttributes['state'], + references: item.references, + }, + sharingSavedObjectProps: { + aliasTargetId: meta.aliasTargetId, + outcome: meta.outcome, + aliasPurpose: meta.aliasPurpose, + sourceId: item.id, + }, + managed: Boolean(item.managed), + }; + }, + saveToLibrary: async ( + attributes: LensSavedObjectAttributesWithoutReferences, + references: Reference[], + savedObjectId?: string + ) => { + const result = await savedObjectStore.save({ ...attributes, + state: attributes.state as LensSavedObjectAttributes['state'], + references, savedObjectId, - type: DOC_TYPE, }); - return { id: savedDoc.savedObjectId }; + return result.savedObjectId; }, - unwrapMethod: async (savedObjectId: string): Promise => { - const { - item: savedObject, - meta: { outcome, aliasTargetId, aliasPurpose }, - } = await savedObjectStore.load(savedObjectId); - const { id } = savedObject; - - const sharingSavedObjectProps = { - aliasTargetId, - outcome, - aliasPurpose, - sourceId: id, - }; - + checkForDuplicateTitle: async ({ + newTitle, + isTitleDuplicateConfirmed, + onTitleDuplicate = noop, + displayName = DOC_TYPE, + lastSavedTitle = '', + copyOnSave = false, + id, + }: CheckDuplicateTitleProps) => { return { - attributes: savedObjectToEmbeddableAttributes(savedObject), - metaInfo: { - sharingSavedObjectProps, - managed: savedObject.managed, - }, + isDuplicate: await checkForDuplicateTitle( + { + id, + title: newTitle, + isTitleDuplicateConfirmed, + displayName, + lastSavedTitle, + copyOnSave, + }, + onTitleDuplicate, + { + client: savedObjectStore, + ...core, + } + ), }; }, - checkForDuplicateTitle: (props: OnSaveProps) => { - return checkForDuplicateTitle( - { - title: props.newTitle, - displayName: DOC_TYPE, - isTitleDuplicateConfirmed: props.isTitleDuplicateConfirmed, - lastSavedTitle: '', - copyOnSave: false, - }, - props.onTitleDuplicate, - { - client: savedObjectStore, - ...core, - } - ); + // Make sure to inject references from the container down to the runtime state + // this ensure migrations/copy to spaces works correctly + injectReferences: (runtimeState, references) => { + return inject( + runtimeState as unknown as EmbeddableStateWithType, + references ?? runtimeState.attributes.references + ) as unknown as LensRuntimeState; }, - }); + // Make sure to move the internal references into the parent references + // so migrations/move to spaces can work properly + extractReferences: (runtimeState) => { + const { state, references } = extract(runtimeState as unknown as EmbeddableStateWithType); + return { rawState: state as unknown as LensRuntimeState, references }; + }, + }; } diff --git a/x-pack/plugins/lens/public/lens_inspector_service.ts b/x-pack/plugins/lens/public/lens_inspector_service.ts index 4de0a8ec1340f..052a741851ba9 100644 --- a/x-pack/plugins/lens/public/lens_inspector_service.ts +++ b/x-pack/plugins/lens/public/lens_inspector_service.ts @@ -18,7 +18,7 @@ export const getLensInspectorService = (inspector: InspectorStartContract) => { const adapters: Adapters = createDefaultInspectorAdapters(); let overlayRef: InspectorSession | undefined; return { - adapters, + getInspectorAdapters: () => adapters, inspect: (options?: InspectorOptions) => { overlayRef = inspector.open(adapters, options); overlayRef.onClose.then(() => { @@ -28,7 +28,7 @@ export const getLensInspectorService = (inspector: InspectorStartContract) => { }); return overlayRef; }, - close: () => overlayRef?.close(), + closeInspector: async () => overlayRef?.close(), }; }; diff --git a/x-pack/plugins/lens/public/lens_suggestions_api/helpers.test.ts b/x-pack/plugins/lens/public/lens_suggestions_api/helpers.test.ts index 177a7e2e0d33c..fa53ec84293ca 100644 --- a/x-pack/plugins/lens/public/lens_suggestions_api/helpers.test.ts +++ b/x-pack/plugins/lens/public/lens_suggestions_api/helpers.test.ts @@ -7,7 +7,7 @@ import type { DatatableColumn } from '@kbn/expressions-plugin/common'; import { mergeSuggestionWithVisContext } from './helpers'; import { mockAllSuggestions } from '../mocks'; -import type { TypedLensByValueInput } from '../embeddable/embeddable_component'; +import { TypedLensByValueInput } from '../react_embeddable/types'; const context = { dataViewSpec: { diff --git a/x-pack/plugins/lens/public/lens_suggestions_api/helpers.ts b/x-pack/plugins/lens/public/lens_suggestions_api/helpers.ts index 394d32e8c5bb7..5e000d1f14c8a 100644 --- a/x-pack/plugins/lens/public/lens_suggestions_api/helpers.ts +++ b/x-pack/plugins/lens/public/lens_suggestions_api/helpers.ts @@ -7,7 +7,7 @@ import type { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public'; import { getDatasourceId } from '@kbn/visualization-utils'; import type { VisualizeEditorContext, Suggestion } from '../types'; -import type { TypedLensByValueInput } from '../embeddable/embeddable_component'; +import { TypedLensByValueInput } from '../react_embeddable/types'; /** * Returns the suggestion updated with external visualization state for ES|QL charts diff --git a/x-pack/plugins/lens/public/lens_suggestions_api/index.ts b/x-pack/plugins/lens/public/lens_suggestions_api/index.ts index c73379d9a42cd..6f3f558b60b15 100644 --- a/x-pack/plugins/lens/public/lens_suggestions_api/index.ts +++ b/x-pack/plugins/lens/public/lens_suggestions_api/index.ts @@ -10,7 +10,7 @@ import type { ChartType } from '@kbn/visualization-utils'; import { getSuggestions } from '../editor_frame_service/editor_frame/suggestion_helpers'; import type { DatasourceMap, VisualizationMap, VisualizeEditorContext } from '../types'; import type { DataViewsState } from '../state_management'; -import type { TypedLensByValueInput } from '../embeddable/embeddable_component'; +import type { TypedLensByValueInput } from '../react_embeddable/types'; import { mergeSuggestionWithVisContext } from './helpers'; interface SuggestionsApiProps { diff --git a/x-pack/plugins/lens/public/lens_suggestions_api/lens_suggestions_api.test.ts b/x-pack/plugins/lens/public/lens_suggestions_api/lens_suggestions_api.test.ts index e5e60284e4919..784c0ae03e56f 100644 --- a/x-pack/plugins/lens/public/lens_suggestions_api/lens_suggestions_api.test.ts +++ b/x-pack/plugins/lens/public/lens_suggestions_api/lens_suggestions_api.test.ts @@ -10,7 +10,7 @@ import { ChartType } from '@kbn/visualization-utils'; import { createMockVisualization, DatasourceMock, createMockDatasource } from '../mocks'; import { DatasourceSuggestion } from '../types'; import { suggestionsApi } from '.'; -import type { TypedLensByValueInput } from '../embeddable/embeddable_component'; +import { TypedLensByValueInput } from '../react_embeddable/types'; const generateSuggestion = (state = {}, layerId: string = 'first'): DatasourceSuggestion => ({ state, diff --git a/x-pack/plugins/lens/public/mocks/data_plugin_mock.ts b/x-pack/plugins/lens/public/mocks/data_plugin_mock.ts index db7ab00de22e3..8628cc29c1940 100644 --- a/x-pack/plugins/lens/public/mocks/data_plugin_mock.ts +++ b/x-pack/plugins/lens/public/mocks/data_plugin_mock.ts @@ -48,13 +48,13 @@ export function mockDataPlugin( function createMockSearchService() { let sessionIdCounter = initialSessionId ? 1 : 0; let currentSessionId: string | undefined = initialSessionId; - const start = () => { - currentSessionId = `sessionId-${++sessionIdCounter}`; - return currentSessionId; - }; + return { session: { - start: jest.fn(start), + start: jest.fn(() => { + currentSessionId = `sessionId-${++sessionIdCounter}`; + return currentSessionId; + }), clear: jest.fn(), getSessionId: jest.fn(() => currentSessionId), getSession$: jest.fn(() => sessionIdSubject.asObservable()), @@ -146,5 +146,6 @@ export function mockDataPlugin( fieldFormats: { deserialize: jest.fn(), }, + datatableUtilities: { getDateHistogramMeta: jest.fn(() => true) }, } as unknown as DataPublicPluginStart; } diff --git a/x-pack/plugins/lens/public/mocks/lens_plugin_mock.tsx b/x-pack/plugins/lens/public/mocks/lens_plugin_mock.tsx index 4e5f83c7db839..cbb2f0c5dddbf 100644 --- a/x-pack/plugins/lens/public/mocks/lens_plugin_mock.tsx +++ b/x-pack/plugins/lens/public/mocks/lens_plugin_mock.tsx @@ -16,7 +16,7 @@ type Start = jest.Mocked; export const lensPluginMock = { createStartContract: (): Start => { const startContract: Start = { - EmbeddableComponent: jest.fn(() => { + EmbeddableComponent: jest.fn((props) => { return Lens Embeddable Component; }), SaveModalComponent: jest.fn(() => { diff --git a/x-pack/plugins/lens/public/mocks/services_mock.tsx b/x-pack/plugins/lens/public/mocks/services_mock.tsx index 18fa29fd6caf2..b5366984c4352 100644 --- a/x-pack/plugins/lens/public/mocks/services_mock.tsx +++ b/x-pack/plugins/lens/public/mocks/services_mock.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import React from 'react'; import { Subject } from 'rxjs'; import { coreMock } from '@kbn/core/public/mocks'; import { navigationPluginMock } from '@kbn/navigation-plugin/public/mocks'; @@ -20,46 +19,35 @@ import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; -import { - mockAttributeService, - createEmbeddableStateTransferMock, -} from '@kbn/embeddable-plugin/public/mocks'; +import { createEmbeddableStateTransferMock } from '@kbn/embeddable-plugin/public/mocks'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; import type { EmbeddableStateTransfer } from '@kbn/embeddable-plugin/public'; import { presentationUtilPluginMock } from '@kbn/presentation-util-plugin/public/mocks'; import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks'; import type { EventAnnotationServiceType } from '@kbn/event-annotation-plugin/public'; -import type { LensAttributeService } from '../lens_attribute_service'; -import type { - LensByValueInput, - LensByReferenceInput, - LensSavedObjectAttributes, - LensUnwrapMetaInfo, -} from '../embeddable/embeddable'; -import { DOC_TYPE } from '../../common/constants'; + import { LensAppServices } from '../app_plugin/types'; import { mockDataPlugin } from './data_plugin_mock'; import { getLensInspectorService } from '../lens_inspector_service'; -import { SavedObjectIndexStore } from '../persistence'; +import { LensDocument, SavedObjectIndexStore } from '../persistence'; +import { LensAttributesService } from '../lens_attribute_service'; +import { mockDatasourceStates } from './store_mocks'; const startMock = coreMock.createStart(); -export const defaultDoc = { +export const defaultDoc: LensDocument = { savedObjectId: '1234', title: 'An extremely cool default document!', - expression: 'definitely a valid expression', visualizationType: 'testVis', state: { - query: 'kuery', + query: { query: 'test', language: 'kuery' }, filters: [{ query: { match_phrase: { src: 'test' } }, meta: { index: 'index-pattern-0' } }], - datasourceStates: { - testDatasource: 'datasource', - }, + datasourceStates: mockDatasourceStates(), visualization: {}, }, references: [{ type: 'index-pattern', id: '1', name: 'index-pattern-0' }], -} as unknown as Document; +}; export const exactMatchDoc = { attributes: { @@ -70,6 +58,27 @@ export const exactMatchDoc = { }, }; +export function makeAttributeService(doc: LensDocument): jest.Mocked { + const attributeServiceMock: jest.Mocked = { + loadFromLibrary: jest.fn().mockResolvedValue(exactMatchDoc), + saveToLibrary: jest.fn().mockResolvedValue(doc.savedObjectId), + checkForDuplicateTitle: jest.fn(), + injectReferences: jest.fn((_runtimeState, references) => ({ + ..._runtimeState, + attributes: { + ..._runtimeState.attributes, + references: references?.length ? references : _runtimeState.attributes.references, + }, + })), + extractReferences: jest.fn((_runtimeState) => ({ + rawState: _runtimeState, + references: _runtimeState.attributes.references || [], + })), + }; + + return attributeServiceMock; +} + export function makeDefaultServices( sessionIdSubject = new Subject(), sessionId: string | undefined = undefined, @@ -106,44 +115,16 @@ export function makeDefaultServices( const navigationStartMock = navigationPluginMock.createStartContract(); - jest - .spyOn(navigationStartMock.ui.AggregateQueryTopNavMenu.prototype, 'constructor') - .mockImplementation(() => { - return
; - }); - - function makeAttributeService(): LensAttributeService { - const attributeServiceMock = mockAttributeService< - LensSavedObjectAttributes, - LensByValueInput, - LensByReferenceInput, - LensUnwrapMetaInfo - >( - DOC_TYPE, - { - saveMethod: jest.fn(), - unwrapMethod: jest.fn(), - checkForDuplicateTitle: jest.fn(), - }, - core - ); - attributeServiceMock.unwrapAttributes = jest.fn().mockResolvedValue(exactMatchDoc); - attributeServiceMock.wrapAttributes = jest.fn().mockResolvedValue({ - savedObjectId: (doc as unknown as LensByReferenceInput).savedObjectId, - }); - - return attributeServiceMock; - } - return { ...startMock, chrome: core.chrome, navigation: navigationStartMock, - attributeService: makeAttributeService(), + attributeService: makeAttributeService(doc), inspector: { - adapters: getLensInspectorService(inspectorPluginMock.createStartContract()).adapters, + getInspectorAdapters: getLensInspectorService(inspectorPluginMock.createStartContract()) + .getInspectorAdapters, inspect: jest.fn(), - close: jest.fn(), + closeInspector: jest.fn(), }, presentationUtil: presentationUtilPluginMock.createStartContract(), savedObjectStore: { @@ -158,6 +139,9 @@ export function makeDefaultServices( capabilities: { ...core.application.capabilities, visualize: { save: true, saveQuery: true, show: true, createShortUrl: true }, + dashboard: { + showWriteControls: true, + }, }, getUrlForApp: jest.fn((appId: string) => `/testbasepath/app/${appId}#/`), }, diff --git a/x-pack/plugins/lens/public/mocks/store_mocks.tsx b/x-pack/plugins/lens/public/mocks/store_mocks.tsx index f465eadc9dfdd..87667c21fed20 100644 --- a/x-pack/plugins/lens/public/mocks/store_mocks.tsx +++ b/x-pack/plugins/lens/public/mocks/store_mocks.tsx @@ -8,7 +8,6 @@ import React, { PropsWithChildren, ReactElement } from 'react'; import { ReactWrapper, mount } from 'enzyme'; import { Provider } from 'react-redux'; -import { act } from 'react-dom/test-utils'; import { PreloadedState } from '@reduxjs/toolkit'; import { RenderOptions, render } from '@testing-library/react'; import { I18nProvider } from '@kbn/i18n-react'; @@ -20,17 +19,25 @@ import { mockVisualizationMap } from './visualization_mock'; import { mockDatasourceMap } from './datasource_mock'; import { makeDefaultServices } from './services_mock'; -export const mockStoreDeps = (deps?: { - lensServices?: LensAppServices; - datasourceMap?: DatasourceMap; - visualizationMap?: VisualizationMap; -}) => { - return { - datasourceMap: deps?.datasourceMap || mockDatasourceMap(), - visualizationMap: deps?.visualizationMap || mockVisualizationMap(), - lensServices: deps?.lensServices || makeDefaultServices(), - }; -}; +export const mockStoreDeps = ( + { + lensServices = makeDefaultServices(), + datasourceMap = mockDatasourceMap(), + visualizationMap = mockVisualizationMap(), + }: { + lensServices?: LensAppServices; + datasourceMap?: DatasourceMap; + visualizationMap?: VisualizationMap; + } = { + lensServices: makeDefaultServices(), + datasourceMap: mockDatasourceMap(), + visualizationMap: mockVisualizationMap(), + } +) => ({ + datasourceMap, + visualizationMap, + lensServices, +}); export function mockDatasourceStates() { return { @@ -138,12 +145,7 @@ export const mountWithProvider = async ( } ) => { const { mountArgs, lensStore, deps } = getMountWithProviderParams(component, store, options); - - let instance: ReactWrapper = {} as ReactWrapper; - - await act(async () => { - instance = mount(mountArgs.component, mountArgs.options); - }); + const instance = mount(mountArgs.component, mountArgs.options); return { instance, lensStore, deps }; }; diff --git a/x-pack/plugins/lens/public/persistence/saved_object_store.ts b/x-pack/plugins/lens/public/persistence/saved_object_store.ts index d15386548dacf..9edd481f7b62f 100644 --- a/x-pack/plugins/lens/public/persistence/saved_object_store.ts +++ b/x-pack/plugins/lens/public/persistence/saved_object_store.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { Filter, Query } from '@kbn/es-query'; -import { SavedObjectReference } from '@kbn/core/public'; +import type { AggregateQuery, Filter, Query } from '@kbn/es-query'; +import type { SavedObjectReference } from '@kbn/core/public'; import type { DataViewSpec } from '@kbn/data-views-plugin/public'; import type { ContentManagementPublicStart } from '@kbn/content-management-plugin/public'; import type { SearchQuery } from '@kbn/content-management-plugin/common'; @@ -14,7 +14,7 @@ import type { VisualizationClient } from '@kbn/visualizations-plugin/public'; import type { LensSavedObjectAttributes, LensSearchQuery } from '../../common/content_management'; import { getLensClient } from './lens_client'; -export interface Document { +export interface LensDocument { savedObjectId?: string; type?: string; visualizationType: string | null; @@ -23,7 +23,7 @@ export interface Document { state: { datasourceStates: Record; visualization: unknown; - query: Query; + query: Query | AggregateQuery; globalPalette?: { activePaletteId: string; state?: unknown; @@ -36,7 +36,7 @@ export interface Document { } export interface DocumentSaver { - save: (vis: Document) => Promise<{ savedObjectId: string }>; + save: (vis: LensDocument) => Promise<{ savedObjectId: string }>; } export interface DocumentLoader { @@ -52,9 +52,8 @@ export class SavedObjectIndexStore implements SavedObjectStore { this.client = getLensClient(cm); } - save = async (vis: Document) => { - const { savedObjectId, type, references, ...rest } = vis; - const attributes = rest; + save = async (vis: LensDocument) => { + const { savedObjectId, type, references, ...attributes } = vis; if (savedObjectId) { const result = await this.client.update({ @@ -65,15 +64,14 @@ export class SavedObjectIndexStore implements SavedObjectStore { }, }); return { ...vis, savedObjectId: result.item.id }; - } else { - const result = await this.client.create({ - data: attributes, - options: { - references, - }, - }); - return { ...vis, savedObjectId: result.item.id }; } + const result = await this.client.create({ + data: attributes, + options: { + references, + }, + }); + return { ...vis, savedObjectId: result.item.id }; }; async load(savedObjectId: string) { diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index 3145606abaf6c..38f831ce34151 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -14,8 +14,9 @@ import type { } from '@kbn/usage-collection-plugin/public'; import { Storage } from '@kbn/kibana-utils-plugin/public'; import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; -import type { EmbeddableSetup, EmbeddableStart } from '@kbn/embeddable-plugin/public'; +import { EmbeddableSetup, EmbeddableStart } from '@kbn/embeddable-plugin/public'; import { CONTEXT_MENU_TRIGGER } from '@kbn/embeddable-plugin/public'; +import type { EmbeddableEnhancedPluginStart } from '@kbn/embeddable-enhanced-plugin/public'; import type { DataViewsPublicPluginStart, DataView } from '@kbn/data-views-plugin/public'; import type { SpacesPluginStart } from '@kbn/spaces-plugin/public'; import type { @@ -24,6 +25,7 @@ import type { ExpressionsStart, } from '@kbn/expressions-plugin/public'; import { + ACTION_CONVERT_DASHBOARD_PANEL_TO_LENS, DASHBOARD_VISUALIZATION_PANEL_TRIGGER, VisualizationsSetup, VisualizationsStart, @@ -94,7 +96,13 @@ import type { HeatmapVisualization as HeatmapVisualizationType } from './visuali import type { GaugeVisualization as GaugeVisualizationType } from './visualizations/gauge'; import type { TagcloudVisualization as TagcloudVisualizationType } from './visualizations/tagcloud'; -import { APP_ID, getEditPath, NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../common/constants'; +import { + APP_ID, + getEditPath, + LENS_EMBEDDABLE_TYPE, + LENS_ICON, + NOT_INTERNATIONALIZED_PRODUCT_NAME, +} from '../common/constants'; import type { FormatFactory } from '../common/types'; import type { Visualization, @@ -103,10 +111,11 @@ import type { LensTopNavMenuEntryGenerator, VisualizeEditorContext, Suggestion, + DatasourceMap, + VisualizationMap, } from './types'; import { getLensAliasConfig } from './vis_type_alias'; import { createOpenInDiscoverAction } from './trigger_actions/open_in_discover_action'; -import { ConfigureInLensPanelAction } from './trigger_actions/open_lens_config/edit_action'; import { CreateESQLPanelAction } from './trigger_actions/open_lens_config/create_action'; import { inAppEmbeddableEditTrigger, @@ -115,12 +124,12 @@ import { import { EditLensEmbeddableAction } from './trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action'; import { visualizeFieldAction } from './trigger_actions/visualize_field_actions'; import { visualizeTSVBAction } from './trigger_actions/visualize_tsvb_actions'; -import { visualizeAggBasedVisAction } from './trigger_actions/visualize_agg_based_vis_actions'; -import { visualizeDashboardVisualizePanelction } from './trigger_actions/dashboard_visualize_panel_actions'; -import type { LensByValueInput, LensEmbeddableInput } from './embeddable'; -import { EmbeddableFactory, LensEmbeddableStartServices } from './embeddable/embeddable_factory'; -import { EmbeddableComponent, getEmbeddableComponent } from './embeddable/embeddable_component'; +import type { + LensEmbeddableStartServices, + LensSerializedState, + TypedLensByValueInput, +} from './react_embeddable/types'; import { getSaveModalComponent } from './app_plugin/shared/saved_modal_lazy'; import type { SaveModalContainerProps } from './app_plugin/save_modal_container'; @@ -130,15 +139,16 @@ import { OpenInDiscoverDrilldown } from './trigger_actions/open_in_discover_dril import { ChartInfoApi } from './chart_info_api'; import { type LensAppLocator, LensAppLocatorDefinition } from '../common/locator/locator'; import { downloadCsvShareProvider } from './app_plugin/csv_download_provider/csv_download_provider'; - +import { LensDocument } from './persistence/saved_object_store'; import { CONTENT_ID, LATEST_VERSION, LensSavedObjectAttributes, } from '../common/content_management'; import type { EditLensConfigurationProps } from './app_plugin/shared/edit_on_the_fly/get_edit_lens_configuration'; -import { savedObjectToEmbeddableAttributes } from './lens_attribute_service'; -import type { TypedLensByValueInput } from './embeddable/embeddable_component'; +import { convertToLensActionFactory } from './trigger_actions/convert_to_lens_action'; +import { LensRenderer } from './react_embeddable/renderer/lens_custom_renderer_component'; +import { deserializeState } from './react_embeddable/helper'; export type { SaveProps } from './app_plugin'; @@ -182,6 +192,7 @@ export interface LensPluginStartDependencies { contentManagement: ContentManagementPublicStart; serverless?: ServerlessPluginStart; licensing?: LicensingPluginStart; + embeddableEnhanced?: EmbeddableEnhancedPluginStart; } export interface LensPublicSetup { @@ -221,7 +232,7 @@ export interface LensPublicStart { * * @experimental */ - EmbeddableComponent: EmbeddableComponent; + EmbeddableComponent: typeof LensRenderer; /** * React component which can be used to embed a Lens Visualization Save Modal Component. * See `x-pack/examples/embedded_lens_example` for exemplary usage. @@ -248,7 +259,7 @@ export interface LensPublicStart { * @experimental */ navigateToPrefilledEditor: ( - input: LensEmbeddableInput | undefined, + input: LensSerializedState | undefined, options?: { openInNewTab?: boolean; originatingApp?: string; @@ -303,9 +314,14 @@ export class LensPlugin { private topNavMenuEntries: LensTopNavMenuEntryGenerator[] = []; private hasDiscoverAccess: boolean = false; private dataViewsService: DataViewsPublicPluginStart | undefined; - private initDependenciesForApi: () => void = () => {}; private locator?: LensAppLocator; + // Note: this method will be overwritten in the setup flow + private initEditorFrameService = async (): Promise<{ + datasourceMap: DatasourceMap; + visualizationMap: VisualizationMap; + }> => ({ datasourceMap: {}, visualizationMap: {} }); + setup( core: CoreSetup, { @@ -326,26 +342,16 @@ export class LensPlugin { const startServices = createStartServicesGetter(core.getStartServices); const getStartServicesForEmbeddable = async (): Promise => { - const { getLensAttributeService, setUsageCollectionStart, initMemoizedErrorNotification } = - await import('./async_services'); + const { setUsageCollectionStart, initMemoizedErrorNotification } = await import( + './async_services' + ); const { core: coreStart, plugins } = startServices(); - await this.initParts( - core, - data, - charts, - expressions, - fieldFormats, - plugins.fieldFormats.deserialize - ); - const [visualizationMap, datasourceMap] = await Promise.all([ - this.editorFrameService!.loadVisualizations(), - this.editorFrameService!.loadDatasources(), + const { visualizationMap, datasourceMap } = await this.initEditorFrameService(); + const [{ getLensAttributeService }, eventAnnotationService] = await Promise.all([ + import('./async_services'), + plugins.eventAnnotation.getService(), ]); - const { setVisualizationMap, setDatasourceMap } = await import('./async_services'); - setDatasourceMap(datasourceMap); - setVisualizationMap(visualizationMap); - const eventAnnotationService = await plugins.eventAnnotation.getService(); if (plugins.usageCollection) { setUsageCollectionStart(plugins.usageCollection); @@ -354,14 +360,14 @@ export class LensPlugin { initMemoizedErrorNotification(coreStart); return { + ...plugins, attributeService: getLensAttributeService(coreStart, plugins), capabilities: coreStart.application.capabilities, coreHttp: coreStart.http, coreStart, - data: plugins.data, timefilter: plugins.data.query.timefilter.timefilter, expressionRenderer: plugins.expressions.ReactExpressionRenderer, - documentToExpression: (doc) => + documentToExpression: (doc: LensDocument) => this.editorFrameService!.documentToExpression(doc, { dataViews: plugins.dataViews, storage: new Storage(localStorage), @@ -373,36 +379,45 @@ export class LensPlugin { injectFilterReferences: data.query.filterManager.inject.bind(data.query.filterManager), visualizationMap, datasourceMap, - dataViews: plugins.dataViews, - uiActions: plugins.uiActions, - usageCollection, - inspector: plugins.inspector, - spaces: plugins.spaces, theme: core.theme, uiSettings: core.uiSettings, }; }; if (embeddable) { - embeddable.registerEmbeddableFactory( - 'lens', - new EmbeddableFactory(getStartServicesForEmbeddable) - ); - - embeddable.registerSavedObjectToPanelMethod( - CONTENT_ID, - (savedObject) => { - if (!savedObject.managed) { - return { savedObjectId: savedObject.id }; - } - - const panel = { - attributes: savedObjectToEmbeddableAttributes(savedObject), - }; - - return panel; - } - ); + // Let Kibana know about the Lens embeddable + embeddable.registerReactEmbeddableFactory(LENS_EMBEDDABLE_TYPE, async () => { + const [deps, { createLensEmbeddableFactory }] = await Promise.all([ + getStartServicesForEmbeddable(), + import('./react_embeddable/lens_embeddable'), + ]); + return createLensEmbeddableFactory(deps); + }); + + // Let Dashboard know about the Lens panel type + embeddable.registerReactEmbeddableSavedObject({ + onAdd: async (container, savedObject) => { + const { attributeService } = await getStartServicesForEmbeddable(); + // deserialize the saved object from visualize library + // this make sure to fit into the new embeddable model, where the following build() + // function expects a fully loaded runtime state + const state = await deserializeState( + attributeService, + { savedObjectId: savedObject.id }, + savedObject.references + ); + container.addNewPanel({ + panelType: LENS_EMBEDDABLE_TYPE, + initialState: state, + }); + }, + embeddableType: LENS_EMBEDDABLE_TYPE, + savedObjectType: LENS_EMBEDDABLE_TYPE, + savedObjectName: i18n.translate('xpack.lens.mapSavedObjectLabel', { + defaultMessage: 'Lens', + }), + getIconForSavedObject: () => LENS_ICON, + }); } if (share) { @@ -509,9 +524,10 @@ export class LensPlugin { ); } - urlForwarding.forwardApp('lens', 'lens'); + urlForwarding.forwardApp(APP_ID, APP_ID); - this.initDependenciesForApi = async () => { + // Note: this overwrites a method defined above + this.initEditorFrameService = async () => { const { plugins } = startServices(); await this.initParts( core, @@ -521,6 +537,15 @@ export class LensPlugin { fieldFormats, plugins.fieldFormats.deserialize ); + // This needs to be executed before the import call to avoid race conditions + const [visualizationMap, datasourceMap] = await Promise.all([ + this.editorFrameService!.loadVisualizations(), + this.editorFrameService!.loadDatasources(), + ]); + const { setVisualizationMap, setDatasourceMap } = await import('./async_services'); + setDatasourceMap(datasourceMap); + setVisualizationMap(visualizationMap); + return { datasourceMap, visualizationMap }; }; return { @@ -625,21 +650,33 @@ export class LensPlugin { startDependencies.uiActions.addTriggerAction( DASHBOARD_VISUALIZATION_PANEL_TRIGGER, - visualizeDashboardVisualizePanelction(core.application) + convertToLensActionFactory( + ACTION_CONVERT_DASHBOARD_PANEL_TO_LENS, + i18n.translate('xpack.lens.visualizeLegacyVisualizationChart', { + defaultMessage: 'Visualize legacy visualization chart', + }), + i18n.translate('xpack.lens.dashboardLabel', { + defaultMessage: 'Dashboard', + }) + )(core.application) ); startDependencies.uiActions.addTriggerAction( AGG_BASED_VISUALIZATION_TRIGGER, - visualizeAggBasedVisAction(core.application) + convertToLensActionFactory( + ACTION_CONVERT_DASHBOARD_PANEL_TO_LENS, + i18n.translate('xpack.lens.visualizeAggBasedLegend', { + defaultMessage: 'Visualize agg based chart', + }), + i18n.translate('xpack.lens.AggBasedLabel', { + defaultMessage: 'aggregation based visualization', + }) + )(core.application) ); - const editInLensAction = new ConfigureInLensPanelAction(startDependencies, core); - // dashboard edit panel action - startDependencies.uiActions.addTriggerAction('CONTEXT_MENU_TRIGGER', editInLensAction); - - // Allows the Lens embeddable to easily open the inapp editing flyout + // Allows the Lens embeddable to easily open the inline editing flyout const editLensEmbeddableAction = new EditLensEmbeddableAction(startDependencies, core); - // embeddable edit panel action + // embeddable inline edit panel action startDependencies.uiActions.addTriggerAction( IN_APP_EMBEDDABLE_EDIT_TRIGGER, editLensEmbeddableAction @@ -648,7 +685,7 @@ export class LensPlugin { // Displays the add ESQL panel in the dashboard add Panel menu const createESQLPanelAction = new CreateESQLPanelAction(startDependencies, core, async () => { if (!this.editorFrameService) { - await this.initDependenciesForApi(); + await this.initEditorFrameService(); } return this.editorFrameService!; @@ -668,7 +705,7 @@ export class LensPlugin { } return { - EmbeddableComponent: getEmbeddableComponent(core, startDependencies), + EmbeddableComponent: LensRenderer, SaveModalComponent: getSaveModalComponent(core, startDependencies), navigateToPrefilledEditor: ( input, @@ -705,16 +742,15 @@ export class LensPlugin { const { createFormulaPublicApi, createChartInfoApi, suggestionsApi } = await import( './async_services' ); - if (!this.editorFrameService) { - await this.initDependenciesForApi(); - } - const [visualizationMap, datasourceMap] = await Promise.all([ - this.editorFrameService!.loadVisualizations(), - this.editorFrameService!.loadDatasources(), - ]); + + const { visualizationMap, datasourceMap } = await this.initEditorFrameService(); return { formula: createFormulaPublicApi(), - chartInfo: createChartInfoApi(startDependencies.dataViews, this.editorFrameService), + chartInfo: createChartInfoApi( + startDependencies.dataViews, + visualizationMap, + datasourceMap + ), suggestions: ( context, dataView, @@ -734,15 +770,11 @@ export class LensPlugin { }, }; }, + // TODO: remove this in faviour of the custom action thing + // This is currently used in Discover by the unified histogram plugin EditLensConfigPanelApi: async () => { + const { visualizationMap, datasourceMap } = await this.initEditorFrameService(); const { getEditLensConfiguration } = await import('./async_services'); - if (!this.editorFrameService) { - this.initDependenciesForApi(); - } - const [visualizationMap, datasourceMap] = await Promise.all([ - this.editorFrameService!.loadVisualizations(), - this.editorFrameService!.loadDatasources(), - ]); const Component = await getEditLensConfiguration( core, startDependencies, diff --git a/x-pack/plugins/lens/public/react_embeddable/data_loader.ts b/x-pack/plugins/lens/public/react_embeddable/data_loader.ts new file mode 100644 index 0000000000000..0aed3edf70b89 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/data_loader.ts @@ -0,0 +1,329 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { DefaultInspectorAdapters } from '@kbn/expressions-plugin/common'; +import { fetch$, type FetchContext } from '@kbn/presentation-publishing'; +import { apiPublishesSearchSession } from '@kbn/presentation-publishing/interfaces/fetch/publishes_search_session'; +import { type KibanaExecutionContext } from '@kbn/core/public'; +import { + BehaviorSubject, + type Subscription, + distinctUntilChanged, + debounceTime, + skip, + pipe, + merge, + tap, + map, +} from 'rxjs'; +import fastIsEqual from 'fast-deep-equal'; +import { getEditPath } from '../../common/constants'; +import type { + GetStateType, + LensApi, + LensInternalApi, + LensPublicCallbacks, + VisualizationContextHelper, +} from './types'; +import { getExpressionRendererParams } from './expressions/expression_params'; +import type { LensEmbeddableStartServices } from './types'; +import { prepareCallbacks } from './expressions/callbacks'; +import { buildUserMessagesHelpers } from './user_messages/api'; +import { getLogError } from './expressions/telemetry'; +import type { SharingSavedObjectProps, UserMessagesDisplayLocationId } from '../types'; +import { apiHasLensComponentCallbacks } from './type_guards'; +import { getRenderMode, getParentContext } from './helper'; +import { addLog } from './logger'; +import { getUsedDataViews } from './expressions/update_data_views'; +import { getMergedSearchContext } from './expressions/merged_search_context'; + +const blockingMessageDisplayLocations: UserMessagesDisplayLocationId[] = [ + 'visualization', + 'visualizationOnEmbeddable', +]; + +type ReloadReason = + | 'attributes' + | 'savedObjectId' + | 'overrides' + | 'disableTriggers' + | 'viewMode' + | 'searchContext'; + +/** + * The function computes the expression used to render the panel and produces the necessary props + * for the ExpressionWrapper component, binding any outer context to them. + * @returns + */ +export function loadEmbeddableData( + uuid: string, + getState: GetStateType, + api: LensApi, + parentApi: unknown, + internalApi: LensInternalApi, + services: LensEmbeddableStartServices, + { getVisualizationContext, updateVisualizationContext }: VisualizationContextHelper, + metaInfo?: SharingSavedObjectProps +) { + const { onLoad, onBeforeBadgesRender, ...callbacks } = apiHasLensComponentCallbacks(parentApi) + ? parentApi + : ({} as LensPublicCallbacks); + + // Some convenience api for the user messaging + const { + getUserMessages, + addUserMessages, + updateBlockingErrors, + updateValidationErrors, + updateWarnings, + resetMessages, + updateMessages, + } = buildUserMessagesHelpers( + api, + internalApi, + getVisualizationContext, + services, + onBeforeBadgesRender, + services.spaces, + metaInfo + ); + + const dispatchBlockingErrorIfAny = () => { + const blockingErrors = getUserMessages(blockingMessageDisplayLocations, { + severity: 'error', + }); + updateValidationErrors(blockingErrors); + updateBlockingErrors(blockingErrors); + if (blockingErrors.length > 0) { + internalApi.dispatchError(); + } + return blockingErrors.length > 0; + }; + + const onRenderComplete = () => { + updateMessages(getUserMessages('embeddableBadge')); + // No issues so far, blocking errors are handled directly by Lens from this point on + if (!dispatchBlockingErrorIfAny()) { + internalApi.dispatchRenderComplete(); + } + }; + + const unifiedSearch$ = new BehaviorSubject< + Pick + >({ + query: undefined, + filters: undefined, + timeRange: undefined, + timeslice: undefined, + searchSessionId: undefined, + }); + + async function reload( + // make reload easier to debug + sourceId: ReloadReason + ) { + addLog(`Embeddable reload reason: ${sourceId}`); + resetMessages(); + + // reset the render on reload + internalApi.dispatchRenderStart(); + + // notify about data loading + internalApi.updateDataLoading(true); + + // the component is ready to load + if (apiHasLensComponentCallbacks(parentApi)) { + parentApi.onLoad?.(true); + } + + const currentState = getState(); + + const { searchSessionId, ...unifiedSearch } = unifiedSearch$.getValue(); + + const getExecutionContext = () => { + const parentContext = getParentContext(parentApi); + const lastState = getState(); + if (lastState.attributes) { + const child: KibanaExecutionContext = { + type: 'lens', + name: lastState.attributes.visualizationType ?? '', + id: uuid || 'new', + description: lastState.attributes.title || lastState.title || '', + url: `${services.coreStart.application.getUrlForApp('lens')}${getEditPath( + lastState.savedObjectId + )}`, + }; + + return parentContext + ? { + ...parentContext, + child, + } + : child; + } + }; + + const onDataCallback = (adapters: Partial | undefined) => { + updateVisualizationContext({ + activeData: adapters?.tables?.tables, + }); + // data has loaded + internalApi.updateDataLoading(false); + // The third argument here is an observable to let the + // consumer to be notified on data change + onLoad?.(false, adapters, api.dataLoading); + + api.loadViewUnderlyingData(); + + updateWarnings(); + // Render can still go wrong, so perfor a new check + dispatchBlockingErrorIfAny(); + }; + + const { onRender, onData, handleEvent, disableTriggers } = prepareCallbacks( + api, + internalApi, + parentApi, + getState, + services, + getExecutionContext(), + onDataCallback, + onRenderComplete, + callbacks + ); + + const searchContext = getMergedSearchContext( + currentState, + unifiedSearch, + api.timeRange$, + parentApi, + services + ); + + // Go concurrently: build the expression and fetch the dataViews + const [{ params, abortController, ...rest }, dataViews] = await Promise.all([ + getExpressionRendererParams(currentState, { + searchContext, + api, + settings: { + syncColors: currentState.syncColors, + syncCursor: currentState.syncCursor, + syncTooltips: currentState.syncTooltips, + }, + renderMode: getRenderMode(parentApi), + services, + searchSessionId, + abortController: internalApi.expressionAbortController$.getValue(), + getExecutionContext, + logError: getLogError(getExecutionContext), + addUserMessages, + onRender, + onData, + handleEvent, + disableTriggers, + updateBlockingErrors, + renderCount: internalApi.renderCount$.getValue(), + }), + getUsedDataViews( + currentState.attributes.references, + currentState.attributes.state?.adHocDataViews, + services.dataViews + ), + ]); + + // update the visualization context before anything else + // as it will be used to compute blocking errors also in case of issues + updateVisualizationContext({ + doc: currentState.attributes, + mergedSearchContext: params?.searchContext || {}, + ...rest, + }); + + // Publish the used dataViews on the Lens API + internalApi.updateDataViews(dataViews); + + if (params?.expression != null && !dispatchBlockingErrorIfAny()) { + internalApi.updateExpressionParams(params); + } + + internalApi.updateAbortController(abortController); + } + + // Build a custom operator to be resused for various observables + function waitUntilChanged() { + return pipe(distinctUntilChanged(fastIsEqual), skip(1)); + } + + const mergedSubscriptions = merge( + // on data change from the parentApi, reload + fetch$(api).pipe( + tap((data) => { + const searchSessionId = apiPublishesSearchSession(parentApi) ? data.searchSessionId : ''; + unifiedSearch$.next({ + query: data.query, + filters: data.filters, + timeRange: data.timeRange, + timeslice: data.timeslice, + searchSessionId, + }); + }), + map(() => 'searchContext' as ReloadReason) + ), + // On state change, reload + // this is used to refresh the chart on inline editing + // just make sure to avoid to rerender if there's no substantial change + // make sure to debounce one tick to make the refresh work + internalApi.attributes$.pipe( + waitUntilChanged(), + tap(() => { + // the ES|QL query may have changed, so recompute the args for view underlying data + if (api.isTextBasedLanguage()) { + api.loadViewUnderlyingData(); + } + }), + map(() => 'attributes' as ReloadReason) + ), + api.savedObjectId.pipe( + waitUntilChanged(), + map(() => 'savedObjectId' as ReloadReason) + ), + internalApi.overrides$.pipe( + waitUntilChanged(), + map(() => 'overrides' as ReloadReason) + ), + internalApi.disableTriggers$.pipe( + waitUntilChanged(), + map(() => 'disableTriggers' as ReloadReason) + ) + ); + + const subscriptions: Subscription[] = [ + mergedSubscriptions.pipe(debounceTime(0)).subscribe(reload), + // make sure to reload on viewMode change + api.viewMode.subscribe(() => { + // only reload if drilldowns are set + if (getState().enhancements?.dynamicActions) { + reload('viewMode'); + } + }), + ]; + // There are few key moments when errors are checked and displayed: + // * at setup time (here) before the first expression evaluation + // * at runtime => when the expression is running and ES/Kibana server could emit errors) + // * at data time => data has arrived but for something goes wrong + // * at render time => rendering happened but somethign went wrong + // Bubble the error up to the embeddable system if any + dispatchBlockingErrorIfAny(); + + return { + cleanup: () => { + for (const subscription of subscriptions) { + subscription.unsubscribe(); + } + }, + }; +} diff --git a/x-pack/plugins/lens/public/embeddable/expression_wrapper.tsx b/x-pack/plugins/lens/public/react_embeddable/expression_wrapper.tsx similarity index 88% rename from x-pack/plugins/lens/public/embeddable/expression_wrapper.tsx rename to x-pack/plugins/lens/public/react_embeddable/expression_wrapper.tsx index d16df5bf9d1e8..e0d21d9ba8356 100644 --- a/x-pack/plugins/lens/public/embeddable/expression_wrapper.tsx +++ b/x-pack/plugins/lens/public/react_embeddable/expression_wrapper.tsx @@ -17,7 +17,7 @@ import { DefaultInspectorAdapters, RenderMode } from '@kbn/expressions-plugin/co import classNames from 'classnames'; import { getOriginalRequestErrorMessages } from '../editor_frame_service/error_helper'; import { LensInspector } from '../lens_inspector_service'; -import { AddUserMessages } from '../types'; +import { UserMessage } from '../types'; export interface ExpressionWrapperProps { ExpressionRenderer: ReactExpressionRendererType; @@ -31,7 +31,7 @@ export interface ExpressionWrapperProps { data: unknown, inspectorAdapters?: Partial | undefined ) => void; - onRender$: () => void; + onRender$: (count: number) => void; renderMode?: RenderMode; syncColors?: boolean; syncTooltips?: boolean; @@ -40,7 +40,7 @@ export interface ExpressionWrapperProps { getCompatibleCellValueActions?: ReactExpressionRendererProps['getCompatibleCellValueActions']; style?: React.CSSProperties; className?: string; - addUserMessages: AddUserMessages; + addUserMessages: (messages: UserMessage[]) => void; onRuntimeError: (error: Error) => void; executionContext?: KibanaExecutionContext; lensInspector: LensInspector; @@ -75,7 +75,11 @@ export function ExpressionWrapper({ }: ExpressionWrapperProps) { if (!expression) return null; return ( -
+
{ const messages = getOriginalRequestErrorMessages(error || null); addUserMessages(messages); - if (error?.original) { - onRuntimeError(error.original); - } else { - onRuntimeError(new Error(errorMessage ? errorMessage : '')); - } - + onRuntimeError(error?.original || new Error(errorMessage ? errorMessage : '')); return <>; // the embeddable will take care of displaying the messages }} onEvent={handleEvent} diff --git a/x-pack/plugins/lens/public/react_embeddable/expressions/callbacks.ts b/x-pack/plugins/lens/public/react_embeddable/expressions/callbacks.ts new file mode 100644 index 0000000000000..78a9aa6ab9186 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/expressions/callbacks.ts @@ -0,0 +1,51 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { KibanaExecutionContext } from '@kbn/core/public'; +import type { DefaultInspectorAdapters } from '@kbn/expressions-plugin/common'; +import { apiHasDisableTriggers } from '@kbn/presentation-publishing'; +import { + GetStateType, + LensApi, + LensEmbeddableStartServices, + LensInternalApi, + LensPublicCallbacks, +} from '../types'; +import { prepareOnRender } from './on_render'; +import { prepareEventHandler } from './on_event'; +import { addLog } from '../logger'; + +export function prepareCallbacks( + api: LensApi, + internalApi: LensInternalApi, + parentApi: unknown, + getState: GetStateType, + services: LensEmbeddableStartServices, + executionContext: KibanaExecutionContext | undefined, + onDataUpdate: (adapters: Partial) => void, + dispatchRenderComplete: () => void, + callbacks: LensPublicCallbacks +) { + const disableTriggers = apiHasDisableTriggers(parentApi) ? parentApi.disableTriggers : undefined; + return { + disableTriggers, + onRender: prepareOnRender( + api, + internalApi, + parentApi, + getState, + services, + executionContext, + dispatchRenderComplete + ), + onData: (_data: unknown, adapters: Partial | undefined) => { + addLog(`onData$`); + onDataUpdate(adapters); + }, + handleEvent: prepareEventHandler(api, getState, callbacks, services, disableTriggers), + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/expressions/expression_params.ts b/x-pack/plugins/lens/public/react_embeddable/expressions/expression_params.ts new file mode 100644 index 0000000000000..e10dded4ad8f9 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/expressions/expression_params.ts @@ -0,0 +1,238 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { KibanaExecutionContext } from '@kbn/core-execution-context-common'; +import type { Action } from '@kbn/ui-actions-plugin/public'; +import { RenderMode } from '@kbn/expressions-plugin/common'; +import { ExpressionRendererEvent } from '@kbn/expressions-plugin/public'; +import { toExpression } from '@kbn/interpreter'; +import { noop } from 'lodash'; +import { VIS_EVENT_TO_TRIGGER } from '@kbn/visualizations-plugin/public'; +import { + CellValueContext, + cellValueTrigger, + CELL_VALUE_TRIGGER, +} from '@kbn/embeddable-plugin/public'; +import { DocumentToExpressionReturnType } from '../../async_services'; +import { LensDocument } from '../../persistence'; +import { + GetCompatibleCellValueActions, + IndexPatternMap, + IndexPatternRef, + UserMessage, + isLensFilterEvent, + isLensMultiFilterEvent, + isLensTableRowContextMenuClickEvent, +} from '../../types'; +import type { + ExpressionWrapperProps, + LensApi, + LensEmbeddableStartServices, + LensRuntimeState, +} from '../types'; +import { getVariables } from './variables'; +// import { +// getSearchContextIncompatibleMessage, +// isSearchContextIncompatibleWithDataViews, +// } from '../user_messages/checks'; +import { getExecutionSearchContext, type MergedSearchContext } from './merged_search_context'; + +interface GetExpressionRendererPropsParams { + searchContext: MergedSearchContext; + disableTriggers?: boolean; + renderMode?: RenderMode; + settings: { + syncColors?: boolean; + syncCursor?: boolean; + syncTooltips?: boolean; + }; + services: LensEmbeddableStartServices; + getExecutionContext: () => KibanaExecutionContext | undefined; + searchSessionId?: string; + abortController?: AbortController; + onRender: (count: number) => void; + handleEvent: (event: ExpressionRendererEvent) => void; + onData: ExpressionWrapperProps['onData$']; + logError: (type: 'runtime' | 'validation') => void; + api: LensApi; + addUserMessages: (messages: UserMessage[]) => void; + updateBlockingErrors: (error: Error) => void; + renderCount: number; +} + +async function getExpressionFromDocument( + document: LensDocument, + documentToExpression: (doc: LensDocument) => Promise +) { + const { ast, indexPatterns, indexPatternRefs, activeVisualizationState, activeDatasourceState } = + await documentToExpression(document); + return { + expression: ast ? toExpression(ast) : null, + indexPatterns, + indexPatternRefs, + activeVisualizationState, + activeDatasourceState, + }; +} + +function buildHasCompatibleActions(api: LensApi, { uiActions }: LensEmbeddableStartServices) { + return async (event: ExpressionRendererEvent): Promise => { + if (!uiActions?.getTriggerCompatibleActions) { + return false; + } + if ( + isLensTableRowContextMenuClickEvent(event) || + isLensMultiFilterEvent(event) || + isLensFilterEvent(event) + ) { + const actions = await uiActions.getTriggerCompatibleActions( + VIS_EVENT_TO_TRIGGER[event.name], + { + data: event.data, + embeddable: api, + } + ); + + return actions.length > 0; + } + + return false; + }; +} + +function buildGetCompatibleCellValueActions( + api: LensApi, + { uiActions }: LensEmbeddableStartServices +): GetCompatibleCellValueActions { + return async (data) => { + if (!uiActions?.getTriggerCompatibleActions) { + return []; + } + const actions: Array> = (await uiActions.getTriggerCompatibleActions( + CELL_VALUE_TRIGGER, + { data, embeddable: api } + )) as Array>; + return actions + .sort((a, b) => (a.order ?? Infinity) - (b.order ?? Infinity)) + .map((action) => ({ + id: action.id, + type: action.type, + iconType: action.getIconType({ embeddable: api, data, trigger: cellValueTrigger })!, + displayName: action.getDisplayName({ embeddable: api, data, trigger: cellValueTrigger }), + execute: (cellData) => + action.execute({ embeddable: api, data: cellData, trigger: cellValueTrigger }), + })); + }; +} + +export async function getExpressionRendererParams( + state: LensRuntimeState, + { + settings: { syncColors = true, syncCursor = true, syncTooltips = false }, + services, + disableTriggers = false, + getExecutionContext, + searchSessionId, + abortController, + onRender, + handleEvent, + onData = noop, + logError, + api, + addUserMessages, + updateBlockingErrors, + searchContext, + renderCount, + }: GetExpressionRendererPropsParams +): Promise<{ + params: ExpressionWrapperProps | null; + abortController?: AbortController; + indexPatterns: IndexPatternMap; + indexPatternRefs: IndexPatternRef[]; + activeVisualizationState?: unknown; + activeDatasourceState?: unknown; +}> { + const { expressionRenderer, documentToExpression } = services; + + const { + expression, + indexPatterns, + indexPatternRefs, + activeVisualizationState, + activeDatasourceState, + } = await getExpressionFromDocument(state.attributes, documentToExpression); + + // Apparently this change produces had lots of issues with solutions not using + // the Embeddable incorrectly. Will comment for now and later on will restore it when + // https://github.com/elastic/kibana/issues/200236 is resolved + // + // if at least one indexPattern is time based, then the Lens embeddable requires the timeRange prop + // this is necessary for the dataview embeddable but not the ES|QL one + // if ( + // isSearchContextIncompatibleWithDataViews( + // api, + // getExecutionContext(), + // searchContext, + // indexPatternRefs, + // indexPatterns + // ) + // ) { + // addUserMessages([getSearchContextIncompatibleMessage()]); + // } + + if (expression) { + const params: ExpressionWrapperProps = { + expression, + syncColors, + syncCursor, + syncTooltips, + searchSessionId, + onRender$: onRender, + handleEvent, + onData$: onData, + // Remove ES|QL query from it + searchContext: getExecutionSearchContext(searchContext), + interactive: !disableTriggers, + executionContext: getExecutionContext(), + lensInspector: { + getInspectorAdapters: api.getInspectorAdapters, + inspect: api.inspect, + closeInspector: api.closeInspector, + }, + ExpressionRenderer: expressionRenderer, + addUserMessages, + onRuntimeError: (error: Error) => { + updateBlockingErrors(error); + logError('runtime'); + }, + abortController, + hasCompatibleActions: buildHasCompatibleActions(api, services), + getCompatibleCellValueActions: buildGetCompatibleCellValueActions(api, services), + variables: getVariables(api, state), + style: state.style, + className: state.className, + noPadding: state.noPadding, + }; + return { + indexPatterns, + indexPatternRefs, + activeVisualizationState, + activeDatasourceState, + params, + abortController, + }; + } + + return { + params: null, + abortController, + indexPatterns, + indexPatternRefs, + activeVisualizationState, + activeDatasourceState, + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/expressions/merged_search_context.ts b/x-pack/plugins/lens/public/react_embeddable/expressions/merged_search_context.ts new file mode 100644 index 0000000000000..5b467dd706a69 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/expressions/merged_search_context.ts @@ -0,0 +1,91 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { DataPublicPluginStart, FilterManager } from '@kbn/data-plugin/public'; +import { + type AggregateQuery, + type Filter, + isOfAggregateQueryType, + type Query, + type TimeRange, + ExecutionContextSearch, +} from '@kbn/es-query'; +import { PublishingSubject, apiPublishesTimeslice } from '@kbn/presentation-publishing'; +import type { LensRuntimeState } from '../types'; +import { nonNullable } from '../../utils'; + +export interface MergedSearchContext { + now: number; + timeRange: TimeRange | undefined; + query: Array; + filters: Filter[]; + disableWarningToasts: boolean; +} + +export function getMergedSearchContext( + { attributes }: LensRuntimeState, + { + filters, + query, + timeRange, + }: { + filters?: Filter[]; + query?: Query | AggregateQuery; + timeRange?: TimeRange; + }, + customTimeRange$: PublishingSubject, + parentApi: unknown, + { + data, + injectFilterReferences, + }: { data: DataPublicPluginStart; injectFilterReferences: FilterManager['inject'] } +): MergedSearchContext { + const parentTimeSlice = apiPublishesTimeslice(parentApi) + ? parentApi.timeslice$.getValue() + : undefined; + + const timesliceTimeRange = parentTimeSlice + ? { + from: new Date(parentTimeSlice[0]).toISOString(), + to: new Date(parentTimeSlice[1]).toISOString(), + mode: 'absolute' as 'absolute', + } + : undefined; + + const customTimeRange = customTimeRange$.getValue(); + + const timeRangeToRender = customTimeRange ?? timesliceTimeRange ?? timeRange; + const context = { + now: data.nowProvider.get().getTime(), + timeRange: timeRangeToRender, + query: [attributes.state.query].filter(nonNullable), + filters: injectFilterReferences(attributes.state.filters || [], attributes.references), + disableWarningToasts: true, + }; + // Prepend query and filters from dashboard to the visualization ones + if (query) { + if (!isOfAggregateQueryType(query)) { + context.query.unshift(query); + } + } + if (filters) { + context.filters.unshift(...filters.filter(({ meta }) => !meta.disabled)); + } + return context; +} + +export function getExecutionSearchContext( + searchContext: MergedSearchContext +): ExecutionContextSearch { + if (!isOfAggregateQueryType(searchContext.query[0])) { + return searchContext as ExecutionContextSearch; + } + return { + ...searchContext, + query: [], + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/expressions/on_event.test.ts b/x-pack/plugins/lens/public/react_embeddable/expressions/on_event.test.ts new file mode 100644 index 0000000000000..dfddfe84b57cc --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/expressions/on_event.test.ts @@ -0,0 +1,181 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ExpressionRendererEvent } from '@kbn/expressions-plugin/public'; +import { getLensApiMock, getLensRuntimeStateMock, makeEmbeddableServices } from '../mocks'; +import { LensApi, LensEmbeddableStartServices, LensPublicCallbacks } from '../types'; +import { prepareEventHandler } from './on_event'; +import faker from 'faker'; +import { + LENS_EDIT_PAGESIZE_ACTION, + LENS_EDIT_RESIZE_ACTION, + LENS_EDIT_SORT_ACTION, + LENS_TOGGLE_ACTION, +} from '../../visualizations/datatable/components/constants'; + +describe('Embeddable interaction event handlers', () => { + beforeEach(() => { + // LensAPI mock is a static mock, so we need to reset it between tests + jest.resetAllMocks(); + }); + + function getCallbacks(shouldPreventDefault?: boolean) { + if (!shouldPreventDefault) { + return { onFilter: jest.fn(), onBrushEnd: jest.fn(), onTableRowClick: jest.fn() }; + } + return { + onFilter: jest.fn((event) => event.preventDefault()), + onBrushEnd: jest.fn((event) => event.preventDefault()), + onTableRowClick: jest.fn((event) => event.preventDefault()), + }; + } + + function getHandler( + api: LensApi = getLensApiMock(), + callbacks: LensPublicCallbacks = getCallbacks(), + services: LensEmbeddableStartServices = makeEmbeddableServices(), + disableTriggers: boolean = false + ) { + return prepareEventHandler( + api, + jest.fn(() => getLensRuntimeStateMock()), + callbacks, + services, + disableTriggers + ); + } + + function getTable() { + return { columns: { test: { meta: { field: '@timestamp', sourceParams: {} } } } }; + } + + async function submitEvent(event: ExpressionRendererEvent, callPreventDefault: boolean = false) { + const onEditAction = jest.fn(); + const callbacks = getCallbacks(callPreventDefault); + const services = makeEmbeddableServices(undefined, undefined, { + visOverrides: { id: 'lnsXY', onEditAction }, + }); + const lensApi = getLensApiMock(); + const handler = getHandler(lensApi, callbacks, services); + + await handler(event); + + return { + reSubmit: (newEvent: ExpressionRendererEvent) => handler(newEvent), + callbacks, + getTrigger: services.uiActions.getTrigger, + updateAttributes: lensApi.updateAttributes, + onEditAction, + }; + } + + it('should call onTableRowClick event ', async () => { + const event = { + name: 'tableRowContextMenuClick', + data: { rowIndex: 1, table: getTable() }, + }; + const { callbacks } = await submitEvent(event); + expect(callbacks.onTableRowClick).toHaveBeenCalledWith(expect.objectContaining(event.data)); + }); + it('should prevent onTableRowClick trigger when calling preventDefault ', async () => { + const event = { + name: 'tableRowContextMenuClick', + data: { rowIndex: 1, table: getTable() }, + }; + const { getTrigger } = await submitEvent(event, true); + expect(getTrigger).not.toHaveBeenCalled(); + }); + it('should call onBrush event on filter call ', async () => { + const event = { + name: 'brush', + data: { column: 'test', range: [1, 2], table: getTable() }, + }; + const { callbacks } = await submitEvent(event); + expect(callbacks.onBrushEnd).toHaveBeenCalledWith(expect.objectContaining(event.data)); + }); + it('should prevent the onBrush trigger when calling preventDefault', async () => { + const event = { + name: 'brush', + data: { column: 'test', range: [1, 2], table: getTable() }, + }; + const { getTrigger } = await submitEvent(event, true); + expect(getTrigger).not.toHaveBeenCalled(); + }); + it('should call onFilter event on filter call ', async () => { + const event = { + name: 'filter', + data: { + data: [{ value: faker.random.number(), row: 1, column: 'test', table: getTable() }], + }, + }; + const { callbacks } = await submitEvent(event); + expect(callbacks.onFilter).toHaveBeenCalledWith(expect.objectContaining(event.data)); + }); + it('should prevent the onFilter trigger when calling preventDefault', async () => { + const event = { + name: 'filter', + data: { + data: [{ value: faker.random.number(), row: 1, column: 'test', table: getTable() }], + }, + }; + const { getTrigger } = await submitEvent(event, true); + expect(getTrigger).not.toHaveBeenCalled(); + }); + + it('should reload on edit events', async () => { + const { reSubmit, onEditAction, updateAttributes } = await submitEvent({ + name: 'edit', + data: { action: LENS_EDIT_SORT_ACTION }, + }); + + expect(onEditAction).toHaveBeenCalled(); + expect(updateAttributes).toHaveBeenCalled(); + + await reSubmit({ name: 'edit', data: { action: LENS_EDIT_RESIZE_ACTION } }); + + expect(onEditAction).toHaveBeenCalled(); + expect(updateAttributes).toHaveBeenCalled(); + + await reSubmit({ name: 'edit', data: { action: LENS_TOGGLE_ACTION } }); + + expect(onEditAction).toHaveBeenCalled(); + expect(updateAttributes).toHaveBeenCalled(); + + await reSubmit({ name: 'edit', data: { action: LENS_EDIT_PAGESIZE_ACTION } }); + + expect(onEditAction).toHaveBeenCalled(); + expect(updateAttributes).toHaveBeenCalled(); + }); + + it('should not reload on non-edit events', async () => { + const { reSubmit, onEditAction, updateAttributes } = await submitEvent({ + name: 'tableRowContextMenuClick', + data: { rowIndex: 1, table: getTable() }, + }); + + expect(onEditAction).not.toHaveBeenCalled(); + expect(updateAttributes).not.toHaveBeenCalled(); + + await reSubmit({ + name: 'brush', + data: { column: 'test', range: [1, 2], table: getTable() }, + }); + + expect(onEditAction).not.toHaveBeenCalled(); + expect(updateAttributes).not.toHaveBeenCalled(); + + await reSubmit({ + name: 'filter', + data: { + data: [{ value: faker.random.number(), row: 1, column: 'test', table: getTable() }], + }, + }); + + expect(onEditAction).not.toHaveBeenCalled(); + expect(updateAttributes).not.toHaveBeenCalled(); + }); +}); diff --git a/x-pack/plugins/lens/public/react_embeddable/expressions/on_event.ts b/x-pack/plugins/lens/public/react_embeddable/expressions/on_event.ts new file mode 100644 index 0000000000000..71ce4e15693c8 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/expressions/on_event.ts @@ -0,0 +1,113 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ExpressionRendererEvent } from '@kbn/expressions-plugin/public'; +import { VIS_EVENT_TO_TRIGGER } from '@kbn/visualizations-plugin/public'; +import { type AggregateQuery, type Query, isOfAggregateQueryType } from '@kbn/es-query'; +import { + isLensBrushEvent, + isLensEditEvent, + isLensFilterEvent, + isLensMultiFilterEvent, + isLensTableRowContextMenuClickEvent, +} from '../../types'; +import { inferTimeField } from '../../utils'; +import type { + GetStateType, + LensApi, + LensEmbeddableStartServices, + LensPublicCallbacks, +} from '../types'; +import { isTextBasedLanguage } from '../helper'; +import { addLog } from '../logger'; + +export const prepareEventHandler = + ( + api: LensApi, + getState: GetStateType, + callbacks: LensPublicCallbacks, + { data, uiActions, visualizationMap }: LensEmbeddableStartServices, + disableTriggers: boolean | undefined + ) => + async (event: ExpressionRendererEvent) => { + if (!uiActions?.getTrigger || disableTriggers) { + return; + } + addLog(`onEvent$`); + + let eventHandler: + | LensPublicCallbacks['onBrushEnd'] + | LensPublicCallbacks['onFilter'] + | LensPublicCallbacks['onTableRowClick']; + let shouldExecuteDefaultTriggers = true; + + if (isLensBrushEvent(event)) { + eventHandler = callbacks.onBrushEnd; + } else if (isLensFilterEvent(event) || isLensMultiFilterEvent(event)) { + eventHandler = callbacks.onFilter; + } else if (isLensTableRowContextMenuClickEvent(event)) { + eventHandler = callbacks.onTableRowClick; + } + const currentState = getState(); + + eventHandler?.({ + ...event.data, + preventDefault: () => { + shouldExecuteDefaultTriggers = false; + }, + }); + + if (isLensFilterEvent(event) || isLensMultiFilterEvent(event) || isLensBrushEvent(event)) { + if (shouldExecuteDefaultTriggers) { + // if the embeddable is located in an app where there is the Unified search bar with the ES|QL editor, then use this query + // otherwise use the query from the saved object + let esqlQuery: AggregateQuery | Query | undefined; + if (isTextBasedLanguage(currentState)) { + const query = data.query.queryString.getQuery(); + esqlQuery = isOfAggregateQueryType(query) ? query : currentState.attributes.state.query; + } + uiActions.getTrigger(VIS_EVENT_TO_TRIGGER[event.name]).exec({ + data: { + ...event.data, + timeFieldName: + event.data.timeFieldName || inferTimeField(data.datatableUtilities, event), + query: esqlQuery, + }, + embeddable: api, + }); + } + } + + if (isLensTableRowContextMenuClickEvent(event)) { + if (shouldExecuteDefaultTriggers) { + uiActions.getTrigger(VIS_EVENT_TO_TRIGGER[event.name]).exec( + { + data: event.data, + embeddable: api, + }, + true + ); + } + } + + const onEditAction = currentState.attributes.visualizationType + ? visualizationMap[currentState.attributes.visualizationType]?.onEditAction + : undefined; + + // We allow for edit actions in the Embeddable for display purposes only (e.g. changing the datatable sort order). + // No state changes made here with an edit action are persisted. + if (isLensEditEvent(event) && onEditAction) { + // updating the state would trigger a reload + api.updateAttributes({ + ...currentState.attributes, + state: { + ...currentState.attributes.state, + visualization: onEditAction(currentState.attributes.state.visualization, event), + }, + }); + } + }; diff --git a/x-pack/plugins/lens/public/react_embeddable/expressions/on_render.ts b/x-pack/plugins/lens/public/react_embeddable/expressions/on_render.ts new file mode 100644 index 0000000000000..ba0a47b5944e3 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/expressions/on_render.ts @@ -0,0 +1,112 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { KibanaExecutionContext } from '@kbn/core-execution-context-common'; +import { canTrackContentfulRender } from '@kbn/presentation-containers'; +import { reportPerformanceMetricEvent } from '@kbn/ebt-tools'; +import { TableInspectorAdapter } from '../../editor_frame_service/types'; + +import { getExecutionContextEvents, trackUiCounterEvents } from '../../lens_ui_telemetry'; +import { GetStateType, LensApi, LensEmbeddableStartServices, LensInternalApi } from '../types'; +import { getSuccessfulRequestTimings } from '../../report_performance_metric_util'; +import { addLog } from '../logger'; + +function trackContentfulRender(activeData: TableInspectorAdapter, parentApi: unknown) { + if (!canTrackContentfulRender(parentApi)) { + return; + } + + const hasData = Object.values(activeData).some((table) => { + if (table.meta?.statistics?.totalCount != null) { + // if totalCount is set, refer to total count + return table.meta.statistics.totalCount > 0; + } + // if not, fall back to check the rows of the table + return table.rows.length > 0; + }); + + if (hasData) { + parentApi.trackContentfulRender(); + } +} + +function trackPerformanceMetrics( + api: LensApi, + coreStart: LensEmbeddableStartServices['coreStart'] +) { + const inspectorAdapters = api.getInspectorAdapters(); + const timings = getSuccessfulRequestTimings(inspectorAdapters); + if (timings) { + const esRequestMetrics = { + eventName: 'lens_chart_es_request_totals', + duration: timings.requestTimeTotal, + key1: 'es_took_total', + value1: timings.esTookTotal, + }; + reportPerformanceMetricEvent(coreStart.analytics, esRequestMetrics); + } +} + +export function prepareOnRender( + api: LensApi, + internalApi: LensInternalApi, + parentApi: unknown, + getState: GetStateType, + { datasourceMap, visualizationMap, coreStart }: LensEmbeddableStartServices, + executionContext: KibanaExecutionContext | undefined, + dispatchRenderComplete: () => void +) { + return function onRender$(count: number) { + addLog(`onRender$ ${count}`); + // for some reason onRender$ is emitting multiple times with the same render count + // so avoid to repeat the same logic on duplicate calls + if (count === internalApi.renderCount$.getValue()) { + return; + } + let datasourceEvents: string[] = []; + let visualizationEvents: string[] = []; + const currentState = getState(); + + if (currentState) { + datasourceEvents = Object.values(datasourceMap).reduce( + (acc, datasource) => [ + ...acc, + ...(datasource.getRenderEventCounters?.( + currentState.attributes.state.datasourceStates[datasource.id] + ) ?? []), + ], + [] + ); + + if (currentState.attributes.visualizationType) { + visualizationEvents = + visualizationMap[currentState.attributes.visualizationType].getRenderEventCounters?.( + currentState.attributes.state.visualization + ) ?? []; + } + } + + const events = [ + ...datasourceEvents, + ...visualizationEvents, + ...getExecutionContextEvents(executionContext), + ]; + + const adHocDataViews = Object.values(currentState.attributes.state.adHocDataViews || {}); + adHocDataViews.forEach(() => { + events.push('ad_hoc_data_view'); + }); + + trackUiCounterEvents(events, executionContext); + + trackContentfulRender(api.getInspectorAdapters().tables?.tables, parentApi); + + dispatchRenderComplete(); + + trackPerformanceMetrics(api, coreStart); + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/expressions/telemetry.ts b/x-pack/plugins/lens/public/react_embeddable/expressions/telemetry.ts new file mode 100644 index 0000000000000..ede2f1b0aaf37 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/expressions/telemetry.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { KibanaExecutionContext } from '@kbn/core/public'; +import { trackUiCounterEvents } from '../../lens_ui_telemetry'; + +export function getLogError(getExecutionContext: () => KibanaExecutionContext | undefined) { + return (type: 'runtime' | 'validation') => { + trackUiCounterEvents( + type === 'runtime' ? 'embeddable_runtime_error' : 'embeddable_validation_error', + getExecutionContext() + ); + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/expressions/update_data_views.ts b/x-pack/plugins/lens/public/react_embeddable/expressions/update_data_views.ts new file mode 100644 index 0000000000000..0e7f130d339db --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/expressions/update_data_views.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { uniqBy } from 'lodash'; +import { getIndexPatternsObjects } from '../../utils'; +import { LensEmbeddableStartServices, LensRuntimeState } from '../types'; + +export async function getUsedDataViews( + references: LensRuntimeState['attributes']['references'], + adHocDataViewsSpecs: LensRuntimeState['attributes']['state']['adHocDataViews'], + dataViews: LensEmbeddableStartServices['dataViews'] +) { + const [{ indexPatterns }, ...adHocDataViews] = await Promise.all([ + getIndexPatternsObjects(references.map(({ id }) => id) || [], dataViews), + ...Object.values(adHocDataViewsSpecs || {}).map((spec) => dataViews.create(spec)), + ]); + + return uniqBy(indexPatterns.concat(adHocDataViews), 'id'); +} diff --git a/x-pack/plugins/lens/public/react_embeddable/expressions/variables.ts b/x-pack/plugins/lens/public/react_embeddable/expressions/variables.ts new file mode 100644 index 0000000000000..c1fdda750199f --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/expressions/variables.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { Datatable } from '@kbn/expressions-plugin/common'; +import type { TextBasedPersistedState } from '../../datasources/text_based/types'; +import { LensApi, LensRuntimeState } from '../types'; + +function getInternalTables(states: Record) { + const result: Record = {}; + if ('textBased' in states) { + const layers = (states.textBased as TextBasedPersistedState).layers; + for (const layer in layers) { + if (layers[layer]?.table) { + result[layer] = layers[layer].table!; + } + } + } + return result; +} + +/** + * Collect all the data that need to be forwarded at the end of the + * expression pipeline as overrides, palette, etc... and merged them all here + */ +export function getVariables(api: LensApi, state: LensRuntimeState) { + return { + embeddableTitle: api.defaultPanelTitle?.getValue(), + ...(state.palette ? { theme: { palette: state.palette } } : {}), + ...('overrides' in state ? { overrides: state.overrides } : {}), + ...getInternalTables(state.attributes.state.datasourceStates), + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/helper.test.ts b/x-pack/plugins/lens/public/react_embeddable/helper.test.ts new file mode 100644 index 0000000000000..33a8d0d0093d4 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/helper.test.ts @@ -0,0 +1,108 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { defaultDoc, makeAttributeService } from '../mocks/services_mock'; +import { deserializeState } from './helper'; + +describe('Embeddable helpers', () => { + describe('deserializeState', () => { + it('should forward a by value raw state', async () => { + const attributeService = makeAttributeService(defaultDoc); + const rawState = { + attributes: defaultDoc, + }; + const runtimeState = await deserializeState(attributeService, rawState); + expect(runtimeState).toEqual(rawState); + }); + + it('should wrap Lens doc/attributes into component state shape', async () => { + const attributeService = makeAttributeService(defaultDoc); + const runtimeState = await deserializeState(attributeService, defaultDoc); + expect(runtimeState).toEqual( + expect.objectContaining({ + attributes: { ...defaultDoc, references: defaultDoc.references }, + }) + ); + }); + + it('load a by-ref doc from the attribute service', async () => { + const attributeService = makeAttributeService(defaultDoc); + await deserializeState(attributeService, { + savedObjectId: '123', + }); + + expect(attributeService.loadFromLibrary).toHaveBeenCalledWith('123'); + }); + + it('should fallback to an empty Lens doc if the saved object is not found', async () => { + const attributeService = makeAttributeService(defaultDoc); + attributeService.loadFromLibrary.mockRejectedValueOnce(new Error('not found')); + const runtimeState = await deserializeState(attributeService, { + savedObjectId: '123', + }); + // check the visualizationType set to null for empty state + expect(runtimeState.attributes.visualizationType).toBeNull(); + }); + + describe('injected references should overwrite inner ones', () => { + // There are 3 possible scenarios here for reference injections: + // * default space for a by-value + // * default space for a by-ref with a "lens" panel reference type + // * other space for a by-value with new ref ids + + it('should inject correctly serialized references into runtime state for a by value in the default space', async () => { + const attributeService = makeAttributeService(defaultDoc); + const mockedReferences = [ + { id: 'serializedRefs', name: 'index-pattern-0', type: 'mocked-reference' }, + ]; + const runtimeState = await deserializeState( + attributeService, + { + attributes: defaultDoc, + }, + mockedReferences + ); + expect(attributeService.injectReferences).toHaveBeenCalled(); + expect(runtimeState.attributes.references).toEqual(mockedReferences); + }); + + it('should inject correctly serialized references into runtime state for a by ref in the default space', async () => { + const attributeService = makeAttributeService(defaultDoc); + const mockedReferences = [ + { id: 'serializedRefs', name: 'index-pattern-0', type: 'mocked-reference' }, + ]; + const runtimeState = await deserializeState( + attributeService, + { + savedObjectId: '123', + }, + mockedReferences + ); + expect(attributeService.injectReferences).not.toHaveBeenCalled(); + // Note the original references should be kept + expect(runtimeState.attributes.references).toEqual(defaultDoc.references); + }); + + it('should inject correctly serialized references into runtime state for a by value in another space', async () => { + const attributeService = makeAttributeService(defaultDoc); + const mockedReferences = [ + { id: 'serializedRefs', name: 'index-pattern-0', type: 'mocked-reference' }, + ]; + const runtimeState = await deserializeState( + attributeService, + { + attributes: defaultDoc, + }, + mockedReferences + ); + expect(attributeService.injectReferences).toHaveBeenCalled(); + // note: in this case the references are swapped + expect(runtimeState.attributes.references).toEqual(mockedReferences); + }); + }); + }); +}); diff --git a/x-pack/plugins/lens/public/react_embeddable/helper.ts b/x-pack/plugins/lens/public/react_embeddable/helper.ts new file mode 100644 index 0000000000000..3ee63d907068d --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/helper.ts @@ -0,0 +1,147 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + apiHasParentApi, + apiPublishesViewMode, + getInheritedViewMode, + ViewMode, + type PublishingSubject, + apiHasExecutionContext, +} from '@kbn/presentation-publishing'; +import { isObject } from 'lodash'; +import { BehaviorSubject } from 'rxjs'; +import fastIsEqual from 'fast-deep-equal'; +import { isOfAggregateQueryType } from '@kbn/es-query'; +import { RenderMode } from '@kbn/expressions-plugin/common'; +import { SavedObjectReference } from '@kbn/core/types'; +import { LensRuntimeState, LensSerializedState } from './types'; +import type { LensAttributesService } from '../lens_attribute_service'; + +export function createEmptyLensState( + visualizationType: null | string = null, + title?: LensSerializedState['title'], + description?: LensSerializedState['description'], + query?: LensSerializedState['query'], + filters?: LensSerializedState['filters'] +) { + const isTextBased = query && isOfAggregateQueryType(query); + return { + attributes: { + title: title ?? '', + description: description ?? '', + visualizationType, + references: [], + state: { + query: query || { query: '', language: 'kuery' }, + filters: filters || [], + internalReferences: [], + datasourceStates: { ...(isTextBased ? { text_based: {} } : { form_based: {} }) }, + visualization: {}, + }, + }, + }; +} + +// Shared logic to ensure the attributes are correctly loaded +// Make sure to inject references from the container down to the runtime state +// this ensure migrations/copy to spaces works correctly +export async function deserializeState( + attributeService: LensAttributesService, + rawState: LensSerializedState, + references?: SavedObjectReference[] +) { + if (rawState.savedObjectId) { + try { + const { attributes, managed, sharingSavedObjectProps } = + await attributeService.loadFromLibrary(rawState.savedObjectId); + return { ...rawState, attributes, managed, sharingSavedObjectProps }; + } catch (e) { + // return an empty Lens document if no saved object is found + return { ...rawState, attributes: createEmptyLensState().attributes }; + } + } + // Inject applied only to by-value SOs + return attributeService.injectReferences( + ('attributes' in rawState ? rawState : { attributes: rawState }) as LensRuntimeState, + references?.length ? references : undefined + ); +} + +export function emptySerializer() { + return {}; +} + +export type ComparatorType = [ + BehaviorSubject, + (newValue: T) => void, + (a: T, b: T) => boolean +]; + +export function makeComparator( + observable: BehaviorSubject +): ComparatorType { + return [observable, (newValue: T) => observable.next(newValue), fastIsEqual]; +} + +/** + * Helper function to either extract an observable from an API or create a new one + * with a default value to start with. + * Note that extracting from the API will make subscription emit if the value changes upstream + * as it keeps the original reference without cloning. + * @returns the observable and a comparator to use for detecting "unsaved changes" on it + */ +export function buildObservableVariable( + variable: T | PublishingSubject +): [BehaviorSubject, ComparatorType] { + if (variable instanceof BehaviorSubject) { + return [variable, makeComparator(variable)]; + } + const variable$ = new BehaviorSubject(variable as T); + return [variable$, makeComparator(variable$)]; +} + +export function isTextBasedLanguage(state: LensRuntimeState) { + return isOfAggregateQueryType(state.attributes?.state.query); +} + +export function getViewMode(api: unknown) { + return apiPublishesViewMode(api) ? getInheritedViewMode(api) : undefined; +} + +export function getRenderMode(api: unknown): RenderMode { + const mode = getViewMode(api) ?? 'view'; + return mode === 'print' ? 'view' : mode; +} + +function apiHasExecutionContextFunction( + api: unknown +): api is { getAppContext: () => { currentAppId: string } } { + return isObject(api) && 'getAppContext' in api && typeof api.getAppContext === 'function'; +} + +export function getParentContext(parentApi: unknown) { + if (apiHasExecutionContext(parentApi)) { + return parentApi.executionContext; + } + if (apiHasExecutionContextFunction(parentApi)) { + return { type: parentApi.getAppContext().currentAppId }; + } + return; +} + +export function extractInheritedViewModeObservable( + parentApi?: unknown +): PublishingSubject { + if (apiPublishesViewMode(parentApi)) { + return parentApi.viewMode; + } + if (apiHasParentApi(parentApi)) { + return extractInheritedViewModeObservable(parentApi.parentApi); + } + return new BehaviorSubject('view'); +} diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.test.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.test.ts new file mode 100644 index 0000000000000..a4f84c329bd3c --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.test.ts @@ -0,0 +1,131 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { pick } from 'lodash'; +import faker from 'faker'; +import type { LensRuntimeState, VisualizationContext } from '../types'; +import { initializeActionApi } from './initialize_actions'; +import { + getLensApiMock, + makeEmbeddableServices, + getLensRuntimeStateMock, + getVisualizationContextHelperMock, + createUnifiedSearchApi, +} from '../mocks'; +import { createEmptyLensState } from '../helper'; +const DATAVIEW_ID = 'myDataView'; + +jest.mock('../../app_plugin/show_underlying_data', () => { + return { + ...jest.requireActual('../../app_plugin/show_underlying_data'), + getLayerMetaInfo: jest.fn(() => ({ + meta: { + id: DATAVIEW_ID, + columns: ['a', 'b'], + filters: { disabled: [], enabled: [] }, + }, + error: undefined, + isVisible: true, + })), + }; +}); + +function setupActionsApi( + stateOverrides?: Partial, + contextOverrides?: Omit +) { + const services = makeEmbeddableServices(undefined, undefined, { + visOverrides: { id: 'lnsXY' }, + dataOverrides: { id: 'form_based' }, + }); + const uuid = faker.random.uuid(); + const runtimeState = getLensRuntimeStateMock(stateOverrides); + const apiMock = getLensApiMock(); + + const { api } = initializeActionApi( + uuid, + runtimeState, + () => runtimeState, + createUnifiedSearchApi(), + pick(apiMock, ['timeRange$']), + pick(apiMock, ['panelTitle']), + getVisualizationContextHelperMock(stateOverrides?.attributes, contextOverrides), + { + ...services, + data: { + ...services.data, + nowProvider: { ...services.data.nowProvider, get: jest.fn(() => new Date()) }, + }, + } + ); + return api; +} + +describe('Dashboard actions', () => { + describe('Drilldowns', () => { + it('should expose drilldowns for DSL based visualization', async () => { + const api = setupActionsApi(); + expect(api.enhancements).toBeDefined(); + }); + + it('should not expose drilldowns for ES|QL chart types', async () => { + const api = setupActionsApi( + createEmptyLensState('lnsXY', faker.lorem.words(), faker.lorem.text(), { + esql: 'FROM index', + }) + ); + expect(api.enhancements).toBeUndefined(); + }); + }); + + describe('Explore in Discover', () => { + // make it pass the basic check on viewUnderlyingData + const visualizationContextMockOverrides = { + mergedSearchContext: {}, + indexPatterns: { + [DATAVIEW_ID]: { + id: DATAVIEW_ID, + title: 'idx1', + timeFieldName: 'timestamp', + hasRestrictions: false, + fields: [ + { + name: 'timestamp', + displayName: 'timestampLabel', + type: 'date', + aggregatable: true, + searchable: true, + }, + ], + getFieldByName: jest.fn(), + isPersisted: true, + spec: {}, + }, + }, + indexPatternRefs: [], + activeVisualizationState: {}, + activeDatasourceState: {}, + activeData: {}, + }; + it('should expose the "explore in discover" capability for DSL based visualization when compatible', async () => { + const api = setupActionsApi(undefined, visualizationContextMockOverrides); + api.loadViewUnderlyingData(); + expect(api.canViewUnderlyingData$.getValue()).toBe(true); + }); + + it('should expose the "explore in discover" capability for ES|QL chart types', async () => { + const api = setupActionsApi( + createEmptyLensState('lnsXY', faker.lorem.words(), faker.lorem.text(), { + esql: 'FROM index', + }), + visualizationContextMockOverrides + ); + api.loadViewUnderlyingData(); + expect(api.canViewUnderlyingData$.getValue()).toBe(true); + }); + }); +}); diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.ts new file mode 100644 index 0000000000000..65fd13c8fca50 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.ts @@ -0,0 +1,276 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Capabilities } from '@kbn/core-capabilities-common'; +import { getEsQueryConfig } from '@kbn/data-plugin/public'; +import { + AggregateQuery, + EsQueryConfig, + Filter, + Query, + TimeRange, + isOfQueryType, +} from '@kbn/es-query'; +import { + PublishingSubject, + StateComparators, + apiPublishesUnifiedSearch, + getUnchangingComparator, +} from '@kbn/presentation-publishing'; +import { HasDynamicActions } from '@kbn/embeddable-enhanced-plugin/public'; +import { DynamicActionsSerializedState } from '@kbn/embeddable-enhanced-plugin/public/plugin'; +import { partition } from 'lodash'; +import { Visualization } from '../..'; +import { combineQueryAndFilters, getLayerMetaInfo } from '../../app_plugin/show_underlying_data'; +import { TableInspectorAdapter } from '../../editor_frame_service/types'; + +import { Datasource, IndexPatternMap } from '../../types'; +import { getMergedSearchContext } from '../expressions/merged_search_context'; +import { buildObservableVariable, isTextBasedLanguage } from '../helper'; +import type { + GetStateType, + LensEmbeddableStartServices, + LensRuntimeState, + ViewInDiscoverCallbacks, + ViewUnderlyingDataArgs, + VisualizationContextHelper, +} from '../types'; +import { getActiveDatasourceIdFromDoc, getActiveVisualizationIdFromDoc } from '../../utils'; + +function getViewUnderlyingDataArgs({ + activeDatasource, + activeDatasourceState, + activeVisualization, + activeVisualizationState, + activeData, + dataViews, + capabilities, + query, + filters, + timeRange, + esQueryConfig, +}: { + activeDatasource: Datasource; + activeDatasourceState: unknown; + activeVisualization: Visualization; + activeVisualizationState: unknown; + activeData: TableInspectorAdapter | undefined; + dataViews: IndexPatternMap; + capabilities: { + canSaveVisualizations: boolean; + canOpenVisualizations: boolean; + canSaveDashboards: boolean; + navLinks: Capabilities['navLinks']; + discover: Capabilities['discover']; + }; + query: Array; + filters: Filter[]; + timeRange: TimeRange; + esQueryConfig: EsQueryConfig; +}) { + const { error, meta } = getLayerMetaInfo( + activeDatasource, + activeDatasourceState, + activeVisualization, + activeVisualizationState, + activeData, + dataViews, + timeRange, + capabilities + ); + + if (error || !meta) { + return; + } + const luceneOrKuery: Query[] = []; + const aggregateQueries: AggregateQuery[] = []; + + if (Array.isArray(query)) { + const [kqlOrLuceneQueries, esqlQueries] = partition(query, isOfQueryType); + if (kqlOrLuceneQueries.length) { + luceneOrKuery.push(...kqlOrLuceneQueries); + } + if (esqlQueries.length) { + aggregateQueries.push(...esqlQueries); + } + } + + const { filters: newFilters, query: newQuery } = combineQueryAndFilters( + luceneOrKuery.length > 0 ? luceneOrKuery : aggregateQueries[0], + filters, + meta, + Object.values(dataViews), + esQueryConfig + ); + + const dataViewSpec = dataViews[meta.id]!.spec; + + return { + dataViewSpec, + timeRange, + filters: newFilters, + query: aggregateQueries.length > 0 ? aggregateQueries[0] : newQuery, + columns: meta.columns, + }; +} + +function loadViewUnderlyingDataArgs( + state: LensRuntimeState, + { getVisualizationContext }: VisualizationContextHelper, + searchContextApi: { timeRange$: PublishingSubject }, + parentApi: unknown, + { + capabilities, + uiSettings, + injectFilterReferences, + data, + datasourceMap, + visualizationMap, + }: LensEmbeddableStartServices +) { + const { doc, activeData, activeDatasourceState, activeVisualizationState, indexPatterns } = + getVisualizationContext(); + const activeVisualizationId = getActiveVisualizationIdFromDoc(doc); + const activeDatasourceId = getActiveDatasourceIdFromDoc(doc); + const activeVisualization = activeVisualizationId + ? visualizationMap[activeVisualizationId] + : undefined; + const activeDatasource = activeDatasourceId ? datasourceMap[activeDatasourceId] : undefined; + if ( + !doc || + !activeData || + !activeDatasource || + !activeDatasourceState || + !activeVisualization || + !activeVisualizationState + ) { + return; + } + + const { filters$, query$, timeRange$ } = apiPublishesUnifiedSearch(parentApi) + ? parentApi + : { filters$: undefined, query$: undefined, timeRange$: undefined }; + + const mergedSearchContext = getMergedSearchContext( + state, + { + filters: filters$?.getValue(), + query: query$?.getValue(), + timeRange: timeRange$?.getValue(), + }, + searchContextApi.timeRange$, + parentApi, + { + data, + injectFilterReferences, + } + ); + + if (!mergedSearchContext.timeRange) { + return; + } + + const viewUnderlyingDataArgs = getViewUnderlyingDataArgs({ + activeDatasource, + activeDatasourceState, + activeVisualization, + activeVisualizationState, + activeData, + capabilities: { + canSaveDashboards: Boolean(capabilities.dashboard?.showWriteControls), + canSaveVisualizations: Boolean(capabilities.visualize.save), + canOpenVisualizations: Boolean(capabilities.visualize.show), + navLinks: capabilities.navLinks, + discover: capabilities.discover, + }, + query: mergedSearchContext.query, + filters: mergedSearchContext.filters || [], + timeRange: mergedSearchContext.timeRange, + esQueryConfig: getEsQueryConfig(uiSettings), + dataViews: indexPatterns, + }); + + return viewUnderlyingDataArgs; +} + +function createViewUnderlyingDataApis( + getState: GetStateType, + visualizationContextHelper: VisualizationContextHelper, + searchContextApi: { timeRange$: PublishingSubject }, + parentApi: unknown, + services: LensEmbeddableStartServices +): ViewInDiscoverCallbacks { + let viewUnderlyingDataArgs: undefined | ViewUnderlyingDataArgs; + + const [canViewUnderlyingData$] = buildObservableVariable(false); + + return { + canViewUnderlyingData$, + loadViewUnderlyingData: () => { + viewUnderlyingDataArgs = loadViewUnderlyingDataArgs( + getState(), + visualizationContextHelper, + searchContextApi, + parentApi, + services + ); + canViewUnderlyingData$.next(viewUnderlyingDataArgs != null); + }, + getViewUnderlyingDataArgs: () => { + return viewUnderlyingDataArgs; + }, + }; +} + +/** + * Initialize APIs used for actions on Lens panels + * This includes drilldowns, explore data, and more + */ +export function initializeActionApi( + uuid: string, + initialState: LensRuntimeState, + getLatestState: GetStateType, + parentApi: unknown, + searchContextApi: { timeRange$: PublishingSubject }, + titleApi: { panelTitle: PublishingSubject }, + visualizationContextHelper: VisualizationContextHelper, + services: LensEmbeddableStartServices +): { + api: ViewInDiscoverCallbacks & HasDynamicActions; + comparators: StateComparators; + serialize: () => {}; + cleanup: () => void; +} { + const dynamicActionsApi = services.embeddableEnhanced?.initializeReactEmbeddableDynamicActions( + uuid, + () => titleApi.panelTitle.getValue(), + initialState + ); + const maybeStopDynamicActions = dynamicActionsApi?.startDynamicActions(); + + return { + api: { + ...(isTextBasedLanguage(initialState) ? {} : dynamicActionsApi?.dynamicActionsApi ?? {}), + ...createViewUnderlyingDataApis( + getLatestState, + visualizationContextHelper, + searchContextApi, + parentApi, + services + ), + }, + comparators: { + ...(dynamicActionsApi?.dynamicActionsComparator ?? { + enhancements: getUnchangingComparator(), + }), + }, + serialize: () => dynamicActionsApi?.serializeDynamicActions() ?? {}, + cleanup: () => { + maybeStopDynamicActions?.stopDynamicActions(); + }, + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_service.test.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_service.test.ts new file mode 100644 index 0000000000000..2a0c469b3bbfb --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_service.test.ts @@ -0,0 +1,51 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { LensRuntimeState } from '../types'; +import { getLensRuntimeStateMock, getLensInternalApiMock, makeEmbeddableServices } from '../mocks'; +import { initializeStateManagement } from './initialize_state_management'; +import { initializeDashboardServices } from './initialize_dashboard_services'; +import faker from 'faker'; +import { createEmptyLensState } from '../helper'; + +function setupDashboardServicesApi(runtimeOverrides?: Partial) { + const services = makeEmbeddableServices(); + const internalApiMock = getLensInternalApiMock(); + const runtimeState = getLensRuntimeStateMock(runtimeOverrides); + const stateManagementConfig = initializeStateManagement(runtimeState, internalApiMock); + const { api } = initializeDashboardServices( + runtimeState, + () => runtimeState, + internalApiMock, + stateManagementConfig, + {}, + services + ); + return api; +} + +describe('Transformation API', () => { + it("should not save to library if there's already a saveObjectId", async () => { + const api = setupDashboardServicesApi({ savedObjectId: faker.random.uuid() }); + expect(await api.canLinkToLibrary()).toBe(false); + }); + + it("should save to library if there's no saveObjectId declared", async () => { + const api = setupDashboardServicesApi(); + expect(await api.canLinkToLibrary()).toBe(true); + }); + + it('should not save to library for ES|QL chart types', async () => { + // setup a state with an ES|QL query + const api = setupDashboardServicesApi( + createEmptyLensState('lnsXY', faker.lorem.words(), faker.lorem.text(), { + esql: 'FROM index', + }) + ); + expect(await api.canLinkToLibrary()).toBe(false); + }); +}); diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_services.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_services.ts new file mode 100644 index 0000000000000..d030a92a02b59 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_services.ts @@ -0,0 +1,185 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { noop } from 'lodash'; +import { + HasInPlaceLibraryTransforms, + HasLibraryTransforms, + PublishesWritablePanelTitle, + PublishesWritablePanelDescription, + SerializedTitles, + StateComparators, + getUnchangingComparator, + initializeTitles, +} from '@kbn/presentation-publishing'; +import { apiPublishesSettings } from '@kbn/presentation-containers'; +import { buildObservableVariable, isTextBasedLanguage } from '../helper'; +import type { + LensComponentProps, + LensPanelProps, + LensRuntimeState, + LensEmbeddableStartServices, + LensOverrides, + LensSharedProps, + IntegrationCallbacks, + LensInternalApi, +} from '../types'; +import { apiHasLensComponentProps } from '../type_guards'; +import { StateManagementConfig } from './initialize_state_management'; + +// Convenience type for the serialized props of this initializer +type SerializedProps = SerializedTitles & LensPanelProps & LensOverrides & LensSharedProps; + +export interface DashboardServicesConfig { + api: PublishesWritablePanelTitle & + PublishesWritablePanelDescription & + HasInPlaceLibraryTransforms & + HasLibraryTransforms & + Pick; + serialize: () => SerializedProps; + comparators: StateComparators; + cleanup: () => void; +} + +/** + * Everything about panel and library services + */ +export function initializeDashboardServices( + initialState: LensRuntimeState, + getLatestState: () => LensRuntimeState, + internalApi: LensInternalApi, + stateConfig: StateManagementConfig, + parentApi: unknown, + { attributeService, uiActions }: LensEmbeddableStartServices +): DashboardServicesConfig { + const { titlesApi, serializeTitles, titleComparators } = initializeTitles(initialState); + // For some legacy reason the title and description default value is picked differently + // ( based on existing FTR tests ). + const [defaultPanelTitle$] = buildObservableVariable( + initialState.title || internalApi.attributes$.getValue().title + ); + const [defaultPanelDescription$] = buildObservableVariable( + initialState.savedObjectId + ? internalApi.attributes$.getValue().description || initialState.description + : initialState.description + ); + // The observable references here are the same to the internalApi, + // the buildObservableVariable re-uses the same observable when detected but it builds the right comparator + const [overrides$, overridesComparator] = buildObservableVariable( + internalApi.overrides$ + ); + const [disableTriggers$, disabledTriggersComparator] = buildObservableVariable< + boolean | undefined + >(internalApi.disableTriggers$); + + return { + api: { + defaultPanelTitle: defaultPanelTitle$, + defaultPanelDescription: defaultPanelDescription$, + ...titlesApi, + libraryId$: stateConfig.api.savedObjectId, + updateOverrides: internalApi.updateOverrides, + getTriggerCompatibleActions: uiActions.getTriggerCompatibleActions, + // The functions below brings the HasInPlaceLibraryTransforms compliance (new interface) + saveToLibrary: async (title: string) => { + const { attributes } = getLatestState(); + const savedObjectId = await attributeService.saveToLibrary( + { + ...attributes, + title, + }, + attributes.references + ); + // keep in sync the state + stateConfig.api.updateSavedObjectId(savedObjectId); + return savedObjectId; + }, + checkForDuplicateTitle: async ( + newTitle: string, + isTitleDuplicateConfirmed: boolean, + onTitleDuplicate: () => void + ) => { + await attributeService.checkForDuplicateTitle({ + newTitle, + isTitleDuplicateConfirmed, + onTitleDuplicate, + newCopyOnSave: false, + newDescription: '', + displayName: '', + lastSavedTitle: '', + copyOnSave: false, + }); + }, + canLinkToLibrary: async () => + !getLatestState().savedObjectId && !isTextBasedLanguage(getLatestState()), + canUnlinkFromLibrary: async () => Boolean(getLatestState().savedObjectId), + unlinkFromLibrary: () => { + // broadcast the change to the main state serializer + stateConfig.api.updateSavedObjectId(undefined); + + if ((titlesApi.panelTitle.getValue() ?? '').length === 0) { + titlesApi.setPanelTitle(defaultPanelTitle$.getValue()); + } + if ((titlesApi.panelDescription.getValue() ?? '').length === 0) { + titlesApi.setPanelDescription(defaultPanelDescription$.getValue()); + } + defaultPanelTitle$.next(undefined); + defaultPanelDescription$.next(undefined); + }, + getByValueRuntimeSnapshot: (): Omit => { + const { savedObjectId, ...rest } = getLatestState(); + return rest; + }, + // The functions below brings the HasLibraryTransforms compliance (old interface) + getByReferenceState: () => getLatestState(), + getByValueState: (): Omit => { + const { savedObjectId, ...rest } = getLatestState(); + return rest; + }, + }, + serialize: () => { + const { style, noPadding, className } = apiHasLensComponentProps(parentApi) + ? parentApi + : ({} as LensComponentProps); + const settings = apiPublishesSettings(parentApi) + ? { + syncColors: parentApi.settings.syncColors$.getValue(), + syncCursor: parentApi.settings.syncCursor$.getValue(), + syncTooltips: parentApi.settings.syncTooltips$.getValue(), + } + : {}; + return { + ...serializeTitles(), + style, + noPadding, + className, + ...settings, + palette: initialState.palette, + overrides: overrides$.getValue(), + disableTriggers: disableTriggers$.getValue(), + }; + }, + comparators: { + ...titleComparators, + id: getUnchangingComparator(), + palette: getUnchangingComparator(), + renderMode: getUnchangingComparator(), + syncColors: getUnchangingComparator(), + syncCursor: getUnchangingComparator(), + syncTooltips: getUnchangingComparator(), + executionContext: getUnchangingComparator(), + noPadding: getUnchangingComparator(), + viewMode: getUnchangingComparator(), + style: getUnchangingComparator(), + className: getUnchangingComparator(), + overrides: overridesComparator, + disableTriggers: disabledTriggersComparator, + isNewPanel: getUnchangingComparator<{ isNewPanel?: boolean }, 'isNewPanel'>(), + }, + cleanup: noop, + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_edit.tsx b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_edit.tsx new file mode 100644 index 0000000000000..81372dad339f7 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_edit.tsx @@ -0,0 +1,237 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + HasEditCapabilities, + HasSupportedTriggers, + PublishesDisabledActionIds, + PublishesViewMode, + ViewMode, + apiHasAppContext, + apiPublishesDisabledActionIds, +} from '@kbn/presentation-publishing'; +import { ENABLE_ESQL } from '@kbn/esql-utils'; +import { noop } from 'lodash'; +import { EmbeddableStateTransfer } from '@kbn/embeddable-plugin/public'; +import { tracksOverlays } from '@kbn/presentation-containers'; +import { i18n } from '@kbn/i18n'; +import { APP_ID, getEditPath } from '../../../common/constants'; +import { + GetStateType, + LensEmbeddableStartServices, + LensInspectorAdapters, + LensInternalApi, + LensRuntimeState, +} from '../types'; +import { + buildObservableVariable, + emptySerializer, + extractInheritedViewModeObservable, +} from '../helper'; +import { prepareInlineEditPanel } from '../inline_editing/setup_inline_editing'; +import { setupPanelManagement } from '../inline_editing/panel_management'; +import { mountInlineEditPanel } from '../inline_editing/mount'; +import { StateManagementConfig } from './initialize_state_management'; +import { apiPublishesInlineEditingCapabilities } from '../type_guards'; + +function getSupportedTriggers( + getState: GetStateType, + visualizationMap: LensEmbeddableStartServices['visualizationMap'] +) { + return () => { + const currentState = getState(); + if (currentState.attributes?.visualizationType) { + return visualizationMap[currentState.attributes.visualizationType]?.triggers || []; + } + return []; + }; +} + +/** + * Initialize the edit API for the embeddable + **/ +export function initializeEditApi( + uuid: string, + initialState: LensRuntimeState, + getState: GetStateType, + internalApi: LensInternalApi, + stateApi: StateManagementConfig['api'], + inspectorApi: LensInspectorAdapters, + isTextBasedLanguage: (currentState: LensRuntimeState) => boolean, + startDependencies: LensEmbeddableStartServices, + parentApi?: unknown +): { + api: HasSupportedTriggers & + PublishesDisabledActionIds & + HasEditCapabilities & + PublishesViewMode & { uuid: string }; + comparators: {}; + serialize: () => {}; + cleanup: () => void; +} { + const supportedTriggers = getSupportedTriggers(getState, startDependencies.visualizationMap); + + const isESQLModeEnabled = () => uiSettings.get(ENABLE_ESQL); + + const [viewMode$] = buildObservableVariable( + extractInheritedViewModeObservable(parentApi) + ); + + const { disabledActionIds, setDisabledActionIds } = apiPublishesDisabledActionIds(parentApi) + ? parentApi + : { disabledActionIds: undefined, setDisabledActionIds: noop }; + const [disabledActionIds$, disabledActionIdsComparator] = buildObservableVariable< + string[] | undefined + >(disabledActionIds); + + if (isTextBasedLanguage(initialState)) { + // do not expose the drilldown action for ES|QL + disabledActionIds$.next(disabledActionIds$.getValue()?.concat(['OPEN_FLYOUT_ADD_DRILLDOWN'])); + } + + /** + * Inline editing section + */ + const navigateToLensEditor = + (stateTransfer: EmbeddableStateTransfer, skipAppLeave?: boolean) => async () => { + if (!parentApi || !apiHasAppContext(parentApi)) { + return; + } + const parentApiContext = parentApi.getAppContext(); + const currentState = getState(); + await stateTransfer.navigateToEditor(APP_ID, { + path: getEditPath(currentState.savedObjectId), + state: { + embeddableId: uuid, + valueInput: currentState, + originatingApp: parentApiContext.currentAppId ?? 'dashboards', + originatingPath: parentApiContext.getCurrentPath?.(), + searchSessionId: currentState.searchSessionId, + }, + skipAppLeave, + }); + }; + + const panelManagementApi = setupPanelManagement(uuid, parentApi, { + isNewlyCreated$: internalApi.isNewlyCreated$, + setAsCreated: internalApi.setAsCreated, + }); + + const updateState = (newState: Pick) => { + stateApi.updateAttributes(newState.attributes); + stateApi.updateSavedObjectId(newState.savedObjectId); + }; + + const openInlineEditor = prepareInlineEditPanel( + initialState, + getState, + updateState, + internalApi, + panelManagementApi, + inspectorApi, + startDependencies, + navigateToLensEditor, + uuid + ); + + /** + * The rest of the edit stuff + */ + const { uiSettings, capabilities, data } = startDependencies; + + const canEdit = () => { + if (viewMode$.getValue() !== 'edit') { + return false; + } + // check if it's in ES|QL mode + if (isTextBasedLanguage(getState()) && !isESQLModeEnabled()) { + return false; + } + return ( + Boolean(capabilities.visualize.save) || + (!getState().savedObjectId && + Boolean(capabilities.dashboard?.showWriteControls) && + Boolean(capabilities.visualize.show)) + ); + }; + + // this will force the embeddable to toggle the inline editing feature + const canEditInline = apiPublishesInlineEditingCapabilities(parentApi) + ? parentApi.canEditInline + : true; + + return { + comparators: { disabledActionIds: disabledActionIdsComparator }, + serialize: emptySerializer, + cleanup: noop, + api: { + uuid, + viewMode: viewMode$, + getTypeDisplayName: () => + i18n.translate('xpack.lens.embeddableDisplayName', { + defaultMessage: 'Lens', + }), + supportedTriggers, + disabledActionIds: disabledActionIds$, + setDisabledActionIds, + + /** + * This is the key method to enable the new Editing capabilities API + * Lens will leverage the netural nature of this function to build the inline editing experience + */ + onEdit: async () => { + if (!parentApi || !apiHasAppContext(parentApi)) { + return; + } + // just navigate directly to the editor + if (!canEditInline) { + const navigateFn = navigateToLensEditor( + new EmbeddableStateTransfer( + startDependencies.coreStart.application.navigateToApp, + startDependencies.coreStart.application.currentAppId$ + ), + true + ); + return navigateFn(); + } + + // save the initial state in case it needs to revert later on + const firstState = getState(); + + const rootEmbeddable = parentApi; + const overlayTracker = tracksOverlays(rootEmbeddable) ? rootEmbeddable : undefined; + const ConfigPanel = await openInlineEditor({ + onApply: (attributes: LensRuntimeState['attributes']) => + updateState({ ...getState(), attributes }), + // restore the first state found when the panel opened + onCancel: () => updateState({ ...firstState }), + }); + if (ConfigPanel) { + mountInlineEditPanel(ConfigPanel, startDependencies.coreStart, overlayTracker, uuid); + } + }, + /** + * Check everything here: user/app permissions and the current inline editing state + */ + isEditingEnabled: () => { + return apiHasAppContext(parentApi) && canEdit() && panelManagementApi.isEditingEnabled(); + }, + getEditHref: async () => { + if (!parentApi || !apiHasAppContext(parentApi)) { + return; + } + const currentState = getState(); + return getEditPath( + currentState.savedObjectId, + currentState.timeRange, + currentState.filters, + data.query.timefilter.timefilter.getRefreshInterval() + ); + }, + }, + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_inspector.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_inspector.ts new file mode 100644 index 0000000000000..733a1d4eac46c --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_inspector.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { noop } from 'lodash'; +import { BehaviorSubject } from 'rxjs'; +import type { Adapters } from '@kbn/inspector-plugin/public'; +import { getLensInspectorService } from '../../lens_inspector_service'; +import { emptySerializer } from '../helper'; +import type { LensEmbeddableStartServices, LensInspectorAdapters } from '../types'; + +export function initializeInspector(services: LensEmbeddableStartServices): { + api: LensInspectorAdapters; + comparators: {}; + serialize: () => {}; + cleanup: () => void; +} { + const inspectorApi = getLensInspectorService(services.inspector); + + return { + api: { + ...inspectorApi, + adapters$: new BehaviorSubject(inspectorApi.getInspectorAdapters()), + }, + comparators: {}, + serialize: emptySerializer, + cleanup: noop, + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_integrations.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_integrations.ts new file mode 100644 index 0000000000000..c3501bdfcafb9 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_integrations.ts @@ -0,0 +1,61 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + getAggregateQueryMode, + getLanguageDisplayName, + isOfAggregateQueryType, +} from '@kbn/es-query'; +import { noop } from 'lodash'; +import type { HasSerializableState } from '@kbn/presentation-containers'; +import { emptySerializer, isTextBasedLanguage } from '../helper'; +import type { GetStateType, LensEmbeddableStartServices } from '../types'; +import type { IntegrationCallbacks } from '../types'; + +export function initializeIntegrations( + getLatestState: GetStateType, + { attributeService }: LensEmbeddableStartServices +): { + api: Omit< + IntegrationCallbacks, + | 'updateState' + | 'updateAttributes' + | 'updateDataViews' + | 'updateSavedObjectId' + | 'updateOverrides' + | 'updateDataLoading' + | 'getTriggerCompatibleActions' + > & + HasSerializableState; + cleanup: () => void; + serialize: () => {}; + comparators: {}; +} { + return { + api: { + serializeState: () => { + const currentState = getLatestState(); + return attributeService.extractReferences(currentState); + }, + // TODO: workout why we have this duplicated + getFullAttributes: () => getLatestState().attributes, + getSavedVis: () => getLatestState().attributes, + isTextBasedLanguage: () => isTextBasedLanguage(getLatestState()), + getTextBasedLanguage: () => { + const query = getLatestState().attributes?.state.query; + if (!query || !isOfAggregateQueryType(query)) { + return; + } + const language = getAggregateQueryMode(query); + return getLanguageDisplayName(language).toUpperCase(); + }, + }, + comparators: {}, + serialize: emptySerializer, + cleanup: noop, + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_internal_api.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_internal_api.ts new file mode 100644 index 0000000000000..2bdc00b3124a2 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_internal_api.ts @@ -0,0 +1,91 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { BehaviorSubject } from 'rxjs'; +import type { DataView } from '@kbn/data-views-plugin/common'; +import { buildObservableVariable, createEmptyLensState } from '../helper'; +import type { + ExpressionWrapperProps, + LensInternalApi, + LensOverrides, + LensRuntimeState, +} from '../types'; +import { apiHasAbortController } from '../type_guards'; +import type { UserMessage } from '../../types'; + +export function initializeInternalApi( + initialState: LensRuntimeState, + parentApi: unknown +): LensInternalApi { + const [hasRenderCompleted$] = buildObservableVariable(false); + const [expressionParams$] = buildObservableVariable(null); + const expressionAbortController$ = new BehaviorSubject(undefined); + if (apiHasAbortController(parentApi)) { + expressionAbortController$.next(parentApi.abortController); + } + const [renderCount$] = buildObservableVariable(0); + + const attributes$ = new BehaviorSubject( + initialState.attributes || createEmptyLensState().attributes + ); + const overrides$ = new BehaviorSubject(initialState.overrides); + const disableTriggers$ = new BehaviorSubject(initialState.disableTriggers); + const dataLoading$ = new BehaviorSubject(undefined); + + const dataViews$ = new BehaviorSubject(undefined); + // This is an internal error state, not to be confused with the runtime error state thrown by the expression pipeline + // In both cases a blocking error can happen, but for Lens validation errors we want to have full control over the UI + // while for runtime errors the error will bubble up to the embeddable presentation layer + const validationMessages$ = new BehaviorSubject([]); + // This other set of messages is for non-blocking messages that can be displayed in the UI + const messages$ = new BehaviorSubject([]); + + // This should settle the thing once and for all + // the isNewPanel won't be serialized so it will be always false after the edit panel closes applying the changes + const isNewlyCreated$ = new BehaviorSubject(initialState.isNewPanel || false); + + // No need to expose anything at public API right now, that would happen later on + // where each initializer will pick what it needs and publish it + return { + attributes$, + overrides$, + disableTriggers$, + dataLoading$, + hasRenderCompleted$, + expressionParams$, + expressionAbortController$, + renderCount$, + isNewlyCreated$, + dataViews: dataViews$, + dispatchError: () => { + hasRenderCompleted$.next(true); + renderCount$.next(renderCount$.getValue() + 1); + }, + dispatchRenderStart: () => hasRenderCompleted$.next(false), + dispatchRenderComplete: () => { + renderCount$.next(renderCount$.getValue() + 1); + hasRenderCompleted$.next(true); + }, + updateExpressionParams: (newParams: ExpressionWrapperProps | null) => + expressionParams$.next(newParams), + updateDataLoading: (newDataLoading: boolean | undefined) => dataLoading$.next(newDataLoading), + updateOverrides: (overrides: LensOverrides['overrides']) => overrides$.next(overrides), + updateAttributes: (attributes: LensRuntimeState['attributes']) => attributes$.next(attributes), + updateAbortController: (abortController: AbortController | undefined) => + expressionAbortController$.next(abortController), + updateDataViews: (dataViews: DataView[] | undefined) => dataViews$.next(dataViews), + messages$, + updateMessages: (newMessages: UserMessage[]) => messages$.next(newMessages), + validationMessages$, + updateValidationMessages: (newMessages: UserMessage[]) => validationMessages$.next(newMessages), + resetAllMessages: () => { + messages$.next([]); + validationMessages$.next([]); + }, + setAsCreated: () => isNewlyCreated$.next(false), + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_search_context.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_search_context.ts new file mode 100644 index 0000000000000..1a608de11e230 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_search_context.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Filter, Query, AggregateQuery } from '@kbn/es-query'; +import { + PublishesUnifiedSearch, + StateComparators, + getUnchangingComparator, + initializeTimeRange, +} from '@kbn/presentation-publishing'; +import { noop } from 'lodash'; +import { + PublishesSearchSession, + apiPublishesSearchSession, +} from '@kbn/presentation-publishing/interfaces/fetch/publishes_search_session'; +import { buildObservableVariable } from '../helper'; +import { LensInternalApi, LensRuntimeState, LensUnifiedSearchContext } from '../types'; + +export function initializeSearchContext( + initialState: LensRuntimeState, + internalApi: LensInternalApi, + parentApi: unknown +): { + api: PublishesUnifiedSearch & PublishesSearchSession; + comparators: StateComparators; + serialize: () => LensUnifiedSearchContext; + cleanup: () => void; +} { + const [searchSessionId$] = buildObservableVariable( + apiPublishesSearchSession(parentApi) ? parentApi.searchSessionId$ : undefined + ); + + const attributes = internalApi.attributes$.getValue(); + + const [lastReloadRequestTime] = buildObservableVariable(undefined); + + const [filters$] = buildObservableVariable(attributes.state.filters); + + const [query$] = buildObservableVariable( + attributes.state.query + ); + + const [timeslice$] = buildObservableVariable<[number, number] | undefined>(undefined); + + const timeRange = initializeTimeRange(initialState); + return { + api: { + searchSessionId$, + filters$, + query$, + timeslice$, + isCompatibleWithUnifiedSearch: () => true, + ...timeRange.api, + }, + comparators: { + query: getUnchangingComparator(), + filters: getUnchangingComparator(), + timeslice: getUnchangingComparator(), + searchSessionId: getUnchangingComparator(), + lastReloadRequestTime: getUnchangingComparator< + LensUnifiedSearchContext, + 'lastReloadRequestTime' + >(), + ...timeRange.comparators, + }, + cleanup: noop, + serialize: () => ({ + searchSessionId: searchSessionId$.getValue(), + filters: filters$.getValue(), + query: query$.getValue(), + timeslice: timeslice$.getValue(), + lastReloadRequestTime: lastReloadRequestTime.getValue(), + ...timeRange.serialize(), + }), + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_state_management.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_state_management.ts new file mode 100644 index 0000000000000..af5ecddecd2b4 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_state_management.ts @@ -0,0 +1,99 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { + getUnchangingComparator, + type PublishesBlockingError, + type PublishesDataLoading, + type PublishesDataViews, + type PublishesSavedObjectId, + type StateComparators, +} from '@kbn/presentation-publishing'; +import { noop } from 'lodash'; +import type { DataView } from '@kbn/data-views-plugin/common'; +import { BehaviorSubject } from 'rxjs'; +import type { IntegrationCallbacks, LensInternalApi, LensRuntimeState } from '../types'; +import { buildObservableVariable } from '../helper'; +import { SharingSavedObjectProps } from '../../types'; + +export interface StateManagementConfig { + api: Pick & + PublishesSavedObjectId & + PublishesDataViews & + PublishesDataLoading & + PublishesBlockingError; + serialize: () => Pick; + comparators: StateComparators< + Pick & { + managed?: boolean | undefined; + sharingSavedObjectProps?: SharingSavedObjectProps | undefined; + } + >; + cleanup: () => void; +} + +/** + * Due to inline editing we need something advanced to handle the state + * management at the embeddable level, so here's the initializers for it + */ +export function initializeStateManagement( + initialState: LensRuntimeState, + internalApi: LensInternalApi +): StateManagementConfig { + const [attributes$, attributesComparator] = buildObservableVariable< + LensRuntimeState['attributes'] + >(internalApi.attributes$); + + const [savedObjectId$, savedObjectIdComparator] = buildObservableVariable< + LensRuntimeState['savedObjectId'] + >(initialState.savedObjectId); + + const [dataViews$] = buildObservableVariable(internalApi.dataViews); + const [dataLoading$] = buildObservableVariable(internalApi.dataLoading$); + const [abortController$, abortControllerComparator] = buildObservableVariable< + AbortController | undefined + >(internalApi.expressionAbortController$); + + // This is the way to communicate to the embeddable panel to render a blocking error with the + // default panel error component - i.e. cannot find a Lens SO type of thing. + // For Lens specific errors, we use a Lens specific error component. + const [blockingError$] = buildObservableVariable(undefined); + return { + api: { + updateAttributes: internalApi.updateAttributes, + updateSavedObjectId: (newSavedObjectId: LensRuntimeState['savedObjectId']) => + savedObjectId$.next(newSavedObjectId), + savedObjectId: savedObjectId$, + dataViews: dataViews$, + dataLoading: dataLoading$, + blockingError: blockingError$, + }, + serialize: () => { + return { + attributes: attributes$.getValue(), + savedObjectId: savedObjectId$.getValue(), + abortController: abortController$.getValue(), + }; + }, + comparators: { + // need to force cast this to make it pass the type check + // @TODO: workout why this is needed + attributes: attributesComparator as [ + BehaviorSubject, + (newValue: LensRuntimeState['attributes'] | undefined) => void, + ( + a: LensRuntimeState['attributes'] | undefined, + b: LensRuntimeState['attributes'] | undefined + ) => boolean + ], + savedObjectId: savedObjectIdComparator, + abortController: abortControllerComparator, + sharingSavedObjectProps: getUnchangingComparator(), + managed: getUnchangingComparator(), + }, + cleanup: noop, + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_visualization_context.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_visualization_context.ts new file mode 100644 index 0000000000000..93d544013e710 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_visualization_context.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { LensInternalApi, VisualizationContext, VisualizationContextHelper } from '../types'; + +export function initializeVisualizationContext( + internalApi: LensInternalApi +): VisualizationContextHelper { + // TODO: this will likely be merged together with the state$ observable + let visualizationContext: VisualizationContext = { + doc: internalApi.attributes$.getValue(), + mergedSearchContext: {}, + indexPatterns: {}, + indexPatternRefs: [], + activeVisualizationState: undefined, + activeDatasourceState: undefined, + activeData: undefined, + }; + return { + getVisualizationContext: () => visualizationContext, + updateVisualizationContext: (newVisualizationContext: Partial) => { + visualizationContext = { + ...visualizationContext, + ...newVisualizationContext, + }; + }, + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/inline_editing/mount.tsx b/x-pack/plugins/lens/public/react_embeddable/inline_editing/mount.tsx new file mode 100644 index 0000000000000..566c5b27b6541 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/inline_editing/mount.tsx @@ -0,0 +1,62 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreStart } from '@kbn/core/public'; +import { TracksOverlays } from '@kbn/presentation-containers'; +import { toMountPoint } from '@kbn/react-kibana-mount'; +import React from 'react'; +import ReactDOM from 'react-dom'; + +/** + * Shared logic to mount the inline config panel + * @param ConfigPanel + * @param coreStart + * @param overlayTracker + * @param uuid + * @param container + */ +export function mountInlineEditPanel( + ConfigPanel: JSX.Element, + coreStart: CoreStart, + overlayTracker: TracksOverlays | undefined, + uuid?: string, + container?: HTMLElement | null +) { + if (container) { + ReactDOM.render(ConfigPanel, container); + } else { + const handle = coreStart.overlays.openFlyout( + toMountPoint( + React.cloneElement(ConfigPanel, { + closeFlyout: () => { + overlayTracker?.clearOverlays(); + handle.close(); + }, + }), + coreStart + ), + { + className: 'lnsConfigPanel__overlay', + size: 's', + 'data-test-subj': 'customizeLens', + type: 'push', + paddingSize: 'm', + maxWidth: 800, + hideCloseButton: true, + isResizable: true, + onClose: (overlayRef) => { + overlayTracker?.clearOverlays(); + overlayRef.close(); + }, + outsideClickCloses: true, + } + ); + if (uuid) { + overlayTracker?.openOverlay(handle, { focusedPanelId: uuid }); + } + } +} diff --git a/x-pack/plugins/lens/public/react_embeddable/inline_editing/panel_management.tsx b/x-pack/plugins/lens/public/react_embeddable/inline_editing/panel_management.tsx new file mode 100644 index 0000000000000..5753c8112d876 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/inline_editing/panel_management.tsx @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { apiIsPresentationContainer } from '@kbn/presentation-containers'; +import { BehaviorSubject } from 'rxjs'; +import { PublishingSubject } from '@kbn/presentation-publishing'; +import { LensRuntimeState } from '../types'; + +export interface PanelManagementApi { + isEditingEnabled: () => boolean; + isNewPanel: () => boolean; + onStopEditing: (isCancel: boolean, state: LensRuntimeState | undefined) => void; +} + +export function setupPanelManagement( + uuid: string, + parentApi: unknown, + { + isNewlyCreated$, + setAsCreated, + }: { + isNewlyCreated$: PublishingSubject; + setAsCreated: () => void; + } +): PanelManagementApi { + const isEditing$ = new BehaviorSubject(false); + + return { + isEditingEnabled: () => true, + isNewPanel: () => isNewlyCreated$.getValue(), + onStopEditing: (isCancel: boolean = false, state: LensRuntimeState | undefined) => { + isEditing$.next(false); + if (isNewlyCreated$.getValue() && isCancel && !state) { + if (apiIsPresentationContainer(parentApi)) { + parentApi?.removePanel(uuid); + } + } + setAsCreated(); + }, + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/inline_editing/setup_inline_editing.tsx b/x-pack/plugins/lens/public/react_embeddable/inline_editing/setup_inline_editing.tsx new file mode 100644 index 0000000000000..e37e671132964 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/inline_editing/setup_inline_editing.tsx @@ -0,0 +1,143 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EmbeddableStateTransfer } from '@kbn/embeddable-plugin/public'; +import React from 'react'; +import { EditLensConfigurationProps } from '../../app_plugin/shared/edit_on_the_fly/get_edit_lens_configuration'; +import { EditConfigPanelProps } from '../../app_plugin/shared/edit_on_the_fly/types'; +import { getActiveDatasourceIdFromDoc } from '../../utils'; +import { isTextBasedLanguage } from '../helper'; +import { + GetStateType, + LensEmbeddableStartServices, + LensInspectorAdapters, + LensInternalApi, + LensRuntimeState, + TypedLensSerializedState, +} from '../types'; +import { PanelManagementApi } from './panel_management'; +import { getStateManagementForInlineEditing } from './state_management'; + +export function prepareInlineEditPanel( + initialState: LensRuntimeState, + getState: GetStateType, + updateState: (newState: Pick) => void, + { dataLoading$, isNewlyCreated$ }: Pick, + panelManagementApi: PanelManagementApi, + inspectorApi: LensInspectorAdapters, + { + coreStart, + ...startDependencies + }: Omit< + LensEmbeddableStartServices, + | 'timefilter' + | 'coreHttp' + | 'capabilities' + | 'expressionRenderer' + | 'documentToExpression' + | 'injectFilterReferences' + | 'visualizationMap' + | 'datasourceMap' + | 'theme' + | 'uiSettings' + | 'attributeService' + >, + navigateToLensEditor?: ( + stateTransfer: EmbeddableStateTransfer, + skipAppLeave?: boolean + ) => () => Promise, + uuid?: string +) { + return async function openConfigPanel({ + onApply, + onCancel, + hideTimeFilterInfo, + }: Partial> = {}) { + const { getEditLensConfiguration, getVisualizationMap, getDatasourceMap } = await import( + '../../async_services' + ); + const visualizationMap = getVisualizationMap(); + const datasourceMap = getDatasourceMap(); + + const currentState = getState(); + const attributes = currentState.attributes as TypedLensSerializedState['attributes']; + const activeDatasourceId = (getActiveDatasourceIdFromDoc(attributes) || + 'formBased') as EditLensConfigurationProps['datasourceId']; + + const { updatePanelState, updateSuggestion } = getStateManagementForInlineEditing( + activeDatasourceId, + () => getState().attributes as TypedLensSerializedState['attributes'], + (attrs: TypedLensSerializedState['attributes'], resetId: boolean = false) => { + updateState({ + attributes: attrs, + savedObjectId: resetId ? undefined : currentState.savedObjectId, + }); + }, + visualizationMap, + datasourceMap, + startDependencies.data.query.filterManager.extract + ); + + const updateByRefInput = (savedObjectId: LensRuntimeState['savedObjectId']) => { + updateState({ attributes, savedObjectId }); + }; + const Component = await getEditLensConfiguration( + coreStart, + startDependencies, + visualizationMap, + datasourceMap + ); + + if (attributes?.visualizationType == null) { + return null; + } + return ( + { + panelManagementApi.onStopEditing( + true, + // DSL/form based charts are created via the full editor, so there's + // an initial state to preserve. ES|QL charts are created inline, so it needs to pass an empty state + // and the panelManagementApi will decide whether to remove the panel or not + isNewlyCreated$.getValue() ? undefined : initialState + ); + onCancel?.(); + }} + onApply={(newAttributes) => { + panelManagementApi.onStopEditing(false, { ...getState(), attributes: newAttributes }); + if (newAttributes.visualizationType != null) { + onApply?.(newAttributes); + } + }} + hideTimeFilterInfo={hideTimeFilterInfo} + /> + ); + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/inline_editing/state_management.tsx b/x-pack/plugins/lens/public/react_embeddable/inline_editing/state_management.tsx new file mode 100644 index 0000000000000..2a4f1f48fd0dc --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/inline_editing/state_management.tsx @@ -0,0 +1,63 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { FilterManager } from '@kbn/data-plugin/public'; +import { mergeToNewDoc } from '../../state_management/shared_logic'; +import type { DatasourceStates } from '../../state_management/types'; +import type { VisualizationMap, DatasourceMap } from '../../types'; +import type { TypedLensSerializedState } from '../types'; + +export function getStateManagementForInlineEditing( + activeDatasourceId: 'formBased' | 'textBased', + getAttributes: () => TypedLensSerializedState['attributes'], + updateAttributes: ( + newAttributes: TypedLensSerializedState['attributes'], + resetId?: boolean + ) => void, + visualizationMap: VisualizationMap, + datasourceMap: DatasourceMap, + extractFilterReferences: FilterManager['extract'] +) { + const updatePanelState = ( + datasourceState: unknown, + visualizationState: unknown, + visualizationType?: string + ) => { + const viz = getAttributes(); + const datasourceStates: DatasourceStates = { + [activeDatasourceId]: { + isLoading: false, + state: datasourceState, + }, + }; + const newViz = mergeToNewDoc( + viz, + { + activeId: visualizationType || viz.visualizationType, + state: visualizationState, + }, + datasourceStates, + viz.state.query, + viz.state.filters, + activeDatasourceId, + viz.state.adHocDataViews || {}, + { visualizationMap, datasourceMap, extractFilterReferences } + ); + const newDoc = { + ...viz, + ...newViz, + }; + + if (newDoc.state) { + updateAttributes(newDoc, true); + } + }; + + const updateSuggestion = updateAttributes; + + return { updateSuggestion, updatePanelState }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/lens_embeddable.tsx b/x-pack/plugins/lens/public/react_embeddable/lens_embeddable.tsx new file mode 100644 index 0000000000000..8c17063f97a2e --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/lens_embeddable.tsx @@ -0,0 +1,190 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public'; +import { DOC_TYPE } from '../../common/constants'; +import { + LensApi, + LensEmbeddableStartServices, + LensRuntimeState, + LensSerializedState, +} from './types'; + +import { loadEmbeddableData } from './data_loader'; +import { isTextBasedLanguage, deserializeState } from './helper'; +import { initializeEditApi } from './initializers/initialize_edit'; +import { initializeInspector } from './initializers/initialize_inspector'; +import { initializeDashboardServices } from './initializers/initialize_dashboard_services'; +import { initializeInternalApi } from './initializers/initialize_internal_api'; +import { initializeSearchContext } from './initializers/initialize_search_context'; +import { initializeVisualizationContext } from './initializers/initialize_visualization_context'; +import { initializeActionApi } from './initializers/initialize_actions'; +import { initializeIntegrations } from './initializers/initialize_integrations'; +import { initializeStateManagement } from './initializers/initialize_state_management'; +import { LensEmbeddableComponent } from './renderer/lens_embeddable_component'; + +export const createLensEmbeddableFactory = ( + services: LensEmbeddableStartServices +): ReactEmbeddableFactory => { + return { + type: DOC_TYPE, + /** + * This is called before the build and will make sure that the + * final state will contain the attributes object + */ + deserializeState: async ({ rawState, references }) => + deserializeState(services.attributeService, rawState, references), + /** + * This is called after the deserialize, so some assumptions can be made about its arguments: + * @param state the Lens "runtime" state, which means that 'attributes' is always present. + * The difference for a by-value and a by-ref can be determined by the presence of 'savedObjectId' in the state + * @param buildApi a utility function to build the Lens API together to instrument the embeddable container on how to detect + * significative changes in the state (i.e. worth a save or not) + * @param uuid a unique identifier for the embeddable panel + * @param parentApi a set of props passed down from the embeddable container. Note: no assumptions can be made about its content + * so the usage of type-guards is recommended before extracting data from it. + * Due to the new embeddable being rendered by a wrapper, this is the only way + * to pass data/props from a container. + * Typical use cases is the forwarding of the unifiedSearch context to the embeddable, or the passing props + * from the Lens component container to the Lens embeddable. + * @returns an object with the Lens API and the React component to render in the Embeddable + */ + buildEmbeddable: async (initialState, buildApi, uuid, parentApi) => { + /** + * Observables and functions declared here are used internally to store mutating state values + * This is an internal API not exposed outside of the embeddable. + */ + const internalApi = initializeInternalApi(initialState, parentApi); + + const visualizationContextHelper = initializeVisualizationContext(internalApi); + + /** + * Initialize various configurations required to build all the required + * parts for the Lens embeddable. + * Each initialize call returns an object with the following properties: + * - api: a set of methods or observables (also non-serializable) who can be picked up within the component + * - serialize: a serializable subset of the Lens runtime state + * - comparators: a set of comparators to help Dashboard determine if the state has changed since its saved state + * - cleanup: a function to clean up any resources when the component is unmounted + * + * Mind: the getState argument is ok to pass as long as it is lazy evaluated (i.e. called within a function). + * If there's something that should be immediately computed use the "initialState" deserialized variable. + */ + const stateConfig = initializeStateManagement(initialState, internalApi); + const dashboardConfig = initializeDashboardServices( + initialState, + getState, + internalApi, + stateConfig, + parentApi, + services + ); + + const inspectorConfig = initializeInspector(services); + + const editConfig = initializeEditApi( + uuid, + initialState, + getState, + internalApi, + stateConfig.api, + inspectorConfig.api, + isTextBasedLanguage, + services, + parentApi + ); + + const searchContextConfig = initializeSearchContext(initialState, internalApi, parentApi); + const integrationsConfig = initializeIntegrations(getState, services); + const actionsConfig = initializeActionApi( + uuid, + initialState, + getState, + parentApi, + searchContextConfig.api, + dashboardConfig.api, + visualizationContextHelper, + services + ); + + /** + * This is useful to have always the latest version of the state + * at hand when calling callbacks or performing actions + */ + function getState(): LensRuntimeState { + return { + ...actionsConfig.serialize(), + ...editConfig.serialize(), + ...inspectorConfig.serialize(), + ...dashboardConfig.serialize(), + ...searchContextConfig.serialize(), + ...integrationsConfig.serialize(), + ...stateConfig.serialize(), + }; + } + + /** + * Lens API is the object that can be passed to the final component/renderer and + * provide access to the services for and by the outside world + */ + const api: LensApi = buildApi( + // Note: the order matters here, so make sure to have the + // dashboardConfig who owns the savedObjectId after the + // stateConfig one who owns the inline editing + { + ...editConfig.api, + ...inspectorConfig.api, + ...searchContextConfig.api, + ...actionsConfig.api, + ...integrationsConfig.api, + ...stateConfig.api, + ...dashboardConfig.api, + }, + { + ...stateConfig.comparators, + ...editConfig.comparators, + ...inspectorConfig.comparators, + ...searchContextConfig.comparators, + ...actionsConfig.comparators, + ...integrationsConfig.comparators, + ...dashboardConfig.comparators, + } + ); + + // Compute the expression using the provided parameters + // Inside a subscription will be updated based on each unifiedSearch change + // and as side effect update few observables as expressionParams$, expressionAbortController$ and renderCount$ with the new values upon updates + const expressionConfig = loadEmbeddableData( + uuid, + getState, + api, + parentApi, + internalApi, + services, + visualizationContextHelper + ); + + const onUnmount = () => { + editConfig.cleanup(); + inspectorConfig.cleanup(); + searchContextConfig.cleanup(); + expressionConfig.cleanup(); + actionsConfig.cleanup(); + integrationsConfig.cleanup(); + dashboardConfig.cleanup(); + }; + + return { + api, + Component: () => ( + + ), + }; + }, + }; +}; diff --git a/x-pack/plugins/lens/public/react_embeddable/logger.ts b/x-pack/plugins/lens/public/react_embeddable/logger.ts new file mode 100644 index 0000000000000..05454843b6819 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/logger.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/** + * Conditional (window.ELASTIC_LENS_LOGGER needs to be set to true) logger function + * @param message - mandatory message to log + * @param payload - optional object to log + */ + +export const addLog = (message: string, payload?: unknown) => { + // @ts-expect-error + const logger = window?.ELASTIC_LENS_LOGGER; + + if (logger) { + if (logger === 'debug') { + // eslint-disable-next-line no-console + console.log(`[Lens] ${message}`, payload); + } else { + // eslint-disable-next-line no-console + console.log(`[Lens] ${message}`); + } + } +}; diff --git a/x-pack/plugins/lens/public/react_embeddable/mocks/index.tsx b/x-pack/plugins/lens/public/react_embeddable/mocks/index.tsx new file mode 100644 index 0000000000000..a3992e504c4df --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/mocks/index.tsx @@ -0,0 +1,352 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { BehaviorSubject, Subject } from 'rxjs'; +import deepMerge from 'deepmerge'; +import React from 'react'; +import faker from 'faker'; +import { Query, Filter, AggregateQuery, TimeRange } from '@kbn/es-query'; +import { PhaseEvent, ViewMode } from '@kbn/presentation-publishing'; +import { DataView } from '@kbn/data-views-plugin/common'; +import { Adapters } from '@kbn/inspector-plugin/common'; +import { coreMock } from '@kbn/core/public/mocks'; +import { visualizationsPluginMock } from '@kbn/visualizations-plugin/public/mocks'; +import { expressionsPluginMock } from '@kbn/expressions-plugin/public/mocks'; +import { embeddablePluginMock } from '@kbn/embeddable-plugin/public/mocks'; +import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; +import { ReactExpressionRendererProps } from '@kbn/expressions-plugin/public'; +import { ReactEmbeddableDynamicActionsApi } from '@kbn/embeddable-enhanced-plugin/public/plugin'; +import { DOC_TYPE } from '../../../common/constants'; +import { createEmptyLensState } from '../helper'; +import { + ExpressionWrapperProps, + LensApi, + LensEmbeddableStartServices, + LensInternalApi, + LensRendererProps, + LensRuntimeState, + LensSerializedState, + VisualizationContext, +} from '../types'; +import { + createMockDatasource, + createMockVisualization, + defaultDoc, + makeDefaultServices, +} from '../../mocks'; +import { + Datasource, + DatasourceMap, + UserMessage, + Visualization, + VisualizationMap, +} from '../../types'; + +const LensApiMock: LensApi = { + // Static props + type: DOC_TYPE, + uuid: faker.random.uuid(), + // Shared Embeddable Observables + panelTitle: new BehaviorSubject(faker.lorem.words()), + hidePanelTitle: new BehaviorSubject(false), + filters$: new BehaviorSubject([]), + query$: new BehaviorSubject({ + query: 'test', + language: 'kuery', + }), + timeRange$: new BehaviorSubject({ from: 'now-15m', to: 'now' }), + dataLoading: new BehaviorSubject(false), + // Methods + getSavedVis: jest.fn(), + getFullAttributes: jest.fn(), + canViewUnderlyingData$: new BehaviorSubject(false), + loadViewUnderlyingData: jest.fn(), + getViewUnderlyingDataArgs: jest.fn(() => ({ + dataViewSpec: { id: 'index-pattern-id' }, + timeRange: { from: 'now-7d', to: 'now' }, + filters: [], + query: undefined, + columns: [], + })), + isTextBasedLanguage: jest.fn(() => true), + getTextBasedLanguage: jest.fn(), + getInspectorAdapters: jest.fn(() => ({})), + inspect: jest.fn(), + closeInspector: jest.fn(async () => {}), + supportedTriggers: jest.fn(() => []), + canLinkToLibrary: jest.fn(async () => false), + canUnlinkFromLibrary: jest.fn(async () => false), + unlinkFromLibrary: jest.fn(), + checkForDuplicateTitle: jest.fn(), + /** New embeddable api inherited methods */ + resetUnsavedChanges: jest.fn(), + serializeState: jest.fn(), + snapshotRuntimeState: jest.fn(), + saveToLibrary: jest.fn(async () => 'saved-id'), + getByValueRuntimeSnapshot: jest.fn(), + onEdit: jest.fn(), + isEditingEnabled: jest.fn(() => true), + getTypeDisplayName: jest.fn(() => 'Lens'), + setPanelTitle: jest.fn(), + setHidePanelTitle: jest.fn(), + phase$: new BehaviorSubject({ + id: faker.random.uuid(), + status: 'rendered', + timeToEvent: 1000, + }), + unsavedChanges: new BehaviorSubject(undefined), + dataViews: new BehaviorSubject(undefined), + libraryId$: new BehaviorSubject(undefined), + savedObjectId: new BehaviorSubject(undefined), + adapters$: new BehaviorSubject({}), + updateAttributes: jest.fn(), + updateSavedObjectId: jest.fn(), + updateOverrides: jest.fn(), + getByReferenceState: jest.fn(), + getByValueState: jest.fn(), + getTriggerCompatibleActions: jest.fn(), + blockingError: new BehaviorSubject(undefined), + panelDescription: new BehaviorSubject(undefined), + setPanelDescription: jest.fn(), + viewMode: new BehaviorSubject('view'), + disabledActionIds: new BehaviorSubject(undefined), + setDisabledActionIds: jest.fn(), +}; + +const LensSerializedStateMock: LensSerializedState = createEmptyLensState( + 'lnsXY', + faker.lorem.words(), + faker.lorem.text(), + { query: 'test', language: 'kuery' } +); + +export function getLensAttributesMock(attributes?: Partial) { + return deepMerge(LensSerializedStateMock.attributes!, attributes ?? {}); +} + +export function getLensApiMock(overrides: Partial = {}) { + return { + ...LensApiMock, + ...overrides, + }; +} + +export function getLensSerializedStateMock(overrides: Partial = {}) { + return { + savedObjectId: faker.random.uuid(), + ...LensSerializedStateMock, + ...overrides, + }; +} + +export function getLensRuntimeStateMock( + overrides: Partial = {} +): LensRuntimeState { + return { + ...(LensSerializedStateMock as LensRuntimeState), + ...overrides, + }; +} + +export function getLensComponentProps(overrides: Partial = {}) { + return { + ...LensSerializedStateMock, + ...LensApiMock, + ...overrides, + }; +} + +export function makeEmbeddableServices( + sessionIdSubject = new Subject(), + sessionId: string | undefined = undefined, + { + visOverrides, + dataOverrides, + }: { + visOverrides?: { id: string } & Partial; + dataOverrides?: { id: string } & Partial; + } = {} +): jest.Mocked { + const services = makeDefaultServices(sessionIdSubject, sessionId); + return { + ...services, + expressions: expressionsPluginMock.createStartContract(), + visualizations: visualizationsPluginMock.createStartContract(), + embeddable: embeddablePluginMock.createStartContract(), + eventAnnotation: {} as LensEmbeddableStartServices['eventAnnotation'], + timefilter: services.data.query.timefilter.timefilter, + coreHttp: services.http, + coreStart: coreMock.createStart(), + capabilities: services.application.capabilities, + expressionRenderer: jest.fn().mockReturnValue(null), + documentToExpression: jest.fn(), + injectFilterReferences: services.data.query.filterManager.inject as jest.Mock, + visualizationMap: mockVisualizationMap(visOverrides?.id, visOverrides), + datasourceMap: mockDatasourceMap(dataOverrides?.id, dataOverrides), + charts: chartPluginMock.createStartContract(), + inspector: { + ...services.inspector, + isAvailable: jest.fn().mockReturnValue(true), + open: jest.fn(), + }, + uiActions: { + ...services.uiActions, + getTrigger: jest.fn().mockImplementation(() => ({ exec: jest.fn() })), + }, + embeddableEnhanced: { + initializeReactEmbeddableDynamicActions: jest.fn( + () => + ({ + dynamicActionsApi: { + enhancements: { dynamicActions: {} }, + setDynamicActions: jest.fn(), + dynamicActionsState$: {}, + }, + dynamicActionsComparator: jest.fn(), + serializeDynamicActions: jest.fn(), + startDynamicActions: jest.fn(), + } as unknown as ReactEmbeddableDynamicActionsApi) + ), + }, + }; +} + +export const mockVisualizationMap = ( + type: string | undefined = undefined, + overrides: Partial = {} +): VisualizationMap => { + if (type == null) { + return {}; + } + return { + [type]: { ...createMockVisualization(type), ...overrides }, + }; +}; + +export const mockDatasourceMap = ( + type: string | undefined = undefined, + overrides: Partial = {} +): DatasourceMap => { + const baseMap = { + // define the existing ones + formBased: createMockDatasource('formBased'), + textBased: createMockDatasource('textBased'), + }; + if (type == null) { + return baseMap; + } + return { + // define the existing ones + ...baseMap, + // override at will + [type]: { + ...createMockDatasource(type), + ...overrides, + }, + }; +}; + +export function createExpressionRendererMock(): jest.Mock< + React.ReactElement, + [ReactExpressionRendererProps] +> { + return jest.fn(({ expression }) => ( + + {(expression as string) || 'Expression renderer mock'} + + )); +} + +function getValidExpressionParams( + overrides: Partial = {} +): ExpressionWrapperProps { + return { + ExpressionRenderer: createExpressionRendererMock(), + expression: 'test', + searchContext: {}, + handleEvent: jest.fn(), + onData$: jest.fn(), + onRender$: jest.fn(), + addUserMessages: jest.fn(), + onRuntimeError: jest.fn(), + lensInspector: { + getInspectorAdapters: jest.fn(), + inspect: jest.fn(), + closeInspector: jest.fn(), + }, + ...overrides, + }; +} + +const LensInternalApiMock: LensInternalApi = { + dataViews: new BehaviorSubject(undefined), + attributes$: new BehaviorSubject(defaultDoc), + overrides$: new BehaviorSubject(undefined), + disableTriggers$: new BehaviorSubject(undefined), + dataLoading$: new BehaviorSubject(undefined), + hasRenderCompleted$: new BehaviorSubject(true), + expressionParams$: new BehaviorSubject(getValidExpressionParams()), + expressionAbortController$: new BehaviorSubject(undefined), + renderCount$: new BehaviorSubject(0), + messages$: new BehaviorSubject([]), + validationMessages$: new BehaviorSubject([]), + isNewlyCreated$: new BehaviorSubject(true), + updateAttributes: jest.fn(), + updateOverrides: jest.fn(), + dispatchRenderStart: jest.fn(), + dispatchRenderComplete: jest.fn(), + updateDataLoading: jest.fn(), + updateExpressionParams: jest.fn(), + updateAbortController: jest.fn(), + updateDataViews: jest.fn(), + updateMessages: jest.fn(), + resetAllMessages: jest.fn(), + dispatchError: jest.fn(), + updateValidationMessages: jest.fn(), + setAsCreated: jest.fn(), +}; + +export function getLensInternalApiMock(overrides: Partial = {}): LensInternalApi { + return { + ...LensInternalApiMock, + ...overrides, + }; +} + +export function getVisualizationContextHelperMock( + attributesOverrides?: Partial, + contextOverrides?: Omit, 'doc'> +) { + return { + getVisualizationContext: jest.fn(() => ({ + mergedSearchContext: {}, + indexPatterns: {}, + indexPatternRefs: [], + activeVisualizationState: undefined, + activeDatasourceState: undefined, + activeData: undefined, + ...contextOverrides, + doc: getLensAttributesMock(attributesOverrides), + })), + updateVisualizationContext: jest.fn(), + }; +} + +export function createUnifiedSearchApi( + query: Query | AggregateQuery = { + query: '', + language: 'kuery', + }, + filters: Filter[] = [], + timeRange: TimeRange = { from: 'now-7d', to: 'now' } +) { + return { + filters$: new BehaviorSubject(filters), + query$: new BehaviorSubject(query), + timeRange$: new BehaviorSubject(timeRange), + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/renderer/hooks.ts b/x-pack/plugins/lens/public/react_embeddable/renderer/hooks.ts new file mode 100644 index 0000000000000..c6d97d16ad386 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/renderer/hooks.ts @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { partition } from 'lodash'; +import { useEffect, useMemo, useRef } from 'react'; +import { useStateFromPublishingSubject } from '@kbn/presentation-publishing'; +import { dispatchRenderComplete, dispatchRenderStart } from '@kbn/kibana-utils-plugin/public'; +import { LensApi, LensInternalApi } from '../types'; + +/** + * This hooks known how to extract message based on types for the UI + */ +export function useMessages({ messages$ }: LensInternalApi) { + const latestMessages = useStateFromPublishingSubject(messages$); + return useMemo( + () => partition(latestMessages, ({ severity }) => severity !== 'info'), + [latestMessages] + ); +} + +/** + * This hook is responsible to emit the render start/complete JS event + * The render error is handled by the data_loader itself when updating the blocking errors + */ +export function useDispatcher(hasRendered: boolean, api: LensApi) { + const rootRef = useRef(null); + useEffect(() => { + if (!rootRef.current || api.blockingError?.getValue()) { + return; + } + if (hasRendered) { + dispatchRenderComplete(rootRef.current); + } else { + dispatchRenderStart(rootRef.current); + } + }, [hasRendered, api.blockingError, rootRef]); + return rootRef; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/renderer/lens_custom_renderer_component.tsx b/x-pack/plugins/lens/public/react_embeddable/renderer/lens_custom_renderer_component.tsx new file mode 100644 index 0000000000000..5bc55d43c3212 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/renderer/lens_custom_renderer_component.tsx @@ -0,0 +1,158 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ReactEmbeddableRenderer } from '@kbn/embeddable-plugin/public'; +import { useSearchApi } from '@kbn/presentation-publishing'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; +import { BehaviorSubject } from 'rxjs'; +import type { PresentationPanelProps } from '@kbn/presentation-panel-plugin/public'; +import type { LensApi, LensRendererProps, LensRuntimeState, LensSerializedState } from '../types'; +import { LENS_EMBEDDABLE_TYPE } from '../../../common/constants'; +import { createEmptyLensState } from '../helper'; + +// This little utility uses the same pattern of the useSearchApi hook: +// create the Subject once and then update its value on change +function useObservableVariable(value: T) { + // eslint-disable-next-line react-hooks/exhaustive-deps + const observable = useMemo(() => new BehaviorSubject(value), []); + + // update the observable on change + useEffect(() => { + observable.next(value); + }, [observable, value]); + + return observable; +} + +type PanelProps = Pick< + PresentationPanelProps, + | 'showShadow' + | 'showBorder' + | 'showBadges' + | 'showNotifications' + | 'hideLoader' + | 'hideHeader' + | 'hideInspector' + | 'getActions' +>; + +/** + * The aim of this component is to provide a wrapper for other plugins who want to + * use a Lens component into their own page. This hides the embeddable parts of it + * by wrapping it into a ReactEmbeddableRenderer component and exposing a custom API + */ +export function LensRenderer({ + title, + withDefaultActions, + extraActions, + showInspector, + syncColors, + syncCursor, + syncTooltips, + viewMode, + id, + query, + filters, + timeRange, + disabledActions, + ...props +}: LensRendererProps) { + // Use the settings interface to store panel settings + const settings = useMemo(() => { + return { + syncColors$: new BehaviorSubject(false), + syncCursor$: new BehaviorSubject(false), + syncTooltips$: new BehaviorSubject(false), + }; + }, []); + const disabledActionIds$ = useObservableVariable(disabledActions); + const viewMode$ = useObservableVariable(viewMode); + + // Lens API will be set once, but when set trigger a reflow to adopt the latest attributes + const [lensApi, setLensApi] = useState(undefined); + const initialStateRef = useRef( + props.attributes ? { attributes: props.attributes } : createEmptyLensState(null, title) + ); + + const searchApi = useSearchApi({ query, filters, timeRange }); + + const showPanelChrome = Boolean(withDefaultActions) || (extraActions?.length || 0) > 0; + + // Re-render on changes + // internally the embeddable will evaluate whether it is worth to actual render or not + useEffect(() => { + // trigger a re-render if the attributes change + if (lensApi) { + lensApi.updateAttributes({ + ...('attributes' in initialStateRef.current + ? initialStateRef.current.attributes + : initialStateRef.current), + ...props.attributes, + }); + lensApi.updateOverrides(props.overrides); + } + }, [lensApi, props.attributes, props.overrides]); + + useEffect(() => { + if (syncColors != null && settings.syncColors$.getValue() !== syncColors) { + settings.syncColors$.next(syncColors); + } + if (syncCursor != null && settings.syncCursor$.getValue() !== syncCursor) { + settings.syncCursor$.next(syncCursor); + } + if (syncTooltips != null && settings.syncTooltips$.getValue() !== syncTooltips) { + settings.syncTooltips$.next(syncTooltips); + } + }, [settings, syncColors, syncCursor, syncTooltips]); + + const panelProps: PanelProps = useMemo(() => { + return { + hideInspector: !showInspector, + hideHeader: showPanelChrome, + showNotifications: false, + showShadow: false, + showBadges: false, + getActions: async (triggerId, context) => { + const actions = withDefaultActions + ? await lensApi?.getTriggerCompatibleActions(triggerId, context) + : []; + + return (extraActions ?? []).concat(actions || []); + }, + }; + }, [showInspector, showPanelChrome, withDefaultActions, extraActions, lensApi]); + + return ( + + type={LENS_EMBEDDABLE_TYPE} + maybeId={id} + getParentApi={() => ({ + // forward the Lens components to the embeddable + ...props, + // forward the unified search context + ...searchApi, + disabledActionIds: disabledActionIds$, + setDisabledActionIds: (ids: string[] | undefined) => disabledActionIds$.next(ids), + viewMode: viewMode$, + // pass the sync* settings with the unified settings interface + settings, + // make sure to provide the initial state (useful for the comparison check) + getSerializedStateForChild: () => ({ rawState: initialStateRef.current, references: [] }), + // update the runtime state on changes + getRuntimeStateForChild: () => ({ + ...initialStateRef.current, + attributes: props.attributes, + }), + })} + onApiAvailable={setLensApi} + hidePanelChrome={!showPanelChrome} + panelProps={panelProps} + /> + ); +} + +export type EmbeddableComponent = React.ComponentType; diff --git a/x-pack/plugins/lens/public/react_embeddable/renderer/lens_embeddable_component.test.tsx b/x-pack/plugins/lens/public/react_embeddable/renderer/lens_embeddable_component.test.tsx new file mode 100644 index 0000000000000..04c3511ab3d4f --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/renderer/lens_embeddable_component.test.tsx @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { render, screen } from '@testing-library/react'; +import { getLensApiMock, getLensInternalApiMock } from '../mocks'; +import { LensApi, LensInternalApi } from '../types'; +import { BehaviorSubject } from 'rxjs'; +import { PublishingSubject } from '@kbn/presentation-publishing'; +import React from 'react'; +import { LensEmbeddableComponent } from './lens_embeddable_component'; + +type GetValueType = Type extends PublishingSubject ? X : never; + +function getDefaultProps({ + internalApiOverrides = undefined, + apiOverrides = undefined, +}: { internalApiOverrides?: Partial; apiOverrides?: Partial } = {}) { + return { + internalApi: getLensInternalApiMock(internalApiOverrides), + api: getLensApiMock(apiOverrides), + onUnmount: jest.fn(), + }; +} + +describe('Lens Embeddable component', () => { + it('should not render the visualization if any error arises', () => { + const props = getDefaultProps({ + internalApiOverrides: { + expressionParams$: new BehaviorSubject>( + null + ), + }, + }); + + render(); + expect(screen.queryByTestId('lens-embeddable')).not.toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/lens/public/react_embeddable/renderer/lens_embeddable_component.tsx b/x-pack/plugins/lens/public/react_embeddable/renderer/lens_embeddable_component.tsx new file mode 100644 index 0000000000000..6d98b901d905f --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/renderer/lens_embeddable_component.tsx @@ -0,0 +1,91 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useBatchedPublishingSubjects } from '@kbn/presentation-publishing'; +import React, { useEffect } from 'react'; +import { LensApi } from '../..'; +import { ExpressionWrapper } from '../expression_wrapper'; +import { LensInternalApi } from '../types'; +import { UserMessages } from '../user_messages/container'; +import { useMessages, useDispatcher } from './hooks'; +import { getViewMode } from '../helper'; +import { addLog } from '../logger'; + +export function LensEmbeddableComponent({ + internalApi, + api, + onUnmount, +}: { + internalApi: LensInternalApi; + api: LensApi; + onUnmount: () => void; +}) { + const [ + // Pick up updated params from the observable + expressionParams, + // used for functional tests + renderCount, + // has the render completed? + hasRendered, + // these are blocking errors that can be shown in a badge + // without replacing the entire panel + blockingErrors, + // has view mode changed? + latestViewMode, + ] = useBatchedPublishingSubjects( + internalApi.expressionParams$, + internalApi.renderCount$, + internalApi.hasRenderCompleted$, + internalApi.validationMessages$, + api.viewMode + ); + const canEdit = Boolean(api.isEditingEnabled?.() && getViewMode(latestViewMode) === 'edit'); + + const [warningOrErrors, infoMessages] = useMessages(internalApi); + + // On unmount call all the cleanups + useEffect(() => { + addLog(`Mounting Lens Embeddable component: ${api.defaultPanelTitle?.getValue()}`); + return onUnmount; + }, [api, onUnmount]); + + // take care of dispatching the event from the DOM node + const rootRef = useDispatcher(hasRendered, api); + + // Publish the data attributes only if avaialble/visible + const title = api.hidePanelTitle?.getValue() + ? undefined + : { 'data-title': api.panelTitle?.getValue() ?? api.defaultPanelTitle?.getValue() }; + const description = api.panelDescription?.getValue() + ? { + 'data-description': + api.panelDescription?.getValue() ?? api.defaultPanelDescription?.getValue(), + } + : undefined; + + return ( +
+ {expressionParams == null || blockingErrors.length ? null : ( + + )} + +
+ ); +} diff --git a/x-pack/plugins/lens/public/react_embeddable/type_guards.ts b/x-pack/plugins/lens/public/react_embeddable/type_guards.ts new file mode 100644 index 0000000000000..95e8311a7a3c0 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/type_guards.ts @@ -0,0 +1,74 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + apiIsOfType, + apiPublishesPanelTitle, + apiPublishesUnifiedSearch, +} from '@kbn/presentation-publishing'; +import { isObject } from 'lodash'; +import { + LensApiCallbacks, + LensApi, + LensComponentForwardedProps, + LensPublicCallbacks, +} from './types'; + +function apiHasLensCallbacks(api: unknown): api is LensApiCallbacks { + const fns = [ + 'getSavedVis', + 'getViewUnderlyingDataArgs', + 'isTextBasedLanguage', + 'getTextBasedLanguage', + ] as Array; + return fns.every((fn) => typeof (api as LensApiCallbacks)[fn] === 'function'); +} + +export const isLensApi = (api: unknown): api is LensApi => { + return Boolean( + api && + apiIsOfType(api, 'lens') && + 'canViewUnderlyingData$' in api && + apiHasLensCallbacks(api) && + apiPublishesPanelTitle(api) && + apiPublishesUnifiedSearch(api) + ); +}; + +export function apiHasLensComponentCallbacks(api: unknown): api is LensPublicCallbacks { + return ( + isObject(api) && + ['onFilter', 'onBrushEnd', 'onLoad', 'onTableRowClick', 'onBeforeBadgesRender'].some((fn) => + Object.hasOwn(api, fn) + ) + ); +} + +export function apiHasLensComponentProps(api: unknown): api is LensComponentForwardedProps { + return ( + isObject(api) && + ['style', 'className', 'noPadding', 'viewMode', 'abortController'].some((prop) => + Object.hasOwn(api, prop) + ) + ); +} + +export function apiHasAbortController(api: unknown): api is { abortController: AbortController } { + return isObject(api) && Object.hasOwn(api, 'abortController'); +} + +export function apiHasLastReloadRequestTime( + api: unknown +): api is { lastReloadRequestTime: number } { + return isObject(api) && Object.hasOwn(api, 'lastReloadRequestTime'); +} + +export function apiPublishesInlineEditingCapabilities( + api: unknown +): api is { canEditInline: boolean } { + return isObject(api) && Object.hasOwn(api, 'canEditInline'); +} diff --git a/x-pack/plugins/lens/public/react_embeddable/types.ts b/x-pack/plugins/lens/public/react_embeddable/types.ts new file mode 100644 index 0000000000000..03a9801507d1c --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/types.ts @@ -0,0 +1,494 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import type { DefaultEmbeddableApi } from '@kbn/embeddable-plugin/public'; +import type { + AggregateQuery, + ExecutionContextSearch, + Filter, + Query, + TimeRange, +} from '@kbn/es-query'; +import type { Adapters, InspectorOptions } from '@kbn/inspector-plugin/public'; +import type { + HasEditCapabilities, + HasInPlaceLibraryTransforms, + HasLibraryTransforms, + HasSupportedTriggers, + PublishesBlockingError, + PublishesDataLoading, + PublishesDataViews, + PublishesDisabledActionIds, + PublishesSavedObjectId, + PublishesUnifiedSearch, + PublishesViewMode, + PublishesWritablePanelDescription, + PublishesWritablePanelTitle, + PublishingSubject, + SerializedTitles, + ViewMode, +} from '@kbn/presentation-publishing'; +import type { DynamicActionsSerializedState } from '@kbn/embeddable-enhanced-plugin/public/plugin'; +import type { + BrushTriggerEvent, + ClickTriggerEvent, + MultiClickTriggerEvent, +} from '@kbn/charts-plugin/public'; +import type { PaletteOutput } from '@kbn/coloring'; +import type { DefaultInspectorAdapters, RenderMode } from '@kbn/expressions-plugin/common'; +import type { + Capabilities, + CoreStart, + HttpSetup, + IUiSettingsClient, + KibanaExecutionContext, + OverlayRef, + SavedObjectReference, + ThemeServiceStart, +} from '@kbn/core/public'; +import type { TimefilterContract, FilterManager } from '@kbn/data-plugin/public'; +import type { DataView, DataViewSpec } from '@kbn/data-views-plugin/common'; +import type { + ExpressionRendererEvent, + ReactExpressionRendererProps, + ReactExpressionRendererType, +} from '@kbn/expressions-plugin/public'; +import type { RecursiveReadonly } from '@kbn/utility-types'; +import type { AllowedChartOverrides, AllowedSettingsOverrides } from '@kbn/charts-plugin/common'; +import type { AllowedGaugeOverrides } from '@kbn/expression-gauge-plugin/common'; +import type { AllowedPartitionOverrides } from '@kbn/expression-partition-vis-plugin/common'; +import type { AllowedXYOverrides } from '@kbn/expression-xy-plugin/common'; +import type { Action } from '@kbn/ui-actions-plugin/public'; +import type { LegacyMetricState } from '../../common'; +import type { LensDocument } from '../persistence'; +import type { LensInspector } from '../lens_inspector_service'; +import type { LensAttributesService } from '../lens_attribute_service'; +import type { + DatatableVisualizationState, + DocumentToExpressionReturnType, + HeatmapVisualizationState, + XYState, +} from '../async_services'; +import type { + DatasourceMap, + IndexPatternMap, + IndexPatternRef, + LensTableRowContextMenuEvent, + SharingSavedObjectProps, + Simplify, + UserMessage, + VisualizationMap, +} from '../types'; +import type { LensPluginStartDependencies } from '../plugin'; +import type { TableInspectorAdapter } from '../editor_frame_service/types'; +import type { PieVisualizationState } from '../../common/types'; +import type { FormBasedPersistedState } from '..'; +import type { TextBasedPersistedState } from '../datasources/text_based/types'; +import type { GaugeVisualizationState } from '../visualizations/gauge/constants'; +import type { MetricVisualizationState } from '../visualizations/metric/types'; + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface LensApiProps {} + +export type LensSavedObjectAttributes = Omit; + +export interface VisualizationContext { + doc: LensDocument | undefined; + mergedSearchContext: ExecutionContextSearch; + indexPatterns: IndexPatternMap; + indexPatternRefs: IndexPatternRef[]; + activeVisualizationState: unknown; + activeDatasourceState: unknown; + activeData?: TableInspectorAdapter; +} + +export interface VisualizationContextHelper { + getVisualizationContext: () => VisualizationContext; + updateVisualizationContext: (newContext: Partial) => void; +} + +export interface ViewUnderlyingDataArgs { + dataViewSpec: DataViewSpec; + timeRange: TimeRange; + filters: Filter[]; + query: Query | AggregateQuery | undefined; + columns: string[]; +} + +export type LensEmbeddableStartServices = Simplify< + LensPluginStartDependencies & { + timefilter: TimefilterContract; + coreHttp: HttpSetup; + coreStart: CoreStart; + capabilities: RecursiveReadonly; + expressionRenderer: ReactExpressionRendererType; + documentToExpression: (doc: LensDocument) => Promise; + injectFilterReferences: FilterManager['inject']; + visualizationMap: VisualizationMap; + datasourceMap: DatasourceMap; + theme: ThemeServiceStart; + uiSettings: IUiSettingsClient; + attributeService: LensAttributesService; + } +>; + +export interface PreventableEvent { + preventDefault(): void; +} + +interface LensByValue { + // by-value + attributes?: Simplify; +} + +export interface LensOverrides { + /** + * Overrides can tweak the style of the final embeddable and are executed at the end of the Lens rendering pipeline. + * Each visualization type offers various type of overrides, per component (i.e. 'setting', 'axisX', 'partition', etc...) + * + * While it is not possible to pass function/callback/handlers to the renderer, it is possible to overwrite + * the current behaviour by passing the "ignore" string to the override prop (i.e. onBrushEnd: "ignore" to stop brushing) + */ + overrides?: + | AllowedChartOverrides + | AllowedSettingsOverrides + | AllowedXYOverrides + | AllowedPartitionOverrides + | AllowedGaugeOverrides; +} + +/** + * Lens embeddable props broken down by type + */ + +export interface LensByReference { + // by-reference + savedObjectId?: string; +} + +interface ContentManagementProps { + sharingSavedObjectProps?: SharingSavedObjectProps; + managed?: boolean; +} + +export type LensPropsVariants = (LensByValue & LensByReference) & { + references?: SavedObjectReference[]; +}; + +export interface ViewInDiscoverCallbacks extends LensApiProps { + canViewUnderlyingData$: PublishingSubject; + loadViewUnderlyingData: () => void; + getViewUnderlyingDataArgs: () => ViewUnderlyingDataArgs | undefined; +} + +export interface IntegrationCallbacks extends LensApiProps { + isTextBasedLanguage: () => boolean | undefined; + getTextBasedLanguage: () => string | undefined; + getSavedVis: () => Readonly; + getFullAttributes: () => LensDocument | undefined; + updateAttributes: (newAttributes: LensRuntimeState['attributes']) => void; + updateSavedObjectId: (newSavedObjectId: LensRuntimeState['savedObjectId']) => void; + updateOverrides: (newOverrides: LensOverrides['overrides']) => void; + getTriggerCompatibleActions: (triggerId: string, context: object) => Promise; +} + +/** + * Public Callbacks are function who are exposed thru the Lens custom renderer component, + * so not directly exposed in the Lens API, rather passed down as parentApi to the Lens Embeddable + */ +export interface LensPublicCallbacks extends LensApiProps { + onBrushEnd?: (data: Simplify) => void; + onLoad?: ( + isLoading: boolean, + adapters?: Partial, + dataLoading$?: PublishingSubject + ) => void; + onFilter?: ( + data: Simplify<(ClickTriggerEvent['data'] | MultiClickTriggerEvent['data']) & PreventableEvent> + ) => void; + onTableRowClick?: ( + data: Simplify + ) => void; + /** + * Let the consumer overwrite embeddable user messages + */ + onBeforeBadgesRender?: (userMessages: UserMessage[]) => UserMessage[]; +} + +/** + * API callbacks are function who are used by direct Embeddable consumers (i.e. Dashboard or our own Lens custom renderer) + */ +export type LensApiCallbacks = Simplify; + +export interface LensUnifiedSearchContext { + filters?: Filter[]; + query?: Query | AggregateQuery; + timeRange?: TimeRange; + timeslice?: [number, number]; + searchSessionId?: string; + lastReloadRequestTime?: number; +} + +export interface LensPanelProps { + id?: string; + renderMode?: ViewMode; + disableTriggers?: boolean; + syncColors?: boolean; + syncTooltips?: boolean; + syncCursor?: boolean; + palette?: PaletteOutput; +} + +/** + * This set of props are exposes by the Lens component too + */ +export interface LensSharedProps { + executionContext?: KibanaExecutionContext; + style?: React.CSSProperties; + className?: string; + noPadding?: boolean; + viewMode?: ViewMode; +} + +interface LensRequestHandlersProps { + /** + * Custom abort controller to be used for the ES client + */ + abortController?: AbortController; +} + +/** + * Compose together all the props and make them inspectable via Simplify + * + * The LensSerializedState is the state stored for a dashboard panel + * that contains: + * * Lens document state + * * Panel settings + * * other props from the embeddable + */ +export type LensSerializedState = Simplify< + LensPropsVariants & + LensOverrides & + LensUnifiedSearchContext & + LensPanelProps & + SerializedTitles & + LensSharedProps & + Partial & { isNewPanel?: boolean } +>; + +/** + * Custom props exposed on the Lens exported component + */ +export type LensComponentProps = Simplify< + LensRequestHandlersProps & + LensSharedProps & { + /** + * When enabled the Lens component will render as a dashboard panel + */ + withDefaultActions?: boolean; + /** + * Allow custom actions to be rendered in the panel + */ + extraActions?: Action[]; + /** + * Disable specific actions for the embeddable + */ + disabledActions?: string[]; + /** + * Toggles the inspector + */ + showInspector?: boolean; + /** + * Toggle inline editing feature + */ + canEditInline?: boolean; + } +>; + +/** + * This is the subset of props that from the LensComponent will be forwarded to the Lens embeddable + */ +export type LensComponentForwardedProps = Pick< + LensComponentProps, + 'style' | 'className' | 'noPadding' | 'abortController' | 'executionContext' | 'viewMode' +>; + +/** + * Carefully chosen props to expose on the Lens renderer component used by + * other plugins + */ + +type ComponentProps = LensComponentProps & LensPublicCallbacks; +type ComponentSerializedProps = TypedLensSerializedState; + +type LensRendererPrivateProps = ComponentSerializedProps & ComponentProps; +export type LensRendererProps = Simplify; + +/** + * The LensRuntimeState is the state stored for a dashboard panel + * that contains: + * * Lens document state + * * Panel settings + * * other props from the embeddable + */ +export type LensRuntimeState = Simplify< + Omit & { + attributes: NonNullable; + } & Pick & + ContentManagementProps +>; + +export interface LensInspectorAdapters { + getInspectorAdapters: () => Adapters; + inspect: (options?: InspectorOptions) => OverlayRef; + closeInspector: () => Promise; + // expose a handler for the inspector adapters + // to be able to subscribe to changes + // a typical use case is the inline editing, where the editor + // needs to be updated on data changes + adapters$: PublishingSubject; +} + +export type LensApi = Simplify< + DefaultEmbeddableApi & + // This is used by actions to operate the edit action + HasEditCapabilities & + // for blocking errors leverage the embeddable panel UI + PublishesBlockingError & + // This is used by dashboard/container to show filters/queries on the panel + PublishesUnifiedSearch & + // Let the container know the loading state + PublishesDataLoading & + // Let the container know the used data views + PublishesDataViews & + // Let the container operate on panel title/description + PublishesWritablePanelTitle & + PublishesWritablePanelDescription & + // This embeddable can narrow down specific triggers usage + HasSupportedTriggers & + PublishesDisabledActionIds & + // Offers methods to operate from/on the linked saved object + HasInPlaceLibraryTransforms & + HasLibraryTransforms & + // Let the container know the view mode + PublishesViewMode & + // Let the container know the saved object id + PublishesSavedObjectId & + // Lens specific API methods: + // Let the container know when the data has been loaded/updated + LensInspectorAdapters & + LensRequestHandlersProps & + LensApiCallbacks +>; + +// This is an API only used internally to the embeddable but not exported elsewhere +// there's some overlapping between this and the LensApi but they are shared references +export type LensInternalApi = Simplify< + Pick & + PublishesDataViews & { + attributes$: PublishingSubject; + overrides$: PublishingSubject; + disableTriggers$: PublishingSubject; + dataLoading$: PublishingSubject; + hasRenderCompleted$: PublishingSubject; + isNewlyCreated$: PublishingSubject; + setAsCreated: () => void; + dispatchRenderStart: () => void; + dispatchRenderComplete: () => void; + dispatchError: () => void; + updateDataLoading: (newDataLoading: boolean | undefined) => void; + expressionParams$: PublishingSubject; + updateExpressionParams: (newParams: ExpressionWrapperProps | null) => void; + expressionAbortController$: PublishingSubject; + updateAbortController: (newAbortController: AbortController | undefined) => void; + renderCount$: PublishingSubject; + updateDataViews: (dataViews: DataView[] | undefined) => void; + messages$: PublishingSubject; + updateMessages: (newMessages: UserMessage[]) => void; + validationMessages$: PublishingSubject; + updateValidationMessages: (newMessages: UserMessage[]) => void; + resetAllMessages: () => void; + } +>; + +export interface ExpressionWrapperProps { + ExpressionRenderer: ReactExpressionRendererType; + expression: string | null; + variables?: Record; + interactive?: boolean; + searchContext: ExecutionContextSearch; + searchSessionId?: string; + handleEvent: (event: ExpressionRendererEvent) => void; + onData$: ( + data: unknown, + inspectorAdapters?: Partial | undefined + ) => void; + onRender$: (count: number) => void; + renderMode?: RenderMode; + syncColors?: boolean; + syncTooltips?: boolean; + syncCursor?: boolean; + hasCompatibleActions?: ReactExpressionRendererProps['hasCompatibleActions']; + getCompatibleCellValueActions?: ReactExpressionRendererProps['getCompatibleCellValueActions']; + style?: React.CSSProperties; + className?: string; + addUserMessages: (messages: UserMessage[]) => void; + onRuntimeError: (error: Error) => void; + executionContext?: KibanaExecutionContext; + lensInspector: LensInspector; + noPadding?: boolean; + abortController?: AbortController; +} + +export type GetStateType = () => LensRuntimeState; + +/** + * Custom Lens component exported by the plugin + * For better DX of Lens component consumers, expose a typed version of the serialized state + */ + +/** Utility function to build typed version for each chart */ +type TypedLensAttributes = Simplify< + Omit & { + visualizationType: TVisType; + state: Simplify< + Omit & { + datasourceStates: { + formBased?: FormBasedPersistedState; + textBased?: TextBasedPersistedState; + }; + visualization: TVisState; + } + >; + } +>; + +/** + * Type-safe variant of by value embeddable input for Lens. + * This can be used to hardcode certain Lens chart configurations within another app. + */ +export type TypedLensSerializedState = Simplify< + Omit & { + attributes: + | TypedLensAttributes<'lnsXY', XYState> + | TypedLensAttributes<'lnsPie', PieVisualizationState> + | TypedLensAttributes<'lnsHeatmap', HeatmapVisualizationState> + | TypedLensAttributes<'lnsGauge', GaugeVisualizationState> + | TypedLensAttributes<'lnsDatatable', DatatableVisualizationState> + | TypedLensAttributes<'lnsLegacyMetric', LegacyMetricState> + | TypedLensAttributes<'lnsMetric', MetricVisualizationState> + | TypedLensAttributes; + } +>; + +/** + * Backward compatibility types + */ +export type LensByValueInput = Omit; +export type LensByReferenceInput = Omit; +export type TypedLensByValueInput = Omit; +export type LensEmbeddableInput = LensByValueInput | LensByReferenceInput; +export type LensEmbeddableOutput = LensApi; diff --git a/x-pack/plugins/lens/public/react_embeddable/user_messages/api.ts b/x-pack/plugins/lens/public/react_embeddable/user_messages/api.ts new file mode 100644 index 0000000000000..90061cfb7c2fe --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/user_messages/api.ts @@ -0,0 +1,288 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { SpacesApi } from '@kbn/spaces-plugin/public'; +import { Adapters } from '@kbn/inspector-plugin/common'; +import { BehaviorSubject } from 'rxjs'; +import { + filterAndSortUserMessages, + getApplicationUserMessages, + handleMessageOverwriteFromConsumer, +} from '../../app_plugin/get_application_user_messages'; +import { getDatasourceLayers } from '../../state_management/utils'; +import { + UserMessagesGetter, + UserMessage, + FramePublicAPI, + SharingSavedObjectProps, +} from '../../types'; +import { + getActiveDatasourceIdFromDoc, + getActiveVisualizationIdFromDoc, + getInitialDataViewsObject, +} from '../../utils'; +import { + LensPublicCallbacks, + LensEmbeddableStartServices, + VisualizationContext, + VisualizationContextHelper, + LensApi, + LensInternalApi, +} from '../types'; +import { getLegacyURLConflictsMessage, hasLegacyURLConflict } from './checks'; +import { getSearchWarningMessages } from '../../utils'; +import { addLog } from '../logger'; + +function getUpdatedState( + getVisualizationContext: VisualizationContextHelper['getVisualizationContext'], + visualizationMap: LensEmbeddableStartServices['visualizationMap'], + datasourceMap: LensEmbeddableStartServices['datasourceMap'] +) { + const { + doc, + mergedSearchContext, + indexPatterns, + indexPatternRefs, + activeVisualizationState, + activeDatasourceState, + activeData, + } = getVisualizationContext(); + const activeVisualizationId = getActiveVisualizationIdFromDoc(doc); + const activeDatasourceId = getActiveDatasourceIdFromDoc(doc); + const activeDatasource = activeDatasourceId ? datasourceMap[activeDatasourceId] : null; + const activeVisualization = activeVisualizationId + ? visualizationMap[activeVisualizationId] + : undefined; + const dataViewObject = getInitialDataViewsObject(indexPatterns, indexPatternRefs); + return { + doc, + mergedSearchContext, + activeDatasource, + activeVisualization, + activeVisualizationId, + dataViewObject, + activeVisualizationState, + activeDatasourceState, + activeDatasourceId, + activeData, + }; +} + +function getWarningMessages( + { + activeDatasource, + activeDatasourceId, + activeDatasourceState, + }: ReturnType, + adapters: Adapters, + data: LensEmbeddableStartServices['data'] +) { + if (!activeDatasource || !activeDatasourceId || !adapters?.requests) { + return []; + } + + const requestWarnings = getSearchWarningMessages( + adapters.requests, + activeDatasource, + activeDatasourceState, + { + searchService: data.search, + } + ); + + return requestWarnings; +} + +export function buildUserMessagesHelpers( + api: LensApi, + internalApi: LensInternalApi, + getVisualizationContext: () => VisualizationContext, + { coreStart, data, visualizationMap, datasourceMap }: LensEmbeddableStartServices, + onBeforeBadgesRender: LensPublicCallbacks['onBeforeBadgesRender'], + spaces?: SpacesApi, + metaInfo?: SharingSavedObjectProps +): { + getUserMessages: UserMessagesGetter; + addUserMessages: (messages: UserMessage[]) => void; + updateWarnings: () => void; + updateMessages: (messages: UserMessage[]) => void; + resetMessages: () => void; + updateBlockingErrors: (blockingMessages: UserMessage[] | Error) => void; + updateValidationErrors: (messages: UserMessage[]) => void; +} { + let runtimeUserMessages: Record = {}; + const addUserMessages = (messages: UserMessage[]) => { + if (messages.length) { + addLog(`addUserMessages: "${messages.map(({ uniqueId }) => uniqueId).join('", "')}"`); + } + for (const message of messages) { + runtimeUserMessages[message.uniqueId] = message; + } + }; + + const resetMessages = () => { + runtimeUserMessages = {}; + internalApi.resetAllMessages(); + }; + + const getUserMessages: UserMessagesGetter = (locationId, filters) => { + const { + doc, + activeVisualizationState, + activeVisualization, + activeVisualizationId, + activeDatasource, + activeDatasourceState, + activeDatasourceId, + dataViewObject, + mergedSearchContext, + activeData, + } = getUpdatedState(getVisualizationContext, visualizationMap, datasourceMap); + const userMessages: UserMessage[] = []; + + userMessages.push( + ...getApplicationUserMessages({ + visualizationType: doc?.visualizationType, + visualizationState: { + state: activeVisualizationState, + activeId: activeVisualizationId, + }, + visualization: activeVisualization, + activeDatasource, + activeDatasourceState: { + isLoading: !activeDatasourceState, + state: activeDatasourceState, + }, + dataViews: dataViewObject, + core: coreStart, + }) + ); + + if (!doc || !activeDatasourceState || !activeVisualizationState) { + return userMessages; + } + + const framePublicAPI: FramePublicAPI = { + dataViews: dataViewObject, + datasourceLayers: getDatasourceLayers( + { + [activeDatasourceId!]: { + isLoading: !activeDatasourceState, + state: activeDatasourceState, + }, + }, + datasourceMap, + dataViewObject.indexPatterns + ), + query: doc.state.query, + filters: mergedSearchContext.filters ?? [], + dateRange: { + fromDate: mergedSearchContext.timeRange?.from ?? '', + toDate: mergedSearchContext.timeRange?.to ?? '', + }, + absDateRange: { + fromDate: mergedSearchContext.timeRange?.from ?? '', + toDate: mergedSearchContext.timeRange?.to ?? '', + }, + activeData, + }; + + if (hasLegacyURLConflict(metaInfo, spaces)) { + userMessages.push(getLegacyURLConflictsMessage(metaInfo!, spaces!)); + } + + userMessages.push( + ...(activeDatasource?.getUserMessages(activeDatasourceState, { + setState: () => {}, + frame: framePublicAPI, + visualizationInfo: activeVisualization?.getVisualizationInfo?.( + activeVisualizationState, + framePublicAPI + ), + }) ?? []), + ...(activeVisualization?.getUserMessages?.(activeVisualizationState, { + frame: framePublicAPI, + }) ?? []) + ); + + return handleMessageOverwriteFromConsumer( + filterAndSortUserMessages( + userMessages.concat(Object.values(runtimeUserMessages)), + locationId, + filters ?? {} + ), + onBeforeBadgesRender + ); + }; + + return { + addUserMessages, + resetMessages, + getUserMessages, + /** + * Here pass all the messages that comes directly from the Lens validation/info system + * who includes: + * * configuration errors (i.e. missing fields) + * * warning messages (badge related) + * * info messages (badge related) + */ + updateMessages: (messages: UserMessage[]) => { + // update the messages only if something changed + const existingMessages = new Set( + internalApi.messages$.getValue().map(({ uniqueId }) => uniqueId) + ); + if ( + existingMessages.size !== messages.length || + messages.some(({ uniqueId }) => !existingMessages.has(uniqueId)) + ) { + internalApi.updateMessages(messages); + } + }, + updateValidationErrors: (messages: UserMessage[]) => { + addLog( + `Validation error: ${ + messages.length ? messages.map(({ uniqueId }) => uniqueId).join(', ') : 'No errors' + }` + ); + internalApi.updateValidationMessages(messages); + }, + /** + * This type of errors are those who need to be rendered in the embeddable native error panel + * like runtime errors. + */ + updateBlockingErrors: (blockingMessages: UserMessage[] | Error) => { + const error = + blockingMessages instanceof Error + ? blockingMessages + : blockingMessages.length + ? new Error( + typeof blockingMessages[0].longMessage === 'string' && blockingMessages[0].longMessage + ? blockingMessages[0].longMessage + : blockingMessages[0].shortMessage + ) + : undefined; + + if (error) { + addLog(`Blocking error: ${error?.message}`); + } + + if (error?.message !== api.blockingError.getValue()?.message) { + const finalError = error?.message === '' ? undefined : error; + (api.blockingError as BehaviorSubject).next(finalError); + } + }, + updateWarnings: () => { + addUserMessages( + getWarningMessages( + getUpdatedState(getVisualizationContext, visualizationMap, datasourceMap), + api.adapters$.getValue(), + data + ) + ); + }, + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/user_messages/checks.tsx b/x-pack/plugins/lens/public/react_embeddable/user_messages/checks.tsx new file mode 100644 index 0000000000000..50250b31fdc7c --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/user_messages/checks.tsx @@ -0,0 +1,73 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import type { SpacesApi } from '@kbn/spaces-plugin/public'; +import React from 'react'; +import { DOC_TYPE } from '../../../common/constants'; +import type { + IndexPatternMap, + IndexPatternRef, + SharingSavedObjectProps, + UserMessage, +} from '../../types'; +import type { LensApi } from '../types'; +import type { MergedSearchContext } from '../expressions/merged_search_context'; +import { MISSING_TIME_RANGE_ON_EMBEDDABLE, URL_CONFLICT } from '../../user_messages_ids'; + +export function hasLegacyURLConflict(metaInfo?: SharingSavedObjectProps, spaces?: SpacesApi) { + return metaInfo?.outcome === 'conflict' && spaces?.ui?.components?.getEmbeddableLegacyUrlConflict; +} + +export function getLegacyURLConflictsMessage( + metaInfo: SharingSavedObjectProps, + spaces: SpacesApi +): UserMessage { + const LegacyURLConfig = spaces.ui.components.getEmbeddableLegacyUrlConflict; + return { + uniqueId: URL_CONFLICT, + severity: 'error', + displayLocations: [{ id: 'visualization' }], + shortMessage: i18n.translate('xpack.lens.legacyURLConflict.shortMessage', { + defaultMessage: `You've encountered a URL conflict`, + }), + longMessage: , + fixableInEditor: false, + }; +} + +export function isSearchContextIncompatibleWithDataViews( + api: LensApi, + context: { type?: string; id?: string } | undefined, + searchContext: MergedSearchContext, + indexPatternRefs: IndexPatternRef[], + indexPatterns: IndexPatternMap +) { + return ( + !api.isTextBasedLanguage() && + searchContext.timeRange == null && + indexPatternRefs.some(({ id }) => { + const indexPattern = indexPatterns[id]; + return indexPattern?.timeFieldName && indexPattern.getFieldByName(indexPattern.timeFieldName); + }) + ); +} + +export function getSearchContextIncompatibleMessage(): UserMessage { + return { + uniqueId: MISSING_TIME_RANGE_ON_EMBEDDABLE, + severity: 'error', + fixableInEditor: false, + displayLocations: [{ id: 'visualization' }], + shortMessage: i18n.translate('xpack.lens.missingTimeRangeParam.shortMessage', { + defaultMessage: `Missing timeRange property`, + }), + longMessage: i18n.translate('xpack.lens.missingTimeRangeParam.longMessage', { + defaultMessage: `The timeRange property is required for the given configuration`, + }), + }; +} diff --git a/x-pack/plugins/lens/public/react_embeddable/user_messages/container.tsx b/x-pack/plugins/lens/public/react_embeddable/user_messages/container.tsx new file mode 100644 index 0000000000000..451de837e96e7 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/user_messages/container.tsx @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { css } from '@emotion/react'; +import React from 'react'; +import type { UserMessage } from '../../types'; +import { VisualizationErrorPanel } from './error_panel'; +import { EmbeddableFeatureBadge } from './info_badges'; +import { MessagesPopover } from './message_popover'; + +export function UserMessages({ + blockingErrors, + warningOrErrors, + infoMessages, + canEdit, +}: { + canEdit: boolean; + blockingErrors: UserMessage[]; + warningOrErrors: UserMessage[]; + infoMessages: UserMessage[]; +}) { + if (!blockingErrors.length && !warningOrErrors.length && !infoMessages.length) { + return null; + } + return ( + <> + +
+ + +
+ + ); +} diff --git a/x-pack/plugins/lens/public/react_embeddable/user_messages/error_panel.tsx b/x-pack/plugins/lens/public/react_embeddable/user_messages/error_panel.tsx new file mode 100644 index 0000000000000..ee050382914c8 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/user_messages/error_panel.tsx @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiEmptyPrompt } from '@elastic/eui'; +import React from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { UserMessage } from '../../types'; +import { getLongMessage } from '../../user_messages_utils'; + +export function VisualizationErrorPanel({ + errors, + canEdit, +}: { + errors: UserMessage[]; + canEdit: boolean; +}) { + if (!errors.length) { + return null; + } + const showMore = errors.length > 1; + const canFixInLens = canEdit && errors.some(({ fixableInEditor }) => fixableInEditor); + return ( +
+ + {errors.length ? ( + <> +

{getLongMessage(errors[0]) || errors[0].shortMessage}

+ {showMore && !canFixInLens ? ( +

+ +

+ ) : null} + {canFixInLens ? ( +

+ +

+ ) : null} + + ) : ( +

+ +

+ )} + + } + /> +
+ ); +} diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_info_badges.scss b/x-pack/plugins/lens/public/react_embeddable/user_messages/info_badges.scss similarity index 62% rename from x-pack/plugins/lens/public/embeddable/embeddable_info_badges.scss rename to x-pack/plugins/lens/public/react_embeddable/user_messages/info_badges.scss index 55407855b49f6..7435808095a19 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_info_badges.scss +++ b/x-pack/plugins/lens/public/react_embeddable/user_messages/info_badges.scss @@ -1,4 +1,4 @@ -.lnsEmbeddablePanelFeatureList { +.lnsPanelFeatureList { max-height: $euiSize * 20; @include euiYScroll; } diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_info_badges.test.tsx b/x-pack/plugins/lens/public/react_embeddable/user_messages/info_badges.test.tsx similarity index 97% rename from x-pack/plugins/lens/public/embeddable/embeddable_info_badges.test.tsx rename to x-pack/plugins/lens/public/react_embeddable/user_messages/info_badges.test.tsx index b70b102a78484..ef3ee40e17d1e 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_info_badges.test.tsx +++ b/x-pack/plugins/lens/public/react_embeddable/user_messages/info_badges.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; -import { EmbeddableFeatureBadge } from './embeddable_info_badges'; -import { UserMessage } from '../types'; +import { EmbeddableFeatureBadge } from './info_badges'; +import { UserMessage } from '../../types'; describe('EmbeddableFeatureBadge', () => { async function renderPopup(messages: UserMessage[], count: number = messages.length) { diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_info_badges.tsx b/x-pack/plugins/lens/public/react_embeddable/user_messages/info_badges.tsx similarity index 89% rename from x-pack/plugins/lens/public/embeddable/embeddable_info_badges.tsx rename to x-pack/plugins/lens/public/react_embeddable/user_messages/info_badges.tsx index 18cff3f2ac90a..5b120625b662e 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_info_badges.tsx +++ b/x-pack/plugins/lens/public/react_embeddable/user_messages/info_badges.tsx @@ -18,9 +18,9 @@ import { css } from '@emotion/react'; import { i18n } from '@kbn/i18n'; import React, { Fragment } from 'react'; import { useState } from 'react'; -import type { UserMessage } from '../types'; -import './embeddable_info_badges.scss'; -import { getLongMessage } from '../user_messages_utils'; +import type { UserMessage } from '../../types'; +import './info_badges.scss'; +import { getLongMessage } from '../../user_messages_utils'; export const EmbeddableFeatureBadge = ({ messages }: { messages: UserMessage[] }) => { const { euiTheme } = useEuiTheme(); @@ -31,7 +31,7 @@ export const EmbeddableFeatureBadge = ({ messages }: { messages: UserMessage[] } if (!messages.length) { return null; } - const iconTitle = i18n.translate('xpack.lens.embeddable.featureBadge.iconDescription', { + const iconTitle = i18n.translate('xpack.lens.featureBadge.iconDescription', { defaultMessage: `{count} visualization {count, plural, one {modifier} other {modifiers}}`, values: { count: messages.length, @@ -51,7 +51,7 @@ export const EmbeddableFeatureBadge = ({ messages }: { messages: UserMessage[] } @@ -98,7 +101,7 @@ export const EmbeddableFeatureBadge = ({ messages }: { messages: UserMessage[] }

{shortMessage}

-
    +
      {messageGroup.map((message, i) => ( {getLongMessage(message)} ))} diff --git a/x-pack/plugins/lens/public/react_embeddable/user_messages/message_popover.tsx b/x-pack/plugins/lens/public/react_embeddable/user_messages/message_popover.tsx new file mode 100644 index 0000000000000..a6359bd683d13 --- /dev/null +++ b/x-pack/plugins/lens/public/react_embeddable/user_messages/message_popover.tsx @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useEuiTheme, useEuiFontSize } from '@elastic/eui'; +import { css } from '@emotion/react'; + +import React from 'react'; +import { MessageList } from '../../editor_frame_service/editor_frame/workspace_panel/message_list'; +import { UserMessage } from '../../types'; + +export const MessagesPopover = ({ messages }: { messages: UserMessage[] }) => { + const { euiTheme } = useEuiTheme(); + const xsFontSize = useEuiFontSize('xs').fontSize; + + if (!messages.length) { + return null; + } + + return ( + * { + gap: ${euiTheme.size.xs}; + } + `} + /> + ); +}; diff --git a/x-pack/plugins/lens/public/state_management/__snapshots__/load_initial.test.tsx.snap b/x-pack/plugins/lens/public/state_management/__snapshots__/load_initial.test.tsx.snap index a1ae0da676803..8af3d61bf668d 100644 --- a/x-pack/plugins/lens/public/state_management/__snapshots__/load_initial.test.tsx.snap +++ b/x-pack/plugins/lens/public/state_management/__snapshots__/load_initial.test.tsx.snap @@ -28,7 +28,6 @@ Object { "persistedDoc": Object { "exactMatchDoc": Object { "attributes": Object { - "expression": "definitely a valid expression", "references": Array [ Object { "id": "1", @@ -39,7 +38,10 @@ Object { "savedObjectId": "1234", "state": Object { "datasourceStates": Object { - "testDatasource": "datasource", + "testDatasource": Object { + "isLoading": false, + "state": Object {}, + }, }, "filters": Array [ Object { @@ -53,7 +55,10 @@ Object { }, }, ], - "query": "kuery", + "query": Object { + "language": "kuery", + "query": "test", + }, "visualization": Object {}, }, "title": "An extremely cool default document!", diff --git a/x-pack/plugins/lens/public/state_management/init_middleware/index.ts b/x-pack/plugins/lens/public/state_management/init_middleware/index.ts index 0858d9d8af783..b0011c3c822ed 100644 --- a/x-pack/plugins/lens/public/state_management/init_middleware/index.ts +++ b/x-pack/plugins/lens/public/state_management/init_middleware/index.ts @@ -12,6 +12,7 @@ import { loadInitial as loadInitialAction } from '..'; import { loadInitial } from './load_initial'; import { readFromStorage } from '../../settings_storage'; import { AUTO_APPLY_DISABLED_STORAGE_KEY } from '../../editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper'; +import { type InitialAppState } from '../lens_slice'; const autoApplyDisabled = () => { return readFromStorage(new Storage(localStorage), AUTO_APPLY_DISABLED_STORAGE_KEY) === 'true'; @@ -20,7 +21,7 @@ const autoApplyDisabled = () => { export const initMiddleware = (storeDeps: LensStoreDeps) => (store: MiddlewareAPI) => { return (next: Dispatch) => (action: PayloadAction) => { if (loadInitialAction.match(action)) { - return loadInitial(store, storeDeps, action.payload, autoApplyDisabled()); + return loadInitial(store, storeDeps, action.payload as InitialAppState, autoApplyDisabled()); } next(action); }; diff --git a/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts b/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts index 606ede8cd2686..458285096f7e7 100644 --- a/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts +++ b/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts @@ -9,51 +9,55 @@ import { cloneDeep } from 'lodash'; import { MiddlewareAPI } from '@reduxjs/toolkit'; import { i18n } from '@kbn/i18n'; import { History } from 'history'; -import { setState, initExisting, initEmpty, LensStoreDeps } from '..'; -import { disableAutoApply, getPreloadedState } from '../lens_slice'; +import { setState, initExisting, initEmpty, LensStoreDeps, LensAppState } from '..'; +import { type InitialAppState, disableAutoApply, getPreloadedState } from '../lens_slice'; import { SharingSavedObjectProps } from '../../types'; -import { LensEmbeddableInput, LensByReferenceInput } from '../../embeddable/embeddable'; import { getInitialDatasourceId, getInitialDataViewsObject } from '../../utils'; import { initializeSources } from '../../editor_frame_service/editor_frame'; import { LensAppServices } from '../../app_plugin/types'; import { getEditPath, getFullPath, LENS_EMBEDDABLE_TYPE } from '../../../common/constants'; -import { Document } from '../../persistence'; +import { LensDocument } from '../../persistence'; +import { LensSerializedState } from '../../react_embeddable/types'; -export const getPersisted = async ({ +interface PersistedDoc { + doc: LensDocument; + sharingSavedObjectProps: Omit; + managed: boolean; +} + +/** + * This function returns a Saved object from a either a by reference or by value input + */ +export const getFromPreloaded = async ({ initialInput, lensServices, history, }: { - initialInput: LensEmbeddableInput; + initialInput: LensSerializedState; lensServices: Pick; history?: History; -}): Promise< - | { - doc: Document; - sharingSavedObjectProps: Omit; - managed: boolean; - } - | undefined -> => { +}): Promise => { const { notifications, spaces, attributeService } = lensServices; - let doc: Document; + let doc: LensDocument; try { - const result = await attributeService.unwrapAttributes(initialInput); - if (!result) { + const docFromSavedObject = await (initialInput.savedObjectId + ? attributeService.loadFromLibrary(initialInput.savedObjectId) + : undefined); + if (!docFromSavedObject) { return { + // @TODO: it would be nice to address this type checks once for all doc: { - ...initialInput, + ...initialInput.attributes, type: LENS_EMBEDDABLE_TYPE, - } as unknown as Document, + } as LensDocument, sharingSavedObjectProps: { outcome: 'exactMatch', }, managed: false, }; } - const { metaInfo, attributes } = result; - const sharingSavedObjectProps = metaInfo?.sharingSavedObjectProps; + const { sharingSavedObjectProps, attributes, managed } = docFromSavedObject; if (spaces && sharingSavedObjectProps?.outcome === 'aliasMatch' && history) { // We found this object by a legacy URL alias from its old ID; redirect the user to the page with its new ID, preserving any URL hash const newObjectId = sharingSavedObjectProps.aliasTargetId!; // This is always defined if outcome === 'aliasMatch' @@ -80,7 +84,7 @@ export const getPersisted = async ({ aliasTargetId: sharingSavedObjectProps?.aliasTargetId, outcome: sharingSavedObjectProps?.outcome, }, - managed: Boolean(metaInfo?.managed), + managed: Boolean(managed), }; } catch (e) { notifications.toasts.addDanger( @@ -91,30 +95,242 @@ export const getPersisted = async ({ } }; -export function loadInitial( +interface LoaderSharedArgs { + visualizationMap: LensStoreDeps['visualizationMap']; + datasourceMap: LensStoreDeps['datasourceMap']; + initialContext: LensStoreDeps['initialContext']; + dataViews: LensStoreDeps['lensServices']['dataViews']; + storage: LensStoreDeps['lensServices']['storage']; + eventAnnotationService: LensStoreDeps['lensServices']['eventAnnotationService']; + defaultIndexPatternId: string; +} + +type PreloadedState = Omit< + LensAppState, + 'resolvedDateRange' | 'searchSessionId' | 'isLinkedToOriginatingApp' +>; + +async function loadFromLocatorState( + store: MiddlewareAPI, + initialState: NonNullable, + loaderSharedArgs: LoaderSharedArgs, + { notifications, data }: LensStoreDeps['lensServices'], + emptyState: PreloadedState, + autoApplyDisabled: boolean +) { + const { lens } = store.getState(); + const locatorReferences = 'references' in initialState ? initialState.references : undefined; + + const { + datasourceStates, + visualizationState, + indexPatterns, + indexPatternRefs, + annotationGroups, + } = await initializeSources( + { + visualizationState: emptyState.visualization, + datasourceStates: emptyState.datasourceStates, + adHocDataViews: lens.persistedDoc?.state.adHocDataViews || initialState.dataViewSpecs, + references: locatorReferences, + ...loaderSharedArgs, + }, + { + isFullEditor: true, + } + ); + const currentSessionId = initialState?.searchSessionId || data.search.session.getSessionId(); + store.dispatch( + initExisting({ + isSaveable: true, + filters: initialState.filters || data.query.filterManager.getFilters(), + query: initialState.query || emptyState.query, + searchSessionId: currentSessionId, + activeDatasourceId: emptyState.activeDatasourceId, + visualization: { + activeId: emptyState.visualization.activeId, + state: visualizationState, + }, + dataViews: getInitialDataViewsObject(indexPatterns, indexPatternRefs), + datasourceStates: Object.entries(datasourceStates).reduce( + (state, [datasourceId, datasourceState]) => ({ + ...state, + [datasourceId]: { + ...datasourceState, + isLoading: false, + }, + }), + {} + ), + isLoading: false, + annotationGroups, + }) + ); + + if (autoApplyDisabled) { + store.dispatch(disableAutoApply()); + } +} + +async function loadFromEmptyState( + store: MiddlewareAPI, + emptyState: PreloadedState, + loaderSharedArgs: LoaderSharedArgs, + { data }: LensStoreDeps['lensServices'], + activeDatasourceId: string | undefined, + autoApplyDisabled: boolean +) { + const { lens } = store.getState(); + const { datasourceStates, indexPatterns, indexPatternRefs } = await initializeSources( + { + visualizationState: lens.visualization, + datasourceStates: lens.datasourceStates, + adHocDataViews: lens.persistedDoc?.state.adHocDataViews, + ...loaderSharedArgs, + }, + { + isFullEditor: true, + } + ); + + store.dispatch( + initEmpty({ + newState: { + ...emptyState, + dataViews: getInitialDataViewsObject(indexPatterns, indexPatternRefs), + searchSessionId: data.search.session.getSessionId() || data.search.session.start(), + ...(activeDatasourceId && { activeDatasourceId }), + datasourceStates: Object.entries(datasourceStates).reduce( + (state, [datasourceId, datasourceState]) => ({ + ...state, + [datasourceId]: { + ...datasourceState, + isLoading: false, + }, + }), + {} + ), + isLoading: false, + }, + initialContext: loaderSharedArgs.initialContext, + }) + ); + if (autoApplyDisabled) { + store.dispatch(disableAutoApply()); + } +} + +async function loadFromSavedObject( + store: MiddlewareAPI, + savedObjectId: string | undefined, + persisted: PersistedDoc, + loaderSharedArgs: LoaderSharedArgs, + { data, chrome }: LensStoreDeps['lensServices'], + autoApplyDisabled: boolean, + inlineEditing?: boolean +) { + const { doc, sharingSavedObjectProps, managed } = persisted; + if (savedObjectId) { + chrome.recentlyAccessed.add(getFullPath(savedObjectId), doc.title, savedObjectId); + } + + const docDatasourceStates = Object.entries(doc.state.datasourceStates).reduce( + (stateMap, [datasourceId, datasourceState]) => ({ + ...stateMap, + [datasourceId]: { + isLoading: true, + state: datasourceState, + }, + }), + {} + ); + + // when the embeddable is initialized from the dashboard we don't want to inject the filters + // as this will replace the parent application filters (such as a dashboard) + if (!inlineEditing) { + const filters = data.query.filterManager.inject(doc.state.filters, doc.references); + // Don't overwrite any pinned filters + data.query.filterManager.setAppFilters(filters); + } + + const docVisualizationState = { + activeId: doc.visualizationType, + state: doc.state.visualization, + }; + const { + datasourceStates, + visualizationState, + indexPatterns, + indexPatternRefs, + annotationGroups, + } = await initializeSources( + { + visualizationState: docVisualizationState, + datasourceStates: docDatasourceStates, + references: [...doc.references, ...(doc.state.internalReferences || [])], + adHocDataViews: doc.state.adHocDataViews, + ...loaderSharedArgs, + }, + { isFullEditor: true } + ); + const currentSessionId = data.search.session.getSessionId(); + store.dispatch( + initExisting({ + isSaveable: true, + sharingSavedObjectProps, + filters: data.query.filterManager.getFilters(), + query: doc.state.query, + searchSessionId: + !savedObjectId && currentSessionId + ? currentSessionId + : !inlineEditing + ? data.search.session.start() + : undefined, + persistedDoc: doc, + activeDatasourceId: getInitialDatasourceId(loaderSharedArgs.datasourceMap, doc), + visualization: { + activeId: doc.visualizationType, + state: visualizationState, + }, + dataViews: getInitialDataViewsObject(indexPatterns, indexPatternRefs), + datasourceStates: Object.entries(datasourceStates).reduce( + (state, [datasourceId, datasourceState]) => ({ + ...state, + [datasourceId]: { + ...datasourceState, + isLoading: false, + }, + }), + {} + ), + isLoading: false, + annotationGroups, + managed, + }) + ); + + if (autoApplyDisabled) { + store.dispatch(disableAutoApply()); + } +} + +export async function loadInitial( store: MiddlewareAPI, storeDeps: LensStoreDeps, - { - redirectCallback, - initialInput, - history, - inlineEditing, - }: { - redirectCallback?: (savedObjectId?: string) => void; - initialInput?: LensEmbeddableInput; - history?: History; - inlineEditing?: boolean; - }, + { redirectCallback, initialInput, history, inlineEditing }: InitialAppState, autoApplyDisabled: boolean ) { const { lensServices, datasourceMap, initialContext, initialStateFromLocator, visualizationMap } = storeDeps; const { resolvedDateRange, searchSessionId, isLinkedToOriginatingApp, ...emptyState } = getPreloadedState(storeDeps); - const { attributeService, notifications, data } = lensServices; + const { notifications, data } = lensServices; const { lens } = store.getState(); - const loaderSharedArgs = { + const loaderSharedArgs: LoaderSharedArgs = { + visualizationMap, + initialContext, + datasourceMap, dataViews: lensServices.dataViews, storage: lensServices.storage, eventAnnotationService: lensServices.eventAnnotationService, @@ -144,79 +360,27 @@ export function loadInitial( // URL Reporting is using the locator params but also passing the savedObjectId // so be sure to not go here as there's no full snapshot URL if (!initialInput) { - const locatorReferences = - 'references' in initialStateFromLocator ? initialStateFromLocator.references : undefined; - - return initializeSources( - { - datasourceMap, - visualizationMap, - visualizationState: emptyState.visualization, - datasourceStates: emptyState.datasourceStates, - initialContext, - adHocDataViews: - lens.persistedDoc?.state.adHocDataViews || initialStateFromLocator.dataViewSpecs, - references: locatorReferences, - ...loaderSharedArgs, - }, - { - isFullEditor: true, - } - ) - .then( - ({ - datasourceStates, - visualizationState, - indexPatterns, - indexPatternRefs, - annotationGroups, - }) => { - const currentSessionId = - initialStateFromLocator?.searchSessionId || data.search.session.getSessionId(); - store.dispatch( - initExisting({ - isSaveable: true, - filters: initialStateFromLocator.filters || data.query.filterManager.getFilters(), - query: initialStateFromLocator.query || emptyState.query, - searchSessionId: currentSessionId, - activeDatasourceId: emptyState.activeDatasourceId, - visualization: { - activeId: emptyState.visualization.activeId, - state: visualizationState, - }, - dataViews: getInitialDataViewsObject(indexPatterns, indexPatternRefs), - datasourceStates: Object.entries(datasourceStates).reduce( - (state, [datasourceId, datasourceState]) => ({ - ...state, - [datasourceId]: { - ...datasourceState, - isLoading: false, - }, - }), - {} - ), - isLoading: false, - annotationGroups, - }) - ); - - if (autoApplyDisabled) { - store.dispatch(disableAutoApply()); - } - } - ) - .catch((e: { message: string }) => { - notifications.toasts.addDanger({ - title: e.message, - }); + try { + return loadFromLocatorState( + store, + initialStateFromLocator, + loaderSharedArgs, + lensServices, + emptyState, + autoApplyDisabled + ); + } catch ({ message }) { + notifications.toasts.addDanger({ + title: message, }); + return; + } } } if ( !initialInput || - (attributeService.inputIsRefType(initialInput) && - initialInput.savedObjectId === lens.persistedDoc?.savedObjectId) + (initialInput.savedObjectId && initialInput.savedObjectId === lens.persistedDoc?.savedObjectId) ) { const newFilters = initialContext && 'searchFilters' in initialContext && initialContext.searchFilters @@ -226,179 +390,57 @@ export function loadInitial( if (newFilters) { data.query.filterManager.setAppFilters(newFilters); } - - return initializeSources( - { - datasourceMap, - visualizationMap, - visualizationState: lens.visualization, - datasourceStates: lens.datasourceStates, - initialContext, - adHocDataViews: lens.persistedDoc?.state.adHocDataViews, - ...loaderSharedArgs, - }, - { - isFullEditor: true, - } - ) - .then(({ datasourceStates, indexPatterns, indexPatternRefs }) => { - store.dispatch( - initEmpty({ - newState: { - ...emptyState, - dataViews: getInitialDataViewsObject(indexPatterns, indexPatternRefs), - searchSessionId: data.search.session.getSessionId() || data.search.session.start(), - ...(activeDatasourceId && { activeDatasourceId }), - datasourceStates: Object.entries(datasourceStates).reduce( - (state, [datasourceId, datasourceState]) => ({ - ...state, - [datasourceId]: { - ...datasourceState, - isLoading: false, - }, - }), - {} - ), - isLoading: false, - }, - initialContext, - }) - ); - if (autoApplyDisabled) { - store.dispatch(disableAutoApply()); - } - }) - .catch((e: { message: string }) => { - notifications.toasts.addDanger({ - title: e.message, - }); - redirectCallback?.(); + try { + return loadFromEmptyState( + store, + emptyState, + loaderSharedArgs, + lensServices, + activeDatasourceId, + autoApplyDisabled + ); + } catch ({ message }) { + notifications.toasts.addDanger({ + title: message, }); + return redirectCallback?.(); + } } - return getPersisted({ initialInput, lensServices, history }) - .then( - (persisted) => { - if (persisted) { - const { doc, sharingSavedObjectProps, managed } = persisted; - if (attributeService.inputIsRefType(initialInput)) { - lensServices.chrome.recentlyAccessed.add( - getFullPath(initialInput.savedObjectId), - doc.title, - initialInput.savedObjectId - ); - } - - const docDatasourceStates = Object.entries(doc.state.datasourceStates).reduce( - (stateMap, [datasourceId, datasourceState]) => ({ - ...stateMap, - [datasourceId]: { - isLoading: true, - state: datasourceState, - }, - }), - {} - ); - - // when the embeddable is initialized from the dashboard we don't want to inject the filters - // as this will replace the parent application filters (such as a dashboard) - if (!Boolean(inlineEditing)) { - const filters = data.query.filterManager.inject(doc.state.filters, doc.references); - // Don't overwrite any pinned filters - data.query.filterManager.setAppFilters(filters); - } - - const docVisualizationState = { - activeId: doc.visualizationType, - state: doc.state.visualization, - }; - return initializeSources( - { - datasourceMap, - visualizationMap, - visualizationState: docVisualizationState, - datasourceStates: docDatasourceStates, - references: [...doc.references, ...(doc.state.internalReferences || [])], - initialContext, - dataViews: lensServices.dataViews, - eventAnnotationService: lensServices.eventAnnotationService, - storage: lensServices.storage, - adHocDataViews: doc.state.adHocDataViews, - defaultIndexPatternId: lensServices.uiSettings.get('defaultIndex'), - }, - { isFullEditor: true } - ) - .then( - ({ - datasourceStates, - visualizationState, - indexPatterns, - indexPatternRefs, - annotationGroups, - }) => { - const currentSessionId = data.search.session.getSessionId(); - store.dispatch( - initExisting({ - isSaveable: true, - sharingSavedObjectProps, - filters: data.query.filterManager.getFilters(), - query: doc.state.query, - searchSessionId: - !(initialInput as LensByReferenceInput)?.savedObjectId && currentSessionId - ? currentSessionId - : !inlineEditing - ? data.search.session.start() - : undefined, - persistedDoc: doc, - activeDatasourceId: getInitialDatasourceId(datasourceMap, doc), - visualization: { - activeId: doc.visualizationType, - state: visualizationState, - }, - dataViews: getInitialDataViewsObject(indexPatterns, indexPatternRefs), - datasourceStates: Object.entries(datasourceStates).reduce( - (state, [datasourceId, datasourceState]) => ({ - ...state, - [datasourceId]: { - ...datasourceState, - isLoading: false, - }, - }), - {} - ), - isLoading: false, - annotationGroups, - managed, - }) - ); - - if (autoApplyDisabled) { - store.dispatch(disableAutoApply()); - } - } - ) - .catch((e: { message: string }) => - notifications.toasts.addDanger({ - title: e.message, - }) - ); - } else { - redirectCallback?.(); - } - }, - () => { - store.dispatch( - setState({ - isLoading: false, - }) + try { + const persisted = await getFromPreloaded({ initialInput, lensServices, history }); + if (persisted) { + try { + return loadFromSavedObject( + store, + initialInput.savedObjectId, + persisted, + loaderSharedArgs, + lensServices, + autoApplyDisabled, + inlineEditing ); - redirectCallback?.(); + } catch ({ message }) { + notifications.toasts.addDanger({ + title: message, + }); } - ) - .catch((e: { message: string }) => { + } else { + return redirectCallback?.(); + } + } catch (e) { + try { + store.dispatch( + setState({ + isLoading: false, + }) + ); + redirectCallback?.(); + } catch ({ message }) { notifications.toasts.addDanger({ - title: e.message, + title: message, }); redirectCallback?.(); - }); + } + } } diff --git a/x-pack/plugins/lens/public/state_management/lens_slice.ts b/x-pack/plugins/lens/public/state_management/lens_slice.ts index 20c727734aa93..b2a9beb0fb0af 100644 --- a/x-pack/plugins/lens/public/state_management/lens_slice.ts +++ b/x-pack/plugins/lens/public/state_management/lens_slice.ts @@ -14,7 +14,6 @@ import { LayerTypes } from '@kbn/expression-xy-plugin/public'; import { EventAnnotationGroupConfig } from '@kbn/event-annotation-common'; import { DragDropIdentifier, DropType } from '@kbn/dom-drag-drop'; import { SeriesType } from '@kbn/visualizations-plugin/common'; -import { LensEmbeddableInput } from '..'; import { TableInspectorAdapter } from '../editor_frame_service/types'; import type { VisualizeEditorContext, @@ -34,6 +33,7 @@ import type { FramePublicAPI, LensEditContextMapping, LensEditEvent } from '../t import { selectDataViews, selectFramePublicAPI } from './selectors'; import { onDropForVisualization } from '../editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils'; import type { LensAppServices } from '../app_plugin/types'; +import type { LensSerializedState } from '../react_embeddable/types'; const getQueryFromContext = ( context: VisualizeFieldContext | VisualizeEditorContext, @@ -149,6 +149,13 @@ export interface SetExecutionContextPayload { resolvedDateRange?: DateRange; } +export interface InitialAppState { + initialInput?: LensSerializedState; + redirectCallback?: (savedObjectId?: string) => void; + history?: History; + inlineEditing?: boolean; +} + export const setState = createAction>('lens/setState'); export const setExecutionContext = createAction( 'lens/setExecutionContext' @@ -201,12 +208,7 @@ export const switchAndCleanDatasource = createAction<{ currentIndexPatternId?: string; }>('lens/switchAndCleanDatasource'); export const navigateAway = createAction('lens/navigateAway'); -export const loadInitial = createAction<{ - initialInput?: LensEmbeddableInput; - redirectCallback?: (savedObjectId?: string) => void; - history?: History; - inlineEditing?: boolean; -}>('lens/loadInitial'); +export const loadInitial = createAction('lens/loadInitial'); export const initEmpty = createAction( 'initEmpty', function prepare({ diff --git a/x-pack/plugins/lens/public/state_management/load_initial.test.tsx b/x-pack/plugins/lens/public/state_management/load_initial.test.tsx index a70b713787ce0..1514a508b8781 100644 --- a/x-pack/plugins/lens/public/state_management/load_initial.test.tsx +++ b/x-pack/plugins/lens/public/state_management/load_initial.test.tsx @@ -15,10 +15,10 @@ import { } from '../mocks'; import { Location, History } from 'history'; import { act } from 'react-dom/test-utils'; -import { LensEmbeddableInput } from '../embeddable'; -import { loadInitial } from './lens_slice'; +import { InitialAppState, loadInitial } from './lens_slice'; import { Filter } from '@kbn/es-query'; import faker from 'faker'; +import { DOC_TYPE } from '../../common/constants'; const history = { location: { @@ -35,26 +35,37 @@ const preloadedState = { }, }; -const defaultProps = { +const defaultProps: InitialAppState = { redirectCallback: jest.fn(), - initialInput: { savedObjectId: defaultSavedObjectId } as unknown as LensEmbeddableInput, + initialInput: { savedObjectId: defaultSavedObjectId }, history, }; +/** + * This is just a convenience wrapper around act & dispatch + * The loadInitial action is hijacked by a custom middleware which returns a Promise + * therefore we need to await before proceeding with all the checks + * The intent of this wrapper is to avoid confusion with this specific action + */ +async function loadInitialAppState( + store: ReturnType['store'], + initialState: InitialAppState +) { + await act(async () => { + await store.dispatch(loadInitial(initialState)); + }); +} + describe('Initializing the store', () => { it('should initialize initial datasource', async () => { - const { store, deps } = await makeLensStore({ preloadedState }); - await act(async () => { - await store.dispatch(loadInitial(defaultProps)); - }); + const { store, deps } = makeLensStore({ preloadedState }); + await loadInitialAppState(store, defaultProps); expect(deps.datasourceMap.testDatasource.initialize).toHaveBeenCalled(); }); it('should have initialized the initial datasource and visualization', async () => { - const { store, deps } = await makeLensStore({ preloadedState }); - await act(async () => { - await store.dispatch(loadInitial({ ...defaultProps, initialInput: undefined })); - }); + const { store, deps } = makeLensStore({ preloadedState }); + await loadInitialAppState(store, { ...defaultProps, initialInput: undefined }); expect(deps.datasourceMap.testDatasource.initialize).toHaveBeenCalled(); expect(deps.datasourceMap.testDatasource2.initialize).not.toHaveBeenCalled(); expect(deps.visualizationMap.testVis.initialize).toHaveBeenCalled(); @@ -65,7 +76,7 @@ describe('Initializing the store', () => { const datasource1State = { datasource1: '' }; const datasource2State = { datasource2: '' }; const services = makeDefaultServices(); - services.attributeService.unwrapAttributes = jest.fn().mockResolvedValue({ + services.attributeService.loadFromLibrary = jest.fn().mockResolvedValue({ attributes: { exactMatchDoc, visualizationType: 'testVis', @@ -107,16 +118,13 @@ describe('Initializing the store', () => { }, }); - const { store, deps } = await makeLensStore({ + const { store, deps } = makeLensStore({ storeDeps, preloadedState, }); - await act(async () => { - await store.dispatch(loadInitial(defaultProps)); - }); + await loadInitialAppState(store, defaultProps); const { datasourceMap } = deps; - expect(datasourceMap.testDatasource.initialize).toHaveBeenCalled(); expect(datasourceMap.testDatasource.initialize).toHaveBeenCalledWith( datasource1State, @@ -139,22 +147,17 @@ describe('Initializing the store', () => { describe('loadInitial', () => { it('does not load a document if there is no initial input', async () => { const { deps, store } = makeLensStore({ preloadedState }); - await act(async () => { - await store.dispatch( - loadInitial({ - ...defaultProps, - initialInput: undefined, - }) - ); + await loadInitialAppState(store, { + ...defaultProps, + initialInput: undefined, }); - expect(deps.lensServices.attributeService.unwrapAttributes).not.toHaveBeenCalled(); + + expect(deps.lensServices.attributeService.loadFromLibrary).not.toHaveBeenCalled(); }); it('starts new searchSessionId', async () => { - const { store } = await makeLensStore({ preloadedState }); - await act(async () => { - await store.dispatch(loadInitial({ ...defaultProps, initialInput: undefined })); - }); + const { store } = makeLensStore({ preloadedState }); + await loadInitialAppState(store, { ...defaultProps, initialInput: undefined }); expect(store.getState()).toEqual({ lens: expect.objectContaining({ searchSessionId: 'sessionId-1', @@ -163,7 +166,7 @@ describe('Initializing the store', () => { }); it('cleans datasource and visualization state properly when reloading', async () => { - const { store, deps } = await makeLensStore({ + const { store, deps } = makeLensStore({ preloadedState: { ...preloadedState, visualization: { @@ -187,13 +190,9 @@ describe('Initializing the store', () => { }), }); - await act(async () => { - await store.dispatch( - loadInitial({ - ...defaultProps, - initialInput: undefined, - }) - ); + await loadInitialAppState(store, { + ...defaultProps, + initialInput: undefined, }); expect(deps.visualizationMap.testVis.initialize).toHaveBeenCalled(); @@ -217,19 +216,17 @@ describe('Initializing the store', () => { it('loads a document and uses query and filters if initial input is provided', async () => { const { store, deps } = makeLensStore({ preloadedState }); - const mockFilters = 'some filters from the filter manager' as unknown as Filter[]; + const mockFilters = faker.lorem.words(3).split(' ') as unknown as Filter[]; jest .spyOn(deps.lensServices.data.query.filterManager, 'getFilters') .mockReturnValue(mockFilters); - await act(async () => { - store.dispatch(loadInitial(defaultProps)); - }); + await loadInitialAppState(store, defaultProps); - expect(deps.lensServices.attributeService.unwrapAttributes).toHaveBeenCalledWith({ - savedObjectId: defaultSavedObjectId, - }); + expect(deps.lensServices.attributeService.loadFromLibrary).toHaveBeenCalledWith( + defaultSavedObjectId + ); expect(deps.lensServices.data.query.filterManager.setAppFilters).toHaveBeenCalledWith([ { query: { match_phrase: { src: 'test' } }, meta: { index: 'injected!' } }, @@ -237,8 +234,8 @@ describe('Initializing the store', () => { expect(store.getState()).toEqual({ lens: expect.objectContaining({ - persistedDoc: { ...defaultDoc, type: 'lens' }, - query: 'kuery', + persistedDoc: { ...defaultDoc, type: DOC_TYPE }, + query: defaultDoc.state.query, isLoading: false, activeDatasourceId: 'testDatasource', filters: mockFilters, @@ -249,68 +246,54 @@ describe('Initializing the store', () => { it('does not load documents on sequential renders unless the id changes', async () => { const { store, deps } = makeLensStore({ preloadedState }); - await act(async () => { - await store.dispatch(loadInitial(defaultProps)); - }); + await loadInitialAppState(store, defaultProps); - await act(async () => { - await store.dispatch(loadInitial(defaultProps)); - }); + await loadInitialAppState(store, defaultProps); - expect(deps.lensServices.attributeService.unwrapAttributes).toHaveBeenCalledTimes(1); + expect(deps.lensServices.attributeService.loadFromLibrary).toHaveBeenCalledTimes(1); - await act(async () => { - await store.dispatch( - loadInitial({ - ...defaultProps, - initialInput: { savedObjectId: '5678' } as unknown as LensEmbeddableInput, - }) - ); + await loadInitialAppState(store, { + ...defaultProps, + initialInput: { savedObjectId: '5678' }, }); - expect(deps.lensServices.attributeService.unwrapAttributes).toHaveBeenCalledTimes(2); + expect(deps.lensServices.attributeService.loadFromLibrary).toHaveBeenCalledTimes(2); }); it('handles document load errors', async () => { const { store, deps } = makeLensStore({ preloadedState }); - deps.lensServices.attributeService.unwrapAttributes = jest + deps.lensServices.attributeService.loadFromLibrary = jest .fn() .mockRejectedValue('failed to load'); const redirectCallback = jest.fn(); - await act(async () => { - await store.dispatch(loadInitial({ ...defaultProps, redirectCallback })); - }); + await loadInitialAppState(store, { ...defaultProps, redirectCallback }); - expect(deps.lensServices.attributeService.unwrapAttributes).toHaveBeenCalledWith({ - savedObjectId: defaultSavedObjectId, - }); + expect(deps.lensServices.attributeService.loadFromLibrary).toHaveBeenCalledWith( + defaultSavedObjectId + ); expect(deps.lensServices.notifications.toasts.addDanger).toHaveBeenCalled(); expect(redirectCallback).toHaveBeenCalled(); }); it('redirects if saved object is an aliasMatch', async () => { const { store, deps } = makeLensStore({ preloadedState }); - deps.lensServices.attributeService.unwrapAttributes = jest.fn().mockResolvedValue({ + deps.lensServices.attributeService.loadFromLibrary = jest.fn().mockResolvedValue({ attributes: { ...defaultDoc, }, - metaInfo: { - sharingSavedObjectProps: { - outcome: 'aliasMatch', - aliasTargetId: 'id2', - aliasPurpose: 'savedObjectConversion', - }, + sharingSavedObjectProps: { + outcome: 'aliasMatch', + aliasTargetId: 'id2', + aliasPurpose: 'savedObjectConversion', }, }); - await act(async () => { - await store.dispatch(loadInitial(defaultProps)); - }); + await loadInitialAppState(store, defaultProps); - expect(deps.lensServices.attributeService.unwrapAttributes).toHaveBeenCalledWith({ - savedObjectId: defaultSavedObjectId, - }); + expect(deps.lensServices.attributeService.loadFromLibrary).toHaveBeenCalledWith( + defaultSavedObjectId + ); expect(deps.lensServices.spaces?.ui.redirectLegacyUrl).toHaveBeenCalledWith({ path: '#/edit/id2?search', aliasPurpose: 'savedObjectConversion', @@ -320,9 +303,7 @@ describe('Initializing the store', () => { it('adds to the recently accessed list on load', async () => { const { store, deps } = makeLensStore({ preloadedState }); - await act(async () => { - await store.dispatch(loadInitial(defaultProps)); - }); + await loadInitialAppState(store, defaultProps); expect(deps.lensServices.chrome.recentlyAccessed.add).toHaveBeenCalledWith( '/app/lens#/edit/1234', diff --git a/x-pack/plugins/lens/public/state_management/selectors.ts b/x-pack/plugins/lens/public/state_management/selectors.ts index 2187302ae02e4..594b1b9632d62 100644 --- a/x-pack/plugins/lens/public/state_management/selectors.ts +++ b/x-pack/plugins/lens/public/state_management/selectors.ts @@ -7,11 +7,11 @@ import { createSelector } from '@reduxjs/toolkit'; import { FilterManager } from '@kbn/data-plugin/public'; -import { SavedObjectReference } from '@kbn/core/public'; -import { DataViewPersistableStateService } from '@kbn/data-views-plugin/common'; +import { isOfAggregateQueryType } from '@kbn/es-query'; import { LensState } from './types'; -import { Datasource, DatasourceMap, VisualizationMap } from '../types'; +import { DatasourceMap, VisualizationMap } from '../types'; import { getDatasourceLayers } from './utils'; +import { mergeToNewDoc } from './shared_logic'; export const selectPersistedDoc = (state: LensState) => state.lens.persistedDoc; export const selectQuery = (state: LensState) => state.lens.query; @@ -60,7 +60,7 @@ export const selectExecutionContext = createSelector( export const selectExecutionContextSearch = createSelector(selectExecutionContext, (res) => ({ now: res.now, - query: res.query, + query: isOfAggregateQueryType(res.query) ? undefined : res.query, timeRange: { from: res.dateRange.fromDate, to: res.dateRange.toDate, @@ -89,107 +89,7 @@ export const selectSavedObjectFormat = createSelector( extractFilterReferences: FilterManager['extract']; }>, ], - ( - persistedDoc, - visualization, - datasourceStates, - query, - filters, - activeDatasourceId, - adHocDataViews, - { datasourceMap, visualizationMap, extractFilterReferences } - ) => { - const activeVisualization = - visualization.state && visualization.activeId - ? visualizationMap[visualization.activeId] - : null; - const activeDatasource = - datasourceStates && activeDatasourceId && !datasourceStates[activeDatasourceId].isLoading - ? datasourceMap[activeDatasourceId] - : undefined; - - if (!activeDatasource || !activeVisualization) { - return; - } - - const activeDatasources: Record = Object.keys(datasourceStates).reduce( - (acc, datasourceId) => ({ - ...acc, - [datasourceId]: datasourceMap[datasourceId], - }), - {} - ); - - const persistibleDatasourceStates: Record = {}; - const references: SavedObjectReference[] = []; - const internalReferences: SavedObjectReference[] = []; - Object.entries(activeDatasources).forEach(([id, datasource]) => { - const { state: persistableState, savedObjectReferences } = datasource.getPersistableState( - datasourceStates[id].state - ); - persistibleDatasourceStates[id] = persistableState; - savedObjectReferences.forEach((r) => { - if (r.type === 'index-pattern' && adHocDataViews[r.id]) { - internalReferences.push(r); - } else { - references.push(r); - } - }); - }); - - let persistibleVisualizationState = visualization.state; - if (activeVisualization.getPersistableState) { - const { state: persistableState, savedObjectReferences } = - activeVisualization.getPersistableState(visualization.state); - persistibleVisualizationState = persistableState; - savedObjectReferences.forEach((r) => { - if (r.type === 'index-pattern' && adHocDataViews[r.id]) { - internalReferences.push(r); - } else { - references.push(r); - } - }); - } - - const persistableAdHocDataViews = Object.fromEntries( - Object.entries(adHocDataViews).map(([id, dataView]) => { - const { references: dataViewReferences, state } = - DataViewPersistableStateService.extract(dataView); - references.push(...dataViewReferences); - return [id, state]; - }) - ); - - const adHocFilters = filters - .filter((f) => !references.some((r) => r.type === 'index-pattern' && r.id === f.meta.index)) - .map((f) => ({ ...f, meta: { ...f.meta, value: undefined } })); - - const referencedFilters = filters.filter((f) => - references.some((r) => r.type === 'index-pattern' && r.id === f.meta.index) - ); - - const { state: persistableFilters, references: filterReferences } = - extractFilterReferences(referencedFilters); - - references.push(...filterReferences); - - return { - savedObjectId: persistedDoc?.savedObjectId, - title: persistedDoc?.title || '', - description: persistedDoc?.description, - visualizationType: visualization.activeId, - type: 'lens', - references, - state: { - visualization: persistibleVisualizationState, - query, - filters: [...persistableFilters, ...adHocFilters], - datasourceStates: persistibleDatasourceStates, - internalReferences, - adHocDataViews: persistableAdHocDataViews, - }, - }; - } + mergeToNewDoc ); export const selectCurrentVisualization = createSelector( diff --git a/x-pack/plugins/lens/public/state_management/shared_logic.ts b/x-pack/plugins/lens/public/state_management/shared_logic.ts new file mode 100644 index 0000000000000..4e24d9f3fdaa0 --- /dev/null +++ b/x-pack/plugins/lens/public/state_management/shared_logic.ts @@ -0,0 +1,124 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { SavedObjectReference } from '@kbn/core-saved-objects-api-server'; +import { DataViewSpec, DataViewPersistableStateService } from '@kbn/data-views-plugin/common'; +import { AggregateQuery, Query, Filter } from '@kbn/es-query'; +import { FilterManager } from '@kbn/data-plugin/public'; +import { DOC_TYPE, INDEX_PATTERN_TYPE } from '../../common/constants'; +import { VisualizationState, DatasourceStates } from '.'; +import { LensDocument } from '../persistence'; +import { DatasourceMap, VisualizationMap, Datasource } from '../types'; + +// This piece of logic is shared between the main editor code base and the inline editor one within the embeddable +export function mergeToNewDoc( + persistedDoc: LensDocument | undefined, + visualization: VisualizationState, + datasourceStates: DatasourceStates, + query: AggregateQuery | Query, + filters: Filter[], + activeDatasourceId: string | null, + adHocDataViews: Record, + { + datasourceMap, + visualizationMap, + extractFilterReferences, + }: { + datasourceMap: DatasourceMap; + visualizationMap: VisualizationMap; + extractFilterReferences: FilterManager['extract']; + } +) { + const activeVisualization = + visualization.state && visualization.activeId ? visualizationMap[visualization.activeId] : null; + const activeDatasource = + datasourceStates && activeDatasourceId && !datasourceStates[activeDatasourceId].isLoading + ? datasourceMap[activeDatasourceId] + : undefined; + + if (!activeDatasource || !activeVisualization) { + return; + } + + const activeDatasources: Record = Object.keys(datasourceStates).reduce( + (acc, datasourceId) => ({ + ...acc, + [datasourceId]: datasourceMap[datasourceId], + }), + {} + ); + + const persistibleDatasourceStates: Record = {}; + const references: SavedObjectReference[] = []; + const internalReferences: SavedObjectReference[] = []; + Object.entries(activeDatasources).forEach(([id, datasource]) => { + const { state: persistableState, savedObjectReferences } = datasource.getPersistableState( + datasourceStates[id].state + ); + persistibleDatasourceStates[id] = persistableState; + savedObjectReferences.forEach((r) => { + if (r.type === INDEX_PATTERN_TYPE && adHocDataViews[r.id]) { + internalReferences.push(r); + } else { + references.push(r); + } + }); + }); + + let persistibleVisualizationState = visualization.state; + if (activeVisualization.getPersistableState) { + const { state: persistableState, savedObjectReferences } = + activeVisualization.getPersistableState(visualization.state); + persistibleVisualizationState = persistableState; + savedObjectReferences.forEach((r) => { + if (r.type === INDEX_PATTERN_TYPE && adHocDataViews[r.id]) { + internalReferences.push(r); + } else { + references.push(r); + } + }); + } + + const persistableAdHocDataViews = Object.fromEntries( + Object.entries(adHocDataViews).map(([id, dataView]) => { + const { references: dataViewReferences, state } = + DataViewPersistableStateService.extract(dataView); + references.push(...dataViewReferences); + return [id, state]; + }) + ); + + const adHocFilters = filters + .filter((f) => !references.some((r) => r.type === INDEX_PATTERN_TYPE && r.id === f.meta.index)) + .map((f) => ({ ...f, meta: { ...f.meta, value: undefined } })); + + const referencedFilters = filters.filter((f) => + references.some((r) => r.type === INDEX_PATTERN_TYPE && r.id === f.meta.index) + ); + + const { state: persistableFilters, references: filterReferences } = + extractFilterReferences(referencedFilters); + + references.push(...filterReferences); + + return { + savedObjectId: persistedDoc?.savedObjectId, + title: persistedDoc?.title || '', + description: persistedDoc?.description, + visualizationType: visualization.activeId!, + type: DOC_TYPE, + references, + state: { + visualization: persistibleVisualizationState, + query, + filters: [...persistableFilters, ...adHocFilters], + datasourceStates: persistibleDatasourceStates, + internalReferences, + adHocDataViews: persistableAdHocDataViews, + }, + }; +} diff --git a/x-pack/plugins/lens/public/state_management/types.ts b/x-pack/plugins/lens/public/state_management/types.ts index 1d683b655b58d..cc8f76118cf22 100644 --- a/x-pack/plugins/lens/public/state_management/types.ts +++ b/x-pack/plugins/lens/public/state_management/types.ts @@ -7,10 +7,10 @@ import type { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public'; import type { EmbeddableEditorState } from '@kbn/embeddable-plugin/public'; -import type { Filter, Query } from '@kbn/es-query'; +import type { AggregateQuery, Filter, Query } from '@kbn/es-query'; import type { SavedQuery } from '@kbn/data-plugin/public'; import type { MainHistoryLocationState } from '../../common/locator/locator'; -import type { Document } from '../persistence'; +import type { LensDocument } from '../persistence'; import type { TableInspectorAdapter } from '../editor_frame_service/types'; import type { DateRange } from '../../common/types'; @@ -54,14 +54,14 @@ export interface EditorFrameState extends PreviewState { isFullscreenDatasource?: boolean; } export interface LensAppState extends EditorFrameState { - persistedDoc?: Document; + persistedDoc?: LensDocument; // Determines whether the lens editor shows the 'save and return' button, and the originating app breadcrumb. isLinkedToOriginatingApp?: boolean; isSaveable: boolean; isLoading: boolean; - query: Query; + query: Query | AggregateQuery; filters: Filter[]; savedQuery?: SavedQuery; searchSessionId: string; diff --git a/x-pack/plugins/lens/public/trigger_actions/convert_to_lens_action.ts b/x-pack/plugins/lens/public/trigger_actions/convert_to_lens_action.ts new file mode 100644 index 0000000000000..017cb64f9dd4b --- /dev/null +++ b/x-pack/plugins/lens/public/trigger_actions/convert_to_lens_action.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { createAction } from '@kbn/ui-actions-plugin/public'; +import { ACTION_CONVERT_TO_LENS } from '@kbn/visualizations-plugin/public'; +import type { ApplicationStart } from '@kbn/core/public'; +import { APP_ID } from '../../common/constants'; +import type { VisualizeEditorContext } from '../types'; + +export const convertToLensActionFactory = + (id: string, displayName: string, originatingApp: string) => (application: ApplicationStart) => + createAction<{ [key: string]: VisualizeEditorContext }>({ + type: ACTION_CONVERT_TO_LENS, + id, + getDisplayName: () => displayName, + isCompatible: async () => !!application.capabilities.visualize.show, + execute: async (context: { [key: string]: VisualizeEditorContext }) => { + const table = Object.values(context.layers); + const payload = { + ...context, + layers: table, + isVisualizeAction: true, + }; + application.navigateToApp(APP_ID, { + state: { + type: ACTION_CONVERT_TO_LENS, + payload, + originatingApp, + }, + }); + }, + }); diff --git a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_action.test.ts b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_action.test.ts index fd1ef4f746c41..c74486abfe8d0 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_action.test.ts +++ b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_action.test.ts @@ -8,30 +8,12 @@ import { DataViewsService } from '@kbn/data-views-plugin/public'; import { type EmbeddableApiContext } from '@kbn/presentation-publishing'; import { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; -import { BehaviorSubject } from 'rxjs'; -import { DOC_TYPE } from '../../common/constants'; import { createOpenInDiscoverAction } from './open_in_discover_action'; import type { DiscoverAppLocator } from './open_in_discover_helpers'; +import { getLensApiMock } from '../react_embeddable/mocks'; describe('open in discover action', () => { - const compatibleEmbeddableApi = { - type: DOC_TYPE, - panelTitle: 'some title', - hidePanelTitle: false, - filters$: new BehaviorSubject([]), - query$: new BehaviorSubject({ query: 'test', language: 'kuery' }), - timeRange$: new BehaviorSubject({ from: 'now-15m', to: 'now' }), - getSavedVis: jest.fn(() => undefined), - canViewUnderlyingData$: new BehaviorSubject(true), - getFullAttributes: jest.fn(() => undefined), - getViewUnderlyingDataArgs: jest.fn(() => ({ - dataViewSpec: { id: 'index-pattern-id' }, - timeRange: { from: 'now-7d', to: 'now' }, - filters: [], - query: undefined, - columns: [], - })), - }; + const compatibleEmbeddableApi = getLensApiMock(); describe('compatibility check', () => { it('is incompatible with non-lens embeddables', async () => { @@ -49,6 +31,10 @@ describe('open in discover action', () => { }); it('is incompatible if user cant access Discover app', async () => { // setup + const lensApi = { + ...compatibleEmbeddableApi, + canViewUnderlyingData$: { getValue: jest.fn(() => true) }, + }; let hasDiscoverAccess = true; // make sure it would work if we had access to Discover @@ -58,7 +44,7 @@ describe('open in discover action', () => { {} as DataViewsService, hasDiscoverAccess ).isCompatible({ - embeddable: compatibleEmbeddableApi, + embeddable: lensApi, } as ActionExecutionContext) ).toBeTruthy(); @@ -70,7 +56,7 @@ describe('open in discover action', () => { {} as DataViewsService, hasDiscoverAccess ).isCompatible({ - embeddable: compatibleEmbeddableApi, + embeddable: lensApi, } as ActionExecutionContext) ).toBeFalsy(); }); diff --git a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_action.ts b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_action.ts index d9dccab616d5b..fa67aa74f9de3 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_action.ts +++ b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_action.ts @@ -10,7 +10,7 @@ import { Action, createAction, IncompatibleActionError } from '@kbn/ui-actions-p import { EmbeddableApiContext } from '@kbn/presentation-publishing'; import type { DataViewsService } from '@kbn/data-views-plugin/public'; import type { DiscoverAppLocator } from './open_in_discover_helpers'; -import { LensApi } from '../embeddable'; +import { LensApi } from '../react_embeddable/types'; const ACTION_OPEN_IN_DISCOVER = 'ACTION_OPEN_IN_DISCOVER'; @@ -41,7 +41,7 @@ export const createOpenInDiscoverAction = ( }, isCompatible: async (context: EmbeddableApiContext) => { const { isCompatible } = await getDiscoverHelpersAsync(); - return isCompatible({ + return await isCompatible({ hasDiscoverAccess, locator, dataViews, diff --git a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx index d9b8b93e28d07..199700af157d1 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx @@ -17,10 +17,10 @@ import { OpenInDiscoverDrilldown, } from './open_in_discover_drilldown'; import { DataViewsService } from '@kbn/data-views-plugin/public'; -import { LensApi } from '../embeddable'; +import { getLensApiMock } from '../react_embeddable/mocks'; jest.mock('./open_in_discover_helpers', () => ({ - isCompatible: jest.fn(() => true), + isCompatible: jest.fn().mockReturnValue(true), getHref: jest.fn(), })); @@ -63,19 +63,13 @@ describe('open in discover drilldown', () => { it('calls through to isCompatible helper', async () => { const filters: Filter[] = [{ meta: { disabled: false } }]; - await drilldown.isCompatible( - { openInNewTab: true }, - { embeddable: { type: 'lens' } as LensApi, filters } - ); + await drilldown.isCompatible({ openInNewTab: true }, { embeddable: getLensApiMock(), filters }); expect(isCompatible).toHaveBeenCalledWith(expect.objectContaining({ filters })); }); it('calls through to getHref helper', async () => { const filters: Filter[] = [{ meta: { disabled: false } }]; - await drilldown.execute( - { openInNewTab: true }, - { embeddable: { type: 'lens' } as LensApi, filters } - ); + await drilldown.execute({ openInNewTab: true }, { embeddable: getLensApiMock(), filters }); expect(getHref).toHaveBeenCalledWith(expect.objectContaining({ filters })); }); }); diff --git a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx index 6602dc4acb69f..0a8f7cb3bf5e2 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx @@ -21,7 +21,7 @@ import type { DataViewsService } from '@kbn/data-views-plugin/public'; import { apiIsOfType } from '@kbn/presentation-publishing'; import { DOC_TYPE } from '../../common/constants'; import type { DiscoverAppLocator } from './open_in_discover_helpers'; -import { LensApi } from '../embeddable'; +import { LensApi } from '../react_embeddable/types'; export const getDiscoverHelpersAsync = async () => await import('../async_services'); diff --git a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_helpers.ts b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_helpers.ts index 0a52ea6b4711f..3ad62f212e49b 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_helpers.ts +++ b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_helpers.ts @@ -10,7 +10,7 @@ import type { DataViewsService } from '@kbn/data-views-plugin/public'; import type { LocatorPublic } from '@kbn/share-plugin/public'; import type { SerializableRecord } from '@kbn/utility-types'; import { EmbeddableApiContext } from '@kbn/presentation-publishing'; -import { isLensApi } from '../embeddable'; +import { isLensApi } from '../react_embeddable/type_guards'; interface DiscoverAppLocatorParams extends SerializableRecord { timeRange?: TimeRange; diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action_helpers.ts b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action_helpers.ts index 96cd0ab6877e3..6f875e49f160c 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action_helpers.ts +++ b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/create_action_helpers.ts @@ -20,9 +20,8 @@ import type { Datasource, Visualization } from '../../types'; import type { LensPluginStartDependencies } from '../../plugin'; import { suggestionsApi } from '../../lens_suggestions_api'; import { generateId } from '../../id_generator'; -import { executeEditAction } from './edit_action_helpers'; -import { Embeddable } from '../../embeddable'; import type { EditorFrameService } from '../../editor_frame_service'; +import { LensApi } from '../..'; // datasourceMap and visualizationMap setters/getters export const [getVisualizationMap, setVisualizationMap] = createGetterSetter< @@ -117,29 +116,21 @@ export async function executeCreateAction({ const attrs = getLensAttributesFromSuggestion({ filters: [], query: defaultEsqlQuery, - suggestion: firstSuggestion, + suggestion: { + ...firstSuggestion, + title: '', // when creating a new panel, we don't want to use the title from the suggestion + }, dataView, }); - const embeddable = await api.addNewPanel({ + const embeddable = await api.addNewPanel({ panelType: 'lens', initialState: { attributes: attrs, id: generateId(), + isNewPanel: true, }, }); // open the flyout if embeddable has been created successfully - if (embeddable) { - const deletePanel = () => { - api.removePanel(embeddable.id); - }; - - executeEditAction({ - embeddable, - startDependencies: deps, - isNewPanel: true, - deletePanel, - ...core, - }); - } + embeddable?.onEdit?.(); } diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action.test.tsx b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action.test.tsx deleted file mode 100644 index e9daa06b9ac07..0000000000000 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action.test.tsx +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import React from 'react'; -import { coreMock } from '@kbn/core/public/mocks'; -import type { IEmbeddable } from '@kbn/embeddable-plugin/public'; -import { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; -import type { LensPluginStartDependencies } from '../../plugin'; -import { createMockStartDependencies } from '../../editor_frame_service/mocks'; -import { DOC_TYPE } from '../../../common/constants'; -import { ConfigureInLensPanelAction } from './edit_action'; - -describe('open config panel action', () => { - const coreStart = coreMock.createStart(); - const mockStartDependencies = - createMockStartDependencies() as unknown as LensPluginStartDependencies; - describe('compatibility check', () => { - it('is incompatible with non-lens embeddables', async () => { - const embeddable = { - type: 'NOT_LENS', - isTextBasedLanguage: () => true, - getInput: () => { - return { - viewMode: 'edit', - }; - }, - } as unknown as IEmbeddable; - const configurablePanelAction = new ConfigureInLensPanelAction( - mockStartDependencies, - coreStart - ); - - const isCompatible = await configurablePanelAction.isCompatible({ - embeddable, - } as ActionExecutionContext<{ embeddable: IEmbeddable }>); - - expect(isCompatible).toBeFalsy(); - }); - - it('is incompatible with input view mode', async () => { - const embeddable = { - type: 'NOT_LENS', - getInput: () => { - return { - viewMode: 'view', - }; - }, - } as unknown as IEmbeddable; - const configurablePanelAction = new ConfigureInLensPanelAction( - mockStartDependencies, - coreStart - ); - - const isCompatible = await configurablePanelAction.isCompatible({ - embeddable, - } as ActionExecutionContext<{ embeddable: IEmbeddable }>); - - expect(isCompatible).toBeFalsy(); - }); - - it('is compatible with text based language embeddable', async () => { - const embeddable = { - type: DOC_TYPE, - isTextBasedLanguage: () => true, - getInput: () => { - return { - viewMode: 'edit', - }; - }, - getIsEditable: () => true, - } as unknown as IEmbeddable; - const configurablePanelAction = new ConfigureInLensPanelAction( - mockStartDependencies, - coreStart - ); - - const isCompatible = await configurablePanelAction.isCompatible({ - embeddable, - } as ActionExecutionContext<{ embeddable: IEmbeddable }>); - - expect(isCompatible).toBeTruthy(); - }); - }); - describe('execution', () => { - it('opens flyout when executed', async () => { - const embeddable = { - type: DOC_TYPE, - isTextBasedLanguage: () => true, - getInput: () => { - return { - viewMode: 'edit', - }; - }, - getIsEditable: () => true, - openConfigPanel: jest.fn().mockResolvedValue(Lens Config Panel Component), - getRoot: () => { - return { - openOverlay: jest.fn(), - clearOverlays: jest.fn(), - }; - }, - } as unknown as IEmbeddable; - const configurablePanelAction = new ConfigureInLensPanelAction( - mockStartDependencies, - coreStart - ); - const spy = jest.spyOn(coreStart.overlays, 'openFlyout'); - - await configurablePanelAction.execute({ - embeddable, - } as ActionExecutionContext<{ embeddable: IEmbeddable }>); - - expect(spy).toHaveBeenCalled(); - }); - }); -}); diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action.tsx b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action.tsx deleted file mode 100644 index 4ad23bc953d23..0000000000000 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action.tsx +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { i18n } from '@kbn/i18n'; -import type { IEmbeddable } from '@kbn/embeddable-plugin/public'; -import { Action } from '@kbn/ui-actions-plugin/public'; -import type { LensPluginStartDependencies } from '../../plugin'; -import { isLensEmbeddable } from '../utils'; -import type { StartServices } from '../../types'; - -const ACTION_CONFIGURE_IN_LENS = 'ACTION_CONFIGURE_IN_LENS'; - -interface Context { - embeddable: IEmbeddable; -} - -export const getConfigureLensHelpersAsync = async () => await import('../../async_services'); - -export class ConfigureInLensPanelAction implements Action { - public type = ACTION_CONFIGURE_IN_LENS; - public id = ACTION_CONFIGURE_IN_LENS; - public order = 50; - - constructor( - protected readonly startDependencies: LensPluginStartDependencies, - protected readonly startServices: StartServices - ) {} - - public getDisplayName({ embeddable }: Context): string { - const language = isLensEmbeddable(embeddable) ? embeddable.getTextBasedLanguage() : undefined; - return i18n.translate('xpack.lens.app.editVisualizationLabel', { - defaultMessage: 'Edit {lang} visualization', - values: { lang: language }, - }); - } - - public getIconType() { - return 'pencil'; - } - - public async isCompatible({ embeddable }: Context) { - const { isEditActionCompatible } = await getConfigureLensHelpersAsync(); - return isEditActionCompatible(embeddable); - } - - public async execute({ embeddable }: Context) { - const { executeEditAction } = await getConfigureLensHelpersAsync(); - return executeEditAction({ - embeddable, - startDependencies: this.startDependencies, - ...this.startServices, - }); - } -} diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action_helpers.ts b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action_helpers.ts deleted file mode 100644 index 7ec70e687efe5..0000000000000 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/edit_action_helpers.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import React from 'react'; -import './helpers.scss'; -import { toMountPoint } from '@kbn/react-kibana-mount'; -import { tracksOverlays } from '@kbn/presentation-containers'; -import type { IEmbeddable } from '@kbn/embeddable-plugin/public'; -import { ViewMode } from '@kbn/embeddable-plugin/common'; -import { IncompatibleActionError } from '@kbn/ui-actions-plugin/public'; -import { isLensEmbeddable } from '../utils'; -import type { LensPluginStartDependencies } from '../../plugin'; -import { StartServices } from '../../types'; - -interface Context extends StartServices { - embeddable: IEmbeddable; - startDependencies: LensPluginStartDependencies; - isNewPanel?: boolean; - deletePanel?: () => void; -} - -export async function isEditActionCompatible(embeddable: IEmbeddable) { - if (!embeddable?.getInput) return false; - // display the action only if dashboard is on editable mode - const inDashboardEditMode = embeddable.getInput().viewMode === ViewMode.EDIT; - return Boolean(isLensEmbeddable(embeddable) && embeddable.getIsEditable() && inDashboardEditMode); -} - -type PanelConfigElement = React.ReactElement void }>; - -const openInlineLensConfigEditor = ( - startServices: StartServices, - embeddable: IEmbeddable, - EmbeddableInlineConfigEditor: PanelConfigElement -) => { - const rootEmbeddable = embeddable.getRoot(); - const overlayTracker = tracksOverlays(rootEmbeddable) ? rootEmbeddable : undefined; - - const handle = startServices.overlays.openFlyout( - toMountPoint( - React.createElement(function InlineLensConfigEditor() { - React.useEffect(() => { - document.body.style.overflowY = 'hidden'; - - return () => { - document.body.style.overflowY = 'initial'; - }; - }, []); - - return React.cloneElement(EmbeddableInlineConfigEditor, { - closeFlyout: () => { - overlayTracker?.clearOverlays(); - handle.close(); - }, - }); - }), - startServices - ), - { - size: 's', - type: 'push', - paddingSize: 'm', - 'data-test-subj': 'customizeLens', - className: 'lnsConfigPanel__overlay', - hideCloseButton: true, - isResizable: true, - onClose: (overlayRef) => { - overlayTracker?.clearOverlays(); - overlayRef.close(); - }, - outsideClickCloses: true, - } - ); - - overlayTracker?.openOverlay(handle, { - focusedPanelId: embeddable.id, - }); -}; - -export async function executeEditAction({ - embeddable, - startDependencies, - isNewPanel, - deletePanel, - ...startServices -}: Context) { - const isCompatibleAction = await isEditActionCompatible(embeddable); - if (!isCompatibleAction || !isLensEmbeddable(embeddable)) { - throw new IncompatibleActionError(); - } - - const ConfigPanel = await embeddable.openConfigPanel(startDependencies, isNewPanel, deletePanel); - - if (ConfigPanel) { - openInlineLensConfigEditor(startServices, embeddable, ConfigPanel); - } -} diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.test.tsx b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.test.tsx index 7525f491e697a..1e1ab4cacff26 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.test.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.test.tsx @@ -8,13 +8,17 @@ import type { CoreStart } from '@kbn/core/public'; import { coreMock } from '@kbn/core/public/mocks'; import type { LensPluginStartDependencies } from '../../../plugin'; import { createMockStartDependencies } from '../../../editor_frame_service/mocks'; -import type { TypedLensByValueInput } from '../../../embeddable/embeddable_component'; import { EditLensEmbeddableAction } from './in_app_embeddable_edit_action'; +import { TypedLensSerializedState } from '../../../react_embeddable/types'; +import { BehaviorSubject } from 'rxjs'; describe('inapp editing of Lens embeddable', () => { const core = coreMock.createStart(); const mockStartDependencies = createMockStartDependencies() as unknown as LensPluginStartDependencies; + + const renderComplete$ = new BehaviorSubject(false); + describe('compatibility check', () => { const attributes = { title: 'An extremely cool default document!', @@ -29,7 +33,7 @@ describe('inapp editing of Lens embeddable', () => { visualization: {}, }, references: [{ type: 'index-pattern', id: '1', name: 'index-pattern-0' }], - } as unknown as TypedLensByValueInput['attributes']; + } as TypedLensSerializedState['attributes']; it('is incompatible for ESQL charts and if ui setting for ES|QL is off', async () => { const inAppEditAction = new EditLensEmbeddableAction(mockStartDependencies, core); const context = { @@ -37,6 +41,7 @@ describe('inapp editing of Lens embeddable', () => { lensEvent: { adapters: {}, embeddableOutput$: undefined, + renderComplete$, }, onUpdate: jest.fn(), }; @@ -61,6 +66,7 @@ describe('inapp editing of Lens embeddable', () => { lensEvent: { adapters: {}, embeddableOutput$: undefined, + renderComplete$, }, onUpdate: jest.fn(), }; @@ -86,6 +92,7 @@ describe('inapp editing of Lens embeddable', () => { lensEvent: { adapters: {}, embeddableOutput$: undefined, + renderComplete$, }, onUpdate: jest.fn(), }; diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.tsx b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.tsx index c132b5e88c6c4..74ffac32605be 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/in_app_embeddable_edit_action.tsx @@ -12,8 +12,6 @@ import type { InlineEditLensEmbeddableContext } from './types'; const ACTION_EDIT_LENS_EMBEDDABLE = 'ACTION_EDIT_LENS_EMBEDDABLE'; -export const getAsyncHelpers = async () => await import('../../../async_services'); - export class EditLensEmbeddableAction implements Action { public type = ACTION_EDIT_LENS_EMBEDDABLE; public id = ACTION_EDIT_LENS_EMBEDDABLE; @@ -35,7 +33,7 @@ export class EditLensEmbeddableAction implements Action {}; + export function isEmbeddableEditActionCompatible( core: CoreStart, attributes: TypedLensByValueInput['attributes'] @@ -49,106 +54,41 @@ export async function executeEditEmbeddableAction({ throw new IncompatibleActionError(); } - const { getEditLensConfiguration, getVisualizationMap, getDatasourceMap } = await import( - '../../../async_services' - ); - const visualizationMap = getVisualizationMap(); - const datasourceMap = getDatasourceMap(); - const query = attributes.state.query; - const activeDatasourceId = isOfAggregateQueryType(query) ? 'textBased' : 'formBased'; - - const onUpdatePanelState = ( - datasourceState: unknown, - visualizationState: unknown, - visualizationType?: string - ) => { - if (attributes.state) { - const datasourceStates = { - ...attributes.state.datasourceStates, - [activeDatasourceId]: datasourceState, - }; - - const references = extractReferencesFromState({ - activeDatasources: Object.keys(datasourceStates).reduce( - (acc, datasourceId) => ({ - ...acc, - [datasourceId]: datasourceMap[datasourceId], - }), - {} - ), - datasourceStates: Object.fromEntries( - Object.entries(datasourceStates).map(([id, state]) => [id, { isLoading: false, state }]) - ), - visualizationState, - activeVisualization: visualizationType ? visualizationMap[visualizationType] : undefined, - }); - - const attrs = { - ...attributes, - state: { - ...attributes.state, - visualization: visualizationState, - datasourceStates, - }, - references, - visualizationType: visualizationType ?? attributes.visualizationType, - } as TypedLensByValueInput['attributes']; - - onUpdate(attrs); - } - }; - - const onUpdateSuggestion = (attrs: TypedLensByValueInput['attributes']) => { - const newAttributes = { - ...attributes, - ...attrs, - }; - onUpdate(newAttributes); - }; - - const Component = await getEditLensConfiguration(core, deps, visualizationMap, datasourceMap); - const ConfigPanel = ( - + const uuid = generateId(); + const isNewlyCreated$ = new BehaviorSubject(false); + const panelManagementApi = setupPanelManagement(uuid, container, { + isNewlyCreated$, + setAsCreated: () => isNewlyCreated$.next(false), + }); + const openInlineEditor = prepareInlineEditPanel( + { attributes }, + () => ({ attributes }), + (newState: LensRuntimeState) => + onUpdate(newState.attributes as TypedLensByValueInput['attributes']), + { + dataLoading$: + lensEvent?.dataLoading$ ?? + (new BehaviorSubject(undefined) as PublishingSubject), + isNewlyCreated$, + }, + panelManagementApi, + { + getInspectorAdapters: () => lensEvent?.adapters, + inspect(): OverlayRef { + return { close: asyncNoop, onClose: Promise.resolve() }; + }, + closeInspector: asyncNoop, + adapters$: new BehaviorSubject(lensEvent?.adapters), + }, + { coreStart: core, ...deps } ); - // in case an element is given render the component in the container, - // otherwise a flyout will open - if (container) { - ReactDOM.render(ConfigPanel, container); - } else { - const handle = core.overlays.openFlyout( - toMountPoint( - React.cloneElement(ConfigPanel, { - closeFlyout: () => { - handle.close(); - }, - }), - core - ), - { - className: 'lnsConfigPanel__overlay', - size: 's', - 'data-test-subj': 'customizeLens', - type: 'push', - paddingSize: 'm', - hideCloseButton: true, - onClose: (overlayRef) => { - overlayRef.close(); - }, - outsideClickCloses: true, - } - ); + const ConfigPanel = await openInlineEditor({ + onApply, + onCancel, + }); + if (ConfigPanel) { + // no need to pass the uuid in this use case + mountInlineEditPanel(ConfigPanel, core, undefined, undefined, container); } } diff --git a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/types.ts b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/types.ts index d86f05d4156e9..0176ef4ee9e8c 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/types.ts +++ b/x-pack/plugins/lens/public/trigger_actions/open_lens_config/in_app_embeddable_edit/types.ts @@ -5,9 +5,8 @@ * 2.0. */ import type { DefaultInspectorAdapters } from '@kbn/expressions-plugin/common'; -import type { EmbeddableOutput } from '@kbn/embeddable-plugin/public'; -import type { Observable } from 'rxjs'; -import type { TypedLensByValueInput } from '../../../embeddable/embeddable_component'; +import { PublishingSubject } from '@kbn/presentation-publishing'; +import type { TypedLensByValueInput } from '../../../react_embeddable/types'; export interface LensChartLoadEvent { /** @@ -15,9 +14,9 @@ export interface LensChartLoadEvent { */ adapters: Partial; /** - * Observable of the lens embeddable output + * Observable to track embeddable loading state */ - embeddableOutput$?: Observable; + dataLoading$?: PublishingSubject; } export interface InlineEditLensEmbeddableContext { diff --git a/x-pack/plugins/lens/public/trigger_actions/utils.ts b/x-pack/plugins/lens/public/trigger_actions/utils.ts deleted file mode 100644 index 527f1adcf7629..0000000000000 --- a/x-pack/plugins/lens/public/trigger_actions/utils.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import type { IEmbeddable } from '@kbn/embeddable-plugin/public'; -import type { Embeddable } from '../embeddable'; -import { DOC_TYPE } from '../../common/constants'; - -export function isLensEmbeddable(embeddable: IEmbeddable): embeddable is Embeddable { - return embeddable.type === DOC_TYPE; -} diff --git a/x-pack/plugins/lens/public/types.ts b/x-pack/plugins/lens/public/types.ts index 5b5e33564cc7d..d6dbccc492a6b 100644 --- a/x-pack/plugins/lens/public/types.ts +++ b/x-pack/plugins/lens/public/types.ts @@ -10,7 +10,7 @@ import type { CoreStart, SavedObjectReference, ResolvedSimpleSavedObject } from import type { ColorMapping, PaletteOutput } from '@kbn/coloring'; import type { TopNavMenuData } from '@kbn/navigation-plugin/public'; import type { MutableRefObject, ReactElement } from 'react'; -import type { Filter, TimeRange } from '@kbn/es-query'; +import type { Query, AggregateQuery, Filter, TimeRange } from '@kbn/es-query'; import type { ExpressionAstExpression, IInterpreterRenderHandlers, @@ -22,7 +22,6 @@ import type { NavigateToLensContext, SeriesType, } from '@kbn/visualizations-plugin/common'; -import type { Query } from '@kbn/es-query'; import type { UiActionsStart, RowClickContext, @@ -63,7 +62,7 @@ import { import type { LensInspector } from './lens_inspector_service'; import type { DataViewsState } from './state_management/types'; import type { IndexPatternServiceAPI } from './data_views_service/service'; -import type { Document } from './persistence/saved_object_store'; +import type { LensDocument } from './persistence/saved_object_store'; import { TableInspectorAdapter } from './editor_frame_service/types'; export type StartServices = Pick< @@ -140,8 +139,8 @@ export interface EditorFrameInstance { export interface EditorFrameSetup { // generic type on the API functions to pull the "unknown vs. specific type" error into the implementation - registerDatasource: ( - datasource: Datasource | (() => Promise>) + registerDatasource: ( + datasource: Datasource | (() => Promise>) ) => void; registerVisualization: ( visualization: @@ -322,8 +321,11 @@ export type AddUserMessages = (messages: UserMessage[]) => () => void; /** * Interface for the datasource registry + * T type: runtime Lens state + * P type: persisted Lens state + * Q type: Query type (useful to filter form vs text based queries) */ -export interface Datasource { +export interface Datasource { id: string; alias?: string[]; @@ -382,7 +384,7 @@ export interface Datasource { LayerSettingsComponent?: ( props: DatasourceLayerSettingsProps ) => React.ReactElement> | null; - DataPanelComponent: (props: DatasourceDataPanelProps) => JSX.Element | null; + DataPanelComponent: (props: DatasourceDataPanelProps) => JSX.Element | null; DimensionTriggerComponent: (props: DatasourceDimensionTriggerProps) => JSX.Element | null; DimensionEditorComponent: ( props: DatasourceDimensionEditorProps @@ -579,7 +581,7 @@ export interface DatasourceLayerSettingsProps { setState: StateSetter; } -export interface DatasourceDataPanelProps { +export interface DatasourceDataPanelProps { state: T; setState: StateSetter; showNoDataPopover: () => void; @@ -587,7 +589,7 @@ export interface DatasourceDataPanelProps { CoreStart, 'http' | 'notifications' | 'uiSettings' | 'overlays' | 'theme' | 'application' | 'docLinks' >; - query: Query; + query: Q; dateRange: DateRange; filters: Filter[]; dropOntoWorkspace: (field: DragDropIdentifier) => void; @@ -946,7 +948,7 @@ export interface VisualizationSuggestion { export type DatasourceLayers = Partial>; export interface FramePublicAPI { - query: Query; + query: Query | AggregateQuery; filters: Filter[]; datasourceLayers: DatasourceLayers; dateRange: DateRange; @@ -1456,10 +1458,10 @@ export type LensTopNavMenuEntryGenerator = (props: { visualizationId: string; datasourceStates: Record; visualizationState: unknown; - query: Query; + query: Query | AggregateQuery; filters: Filter[]; initialContext?: VisualizeFieldContext | VisualizeEditorContext; - currentDoc: Document | undefined; + currentDoc: LensDocument | undefined; }) => undefined | TopNavMenuData; export interface LensCellValueAction { @@ -1473,3 +1475,5 @@ export interface LensCellValueAction { export type GetCompatibleCellValueActions = ( data: CellValueContext['data'] ) => Promise; + +export type Simplify = { [KeyType in keyof T]: T[KeyType] } & {}; diff --git a/x-pack/plugins/lens/public/user_messages_ids.ts b/x-pack/plugins/lens/public/user_messages_ids.ts index a57e5f871cbf9..1bd15a642ba30 100644 --- a/x-pack/plugins/lens/public/user_messages_ids.ts +++ b/x-pack/plugins/lens/public/user_messages_ids.ts @@ -95,3 +95,6 @@ export const GAUGE_METRIC_GT_MAX = 'gauge_metric_gt_max'; export const GAUGE_GOAL_GT_MAX = 'gauge_goal_gt_max'; export const TEXT_BASED_LANGUAGE_ERROR = 'text_based_lang_error'; + +export const URL_CONFLICT = 'url-conflict'; +export const MISSING_TIME_RANGE_ON_EMBEDDABLE = 'missing-time-range-on-embeddable'; diff --git a/x-pack/plugins/lens/public/utils.ts b/x-pack/plugins/lens/public/utils.ts index 43129161adde1..0b0c7037d076e 100644 --- a/x-pack/plugins/lens/public/utils.ts +++ b/x-pack/plugins/lens/public/utils.ts @@ -20,7 +20,7 @@ import { ISearchStart } from '@kbn/data-plugin/public'; import type { DraggingIdentifier, DropType } from '@kbn/dom-drag-drop'; import { getAbsoluteTimeRange } from '@kbn/data-plugin/common'; import { DateRange } from '../common/types'; -import type { Document } from './persistence/saved_object_store'; +import type { LensDocument } from './persistence/saved_object_store'; import { Datasource, DatasourceMap, @@ -100,7 +100,7 @@ export function getTimeZone(uiSettings: IUiSettingsClient) { return configuredTimeZone; } -export function getActiveDatasourceIdFromDoc(doc?: Document) { +export function getActiveDatasourceIdFromDoc(doc?: LensDocument) { if (!doc) { return null; } @@ -109,14 +109,14 @@ export function getActiveDatasourceIdFromDoc(doc?: Document) { return firstDatasourceFromDoc || null; } -export function getActiveVisualizationIdFromDoc(doc?: Document) { +export function getActiveVisualizationIdFromDoc(doc?: LensDocument) { if (!doc) { return null; } return doc.visualizationType || null; } -export const getInitialDatasourceId = (datasourceMap: DatasourceMap, doc?: Document) => { +export const getInitialDatasourceId = (datasourceMap: DatasourceMap, doc?: LensDocument) => { return (doc && getActiveDatasourceIdFromDoc(doc)) || Object.keys(datasourceMap)[0] || null; }; diff --git a/x-pack/plugins/lens/public/vis_type_alias.ts b/x-pack/plugins/lens/public/vis_type_alias.ts index 5f08ce1b9ced6..74e5a2a0d7ac9 100644 --- a/x-pack/plugins/lens/public/vis_type_alias.ts +++ b/x-pack/plugins/lens/public/vis_type_alias.ts @@ -7,15 +7,22 @@ import { i18n } from '@kbn/i18n'; import type { VisTypeAlias } from '@kbn/visualizations-plugin/public'; -import { getBasePath, getEditPath } from '../common/constants'; +import { + APP_ID, + getBasePath, + getEditPath, + LENS_EMBEDDABLE_TYPE, + LENS_ICON, + STAGE_ID, +} from '../common/constants'; import { getLensClient } from './persistence/lens_client'; export const getLensAliasConfig = (): VisTypeAlias => ({ alias: { path: getBasePath(), - app: 'lens', + app: APP_ID, }, - name: 'lens', + name: APP_ID, promotion: true, title: i18n.translate('xpack.lens.visTypeAlias.title', { defaultMessage: 'Lens', @@ -25,11 +32,11 @@ export const getLensAliasConfig = (): VisTypeAlias => ({ 'Create visualizations using an intuitive drag-and-drop interface. Smart suggestions help you follow best practices and find the chart types that best match your data.', }), order: 60, - icon: 'lensApp', - stage: 'production', + icon: LENS_ICON, + stage: STAGE_ID, appExtensions: { visualizations: { - docTypes: ['lens'], + docTypes: [LENS_EMBEDDABLE_TYPE], searchFields: ['title^3'], clientOptions: { update: { overwrite: true } }, client: getLensClient, @@ -43,10 +50,10 @@ export const getLensAliasConfig = (): VisTypeAlias => ({ updatedAt, managed, editor: { editUrl: getEditPath(id), editApp: 'lens' }, - icon: 'lensApp', - stage: 'production', + icon: LENS_ICON, + stage: STAGE_ID, savedObjectType: type, - type: 'lens', + type: LENS_EMBEDDABLE_TYPE, typeTitle: i18n.translate('xpack.lens.visTypeAlias.type', { defaultMessage: 'Lens' }), }; }, diff --git a/x-pack/plugins/lens/public/visualization_container.scss b/x-pack/plugins/lens/public/visualization_container.scss index 3eb4061f8b931..488b138cb0693 100644 --- a/x-pack/plugins/lens/public/visualization_container.scss +++ b/x-pack/plugins/lens/public/visualization_container.scss @@ -27,7 +27,7 @@ } // Make the visualization modifiers icon appear only on panel hover -.embPanel__content:hover .lnsEmbeddablePanelFeatureList_button { +.embPanel__content:hover .lnsPanelFeatureList_button { color: $euiTextColor; background: $euiColorEmptyShade; transition: color $euiAnimSpeedSlow, background $euiAnimSpeedSlow; diff --git a/x-pack/plugins/lens/tsconfig.json b/x-pack/plugins/lens/tsconfig.json index db249f19f3614..39ec693856441 100644 --- a/x-pack/plugins/lens/tsconfig.json +++ b/x-pack/plugins/lens/tsconfig.json @@ -88,7 +88,6 @@ "@kbn/core-plugins-server", "@kbn/esql", "@kbn/field-utils", - "@kbn/panel-loader", "@kbn/shared-ux-button-toolbar", "@kbn/cell-actions", "@kbn/presentation-containers", @@ -111,9 +110,14 @@ "@kbn/licensing-plugin", "@kbn/react-kibana-context-render", "@kbn/react-kibana-mount", + "@kbn/embeddable-enhanced-plugin", "@kbn/es-types", "@kbn/esql-datagrid", "@kbn/transpose-utils", + "@kbn/core-application-browser", + "@kbn/core-chrome-browser", + "@kbn/core-capabilities-common", + "@kbn/presentation-panel-plugin", ], "exclude": ["target/**/*"] } diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/quick_create_job.ts b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/quick_create_job.ts index 99e605fd50864..cda0e842f2c95 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/quick_create_job.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/quick_create_job.ts @@ -14,7 +14,7 @@ import type { import type { IUiSettingsClient } from '@kbn/core/public'; import type { TimefilterContract } from '@kbn/data-plugin/public'; import type { DataViewsContract } from '@kbn/data-views-plugin/public'; -import type { Filter, Query } from '@kbn/es-query'; +import { isOfAggregateQueryType, type Filter, type Query } from '@kbn/es-query'; import type { DashboardStart } from '@kbn/dashboard-plugin/public'; import type { LensApi } from '@kbn/lens-plugin/public'; import type { JobCreatorType } from '../common/job_creator'; @@ -198,6 +198,10 @@ export class QuickLensJobCreator extends QuickJobCreatorBase { bucketSpan: string, layerIndex?: number ) { + // @TODO: ask ML team to check if ES|QL query here is ok + if (isOfAggregateQueryType(chartInfo.query)) { + throw new Error('Cannot create job, query is of aggregate type'); + } const compatibleLayers = chartInfo.layers.filter(isCompatibleLayer); const selectedLayer = diff --git a/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/components/action_menu/action_menu.tsx b/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/components/action_menu/action_menu.tsx index ee95d2a7f61af..efb6623f80e33 100644 --- a/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/components/action_menu/action_menu.tsx +++ b/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/components/action_menu/action_menu.tsx @@ -8,7 +8,7 @@ import React, { useState } from 'react'; import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { LensEmbeddableInput, TypedLensByValueInput } from '@kbn/lens-plugin/public'; +import { TypedLensByValueInput } from '@kbn/lens-plugin/public'; import { EmbedAction } from '../../header/embed_action'; import { AddToCaseAction } from '../../header/add_to_case_action'; import { useKibana } from '../../hooks/use_kibana'; @@ -94,7 +94,7 @@ export function ExpViewActionMenuContent({ {isSaveOpen && lensAttributes && ( setIsSaveOpen(false)} // if we want to do anything after the viz is saved // right now there is no action, so an empty function diff --git a/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts b/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts index 75a5c42c76444..846044a7a7b0a 100644 --- a/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts +++ b/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts @@ -22,6 +22,7 @@ import { obsvReportConfigMap } from '../obsv_exploratory_view'; import { sampleAttributeWithReferenceLines } from './test_data/sample_attribute_with_reference_lines'; import { lensPluginMock } from '@kbn/lens-plugin/public/mocks'; import { FormulaPublicApi, XYState } from '@kbn/lens-plugin/public'; +import { Query } from '@kbn/es-query'; describe('Lens Attribute', () => { mockAppDataView(); @@ -448,7 +449,9 @@ describe('Lens Attribute', () => { reportViewConfig.reportType, formulaHelper ).getJSON(); - expect(multiSeriesLensAttr.state.query.query).toEqual('transaction.duration.us < 60000000'); + expect((multiSeriesLensAttr.state.query as Query).query).toEqual( + 'transaction.duration.us < 60000000' + ); }); describe('Layer breakdowns', function () { diff --git a/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/configurations/lens_attributes.ts b/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/configurations/lens_attributes.ts index dd98e9879e82a..282ae5b768267 100644 --- a/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/configurations/lens_attributes.ts +++ b/x-pack/plugins/observability_solution/exploratory_view/public/components/shared/exploratory_view/configurations/lens_attributes.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { capitalize } from 'lodash'; -import { ExistsFilter, Filter, isExistsFilter } from '@kbn/es-query'; +import { type ExistsFilter, type Query, type Filter, isExistsFilter } from '@kbn/es-query'; import { AvgIndexPatternColumn, CardinalityIndexPatternColumn, @@ -1300,7 +1300,7 @@ export class LensAttributes { visualizationType: 'lnsXY' | 'lnsLegacyMetric' | 'lnsHeatmap' = 'lnsXY', lastRefresh?: number ): TypedLensByValueInput['attributes'] { - const query = this.globalFilter || this.layerConfigs[0].seriesConfig.query; + const query: Query | undefined = this.globalFilter || this.layerConfigs[0].seriesConfig.query; const { internalReferences, adHocDataViews } = this.getReferences(); diff --git a/x-pack/plugins/observability_solution/infra/public/hooks/use_lens_attributes.ts b/x-pack/plugins/observability_solution/infra/public/hooks/use_lens_attributes.ts index 9e0f9071eb079..b1248a1f05e1e 100644 --- a/x-pack/plugins/observability_solution/infra/public/hooks/use_lens_attributes.ts +++ b/x-pack/plugins/observability_solution/infra/public/hooks/use_lens_attributes.ts @@ -6,7 +6,7 @@ */ import { useCallback } from 'react'; -import { Filter, Query, TimeRange } from '@kbn/es-query'; +import { AggregateQuery, Filter, Query, TimeRange } from '@kbn/es-query'; import type { Action, ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; import { i18n } from '@kbn/i18n'; import useAsync from 'react-use/lib/useAsync'; @@ -37,7 +37,13 @@ export const useLensAttributes = (params: UseLensAttributesParams) => { }, [params, dataViews, lens]); const injectFilters = useCallback( - ({ filters, query }: { filters: Filter[]; query: Query }): LensAttributes | null => { + ({ + filters, + query, + }: { + filters: Filter[]; + query: Query | AggregateQuery; + }): LensAttributes | null => { if (!attributes) { return null; } @@ -63,7 +69,7 @@ export const useLensAttributes = (params: UseLensAttributesParams) => { }: { timeRange: TimeRange; filters: Filter[]; - query: Query; + query: Query | AggregateQuery; searchSessionId?: string; }) => () => { @@ -94,7 +100,7 @@ export const useLensAttributes = (params: UseLensAttributesParams) => { }: { timeRange: TimeRange; filters?: Filter[]; - query?: Query; + query?: Query | AggregateQuery; searchSessionId?: string; }) => { const openInLens = getOpenInLensAction( diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/functions/visualize_esql.tsx b/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/functions/visualize_esql.tsx index a570d4ba0276a..9a4cf790b85cd 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/functions/visualize_esql.tsx +++ b/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/functions/visualize_esql.tsx @@ -127,13 +127,13 @@ export function VisualizeESQL({ ( isLoading: boolean, adapters: InlineEditLensEmbeddableContext['lensEvent']['adapters'] | undefined, - lensEmbeddableOutput$?: InlineEditLensEmbeddableContext['lensEvent']['embeddableOutput$'] + dataLoading$?: InlineEditLensEmbeddableContext['lensEvent']['dataLoading$'] ) => { const adapterTables = adapters?.tables?.tables; if (adapterTables && !isLoading) { setLensLoadEvent({ adapters, - embeddableOutput$: lensEmbeddableOutput$, + dataLoading$, }); } }, diff --git a/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/lens/add_to_timeline.test.ts b/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/lens/add_to_timeline.test.ts index b1a272de4d37e..ef920458f51dd 100644 --- a/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/lens/add_to_timeline.test.ts +++ b/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/lens/add_to_timeline.test.ts @@ -4,10 +4,9 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { Subject } from 'rxjs'; +import { BehaviorSubject, Subject } from 'rxjs'; import type { CellValueContext, EmbeddableInput, IEmbeddable } from '@kbn/embeddable-plugin/public'; import { ErrorEmbeddable } from '@kbn/embeddable-plugin/public'; -import { LENS_EMBEDDABLE_TYPE } from '@kbn/lens-plugin/public'; import type { SecurityAppStore } from '../../../../common/store/types'; import { createAddToTimelineLensAction, getInvestigatedValue } from './add_to_timeline'; import { KibanaServices } from '../../../../common/lib/kibana'; @@ -16,6 +15,9 @@ import type { DataProvider } from '../../../../../common/types'; import { TimelineId, EXISTS_OPERATOR } from '../../../../../common/types'; import { addProvider } from '../../../../timelines/store/actions'; import type { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; +import type { Query, Filter, AggregateQuery, TimeRange } from '@kbn/es-query'; +import type { LensApi } from '@kbn/lens-plugin/public'; +import { getLensApiMock } from '@kbn/lens-plugin/public/react_embeddable/mocks'; jest.mock('../../../../common/lib/kibana'); const currentAppId$ = new Subject(); @@ -29,16 +31,32 @@ const store = { dispatch: mockDispatch, } as unknown as SecurityAppStore; -class MockEmbeddable { - public type; - constructor(type: string) { - this.type = type; - } - getFilters() {} - getQuery() {} -} +const getMockLensApi = ( + { from, to = 'now' }: { from: string; to: string } = { from: 'now-24h', to: 'now' } +): LensApi => + getLensApiMock({ + timeRange$: new BehaviorSubject({ from, to }), + getViewUnderlyingDataArgs: jest.fn(() => ({ + dataViewSpec: { id: 'index-pattern-id' }, + timeRange: { from: 'now-7d', to: 'now' }, + filters: [], + query: undefined, + columns: [], + })), + saveToLibrary: jest.fn(async () => 'saved-id'), + }); + +const getMockEmbeddable = (type: string): IEmbeddable => + ({ + type, + filters$: new BehaviorSubject([]), + query$: new BehaviorSubject({ + query: 'test', + language: 'kuery', + }), + } as unknown as IEmbeddable); -const lensEmbeddable = new MockEmbeddable(LENS_EMBEDDABLE_TYPE) as unknown as IEmbeddable; +const lensEmbeddable = getMockLensApi(); const columnMeta = { field: 'user.name', @@ -85,7 +103,7 @@ describe('createAddToTimelineLensAction', () => { expect( await addToTimelineAction.isCompatible({ ...context, - embeddable: new MockEmbeddable('not_lens') as unknown as IEmbeddable, + embeddable: getMockEmbeddable('not_lens') as unknown as IEmbeddable, }) ).toEqual(false); }); diff --git a/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/lens/add_to_timeline.ts b/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/lens/add_to_timeline.ts index 84c95fd659fba..3ccbd30efd614 100644 --- a/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/lens/add_to_timeline.ts +++ b/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/lens/add_to_timeline.ts @@ -6,14 +6,16 @@ */ import type { CellValueContext, IEmbeddable } from '@kbn/embeddable-plugin/public'; -import { isErrorEmbeddable, isFilterableEmbeddable } from '@kbn/embeddable-plugin/public'; +import { isErrorEmbeddable } from '@kbn/embeddable-plugin/public'; import { createAction } from '@kbn/ui-actions-plugin/public'; +import { apiPublishesUnifiedSearch } from '@kbn/presentation-publishing'; +import { isLensApi } from '@kbn/lens-plugin/public'; import { KibanaServices } from '../../../../common/lib/kibana'; import type { SecurityAppStore } from '../../../../common/store/types'; import { addProvider } from '../../../../timelines/store/actions'; import type { DataProvider } from '../../../../../common/types'; import { EXISTS_OPERATOR, TimelineId } from '../../../../../common/types'; -import { fieldHasCellActions, isInSecurityApp, isLensEmbeddable } from '../../utils'; +import { fieldHasCellActions, isInSecurityApp } from '../../utils'; import { ADD_TO_TIMELINE, ADD_TO_TIMELINE_FAILED_TEXT, @@ -83,8 +85,8 @@ export const createAddToTimelineLensAction = ({ getDisplayName: () => ADD_TO_TIMELINE, isCompatible: async ({ embeddable, data }) => !isErrorEmbeddable(embeddable as IEmbeddable) && - isLensEmbeddable(embeddable as IEmbeddable) && - isFilterableEmbeddable(embeddable as IEmbeddable) && + isLensApi(embeddable) && + apiPublishesUnifiedSearch(embeddable) && isDataColumnsFilterable(data) && isInSecurityApp(currentAppId), execute: async ({ data }) => { diff --git a/x-pack/plugins/security_solution/public/app/actions/copy_to_clipboard/lens/copy_to_clipboard.test.ts b/x-pack/plugins/security_solution/public/app/actions/copy_to_clipboard/lens/copy_to_clipboard.test.ts index bb036e3f12e07..0ec4e00848348 100644 --- a/x-pack/plugins/security_solution/public/app/actions/copy_to_clipboard/lens/copy_to_clipboard.test.ts +++ b/x-pack/plugins/security_solution/public/app/actions/copy_to_clipboard/lens/copy_to_clipboard.test.ts @@ -7,12 +7,14 @@ import type { CellValueContext, EmbeddableInput, IEmbeddable } from '@kbn/embeddable-plugin/public'; import { ErrorEmbeddable } from '@kbn/embeddable-plugin/public'; -import { LENS_EMBEDDABLE_TYPE } from '@kbn/lens-plugin/public'; +import type { LensApi } from '@kbn/lens-plugin/public'; import { createCopyToClipboardLensAction } from './copy_to_clipboard'; import { KibanaServices } from '../../../../common/lib/kibana'; import { APP_UI_ID } from '../../../../../common/constants'; -import { Subject } from 'rxjs'; +import { BehaviorSubject, Subject } from 'rxjs'; import type { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; +import type { TimeRange } from '@kbn/es-query'; +import { getLensApiMock } from '@kbn/lens-plugin/public/react_embeddable/mocks'; jest.mock('../../../../common/lib/kibana'); const currentAppId$ = new Subject(); @@ -23,14 +25,29 @@ KibanaServices.get().notifications.toasts.addSuccess = mockSuccessToast; const mockCopy = jest.fn((text: string) => true); jest.mock('copy-to-clipboard', () => (text: string) => mockCopy(text)); -class MockEmbeddable { - public type; - constructor(type: string) { - this.type = type; - } - getFilters() {} - getQuery() {} -} +const getMockLensApi = ( + { from, to = 'now' }: { from: string; to: string } = { from: 'now-24h', to: 'now' } +): LensApi => + getLensApiMock({ + timeRange$: new BehaviorSubject({ from, to }), + getViewUnderlyingDataArgs: jest.fn(() => ({ + dataViewSpec: { id: 'index-pattern-id' }, + timeRange: { from: 'now-7d', to: 'now' }, + filters: [], + query: undefined, + columns: [], + })), + saveToLibrary: jest.fn(async () => 'saved-id'), + }); + +const getMockEmbeddable = (type: string): IEmbeddable => + ({ + type, + getFilters: jest.fn(), + getQuery: jest.fn(), + } as unknown as IEmbeddable); + +const lensEmbeddable = getMockLensApi(); const columnMeta = { field: 'user.name', @@ -39,7 +56,6 @@ const columnMeta = { sourceParams: { indexPatternId: 'some-pattern-id' }, }; const data: CellValueContext['data'] = [{ columnMeta, value: 'the value' }]; -const lensEmbeddable = new MockEmbeddable(LENS_EMBEDDABLE_TYPE) as unknown as IEmbeddable; const context = { data, @@ -76,7 +92,7 @@ describe('createCopyToClipboardLensAction', () => { expect( await copyToClipboardAction.isCompatible({ ...context, - embeddable: new MockEmbeddable('not_lens') as unknown as IEmbeddable, + embeddable: getMockEmbeddable('not_lens') as unknown as IEmbeddable, }) ).toEqual(false); }); diff --git a/x-pack/plugins/security_solution/public/app/actions/utils.ts b/x-pack/plugins/security_solution/public/app/actions/utils.ts index 12c5400dbcf36..d857c54d5091f 100644 --- a/x-pack/plugins/security_solution/public/app/actions/utils.ts +++ b/x-pack/plugins/security_solution/public/app/actions/utils.ts @@ -5,7 +5,7 @@ * 2.0. */ import type { IEmbeddable } from '@kbn/embeddable-plugin/public'; -import { LENS_EMBEDDABLE_TYPE, type Embeddable as LensEmbeddable } from '@kbn/lens-plugin/public'; +import { isLensApi } from '@kbn/lens-plugin/public'; import type { Serializable } from '@kbn/utility-types'; import { APP_UI_ID } from '../../../common/constants'; @@ -21,8 +21,10 @@ export const isInSecurityApp = (currentAppId?: string): boolean => { return !!currentAppId && currentAppId === APP_UI_ID; }; -export const isLensEmbeddable = (embeddable: IEmbeddable): embeddable is LensEmbeddable => { - return embeddable.type === LENS_EMBEDDABLE_TYPE; +// @TODO: this is a temporary fix. It needs a better refactor on the consumer side here to +// adapt to the new Embeddable architecture +export const isLensEmbeddable = (embeddable: IEmbeddable): embeddable is IEmbeddable => { + return isLensApi(embeddable); }; export const fieldHasCellActions = (field?: string): boolean => { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_embeddable.tsx b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_embeddable.tsx index 6b264a4dc759f..871750d5ad00f 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_embeddable.tsx +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_embeddable.tsx @@ -19,7 +19,6 @@ import type { TypedLensByValueInput, XYState, } from '@kbn/lens-plugin/public'; -import type { LensBaseEmbeddableInput } from '@kbn/lens-plugin/public/embeddable'; import { setAbsoluteRangeDatePicker } from '../../store/inputs/actions'; import { useKibana } from '../../lib/kibana'; import { useLensAttributes } from './use_lens_attributes'; @@ -159,7 +158,7 @@ const LensEmbeddableComponent: React.FC = ({ [dispatch, inputsModelId] ); - const onFilterCallback = useCallback['onFilter']>( + const onFilterCallback = useCallback['onFilter']>( (event) => { if (disableOnClickFilter) { event.preventDefault(); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_embeddable_inspect.tsx b/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_embeddable_inspect.tsx index ee577d4a310d9..152930fc76498 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_embeddable_inspect.tsx +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_embeddable_inspect.tsx @@ -5,14 +5,14 @@ * 2.0. */ -import type { LensBaseEmbeddableInput } from '@kbn/lens-plugin/public/embeddable'; +import type { LensEmbeddableInput } from '@kbn/lens-plugin/public'; import { useCallback } from 'react'; import type { OnEmbeddableLoaded, Request } from './types'; import { getRequestsAndResponses } from './utils'; export const useEmbeddableInspect = (onEmbeddableLoad?: OnEmbeddableLoaded) => { - const setInspectData = useCallback>( + const setInspectData = useCallback>( (isLoading, adapters) => { if (!adapters) { return; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.test.tsx b/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.test.tsx index 8ed7d40519ace..3d6bb712e9d93 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.test.tsx @@ -22,6 +22,7 @@ import { useSourcererDataView } from '../../../sourcerer/containers'; import { kpiHostMetricLensAttributes } from './lens_attributes/hosts/kpi_host_metric'; import { useRouteSpy } from '../../utils/route/use_route_spy'; import { SecurityPageName } from '../../../app/types'; +import type { Query } from '@kbn/es-query'; import { getEventsHistogramLensAttributes } from './lens_attributes/common/events'; jest.mock('../../../sourcerer/containers'); @@ -147,7 +148,7 @@ describe('useLensAttributes', () => { { wrapper } ); - expect(result?.current?.state.query.query).toEqual(''); + expect((result?.current?.state.query as Query).query).toEqual(''); expect(result?.current?.state.filters).toEqual([ ...getExternalAlertLensAttributes().state.filters, diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.test.tsx index 494cfd5c16b2a..9cc773df320b0 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_summary_flyout/risk_summary.test.tsx @@ -17,6 +17,7 @@ import type { LensAttributes, VisualizationEmbeddableProps, } from '../../../common/components/visualization_actions/types'; +import type { Query } from '@kbn/es-query'; const mockVisualizationEmbeddable = jest .fn() @@ -159,7 +160,7 @@ describe('FlyoutRiskSummary', () => { ); const firstColumn = Object.values(datasourceLayers[0].columns)[0]; - expect(lensAttributes.state.query.query).toEqual('host.name: test'); + expect((lensAttributes.state.query as Query).query).toEqual('host.name: test'); expect(firstColumn).toEqual( expect.objectContaining({ sourceField: 'host.risk.calculated_score_norm', @@ -230,7 +231,7 @@ describe('FlyoutRiskSummary', () => { ); const firstColumn = Object.values(datasourceLayers[0].columns)[0]; - expect(lensAttributes.state.query.query).toEqual('user.name: test'); + expect((lensAttributes.state.query as Query).query).toEqual('user.name: test'); expect(firstColumn).toEqual( expect.objectContaining({ sourceField: 'user.risk.calculated_score_norm', diff --git a/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_summary.test.ts b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_summary.test.ts index 2a00cb1691970..ac7028fa90280 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_summary.test.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/lens_attributes/risk_score_summary.test.ts @@ -12,6 +12,7 @@ import { RiskSeverity } from '../../../common/search_strategy'; import type { MetricVisualizationState } from '@kbn/lens-plugin/public'; import { wrapper } from '../../common/components/visualization_actions/mocks'; import { useLensAttributes } from '../../common/components/visualization_actions/use_lens_attributes'; +import type { Query } from '@kbn/es-query'; jest.mock('../../sourcerer/containers', () => ({ useSourcererDataView: jest.fn().mockReturnValue({ @@ -78,6 +79,6 @@ describe('getRiskScoreSummaryAttributes', () => { { wrapper } ); - expect(result?.current?.state.query.query).toBe(query); + expect((result?.current?.state.query as Query).query).toBe(query); }); }); diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 1034b3a6f01f7..d37fbc247a2f9 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -26357,7 +26357,6 @@ "xpack.lens.app.createVisualizationLabel": "ES|QL", "xpack.lens.app.docLoadingError": "Erreur lors du chargement du document enregistré", "xpack.lens.app.editLensEmbeddableLabel": "Modifier la visualisation", - "xpack.lens.app.editVisualizationLabel": "Modifier la visualisation {lang}", "xpack.lens.app.exploreDataInDiscover": "Explorer dans Discover", "xpack.lens.app.exploreDataInDiscoverDrilldown": "Ouvrir dans Discover", "xpack.lens.app.exploreDataInDiscoverDrilldown.newTabConfig": "Ouvrir dans un nouvel onglet", @@ -26515,14 +26514,9 @@ "xpack.lens.editorFrame.suggestionPanelTitle": "Suggestions", "xpack.lens.editorFrame.tooManyDimensionsSingularWarningLabel": "Veuillez retirer {dimensionsTooMany, plural, one {une dimension} other {{dimensionsTooMany} dimensions}}", "xpack.lens.editorFrame.workspaceLabel": "Espace de travail", - "xpack.lens.embeddable.failure": "Impossible d'afficher la visualisation", - "xpack.lens.embeddable.featureBadge.iconDescription": "{count} {count, plural, one {modificateur} other {modificateurs}} de visualisation", - "xpack.lens.embeddable.fixErrors": "Effectuez des modifications dans l'éditeur Lens pour corriger l'erreur", - "xpack.lens.embeddable.legacyURLConflict.shortMessage": "Vous avez rencontré un conflit d’URL.", - "xpack.lens.embeddable.missingTimeRangeParam.longMessage": "La propriété timeRange est requise pour cette configuration.", - "xpack.lens.embeddable.missingTimeRangeParam.shortMessage": "Propriété timeRange manquante", - "xpack.lens.embeddable.moreErrors": "Effectuez des modifications dans l'éditeur Lens pour afficher plus d'erreurs", - "xpack.lens.embeddableDisplayName": "Lens", + "xpack.lens.featureBadge.iconDescription": "{count} {count, plural, one {modificateur} other {modificateurs}} de visualisation", + "xpack.lens.fixErrors": "Effectuez des modifications dans l'éditeur Lens pour corriger l'erreur", + "xpack.lens.moreErrors": "Effectuez des modifications dans l'éditeur Lens pour afficher plus d'erreurs", "xpack.lens.endValue.nearest": "La plus proche", "xpack.lens.endValue.none": "Masquer", "xpack.lens.endValue.zero": "Zéro", @@ -27032,7 +27026,6 @@ "xpack.lens.legacyMetric.titlePositions.bottom": "Bas", "xpack.lens.legacyMetric.titlePositions.top": "Haut", "xpack.lens.legacyUrlConflict.objectNoun": "Visualisation Lens", - "xpack.lens.lensSavedObjectLabel": "Visualisation Lens", "xpack.lens.lineCurve.smooth": "Lisser", "xpack.lens.lineCurve.step": "Étape", "xpack.lens.lineCurve.straight": "Droit", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index b942c80200d9a..86d4510491688 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -26328,7 +26328,6 @@ "xpack.lens.app.createVisualizationLabel": "ES|QL", "xpack.lens.app.docLoadingError": "保存されたドキュメントの保存中にエラーが発生", "xpack.lens.app.editLensEmbeddableLabel": "ビジュアライゼーションを編集", - "xpack.lens.app.editVisualizationLabel": "{lang}ビジュアライゼーションを編集", "xpack.lens.app.exploreDataInDiscover": "Discoverで探索", "xpack.lens.app.exploreDataInDiscoverDrilldown": "Discoverで開く", "xpack.lens.app.exploreDataInDiscoverDrilldown.newTabConfig": "新しいタブで開く", @@ -26487,14 +26486,13 @@ "xpack.lens.editorFrame.suggestionPanelTitle": "提案", "xpack.lens.editorFrame.tooManyDimensionsSingularWarningLabel": "{dimensionsTooMany, plural, other {{dimensionsTooMany} ディメンション}}を削除してください", "xpack.lens.editorFrame.workspaceLabel": "ワークスペース", - "xpack.lens.embeddable.failure": "ビジュアライゼーションを表示できませんでした", - "xpack.lens.embeddable.featureBadge.iconDescription": "{count}個のビジュアライゼーション{count, plural, other {修飾子}}", - "xpack.lens.embeddable.fixErrors": "Lensエディターで編集し、エラーを修正", - "xpack.lens.embeddable.legacyURLConflict.shortMessage": "URLの競合が発生しました", - "xpack.lens.embeddable.missingTimeRangeParam.longMessage": "指定された構成にはtimeRangeプロパティが必須です", - "xpack.lens.embeddable.missingTimeRangeParam.shortMessage": "timeRangeプロパティがありません", - "xpack.lens.embeddable.moreErrors": "Lensエディターで編集すると、エラーの詳細が表示されます", - "xpack.lens.embeddableDisplayName": "Lens", + "xpack.lens.failure": "ビジュアライゼーションを表示できませんでした", + "xpack.lens.featureBadge.iconDescription": "{count}個のビジュアライゼーション{count, plural, other {修飾子}}", + "xpack.lens.fixErrors": "Lensエディターで編集し、エラーを修正", + "xpack.lens.legacyURLConflict.shortMessage": "URLの競合が発生しました", + "xpack.lens.missingTimeRangeParam.longMessage": "指定された構成にはtimeRangeプロパティが必須です", + "xpack.lens.missingTimeRangeParam.shortMessage": "timeRangeプロパティがありません", + "xpack.lens.moreErrors": "Lensエディターで編集すると、エラーの詳細が表示されます", "xpack.lens.endValue.nearest": "最も近い", "xpack.lens.endValue.none": "非表示", "xpack.lens.endValue.zero": "ゼロ", @@ -27003,7 +27001,6 @@ "xpack.lens.legacyMetric.titlePositions.bottom": "一番下", "xpack.lens.legacyMetric.titlePositions.top": "トップ", "xpack.lens.legacyUrlConflict.objectNoun": "Lensビジュアライゼーション", - "xpack.lens.lensSavedObjectLabel": "Lensビジュアライゼーション", "xpack.lens.lineCurve.smooth": "平滑化", "xpack.lens.lineCurve.step": "手順", "xpack.lens.lineCurve.straight": "直線", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index e7b6beb56ccb5..2ff442f0a6678 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -25857,7 +25857,6 @@ "xpack.lens.app.createVisualizationLabel": "ES|QL", "xpack.lens.app.docLoadingError": "加载已保存文档时出错", "xpack.lens.app.editLensEmbeddableLabel": "编辑可视化", - "xpack.lens.app.editVisualizationLabel": "编辑 {lang} 可视化", "xpack.lens.app.exploreDataInDiscover": "在 Discover 中浏览", "xpack.lens.app.exploreDataInDiscoverDrilldown": "在 Discover 中打开", "xpack.lens.app.exploreDataInDiscoverDrilldown.newTabConfig": "在新选项卡中打开", @@ -26016,14 +26015,9 @@ "xpack.lens.editorFrame.suggestionPanelTitle": "建议", "xpack.lens.editorFrame.tooManyDimensionsSingularWarningLabel": "请移除{dimensionsTooMany, plural, one {一个维度} other {{dimensionsTooMany} 个维度}}", "xpack.lens.editorFrame.workspaceLabel": "工作区", - "xpack.lens.embeddable.failure": "无法显示可视化", - "xpack.lens.embeddable.featureBadge.iconDescription": "{count} 个可视化{count, plural, other {修饰符}}", - "xpack.lens.embeddable.fixErrors": "在 Lens 编辑器中编辑以修复该错误", - "xpack.lens.embeddable.legacyURLConflict.shortMessage": "您遇到了 URL 冲突", - "xpack.lens.embeddable.missingTimeRangeParam.longMessage": "给定配置需要包含 timeRange 属性", - "xpack.lens.embeddable.missingTimeRangeParam.shortMessage": "缺少 timeRange 属性", - "xpack.lens.embeddable.moreErrors": "在 Lens 编辑器中编辑以查看更多错误", - "xpack.lens.embeddableDisplayName": "Lens", + "xpack.lens.featureBadge.iconDescription": "{count} 个可视化{count, plural, other {修饰符}}", + "xpack.lens.fixErrors": "在 Lens 编辑器中编辑以修复该错误", + "xpack.lens.moreErrors": "在 Lens 编辑器中编辑以查看更多错误", "xpack.lens.endValue.nearest": "最近", "xpack.lens.endValue.none": "隐藏", "xpack.lens.endValue.zero": "零", @@ -26533,7 +26527,6 @@ "xpack.lens.legacyMetric.titlePositions.bottom": "底部", "xpack.lens.legacyMetric.titlePositions.top": "顶部", "xpack.lens.legacyUrlConflict.objectNoun": "Lens 可视化", - "xpack.lens.lensSavedObjectLabel": "Lens 可视化", "xpack.lens.lineCurve.smooth": "平滑", "xpack.lens.lineCurve.step": "步骤", "xpack.lens.lineCurve.straight": "直线", diff --git a/x-pack/test/functional/apps/dashboard/group1/feature_controls/time_to_visualize_security.ts b/x-pack/test/functional/apps/dashboard/group1/feature_controls/time_to_visualize_security.ts index 8922bca6d7fdf..995d26d5efc94 100644 --- a/x-pack/test/functional/apps/dashboard/group1/feature_controls/time_to_visualize_security.ts +++ b/x-pack/test/functional/apps/dashboard/group1/feature_controls/time_to_visualize_security.ts @@ -101,7 +101,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('edits to a by value lens panel are properly applied', async () => { await dashboard.waitForRenderComplete(); - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await lens.switchToVisualization('pie'); await lens.saveAndReturn(); await dashboard.waitForRenderComplete(); @@ -112,7 +112,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('disables save to library button without visualize save permissions', async () => { await dashboard.waitForRenderComplete(); - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); const saveButton = await testSubjects.find('lnsApp_saveButton'); expect(await saveButton.getAttribute('disabled')).to.equal('true'); await lens.saveAndReturn(); diff --git a/x-pack/test/functional/apps/dashboard/group2/dashboard_lens_by_value.ts b/x-pack/test/functional/apps/dashboard/group2/dashboard_lens_by_value.ts index a974eb8c1284b..804790e7ee060 100644 --- a/x-pack/test/functional/apps/dashboard/group2/dashboard_lens_by_value.ts +++ b/x-pack/test/functional/apps/dashboard/group2/dashboard_lens_by_value.ts @@ -47,7 +47,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('edits to a by value lens panel are properly applied', async () => { await dashboard.waitForRenderComplete(); - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await lens.switchToVisualization('pie'); await lens.saveAndReturn(); await dashboard.waitForRenderComplete(); @@ -59,7 +59,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('editing and saving a lens by value panel retains number of panels', async () => { const originalPanelCount = await dashboard.getPanelCount(); await dashboard.waitForRenderComplete(); - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await lens.switchToVisualization('treemap'); await lens.saveAndReturn(); await dashboard.waitForRenderComplete(); @@ -71,7 +71,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const newTitle = 'look out library, here I come!'; const originalPanelCount = await dashboard.getPanelCount(); await dashboard.waitForRenderComplete(); - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await lens.save(newTitle, false, true); await dashboard.waitForRenderComplete(); const newPanelCount = await dashboard.getPanelCount(); diff --git a/x-pack/test/functional/apps/dashboard/group2/migration_smoke_tests/lens_migration_smoke_test.ts b/x-pack/test/functional/apps/dashboard/group2/migration_smoke_tests/lens_migration_smoke_test.ts index 81fade0255cf7..df5860fd20a8b 100644 --- a/x-pack/test/functional/apps/dashboard/group2/migration_smoke_tests/lens_migration_smoke_test.ts +++ b/x-pack/test/functional/apps/dashboard/group2/migration_smoke_tests/lens_migration_smoke_test.ts @@ -69,7 +69,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // All panels should be editable. This will catch cases where an error does not create an error embeddable. const panelTitles = await dashboard.getPanelTitles(); for (const title of panelTitles) { - await dashboardPanelActions.expectExistsEditPanelAction(title, true); + await dashboardPanelActions.expectExistsEditPanelAction(title); } }); diff --git a/x-pack/test/functional/apps/dashboard/group2/panel_time_range.ts b/x-pack/test/functional/apps/dashboard/group2/panel_time_range.ts index d5070b931b18f..78b34f1d55933 100644 --- a/x-pack/test/functional/apps/dashboard/group2/panel_time_range.ts +++ b/x-pack/test/functional/apps/dashboard/group2/panel_time_range.ts @@ -58,7 +58,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('by reference', () => { it('can add a custom time range to panel', async () => { - await dashboardPanelActions.legacySaveToLibrary('My by reference visualization'); + await dashboardPanelActions.saveToLibrary('My by reference visualization'); await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.enableCustomTimeRange(); await dashboardCustomizePanel.openDatePickerQuickMenu(); diff --git a/x-pack/test/functional/apps/dashboard/group2/panel_titles.ts b/x-pack/test/functional/apps/dashboard/group2/panel_titles.ts index 7d8456a9e81a8..19109ef3b76e0 100644 --- a/x-pack/test/functional/apps/dashboard/group2/panel_titles.ts +++ b/x-pack/test/functional/apps/dashboard/group2/panel_titles.ts @@ -92,7 +92,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle('Custom title'); await dashboardCustomizePanel.clickSaveButton(); - await dashboardPanelActions.legacySaveToLibrary(getVisTitle(true)); + await dashboardPanelActions.saveToLibrary(getVisTitle(true)); await retry.tryForTime(500, async () => { // need to surround in 'retry' due to delays in HTML updates causing the title read to be behind const [newPanelTitle] = await dashboard.getPanelTitles(); @@ -113,7 +113,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('resetting description on a by reference panel sets it to the library title', async () => { await dashboardPanelActions.navigateToEditorFromFlyout(); - // legacySaveToLibrary UI cannot set description await lens.save( getVisTitle(true), false, @@ -142,7 +141,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle('Custom title'); await dashboardCustomizePanel.clickSaveButton(); - await dashboardPanelActions.legacyUnlinkFromLibrary('Custom title'); + await dashboardPanelActions.unlinkFromLibrary('Custom title'); const [newPanelTitle] = await dashboard.getPanelTitles(); expect(newPanelTitle).to.equal('Custom title'); }); @@ -151,7 +150,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle(''); await dashboardCustomizePanel.clickSaveButton(); - await dashboardPanelActions.legacySaveToLibrary(getVisTitle(true)); + await dashboardPanelActions.saveToLibrary(getVisTitle(true)); await retry.tryForTime(500, async () => { // need to surround in 'retry' due to delays in HTML updates causing the title read to be behind const [newPanelTitle] = await dashboard.getPanelTitles(); @@ -160,7 +159,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('unlinking a by reference panel without a custom title will keep the library title', async () => { - await dashboardPanelActions.legacyUnlinkFromLibrary(getVisTitle()); + await dashboardPanelActions.unlinkFromLibrary(getVisTitle()); const [newPanelTitle] = await dashboard.getPanelTitles(); expect(newPanelTitle).to.equal(getVisTitle()); }); diff --git a/x-pack/test/functional/apps/discover/visualize_field.ts b/x-pack/test/functional/apps/discover/visualize_field.ts index 3d8bdc9c7d781..7a9a5e3b1a8c3 100644 --- a/x-pack/test/functional/apps/discover/visualize_field.ts +++ b/x-pack/test/functional/apps/discover/visualize_field.ts @@ -67,6 +67,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); after(async () => { + await timePicker.resetDefaultAbsoluteRangeViaUiSettings(); await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); await kibanaServer.importExport.unload( 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' diff --git a/x-pack/test/functional/apps/lens/group3/add_to_dashboard.ts b/x-pack/test/functional/apps/lens/group3/add_to_dashboard.ts index 433fc2dbc943f..acf383fb946f4 100644 --- a/x-pack/test/functional/apps/lens/group3/add_to_dashboard.ts +++ b/x-pack/test/functional/apps/lens/group3/add_to_dashboard.ts @@ -67,7 +67,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboard.waitForRenderComplete(); await lens.assertLegacyMetric('Average of bytes', '5,727.322'); - await dashboardPanelActions.expectNotLinkedToLibrary('New Lens from Modal', true); + await dashboardPanelActions.expectNotLinkedToLibrary('New Lens from Modal'); const panelCount = await dashboard.getPanelCount(); expect(panelCount).to.eql(1); @@ -82,10 +82,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboard.waitForRenderComplete(); await lens.assertLegacyMetric('Maximum of bytes', '19,986'); - await dashboardPanelActions.expectNotLinkedToLibrary( - 'Artistpreviouslyknownaslens Copy', - true - ); + await dashboardPanelActions.expectNotLinkedToLibrary('Artistpreviouslyknownaslens Copy'); const panelCount = await dashboard.getPanelCount(); expect(panelCount).to.eql(1); @@ -109,7 +106,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboard.waitForRenderComplete(); await lens.assertLegacyMetric('Average of bytes', '5,727.322'); - await dashboardPanelActions.expectNotLinkedToLibrary('New Lens from Modal', true); + await dashboardPanelActions.expectNotLinkedToLibrary('New Lens from Modal'); const panelCount = await dashboard.getPanelCount(); expect(panelCount).to.eql(2); @@ -131,10 +128,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboard.waitForRenderComplete(); await lens.assertLegacyMetric('Maximum of bytes', '19,986'); - await dashboardPanelActions.expectNotLinkedToLibrary( - 'Artistpreviouslyknownaslens Copy', - true - ); + await dashboardPanelActions.expectNotLinkedToLibrary('Artistpreviouslyknownaslens Copy'); const panelCount = await dashboard.getPanelCount(); expect(panelCount).to.eql(2); @@ -147,7 +141,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboard.waitForRenderComplete(); await lens.assertLegacyMetric('Average of bytes', '5,727.322'); - await dashboardPanelActions.expectLinkedToLibrary('New by ref Lens from Modal', true); + await dashboardPanelActions.expectLinkedToLibrary('New by ref Lens from Modal'); const panelCount = await dashboard.getPanelCount(); expect(panelCount).to.eql(1); @@ -162,7 +156,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboard.waitForRenderComplete(); await lens.assertLegacyMetric('Maximum of bytes', '19,986'); - await dashboardPanelActions.expectLinkedToLibrary('Artistpreviouslyknownaslens by ref', true); + await dashboardPanelActions.expectLinkedToLibrary('Artistpreviouslyknownaslens by ref'); const panelCount = await dashboard.getPanelCount(); expect(panelCount).to.eql(1); @@ -186,7 +180,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboard.waitForRenderComplete(); await lens.assertLegacyMetric('Average of bytes', '5,727.322'); - await dashboardPanelActions.expectLinkedToLibrary('New Lens by ref from Modal', true); + await dashboardPanelActions.expectLinkedToLibrary('New Lens by ref from Modal'); const panelCount = await dashboard.getPanelCount(); expect(panelCount).to.eql(2); @@ -208,10 +202,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboard.waitForRenderComplete(); await lens.assertLegacyMetric('Maximum of bytes', '19,986'); - await dashboardPanelActions.expectLinkedToLibrary( - 'Artistpreviouslyknownaslens by ref 2', - true - ); + await dashboardPanelActions.expectLinkedToLibrary('Artistpreviouslyknownaslens by ref 2'); const panelCount = await dashboard.getPanelCount(); expect(panelCount).to.eql(2); diff --git a/x-pack/test/functional/apps/lens/group3/dashboard_inline_editing.ts b/x-pack/test/functional/apps/lens/group3/dashboard_inline_editing.ts index 3790c22c377be..4ff6da617bbd3 100644 --- a/x-pack/test/functional/apps/lens/group3/dashboard_inline_editing.ts +++ b/x-pack/test/functional/apps/lens/group3/dashboard_inline_editing.ts @@ -85,7 +85,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboard.waitForRenderComplete(); await elasticChart.setNewChartUiDebugFlag(true); - await dashboardPanelActions.legacySaveToLibrary('My by reference visualization'); + await dashboardPanelActions.saveToLibrary('My by reference visualization'); await dashboardPanelActions.clickInlineEdit(); @@ -138,6 +138,71 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await timeToVisualize.resetNewDashboard(); }); + it('should reset changes made to the previous chart with adHoc dataView created from dashboard', async () => { + await dashboard.navigateToApp(); + await dashboard.clickNewDashboard(); + + // it creates a XY histogram with a breakdown by ip + await lens.createAndAddLensFromDashboard({ useAdHocDataView: true }); + await elasticChart.setNewChartUiDebugFlag(true); + // now edit inline and remove the breakdown dimension + await dashboardPanelActions.clickInlineEdit(); + await lens.removeDimension('lnsXY_splitDimensionPanel'); + + log.debug('Cancels the changes'); + await testSubjects.click('cancelFlyoutButton'); + await dashboard.waitForRenderComplete(); + + const data = await lens.getCurrentChartDebugStateForVizType('xyVisChart'); + expect(data?.bars?.length).to.be.above(1); + // open the inline editor again and check that the breakdown is still there + await dashboardPanelActions.clickInlineEdit(); + expect(await testSubjects.exists('lnsXY_splitDimensionPanel')).to.be(true); + // exit via cancel again + await testSubjects.click('cancelFlyoutButton'); + }); + + it('should reset changes made to the previous chart created from dashboard', async () => { + await dashboardPanelActions.removePanel(); + + // it creates a XY histogram with a breakdown by ip + await lens.createAndAddLensFromDashboard({}); + + await dashboard.waitForRenderComplete(); + await elasticChart.setNewChartUiDebugFlag(true); + // now edit inline and remove the breakdown dimension + await dashboardPanelActions.clickInlineEdit(); + await lens.removeDimension('lnsXY_splitDimensionPanel'); + + log.debug('Cancels the changes'); + await testSubjects.click('cancelFlyoutButton'); + await dashboard.waitForRenderComplete(); + + const data = await lens.getCurrentChartDebugStateForVizType('xyVisChart'); + expect(data?.bars?.length).to.be.above(1); + // open the inline editor again and check that the breakdown is still there + await dashboardPanelActions.clickInlineEdit(); + expect(await testSubjects.exists('lnsXY_splitDimensionPanel')).to.be(true); + // exit via cancel again + await testSubjects.click('cancelFlyoutButton'); + }); + + it('should apply changes made in the inline editing panel', async () => { + // now delete the breakdown dimension and check that has been saved + await dashboardPanelActions.clickInlineEdit(); + await lens.removeDimension('lnsXY_splitDimensionPanel'); + + log.debug('Applies the changes'); + await testSubjects.click('applyFlyoutButton'); + await dashboard.waitForRenderComplete(); + + const data = await lens.getCurrentChartDebugStateForVizType('xyVisChart'); + expect(data?.bars?.length).to.eql(1); + // reset all things + await elasticChart.setNewChartUiDebugFlag(false); + await timeToVisualize.resetNewDashboard(); + }); + it('should allow adding an annotation', async () => { await loadExistingLens(); await lens.save('xyVisChart Copy', true, false, false, 'new'); diff --git a/x-pack/test/functional/apps/lens/group4/dashboard.ts b/x-pack/test/functional/apps/lens/group4/dashboard.ts index 670ee2cb22da5..0efdd026e05fd 100644 --- a/x-pack/test/functional/apps/lens/group4/dashboard.ts +++ b/x-pack/test/functional/apps/lens/group4/dashboard.ts @@ -27,6 +27,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const panelActions = getService('dashboardPanelActions'); const inspector = getService('inspector'); const queryBar = getService('queryBar'); + const dashboardDrilldownsManage = getService('dashboardDrilldownsManage'); + const dashboardDrilldownPanelActions = getService('dashboardDrilldownPanelActions'); async function clickInChart(x: number, y: number) { const el = await elasticChart.getCanvas(); @@ -228,11 +230,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await find.clickByButtonText('lnsPieVis'); await dashboardAddPanel.closeAddPanel(); - await panelActions.legacyUnlinkFromLibrary('lnsPieVis'); + await panelActions.unlinkFromLibrary('lnsPieVis'); }); it('save lens panel to embeddable library', async () => { - await panelActions.legacySaveToLibrary('lnsPieVis - copy', 'lnsPieVis'); + await panelActions.saveToLibrary('lnsPieVis - copy', 'lnsPieVis'); await dashboardAddPanel.clickOpenAddPanel(); await dashboardAddPanel.filterEmbeddableNames('lnsPieVis'); @@ -320,5 +322,40 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await browser.switchToWindow(windowHandlers[0]); } }); + + it('should add a drilldown to a Lens by-value chart', async () => { + await dashboard.navigateToApp(); + await dashboard.clickNewDashboard(); + await dashboardAddPanel.clickOpenAddPanel(); + await dashboardAddPanel.filterEmbeddableNames('lnsPieVis'); + await find.clickByButtonText('lnsPieVis'); + await dashboardAddPanel.closeAddPanel(); + + // add a drilldown to the pie chart + await dashboardDrilldownPanelActions.clickCreateDrilldown(); + await testSubjects.click('actionFactoryItem-OPEN_IN_DISCOVER_DRILLDOWN'); + await dashboardDrilldownsManage.saveChanges(); + await dashboardDrilldownsManage.closeFlyout(); + await header.waitUntilLoadingHasFinished(); + + // check that the drilldown is working now + await clickInChart(5, 5); // hardcoded position of the slice, depends heavy on data and charts implementation + expect( + await find.existsByCssSelector('[data-test-subj^="embeddablePanelAction-D_ACTION"]') + ).to.be(true); + + // save the dashboard + await dashboard.saveDashboard('dashboardWithDrilldown'); + + // re-open the dashboard and check the drilldown is still there + await dashboard.navigateToApp(); + await dashboard.loadSavedDashboard('dashboardWithDrilldown'); + await header.waitUntilLoadingHasFinished(); + + await clickInChart(5, 5); // hardcoded position of the slice, depends heavy on data and charts implementation + expect( + await find.existsByCssSelector('[data-test-subj^="embeddablePanelAction-D_ACTION"]') + ).to.be(true); + }); }); } diff --git a/x-pack/test/functional/apps/lens/group4/show_underlying_data_dashboard.ts b/x-pack/test/functional/apps/lens/group4/show_underlying_data_dashboard.ts index 40169ef15ccfe..4227835b2227c 100644 --- a/x-pack/test/functional/apps/lens/group4/show_underlying_data_dashboard.ts +++ b/x-pack/test/functional/apps/lens/group4/show_underlying_data_dashboard.ts @@ -23,6 +23,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const listingTable = getService('listingTable'); const testSubjects = getService('testSubjects'); const dashboardPanelActions = getService('dashboardPanelActions'); + const monacoEditor = getService('monacoEditor'); + const dashboardAddPanel = getService('dashboardAddPanel'); const filterBarService = getService('filterBar'); const queryBar = getService('queryBar'); const savedQueryManagementComponent = getService('savedQueryManagementComponent'); @@ -58,7 +60,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should show the open button for a compatible saved visualization with annotations and reference line', async () => { await dashboard.switchToEditMode(); - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await header.waitUntilLoadingHasFinished(); await lens.createLayer('annotations'); await lens.waitForVisualization('xyVisChart'); @@ -88,7 +90,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should bring both dashboard context and visualization context to discover', async () => { await dashboard.switchToEditMode(); - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await savedQueryManagementComponent.openSavedQueryManagementComponent(); await queryBar.switchQueryLanguage('lucene'); await savedQueryManagementComponent.closeSavedQueryManagementComponent(); @@ -139,5 +141,53 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await browser.closeCurrentWindow(); await browser.switchToWindow(dashboardWindowHandle); }); + + it.skip('should bring visualization context to discover for Lens ES|QL panels', async () => { + // clear out the dashboard + await dashboard.switchToEditMode(); + await dashboardPanelActions.openContextMenu(); + await dashboardPanelActions.removePanel(); + await queryBar.setQuery(''); + await queryBar.submitQuery(); + await filterBarService.removeAllFilters(); + + // Create a new panel + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAddNewPanelFromUIActionLink('ES|QL'); + await dashboardAddPanel.expectEditorMenuClosed(); + + const ESQL_QUERY = 'from logs* | stats maxB = max(bytes)'; + // Configure the ES|QL chart + await monacoEditor.setCodeEditorValue(ESQL_QUERY); + await testSubjects.click('ESQLEditor-run-query-button'); + await header.waitUntilLoadingHasFinished(); + + const lensQuery = await monacoEditor.getCodeEditorValue(); + expect(lensQuery).to.equal(ESQL_QUERY); + await testSubjects.click('applyFlyoutButton'); + + // Save the dashboard + await dashboard.clickQuickSave(); + await dashboard.clickCancelOutOfEditMode(); + + // check if it works correctly + await dashboardPanelActions.clickPanelAction(OPEN_IN_DISCOVER_DATA_TEST_SUBJ); + + const [dashboardWindowHandle, discoverWindowHandle] = await browser.getAllWindowHandles(); + await browser.switchToWindow(discoverWindowHandle); + + // wait to discover to load + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); + + // now check that all queries and filters are correctly transferred + const discoverQuery = await monacoEditor.getCodeEditorValue(); + expect(discoverQuery).to.equal(ESQL_QUERY); + // Filters and queries should not be carried over. + // There's currently a bug but in this test will check only the right thing + + await browser.closeCurrentWindow(); + await browser.switchToWindow(dashboardWindowHandle); + }); }); } diff --git a/x-pack/test/functional/apps/lens/group6/error_handling.ts b/x-pack/test/functional/apps/lens/group6/error_handling.ts index 1b035fab63979..9ac57287feb0b 100644 --- a/x-pack/test/functional/apps/lens/group6/error_handling.ts +++ b/x-pack/test/functional/apps/lens/group6/error_handling.ts @@ -108,7 +108,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.find('emptyPlaceholder'); await dashboard.switchToEditMode(); - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await timePicker.waitForNoDataPopover(); await timePicker.ensureHiddenNoDataPopover(); diff --git a/x-pack/test/functional/apps/lens/group6/lens_tagging.ts b/x-pack/test/functional/apps/lens/group6/lens_tagging.ts index b6b441249f21f..bb39217bd8868 100644 --- a/x-pack/test/functional/apps/lens/group6/lens_tagging.ts +++ b/x-pack/test/functional/apps/lens/group6/lens_tagging.ts @@ -90,7 +90,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('retains its saved object tags after save and return', async () => { - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await lens.saveAndReturn(); await header.waitUntilLoadingHasFinished(); diff --git a/x-pack/test/functional/apps/lens/open_in_lens/tsvb/dashboard.ts b/x-pack/test/functional/apps/lens/open_in_lens/tsvb/dashboard.ts index bf799673c2491..966102852f634 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/tsvb/dashboard.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/tsvb/dashboard.ts @@ -117,7 +117,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const titles = await dashboard.getPanelTitles(); expect(titles[0]).to.be(`${visTitle} (converted)`); - await panelActions.expectNotLinkedToLibrary(titles[0], true); + await panelActions.expectNotLinkedToLibrary(titles[0]); await dashboardBadgeActions.expectExistsTimeRangeBadgeAction(); await panelActions.removePanel(); }); diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts index f4db890b26952..47eacb2604983 100644 --- a/x-pack/test/functional/page_objects/lens_page.ts +++ b/x-pack/test/functional/page_objects/lens_page.ts @@ -34,6 +34,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont const browser = getService('browser'); const dashboardAddPanel = getService('dashboardAddPanel'); const queryBar = getService('queryBar'); + const dataViews = getService('dataViews'); const { common, header, timePicker, dashboard, timeToVisualize, unifiedSearch, share } = getPageObjects([ @@ -1486,10 +1487,12 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont title, redirectToOrigin, ignoreTimeFilter, + useAdHocDataView, }: { title?: string; redirectToOrigin?: boolean; ignoreTimeFilter?: boolean; + useAdHocDataView?: boolean; }) { log.debug(`createAndAddLens${title}`); const inViewMode = await dashboard.getIsInViewMode(); @@ -1502,6 +1505,10 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont await this.goToTimeRange(); } + if (useAdHocDataView) { + await dataViews.createFromSearchBar({ name: '*stash*', adHoc: true }); + } + await this.configureDimension({ dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension', operation: 'average', @@ -2044,5 +2051,9 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont return { maxWidth, maxHeight, minWidth, minHeight, aspectRatio }; }, + + async toggleDebug(enable: boolean = true) { + await browser.execute(`window.ELASTIC_LENS_LOGGER = arguments[0];`, enable); + }, }); } diff --git a/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/lens.ts b/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/lens.ts index b32eafc8c6899..0ce8303a291b3 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/lens.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/lens.ts @@ -48,7 +48,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // Navigating to lens and back should create a new session const byRefSessionId = await dashboardPanelActions.getSearchSessionIdByTitle(lensTitle); - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await lens.saveAndReturn(); await dashboard.waitForRenderComplete(); const newByRefSessionId = await dashboardPanelActions.getSearchSessionIdByTitle(lensTitle); @@ -56,12 +56,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(byRefSessionId).not.to.eql(newByRefSessionId); // Convert to by-value - await dashboardPanelActions.legacyUnlinkFromLibrary(lensTitle); + await dashboardPanelActions.unlinkFromLibrary(lensTitle); await dashboard.waitForRenderComplete(); const byValueSessionId = await dashboardPanelActions.getSearchSessionIdByTitle(lensTitle); // Navigating to lens and back should keep the session - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await lens.saveAndReturn(); await dashboard.waitForRenderComplete(); const newByValueSessionId = await dashboardPanelActions.getSearchSessionIdByTitle(lensTitle); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_charts.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_charts.cy.ts index 509ba40e57fc3..53db62751ebde 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_charts.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_charts.cy.ts @@ -103,7 +103,8 @@ describe('KPI visualizations in Alerts Page', { tags: ['@ess', '@serverless'] }, }); }); - context('Histogram legend hover actions', () => { + // For some reason this suite is failing in CI while I cannot reproduce it locally + context.skip('Histogram legend hover actions', () => { it('should should add a filter in to KQL bar', () => { selectAlertsHistogram(); const expectedNumberOfAlerts = 1; diff --git a/x-pack/test_serverless/functional/test_suites/common/discover/group3/_request_counts.ts b/x-pack/test_serverless/functional/test_suites/common/discover/group3/_request_counts.ts index ff0f2eadf3e20..6402b5ce4737c 100644 --- a/x-pack/test_serverless/functional/test_suites/common/discover/group3/_request_counts.ts +++ b/x-pack/test_serverless/functional/test_suites/common/discover/group3/_request_counts.ts @@ -95,7 +95,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { savedSearchesRequests?: number; setQuery: (query: string) => Promise; }) => { - it('should send 2 search requests (documents + chart) on page load', async () => { + it('should send no more than 2 search requests (documents + chart) on page load', async () => { await browser.refresh(); await browser.execute(async () => { performance.setResourceTimingBufferSize(Number.MAX_SAFE_INTEGER); @@ -105,20 +105,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(searchCount).to.be(2); }); - it('should send 2 requests (documents + chart) when refreshing', async () => { + it('should send no more than 2 requests (documents + chart) when refreshing', async () => { await expectSearches(type, 2, async () => { await queryBar.clickQuerySubmitButton(); }); }); - it('should send 2 requests (documents + chart) when changing the query', async () => { + it('should send no more than 2 requests (documents + chart) when changing the query', async () => { await expectSearches(type, 2, async () => { await setQuery(query1); await queryBar.clickQuerySubmitButton(); }); }); - it('should send 2 requests (documents + chart) when changing the time range', async () => { + it('should send no more than 2 requests (documents + chart) when changing the time range', async () => { await expectSearches(type, 2, async () => { await PageObjects.timePicker.setAbsoluteRange( 'Sep 21, 2015 @ 06:31:44.000', @@ -127,7 +127,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - it('should send 2 requests (documents + chart) when toggling the chart visibility', async () => { + it('should send no more than 2 requests (documents + chart) when toggling the chart visibility', async () => { await expectSearches(type, 2, async () => { await PageObjects.discover.toggleChartVisibility(); }); @@ -136,7 +136,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - it('should send 2 requests for saved search changes', async () => { + it('should send no more than 2 requests for saved search changes', async () => { await setQuery(query1); await queryBar.clickQuerySubmitButton(); await PageObjects.timePicker.setAbsoluteRange( @@ -181,7 +181,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { setQuery: (query) => queryBar.setQuery(query), }); - it('should send 2 requests (documents + chart) when adding a filter', async () => { + it('should send no more than 2 requests (documents + chart) when adding a filter', async () => { await expectSearches(type, 2, async () => { await filterBar.addFilter({ field: 'extension', @@ -191,31 +191,31 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - it('should send 2 requests (documents + chart) when sorting', async () => { + it('should send no more than 2 requests (documents + chart) when sorting', async () => { await expectSearches(type, 2, async () => { await PageObjects.discover.clickFieldSort('@timestamp', 'Sort Old-New'); }); }); - it('should send 2 requests (documents + chart) when changing to a breakdown field without an other bucket', async () => { + it('should send no more than 2 requests (documents + chart) when changing to a breakdown field without an other bucket', async () => { await expectSearches(type, 2, async () => { await PageObjects.discover.chooseBreakdownField('type'); }); }); - it('should send 3 requests (documents + chart + other bucket) when changing to a breakdown field with an other bucket', async () => { + it('should send no more than 3 requests (documents + chart + other bucket) when changing to a breakdown field with an other bucket', async () => { await expectSearches(type, 3, async () => { await PageObjects.discover.chooseBreakdownField('extension.raw'); }); }); - it('should send 2 requests (documents + chart) when changing the chart interval', async () => { + it('should send no more than 2 requests (documents + chart) when changing the chart interval', async () => { await expectSearches(type, 2, async () => { await PageObjects.discover.setChartInterval('Day'); }); }); - it('should send 2 requests (documents + chart) when changing the data view', async () => { + it('should send no more than 2 requests (documents + chart) when changing the data view', async () => { await expectSearches(type, 2, async () => { await dataViews.switchToAndValidate('long-window-logstash-*'); }); diff --git a/x-pack/test_serverless/functional/test_suites/common/visualizations/group3/open_in_lens/tsvb/dashboard.ts b/x-pack/test_serverless/functional/test_suites/common/visualizations/group3/open_in_lens/tsvb/dashboard.ts index eff79084e9dee..8b4a0019433b8 100644 --- a/x-pack/test_serverless/functional/test_suites/common/visualizations/group3/open_in_lens/tsvb/dashboard.ts +++ b/x-pack/test_serverless/functional/test_suites/common/visualizations/group3/open_in_lens/tsvb/dashboard.ts @@ -113,7 +113,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const titles = await dashboard.getPanelTitles(); expect(titles[0]).to.be(`${visTitle} (converted)`); - await panelActions.expectNotLinkedToLibrary(titles[0], true); + await panelActions.expectNotLinkedToLibrary(titles[0]); await dashboardBadgeActions.expectExistsTimeRangeBadgeAction(); await panelActions.removePanel(); }); diff --git a/x-pack/test_serverless/functional/test_suites/search/dashboards/build_dashboard.ts b/x-pack/test_serverless/functional/test_suites/search/dashboards/build_dashboard.ts index 8f97f53c6275f..aefd4c6da9832 100644 --- a/x-pack/test_serverless/functional/test_suites/search/dashboards/build_dashboard.ts +++ b/x-pack/test_serverless/functional/test_suites/search/dashboards/build_dashboard.ts @@ -56,7 +56,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('can edit a Lens panel by value and save changes', async () => { await PageObjects.dashboard.waitForRenderComplete(); - await dashboardPanelActions.clickEdit(); + await dashboardPanelActions.navigateToEditorFromFlyout(); await PageObjects.lens.switchToVisualization('pie'); await PageObjects.lens.saveAndReturn(); await PageObjects.dashboard.waitForRenderComplete(); From e0607f7fadd0147a1372da62584a585d21e3eda8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Gonz=C3=A1lez?= Date: Tue, 26 Nov 2024 09:49:38 +0100 Subject: [PATCH 64/71] [Search] Choose connector a11y improvement (#201590) ## Summary This PR fixes some a11y and responsive related issues like: - https://github.com/elastic/search-team/issues/8666 - https://github.com/elastic/kibana/issues/197622 Some of the improvements are: - The custom dropdown content truncates the connector name content when there is not enough space - The `EuiComoBox` wrapping Flex item it slightly bigger compared with the connectors name and it gets full width when reaching the `"l"` breakpoint in order to better display its content in different resolutions - The badges now are display horizontally when there are more than one. - Each `EuiComboBoxOptionOption` now has a custom `aria-label` where users can get a better info using screen reader informing for instance "Slack, Tech preview" This should fix the redundancy described in this issue https://github.com/elastic/kibana/issues/197622 - Deleting the selection either pressing Space or Backspace displays the dropdown content options https://github.com/user-attachments/assets/c4494908-2849-4f95-84e9-25a60a5a05ab ![CleanShot 2024-11-25 at 15 25 36@2x](https://github.com/user-attachments/assets/caa27feb-cb3b-443f-b5c8-37cc1d823fe6) --- ...or_selectable.tsx => choose_connector.tsx} | 128 +++++++++--------- .../create_connector/start_step.tsx | 12 +- .../applications/shared/constants/labels.ts | 4 + .../translations/translations/fr-FR.json | 3 - .../translations/translations/ja-JP.json | 3 - .../translations/translations/zh-CN.json | 3 - 6 files changed, 78 insertions(+), 75 deletions(-) rename x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/{choose_connector_selectable.tsx => choose_connector.tsx} (54%) diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector_selectable.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector.tsx similarity index 54% rename from x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector_selectable.tsx rename to x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector.tsx index 7019fcbb71e3f..21fa8e3f89f6d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector_selectable.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector.tsx @@ -7,6 +7,7 @@ import React, { useEffect, useMemo, useState } from 'react'; +import { css } from '@emotion/react'; import { useActions, useValues } from 'kea'; import { @@ -18,11 +19,18 @@ import { EuiFlexGroup, EuiText, useEuiTheme, + EuiTextTruncate, + EuiBadgeGroup, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import connectorLogo from '../../../../../../assets/images/connector.svg'; +import { + BETA_LABEL, + TECH_PREVIEW_LABEL, + CONNECTOR_CLIENT_LABEL, +} from '../../../../../shared/constants'; import { KibanaLogic } from '../../../../../shared/kibana'; import { NewConnectorLogic } from '../../../new_index/method_connector/new_connector_logic'; import { SelfManagePreference } from '../create_connector'; @@ -34,9 +42,7 @@ interface OptionData { secondaryContent?: string; } -export const ChooseConnectorSelectable: React.FC = ({ - selfManaged, -}) => { +export const ChooseConnector: React.FC = ({ selfManaged }) => { const { euiTheme } = useEuiTheme(); const [selectedOption, setSelectedOption] = useState>>( [] @@ -52,20 +58,26 @@ export const ChooseConnectorSelectable: React.FC }; return ( - - {_prepend} - - - {label} - - - - {_append} + {_prepend} + + + + + + + {_append} + ); }; @@ -83,43 +95,39 @@ export const ChooseConnectorSelectable: React.FC const getInitialOptions = () => { return allConnectors.map((connector, key) => { const _append: JSX.Element[] = []; + let _ariaLabelAppend = ''; if (connector.isTechPreview) { _append.push( - - {i18n.translate( - 'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.thechPreviewBadgeLabel', - { defaultMessage: 'Tech preview' } - )} + + {TECH_PREVIEW_LABEL} ); + _ariaLabelAppend += `, ${TECH_PREVIEW_LABEL}`; } if (connector.isBeta) { _append.push( - - {i18n.translate( - 'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.BetaBadgeLabel', - { - defaultMessage: 'Beta', - } - )} + + {BETA_LABEL} ); + _ariaLabelAppend += `, ${BETA_LABEL}`; } if (selfManaged === 'native' && !connector.isNative) { _append.push( - {i18n.translate( - 'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.OnlySelfManagedBadgeLabel', - { - defaultMessage: 'Self managed', - } - )} + {CONNECTOR_CLIENT_LABEL} ); } return { _append, _prepend: , + 'aria-label': connector.name + _ariaLabelAppend, key: key.toString(), label: connector.name, }; @@ -133,33 +141,31 @@ export const ChooseConnectorSelectable: React.FC }, [selfManaged]); return ( - - } - singleSelection - fullWidth - placeholder={i18n.translate( - 'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.placeholder.text', - { defaultMessage: 'Choose a data source' } - )} - options={selectableOptions} - selectedOptions={selectedOption} - onChange={(selectedItem) => { - setSelectedOption(selectedItem); - if (selectedItem.length === 0) { - setSelectedConnector(null); - return; - } - const keySelected = Number(selectedItem[0].key); - setSelectedConnector(allConnectors[keySelected]); - }} - renderOption={renderOption} - rowHeight={(euiTheme.base / 2) * 5} - /> - + } + singleSelection + fullWidth + placeholder={i18n.translate( + 'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.placeholder.text', + { defaultMessage: 'Choose a data source' } + )} + options={selectableOptions} + selectedOptions={selectedOption} + onChange={(selectedItem) => { + setSelectedOption(selectedItem); + if (selectedItem.length === 0) { + setSelectedConnector(null); + return; + } + const keySelected = Number(selectedItem[0].key); + setSelectedConnector(allConnectors[keySelected]); + }} + renderOption={renderOption} + rowHeight={(euiTheme.base / 2) * 5} + /> ); }; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/start_step.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/start_step.tsx index 7e23474b207f1..46840d577e4d6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/start_step.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/start_step.tsx @@ -20,6 +20,7 @@ import { EuiRadio, EuiSpacer, EuiText, + useIsWithinBreakpoints, EuiTitle, useGeneratedHtmlId, } from '@elastic/eui'; @@ -33,7 +34,7 @@ import { GeneratedConfigFields } from '../../connector_detail/components/generat import { ConnectorViewLogic } from '../../connector_detail/connector_view_logic'; import { NewConnectorLogic } from '../../new_index/method_connector/new_connector_logic'; -import { ChooseConnectorSelectable } from './components/choose_connector_selectable'; +import { ChooseConnector } from './components/choose_connector'; import { ConnectorDescriptionPopover } from './components/connector_description_popover'; import { ManualConfiguration } from './components/manual_configuration'; import { SelfManagePreference } from './create_connector'; @@ -53,6 +54,7 @@ export const StartStep: React.FC = ({ onSelfManagePreferenceChange, error, }) => { + const isMediumDevice = useIsWithinBreakpoints(['xs', 's', 'm', 'l']); const elasticManagedRadioButtonId = useGeneratedHtmlId({ prefix: 'elasticManagedRadioButton' }); const selfManagedRadioButtonId = useGeneratedHtmlId({ prefix: 'selfManagedRadioButton' }); @@ -93,8 +95,8 @@ export const StartStep: React.FC = ({

      {title}

      - - + + = ({ { defaultMessage: 'Connector' } )} > - + - + Date: Tue, 26 Nov 2024 09:24:18 +0000 Subject: [PATCH 65/71] [Ownership] Assign test files to logstash team (#201005) ## Summary Assign test files to logstash team Contributes to: #192979 Co-authored-by: Elastic Machine --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0b1ff9850ad54..873bdb7edfe15 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2463,6 +2463,7 @@ x-pack/plugins/security_solution/server/lib/security_integrations @elastic/secur /x-pack/plugins/security_solution_serverless/**/*.scss @elastic/security-design # Logstash +/x-pack/test/functional/es_archives/logstash/example_pipelines @elastic/logstash /x-pack/test/functional/services/pipeline_* @elastic/logstash /x-pack/test/functional/page_objects/logstash_page.ts @elastic/logstash /x-pack/test/functional/apps/logstash @elastic/logstash From 2f6af2d884435e9f12d157b7b6ac665d42103d50 Mon Sep 17 00:00:00 2001 From: Tre Date: Tue, 26 Nov 2024 09:28:34 +0000 Subject: [PATCH 66/71] [Ownership] Assign test files to ml team (#200946) ## Summary Assign test files to ml team Contributes to: #192979 --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 873bdb7edfe15..1bad0e549f172 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1513,6 +1513,7 @@ packages/kbn-monaco/src/esql @elastic/kibana-esql /x-pack/test/api_integration/services/transform.ts @elastic/ml-ui /x-pack/test/functional/apps/aiops @elastic/ml-ui /x-pack/test/functional/apps/transform/ @elastic/ml-ui +/x-pack/test/functional/es_archives/large_arrays @elastic/ml-ui # Assigned per usages /x-pack/test/functional/services/transform/ @elastic/ml-ui /x-pack/test/functional/services/aiops @elastic/ml-ui /x-pack/test/functional_basic/apps/transform/ @elastic/ml-ui From 65345f0680ff1c95734b8c30a45bab9a1ece15c7 Mon Sep 17 00:00:00 2001 From: "elastic-renovate-prod[bot]" <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:31:52 +0100 Subject: [PATCH 67/71] Update OpenAPI Spec (main) (#201609) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@apidevtools/swagger-parser](https://apitools.dev/swagger-parser/) ([source](https://togithub.com/APIDevTools/swagger-parser)) | devDependencies | minor | [`^10.0.3` -> `^10.1.0`](https://renovatebot.com/diffs/npm/@apidevtools%2fswagger-parser/10.0.3/10.1.0) | | [openapi-types](https://togithub.com/kogosoftwarellc/open-api/tree/master/packages/openapi-types#readme) ([source](https://togithub.com/kogosoftwarellc/open-api/tree/HEAD/packages/openapi-types)) | devDependencies | major | [`^10.0.0` -> `^12.1.3`](https://renovatebot.com/diffs/npm/openapi-types/10.0.0/12.1.3) | --- ### Release Notes
      APIDevTools/swagger-parser (@​apidevtools/swagger-parser) ### [`v10.1.0`](https://togithub.com/APIDevTools/swagger-parser/compare/v10.0.3...v10.1.0) [Compare Source](https://togithub.com/APIDevTools/swagger-parser/compare/v10.0.3...v10.1.0)
      kogosoftwarellc/open-api (openapi-types) ### [`v12.1.3`](https://togithub.com/kogosoftwarellc/open-api/compare/v12.1.2...v12.1.3) [Compare Source](https://togithub.com/kogosoftwarellc/open-api/compare/v12.1.2...v12.1.3) ### [`v12.1.2`](https://togithub.com/kogosoftwarellc/open-api/compare/v12.1.1...v12.1.2) [Compare Source](https://togithub.com/kogosoftwarellc/open-api/compare/v12.1.1...v12.1.2) ### [`v12.1.1`](https://togithub.com/kogosoftwarellc/open-api/compare/v12.1.0...v12.1.1) [Compare Source](https://togithub.com/kogosoftwarellc/open-api/compare/v12.1.0...v12.1.1) ### [`v12.1.0`](https://togithub.com/kogosoftwarellc/open-api/compare/v12.0.2...v12.1.0) [Compare Source](https://togithub.com/kogosoftwarellc/open-api/compare/v12.0.2...v12.1.0) ### [`v12.0.2`](https://togithub.com/kogosoftwarellc/open-api/compare/v12.0.0...v12.0.2) [Compare Source](https://togithub.com/kogosoftwarellc/open-api/compare/v12.0.0...v12.0.2) ### [`v12.0.0`](https://togithub.com/kogosoftwarellc/open-api/compare/v11.1.0...v12.0.0) [Compare Source](https://togithub.com/kogosoftwarellc/open-api/compare/v11.1.0...v12.0.0) ### [`v11.1.0`](https://togithub.com/kogosoftwarellc/open-api/compare/v11.0.1...v11.1.0) [Compare Source](https://togithub.com/kogosoftwarellc/open-api/compare/v11.0.1...v11.1.0) ### [`v11.0.1`](https://togithub.com/kogosoftwarellc/open-api/compare/v11.0.0...v11.0.1) [Compare Source](https://togithub.com/kogosoftwarellc/open-api/compare/v11.0.0...v11.0.1) ### [`v11.0.0`](https://togithub.com/kogosoftwarellc/open-api/compare/v10.0.0...v11.0.0) [Compare Source](https://togithub.com/kogosoftwarellc/open-api/compare/v10.0.0...v11.0.0)
      --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> --- package.json | 4 ++-- yarn.lock | 38 ++++++++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 8522a1c27de46..c101dff556576 100644 --- a/package.json +++ b/package.json @@ -1311,7 +1311,7 @@ "zod": "^3.22.3" }, "devDependencies": { - "@apidevtools/swagger-parser": "^10.0.3", + "@apidevtools/swagger-parser": "^10.1.0", "@babel/cli": "^7.24.7", "@babel/core": "^7.24.7", "@babel/eslint-parser": "^7.24.7", @@ -1791,7 +1791,7 @@ "null-loader": "^3.0.0", "nyc": "^15.1.0", "oboe": "^2.1.4", - "openapi-types": "^10.0.0", + "openapi-types": "^12.1.3", "p-reflect": "2.1.0", "peggy": "^1.2.0", "picomatch": "^2.3.1", diff --git a/yarn.lock b/yarn.lock index 61c6e6098f1cc..dfa09b103a980 100644 --- a/yarn.lock +++ b/yarn.lock @@ -35,6 +35,15 @@ "@jridgewell/gen-mapping" "^0.1.0" "@jridgewell/trace-mapping" "^0.3.9" +"@apidevtools/json-schema-ref-parser@9.0.6": + version "9.0.6" + resolved "https://registry.yarnpkg.com/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.6.tgz#5d9000a3ac1fd25404da886da6b266adcd99cf1c" + integrity sha512-M3YgsLjI0lZxvrpeGVk9Ap032W6TPQkH6pRAZz81Ac3WUNF79VQooAFnp8umjvVzUmD93NkogxEwbSce7qMsUg== + dependencies: + "@jsdevtools/ono" "^7.1.3" + call-me-maybe "^1.0.1" + js-yaml "^3.13.1" + "@apidevtools/json-schema-ref-parser@^9.0.6": version "9.0.9" resolved "https://registry.yarnpkg.com/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz#d720f9256e3609621280584f2b47ae165359268b" @@ -45,7 +54,7 @@ call-me-maybe "^1.0.1" js-yaml "^4.1.0" -"@apidevtools/openapi-schemas@^2.0.4": +"@apidevtools/openapi-schemas@^2.0.4", "@apidevtools/openapi-schemas@^2.1.0": version "2.1.0" resolved "https://registry.yarnpkg.com/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz#9fa08017fb59d80538812f03fc7cac5992caaa17" integrity sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ== @@ -55,7 +64,7 @@ resolved "https://registry.yarnpkg.com/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz#b789a362e055b0340d04712eafe7027ddc1ac267" integrity sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg== -"@apidevtools/swagger-parser@10.0.3", "@apidevtools/swagger-parser@^10.0.3": +"@apidevtools/swagger-parser@10.0.3": version "10.0.3" resolved "https://registry.yarnpkg.com/@apidevtools/swagger-parser/-/swagger-parser-10.0.3.tgz#32057ae99487872c4dd96b314a1ab4b95d89eaf5" integrity sha512-sNiLY51vZOmSPFZA5TF35KZ2HbgYklQnTSDnkghamzLb3EkNtcQnrBQEj5AOCxHpTtXpqMCRM1CrmV2rG6nw4g== @@ -67,6 +76,19 @@ call-me-maybe "^1.0.1" z-schema "^5.0.1" +"@apidevtools/swagger-parser@^10.1.0": + version "10.1.0" + resolved "https://registry.yarnpkg.com/@apidevtools/swagger-parser/-/swagger-parser-10.1.0.tgz#a987d71e5be61feb623203be0c96e5985b192ab6" + integrity sha512-9Kt7EuS/7WbMAUv2gSziqjvxwDbFSg3Xeyfuj5laUODX8o/k/CpsAKiQ8W7/R88eXFTMbJYg6+7uAmOWNKmwnw== + dependencies: + "@apidevtools/json-schema-ref-parser" "9.0.6" + "@apidevtools/openapi-schemas" "^2.1.0" + "@apidevtools/swagger-methods" "^3.0.2" + "@jsdevtools/ono" "^7.1.3" + ajv "^8.6.3" + ajv-draft-04 "^1.0.0" + call-me-maybe "^1.0.1" + "@appland/sql-parser@^1.5.1": version "1.5.1" resolved "https://registry.yarnpkg.com/@appland/sql-parser/-/sql-parser-1.5.1.tgz#331d644364899858ba7aa6e884e2492596990626" @@ -13257,6 +13279,11 @@ airbnb-js-shims@^2.2.1: string.prototype.padstart "^3.0.0" symbol.prototype.description "^1.0.0" +ajv-draft-04@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz#3b64761b268ba0b9e668f0b41ba53fce0ad77fc8" + integrity sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw== + ajv-errors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.0.tgz#ecf021fa108fd17dfb5e6b383f2dd233e31ffc59" @@ -13291,7 +13318,7 @@ ajv@^6.1.0, ajv@^6.10.2, ajv@^6.12.2, ajv@^6.12.4, ajv@^6.12.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.0, ajv@^8.0.1, ajv@^8.12.0, ajv@^8.17.1, ajv@^8.8.0: +ajv@^8.0.0, ajv@^8.0.1, ajv@^8.12.0, ajv@^8.17.1, ajv@^8.6.3, ajv@^8.8.0: version "8.17.1" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== @@ -25436,11 +25463,6 @@ openapi-sampler@^1.5.0: "@types/json-schema" "^7.0.7" json-pointer "0.6.2" -openapi-types@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/openapi-types/-/openapi-types-10.0.0.tgz#0debbf663b2feed0322030b5b7c9080804076934" - integrity sha512-Y8xOCT2eiKGYDzMW9R4x5cmfc3vGaaI4EL2pwhDmodWw1HlK18YcZ4uJxc7Rdp7/gGzAygzH9SXr6GKYIXbRcQ== - openapi-types@^12.1.3: version "12.1.3" resolved "https://registry.yarnpkg.com/openapi-types/-/openapi-types-12.1.3.tgz#471995eb26c4b97b7bd356aacf7b91b73e777dd3" From f0c8fde12469a9d827a4f4cb8498f3210b400ce2 Mon Sep 17 00:00:00 2001 From: Faisal Kanout Date: Tue, 26 Nov 2024 10:33:55 +0100 Subject: [PATCH 68/71] [Obx-ux-mgmt][Alerting]Mismatch between preview chart and rule execution regarding wildcards (#201553) ## Summary It fixes #186624 by making the preview chat represent the wildcard correctly. The missing use case was when passing the query without " " |Tested cases|Note| |---|---| |Screenshot 2024-11-25 at 12 04 14|Screenshot 2024-11-25 at 12 04 27We can't show "NoData" in this case. I tested the same formula in Lens and got the same results. It's not ideal, but at least we don't have any data/bars that could mislead the user| |Screenshot 2024-11-25 at 11 59 53|| |Screenshot 2024-11-25 at 11 59 41|| |Screenshot 2024-11-25 at 11 59 28|| |Screenshot 2024-11-25 at 11 59 08|| |Screenshot 2024-11-25 at 11 58 58|| --- .../rule_condition_chart/helpers.test.ts | 28 ++++++++++++++++++- .../rule_condition_chart/helpers.ts | 9 +++--- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/helpers.test.ts b/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/helpers.test.ts index a4825c11f85cd..0aedbb5723219 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/helpers.test.ts +++ b/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/helpers.test.ts @@ -75,6 +75,32 @@ const useCases = [ sourceField: '', }, ], + [ + { + aggType: Aggregators.COUNT, + field: '', + filter: `container.name:container's name-1`, + name: '', + }, + { + operation: 'count', + operationWithField: `count(kql='container.name:container\\'s name-1')`, + sourceField: '', + }, + ], + [ + { + aggType: Aggregators.COUNT, + field: '', + filter: 'host.name: host-*', + name: '', + }, + { + operation: 'count', + operationWithField: `count(kql='host.name: host-*')`, + sourceField: '', + }, + ], [ { aggType: Aggregators.CARDINALITY, @@ -136,7 +162,7 @@ const useCases = [ }, { operation: 'counter_rate', - operationWithField: `counter_rate(max(system.network.in.bytes), kql='host.name : foo')`, + operationWithField: `counter_rate(max(system.network.in.bytes), kql='host.name : "foo"')`, sourceField: 'system.network.in.bytes', }, ], diff --git a/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/helpers.ts b/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/helpers.ts index 9eb52af738ea9..30663d02cda72 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/helpers.ts +++ b/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/helpers.ts @@ -15,15 +15,15 @@ export interface LensOperation { } export const getLensOperationFromRuleMetric = (metric: GenericMetric): LensOperation => { - const { aggType, field, filter } = metric; + const { aggType, field, filter = '' } = metric; let operation: string = aggType; const operationArgs: string[] = []; - const aggFilter = JSON.stringify(filter || '').replace(/"|\\/g, ''); + const escapedFilter = filter.replace(/'/g, "\\'"); if (aggType === Aggregators.RATE) { return { operation: 'counter_rate', - operationWithField: `counter_rate(max(${field}), kql='${aggFilter}')`, + operationWithField: `counter_rate(max(${field}), kql='${escapedFilter}')`, sourceField: field || '', }; } @@ -45,8 +45,7 @@ export const getLensOperationFromRuleMetric = (metric: GenericMetric): LensOpera operationArgs.push('percentile=99'); } - if (aggFilter) operationArgs.push(`kql='${aggFilter}'`); - + if (escapedFilter) operationArgs.push(`kql='${escapedFilter}'`); return { operation, operationWithField: `${operation}(${operationArgs.join(', ')})`, From 17410c39279fcca551d3af7299b04d1ccf8ceefa Mon Sep 17 00:00:00 2001 From: Ievgen Sorokopud Date: Tue, 26 Nov 2024 10:39:17 +0100 Subject: [PATCH 69/71] [Rules migration] Add possibility to navigate to a specific migration (#11264) (#201597) ## Summary [Internal link](https://github.com/elastic/security-team/issues/10820) to the feature details With these changes we: * allow user to navigate to a specific migration by its id * handle different possible states on migrations rules page: * `no migrations`: if there are no existing migrations we will redirect user to the landing page * `unknown selected migration`: if unknown migration id is specified in the URL, then "Unknown Migration" page will be shown * `no selected migration`: if user lands on the root "SIEM migrations rules" page, then most recent migration will be shown * `show existing migration`: selected migration will be shown ### Screenshots **Unknown migration** Screenshot 2024-11-25 at 14 46 56 **Show existing migration** Screenshot 2024-11-25 at 15 03 53 --- .../public/siem_migrations/routes.tsx | 5 +- .../rules/components/no_migrations/index.tsx | 53 ------ .../components/no_migrations/translations.ts | 29 --- .../components/unknown_migration/index.tsx | 34 ++++ .../unknown_migration/translations.ts | 23 +++ .../siem_migrations/rules/pages/index.tsx | 166 ++++++++++-------- 6 files changed, 154 insertions(+), 156 deletions(-) delete mode 100644 x-pack/plugins/security_solution/public/siem_migrations/rules/components/no_migrations/index.tsx delete mode 100644 x-pack/plugins/security_solution/public/siem_migrations/rules/components/no_migrations/translations.ts create mode 100644 x-pack/plugins/security_solution/public/siem_migrations/rules/components/unknown_migration/index.tsx create mode 100644 x-pack/plugins/security_solution/public/siem_migrations/rules/components/unknown_migration/translations.ts diff --git a/x-pack/plugins/security_solution/public/siem_migrations/routes.tsx b/x-pack/plugins/security_solution/public/siem_migrations/routes.tsx index 610eb7e2a72d8..cc2b9fbad3451 100644 --- a/x-pack/plugins/security_solution/public/siem_migrations/routes.tsx +++ b/x-pack/plugins/security_solution/public/siem_migrations/routes.tsx @@ -6,6 +6,7 @@ */ import React from 'react'; +import { Routes, Route } from '@kbn/shared-ux-router'; import type { SecuritySubPluginRoutes } from '../app/types'; import { SIEM_MIGRATIONS_RULES_PATH, SecurityPageName } from '../../common/constants'; @@ -17,7 +18,9 @@ export const RulesRoutes = () => { return ( - + + + ); diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/components/no_migrations/index.tsx b/x-pack/plugins/security_solution/public/siem_migrations/rules/components/no_migrations/index.tsx deleted file mode 100644 index e4b3701d94c73..0000000000000 --- a/x-pack/plugins/security_solution/public/siem_migrations/rules/components/no_migrations/index.tsx +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiButton, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import React from 'react'; -import { SecurityPageName } from '../../../../../common'; -import { useGetSecuritySolutionLinkProps } from '../../../../common/components/links'; -import * as i18n from './translations'; - -const NoMigrationsComponent = () => { - const getSecuritySolutionLinkProps = useGetSecuritySolutionLinkProps(); - const { onClick: onClickLink } = getSecuritySolutionLinkProps({ - deepLinkId: SecurityPageName.landing, - path: 'siem_migrations', - }); - - return ( - - - {i18n.NO_MIGRATIONS_AVAILABLE}} - titleSize="s" - body={i18n.NO_MIGRATIONS_AVAILABLE_BODY} - data-test-subj="noMigrationsAvailable" - /> - - - - {i18n.GO_BACK_TO_RULES_TABLE_BUTTON} - - - - ); -}; - -export const NoMigrations = React.memo(NoMigrationsComponent); -NoMigrations.displayName = 'NoMigrations'; diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/components/no_migrations/translations.ts b/x-pack/plugins/security_solution/public/siem_migrations/rules/components/no_migrations/translations.ts deleted file mode 100644 index 77ec0454fb5a5..0000000000000 --- a/x-pack/plugins/security_solution/public/siem_migrations/rules/components/no_migrations/translations.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; - -export const NO_MIGRATIONS_AVAILABLE = i18n.translate( - 'xpack.securitySolution.siemMigrations.rules.noMigrationsTitle', - { - defaultMessage: 'No migrations', - } -); - -export const NO_MIGRATIONS_AVAILABLE_BODY = i18n.translate( - 'xpack.securitySolution.siemMigrations.rules.noMigrationsBodyTitle', - { - defaultMessage: 'There are no migrations available', - } -); - -export const GO_BACK_TO_RULES_TABLE_BUTTON = i18n.translate( - 'xpack.securitySolution.siemMigrations.rules.table.goToMigrationsPageButton', - { - defaultMessage: 'Go back to SIEM Migrations', - } -); diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/components/unknown_migration/index.tsx b/x-pack/plugins/security_solution/public/siem_migrations/rules/components/unknown_migration/index.tsx new file mode 100644 index 0000000000000..0a33869eff418 --- /dev/null +++ b/x-pack/plugins/security_solution/public/siem_migrations/rules/components/unknown_migration/index.tsx @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import * as i18n from './translations'; + +const UnknownMigrationComponent = () => { + return ( + + + {i18n.UNKNOWN_MIGRATION}} + titleSize="s" + body={i18n.UNKNOWN_MIGRATION_BODY} + data-test-subj="noMigrationsAvailable" + /> + + + ); +}; + +export const UnknownMigration = React.memo(UnknownMigrationComponent); +UnknownMigration.displayName = 'UnknownMigration'; diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/components/unknown_migration/translations.ts b/x-pack/plugins/security_solution/public/siem_migrations/rules/components/unknown_migration/translations.ts new file mode 100644 index 0000000000000..8720640858b94 --- /dev/null +++ b/x-pack/plugins/security_solution/public/siem_migrations/rules/components/unknown_migration/translations.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; + +export const UNKNOWN_MIGRATION = i18n.translate( + 'xpack.securitySolution.siemMigrations.rules.unknownMigrationTitle', + { + defaultMessage: 'Unknown migration', + } +); + +export const UNKNOWN_MIGRATION_BODY = i18n.translate( + 'xpack.securitySolution.siemMigrations.rules.unknownMigrationBodyTitle', + { + defaultMessage: + 'Selected migration does not exist. Please select one of the available migraitons', + } +); diff --git a/x-pack/plugins/security_solution/public/siem_migrations/rules/pages/index.tsx b/x-pack/plugins/security_solution/public/siem_migrations/rules/pages/index.tsx index 83392f0a70d2a..26199616b3777 100644 --- a/x-pack/plugins/security_solution/public/siem_migrations/rules/pages/index.tsx +++ b/x-pack/plugins/security_solution/public/siem_migrations/rules/pages/index.tsx @@ -5,12 +5,15 @@ * 2.0. */ -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import React, { useCallback, useEffect, useMemo } from 'react'; import { EuiSkeletonLoading, EuiSkeletonText, EuiSkeletonTitle } from '@elastic/eui'; +import type { RouteComponentProps } from 'react-router-dom'; +import { useNavigation } from '../../../common/lib/kibana'; import type { RuleMigration } from '../../../../common/siem_migrations/model/rule_migration.gen'; import { HeaderPage } from '../../../common/components/header_page'; import { SecuritySolutionPageWrapper } from '../../../common/components/page_wrapper'; +import { SecurityPageName } from '../../../app/types'; import * as i18n from './translations'; import { RulesTable } from '../components/rules_table'; @@ -18,80 +21,97 @@ import { NeedAdminForUpdateRulesCallOut } from '../../../detections/components/c import { MissingPrivilegesCallOut } from '../../../detections/components/callouts/missing_privileges_callout'; import { HeaderButtons } from '../components/header_buttons'; import { useRulePreviewFlyout } from '../hooks/use_rule_preview_flyout'; -import { NoMigrations } from '../components/no_migrations'; +import { UnknownMigration } from '../components/unknown_migration'; import { useLatestStats } from '../hooks/use_latest_stats'; -export const RulesPage = React.memo(() => { - const { data: ruleMigrationsStatsAll, isLoading: isLoadingMigrationsStats } = useLatestStats(); - - const migrationsIds = useMemo(() => { - if (isLoadingMigrationsStats || !ruleMigrationsStatsAll?.length) { - return []; - } - return ruleMigrationsStatsAll - .filter((migration) => migration.status === 'finished') - .map((migration) => migration.id); - }, [isLoadingMigrationsStats, ruleMigrationsStatsAll]); - - const [selectedMigrationId, setSelectedMigrationId] = useState(); - const onMigrationIdChange = (selectedId?: string) => { - setSelectedMigrationId(selectedId); - }; - - useEffect(() => { - if (!migrationsIds.length) { - return; - } - const index = migrationsIds.findIndex((id) => id === selectedMigrationId); - if (index === -1) { - setSelectedMigrationId(migrationsIds[0]); - } - }, [migrationsIds, selectedMigrationId]); - - const ruleActionsFactory = useCallback( - (ruleMigration: RuleMigration, closeRulePreview: () => void) => { - // TODO: Add flyout action buttons - return null; +type RulesMigrationPageProps = RouteComponentProps<{ migrationId?: string }>; + +export const RulesPage: React.FC = React.memo( + ({ + match: { + params: { migrationId }, }, - [] - ); - - const { rulePreviewFlyout, openRulePreview } = useRulePreviewFlyout({ - ruleActionsFactory, - }); - - return ( - <> - - - - - - { + const { navigateTo } = useNavigation(); + + const { data: ruleMigrationsStatsAll, isLoading: isLoadingMigrationsStats } = useLatestStats(); + + const migrationsIds = useMemo(() => { + if (isLoadingMigrationsStats || !ruleMigrationsStatsAll?.length) { + return []; + } + return ruleMigrationsStatsAll + .filter((migration) => migration.status === 'finished') + .map((migration) => migration.id); + }, [isLoadingMigrationsStats, ruleMigrationsStatsAll]); + + useEffect(() => { + if (isLoadingMigrationsStats) { + return; + } + + // Navigate to landing page if there are no migrations + if (!migrationsIds.length) { + navigateTo({ deepLinkId: SecurityPageName.landing, path: 'siem_migrations' }); + return; + } + + // Navigate to the most recent migration if none is selected + if (!migrationId) { + navigateTo({ deepLinkId: SecurityPageName.siemMigrationsRules, path: migrationsIds[0] }); + } + }, [isLoadingMigrationsStats, migrationId, migrationsIds, navigateTo]); + + const onMigrationIdChange = (selectedId?: string) => { + navigateTo({ deepLinkId: SecurityPageName.siemMigrationsRules, path: selectedId }); + }; + + const ruleActionsFactory = useCallback( + (ruleMigration: RuleMigration, closeRulePreview: () => void) => { + // TODO: Add flyout action buttons + return null; + }, + [] + ); + + const { rulePreviewFlyout, openRulePreview } = useRulePreviewFlyout({ + ruleActionsFactory, + }); + + const content = useMemo(() => { + if (!migrationId || !migrationsIds.includes(migrationId)) { + return ; + } + return ; + }, [migrationId, migrationsIds, openRulePreview]); + + return ( + <> + + + + + + + + + + + + } + loadedContent={content} /> - - - - - - } - loadedContent={ - selectedMigrationId ? ( - - ) : ( - - ) - } - /> - {rulePreviewFlyout} - - - ); -}); + {rulePreviewFlyout} + + + ); + } +); RulesPage.displayName = 'RulesPage'; From aebd13ec678d620c1822d313ea5c9bb6d219a149 Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Tue, 26 Nov 2024 02:43:25 -0700 Subject: [PATCH 70/71] [Streams] Adding the first integration test (#201293) ## Summary This PR introduces the first integration test for the Streams project. This test covers the following basic functionality: - Enable streams - Index a document to `logs` - Create a `logs.nginx` for that reroutes based on `log.logger == 'nginx'` - Index a document to `logs.nginx` - Create a `logs.nginx.access` that reroutes based on `log.level == 'info'` - Index a document to `log.nginx.access` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine Co-authored-by: Joe Reuter --- .buildkite/ftr_oblt_stateful_configs.yml | 1 + .../api_integration/apis/streams/config.ts | 16 ++ .../api_integration/apis/streams/full_flow.ts | 140 ++++++++++++++++++ .../apis/streams/helpers/cleanup.ts | 26 ++++ .../apis/streams/helpers/requests.ts | 43 ++++++ .../api_integration/apis/streams/index.ts | 14 ++ 6 files changed, 240 insertions(+) create mode 100644 x-pack/test/api_integration/apis/streams/config.ts create mode 100644 x-pack/test/api_integration/apis/streams/full_flow.ts create mode 100644 x-pack/test/api_integration/apis/streams/helpers/cleanup.ts create mode 100644 x-pack/test/api_integration/apis/streams/helpers/requests.ts create mode 100644 x-pack/test/api_integration/apis/streams/index.ts diff --git a/.buildkite/ftr_oblt_stateful_configs.yml b/.buildkite/ftr_oblt_stateful_configs.yml index 6cad97ecc4456..eed4654725038 100644 --- a/.buildkite/ftr_oblt_stateful_configs.yml +++ b/.buildkite/ftr_oblt_stateful_configs.yml @@ -32,6 +32,7 @@ enabled: - x-pack/test/api_integration/apis/synthetics/config.ts - x-pack/test/api_integration/apis/uptime/config.ts - x-pack/test/api_integration/apis/entity_manager/config.ts + - x-pack/test/api_integration/apis/streams/config.ts - x-pack/test/apm_api_integration/basic/config.ts - x-pack/test/apm_api_integration/cloud/config.ts - x-pack/test/apm_api_integration/rules/config.ts diff --git a/x-pack/test/api_integration/apis/streams/config.ts b/x-pack/test/api_integration/apis/streams/config.ts new file mode 100644 index 0000000000000..c737db9499836 --- /dev/null +++ b/x-pack/test/api_integration/apis/streams/config.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrConfigProviderContext } from '@kbn/test'; + +export default async function ({ readConfigFile }: FtrConfigProviderContext) { + const baseIntegrationTestsConfig = await readConfigFile(require.resolve('../../config.ts')); + return { + ...baseIntegrationTestsConfig.getAll(), + testFiles: [require.resolve('.')], + }; +} diff --git a/x-pack/test/api_integration/apis/streams/full_flow.ts b/x-pack/test/api_integration/apis/streams/full_flow.ts new file mode 100644 index 0000000000000..03c0cc9e0e219 --- /dev/null +++ b/x-pack/test/api_integration/apis/streams/full_flow.ts @@ -0,0 +1,140 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { + deleteStream, + enableStreams, + fetchDocument, + forkStream, + indexDocument, +} from './helpers/requests'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { waitForDocumentInIndex } from '../../../alerting_api_integration/observability/helpers/alerting_wait_for_helpers'; +import { cleanUpRootStream } from './helpers/cleanup'; + +export default function ({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + const esClient = getService('es'); + const retryService = getService('retry'); + const logger = getService('log'); + + describe('Basic functionality', () => { + after(async () => { + await deleteStream(supertest, 'logs.nginx'); + await cleanUpRootStream(esClient); + }); + + // Note: Each step is dependent on the previous + describe('Full flow', () => { + it('Enable streams', async () => { + await enableStreams(supertest); + }); + + it('Index a JSON document to logs, should go to logs', async () => { + const doc = { + '@timestamp': '2024-01-01T00:00:00.000Z', + message: JSON.stringify({ + 'log.level': 'info', + 'log.logger': 'nginx', + message: 'test', + }), + }; + const response = await indexDocument(esClient, 'logs', doc); + expect(response.result).to.eql('created'); + await waitForDocumentInIndex({ esClient, indexName: 'logs', retryService, logger }); + + const result = await fetchDocument(esClient, 'logs', response._id); + expect(result._index).to.match(/^\.ds\-logs-.*/); + expect(result._source).to.eql({ + '@timestamp': '2024-01-01T00:00:00.000Z', + message: 'test', + log: { level: 'info', logger: 'nginx' }, + }); + }); + + it('Fork logs to logs.nginx', async () => { + const body = { + stream: { + id: 'logs.nginx', + fields: [], + processing: [], + }, + condition: { + field: 'log.logger', + operator: 'eq', + value: 'nginx', + }, + }; + const response = await forkStream(supertest, 'logs', body); + expect(response).to.have.property('acknowledged', true); + }); + + it('Index an Nginx access log message, should goto logs.nginx', async () => { + const doc = { + '@timestamp': '2024-01-01T00:00:10.000Z', + message: JSON.stringify({ + 'log.level': 'info', + 'log.logger': 'nginx', + message: 'test', + }), + }; + const response = await indexDocument(esClient, 'logs', doc); + expect(response.result).to.eql('created'); + await waitForDocumentInIndex({ esClient, indexName: 'logs.nginx', retryService, logger }); + + const result = await fetchDocument(esClient, 'logs.nginx', response._id); + expect(result._index).to.match(/^\.ds\-logs.nginx-.*/); + expect(result._source).to.eql({ + '@timestamp': '2024-01-01T00:00:10.000Z', + message: 'test', + log: { level: 'info', logger: 'nginx' }, + }); + }); + + it('Fork logs to logs.nginx.access', async () => { + const body = { + stream: { + id: 'logs.nginx.access', + fields: [], + processing: [], + }, + condition: { field: 'log.level', operator: 'eq', value: 'info' }, + }; + const response = await forkStream(supertest, 'logs.nginx', body); + expect(response).to.have.property('acknowledged', true); + }); + + it('Index an Nginx access log message, should goto logs.nginx.access', async () => { + const doc = { + '@timestamp': '2024-01-01T00:00:20.000Z', + message: JSON.stringify({ + 'log.level': 'info', + 'log.logger': 'nginx', + message: 'test', + }), + }; + const response = await indexDocument(esClient, 'logs', doc); + expect(response.result).to.eql('created'); + await waitForDocumentInIndex({ + esClient, + indexName: 'logs.nginx.access', + retryService, + logger, + }); + + const result = await fetchDocument(esClient, 'logs.nginx.access', response._id); + expect(result._index).to.match(/^\.ds\-logs.nginx.access-.*/); + expect(result._source).to.eql({ + '@timestamp': '2024-01-01T00:00:20.000Z', + message: 'test', + log: { level: 'info', logger: 'nginx' }, + }); + }); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/streams/helpers/cleanup.ts b/x-pack/test/api_integration/apis/streams/helpers/cleanup.ts new file mode 100644 index 0000000000000..f1d382031d484 --- /dev/null +++ b/x-pack/test/api_integration/apis/streams/helpers/cleanup.ts @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Client } from '@elastic/elasticsearch'; + +/** +DELETE .kibana_streams +DELETE _data_stream/logs +DELETE /_index_template/logs@stream +DELETE /_component_template/logs@stream.layer +DELETE /_ingest/pipeline/logs@json-pipeline +DELETE /_ingest/pipeline/logs@stream.processing +DELETE /_ingest/pipeline/logs@stream.reroutes +*/ + +export async function cleanUpRootStream(esClient: Client) { + await esClient.indices.delete({ index: '.kibana_streams' }); + await esClient.indices.deleteDataStream({ name: 'logs' }); + await esClient.indices.deleteIndexTemplate({ name: 'logs@stream' }); + await esClient.cluster.deleteComponentTemplate({ name: 'logs@stream.layer' }); + await esClient.ingest.deletePipeline({ id: 'logs@stream.*' }); +} diff --git a/x-pack/test/api_integration/apis/streams/helpers/requests.ts b/x-pack/test/api_integration/apis/streams/helpers/requests.ts new file mode 100644 index 0000000000000..d44644e9746b1 --- /dev/null +++ b/x-pack/test/api_integration/apis/streams/helpers/requests.ts @@ -0,0 +1,43 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { Client } from '@elastic/elasticsearch'; +import { JsonObject } from '@kbn/utility-types'; +import { Agent } from 'supertest'; +import expect from '@kbn/expect'; +import { SearchTotalHits } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; + +export async function enableStreams(supertest: Agent) { + const req = supertest.post('/api/streams/_enable').set('kbn-xsrf', 'xxx'); + const response = await req.send().expect(200); + return response.body; +} + +export async function indexDocument(esClient: Client, index: string, document: JsonObject) { + const response = await esClient.index({ index, document }); + return response; +} + +export async function fetchDocument(esClient: Client, index: string, id: string) { + const query = { + ids: { values: [id] }, + }; + const response = await esClient.search({ index, query }); + expect((response.hits.total as SearchTotalHits).value).to.eql(1); + return response.hits.hits[0]; +} + +export async function forkStream(supertest: Agent, root: string, body: JsonObject) { + const req = supertest.post(`/api/streams/${root}/_fork`).set('kbn-xsrf', 'xxx'); + const response = await req.send(body).expect(200); + return response.body; +} + +export async function deleteStream(supertest: Agent, id: string) { + const req = supertest.delete(`/api/streams/${id}`).set('kbn-xsrf', 'xxx'); + const response = await req.send().expect(200); + return response.body; +} diff --git a/x-pack/test/api_integration/apis/streams/index.ts b/x-pack/test/api_integration/apis/streams/index.ts new file mode 100644 index 0000000000000..0e879fd0b9b64 --- /dev/null +++ b/x-pack/test/api_integration/apis/streams/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { FtrProviderContext } from '../../ftr_provider_context'; + +export default function ({ loadTestFile }: FtrProviderContext) { + describe('Streams Endpoints', () => { + loadTestFile(require.resolve('./full_flow')); + }); +} From a1e97b1a43f2971dbf528201b3b82fb4b178b6bb Mon Sep 17 00:00:00 2001 From: Ersin Erdal <92688503+ersin-erdal@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:12:23 +0100 Subject: [PATCH 71/71] Delete connector usage reporting task in on-prem and cloud (#199650) Towards: https://github.com/elastic/response-ops-team/issues/209 `connector_usage_reporting` task is supposed to work only in serverless. As there is no check for that, even though it reports nothing, It was working for on-prem and cloud as well. This PR deletes the `connector_usage_reporting` task after the first run by checking if `plugins.cloud.serverless.projectId` is missing. ### To verify: Run Kibana on this branch, then check the reporting task in the console by running the below query. There shouldn't be any task. ``` GET .kibana_task_manager_*/_search { "query": { "prefix": { "task.taskType": { "value": "actions:" } } } } ``` Then remove or comment out the line (`shouldDeleteTask: true`) added by this PR and save the file, Kibana will restart and register the task again. You can use the above query again to see that the task is still registered. --- x-pack/plugins/actions/server/plugin.ts | 2 ++ .../connector_usage_reporting_task.test.ts | 26 ++++++++++++++++++- .../usage/connector_usage_reporting_task.ts | 6 ++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/actions/server/plugin.ts b/x-pack/plugins/actions/server/plugin.ts index 57304c176c13d..edfd7606950c1 100644 --- a/x-pack/plugins/actions/server/plugin.ts +++ b/x-pack/plugins/actions/server/plugin.ts @@ -140,6 +140,7 @@ export interface PluginSetupContract { getActionsHealth: () => { hasPermanentEncryptionKey: boolean }; getActionsConfigurationUtilities: () => ActionsConfigurationUtilities; setEnabledConnectorTypes: (connectorTypes: EnabledConnectorTypes) => void; + isActionTypeEnabled(id: string, options?: { notifyUsage: boolean }): boolean; } @@ -168,6 +169,7 @@ export interface PluginStartContract { params: Params, variables: Record ): Params; + isSystemActionConnector: (connectorId: string) => boolean; } diff --git a/x-pack/plugins/actions/server/usage/connector_usage_reporting_task.test.ts b/x-pack/plugins/actions/server/usage/connector_usage_reporting_task.test.ts index 77dec7f15e156..2c09576cc2a2b 100644 --- a/x-pack/plugins/actions/server/usage/connector_usage_reporting_task.test.ts +++ b/x-pack/plugins/actions/server/usage/connector_usage_reporting_task.test.ts @@ -230,10 +230,11 @@ describe('ConnectorUsageReportingTask', () => { const response = await taskRunner.run(); expect(logger.warn).toHaveBeenCalledWith( - 'Missing required project id while running actions:connector_usage_reporting' + 'Missing required project id while running actions:connector_usage_reporting, reporting task will be deleted' ); expect(response).toEqual({ + shouldDeleteTask: true, state: { attempts: 0, lastReportedUsageDate, @@ -391,4 +392,27 @@ describe('ConnectorUsageReportingTask', () => { 'Usage data could not be pushed to usage-api. Stopped retrying after 5 attempts. Error:test-error' ); }); + + it('does not schedule the task when the project id is missing', async () => { + const core = createSetup(); + const taskManagerStart = taskManagerStartMock(); + + const task = new ConnectorUsageReportingTask({ + eventLogIndex: 'test-index', + projectId: undefined, + logger, + core, + taskManager: mockTaskManagerSetup, + config: { + url: 'usage-api', + ca: { + path: './ca.crt', + }, + }, + }); + + await task.start(taskManagerStart); + + expect(taskManagerStart.ensureScheduled).not.toBeCalled(); + }); }); diff --git a/x-pack/plugins/actions/server/usage/connector_usage_reporting_task.ts b/x-pack/plugins/actions/server/usage/connector_usage_reporting_task.ts index ce44718749006..ddaa930b15c34 100644 --- a/x-pack/plugins/actions/server/usage/connector_usage_reporting_task.ts +++ b/x-pack/plugins/actions/server/usage/connector_usage_reporting_task.ts @@ -82,6 +82,9 @@ export class ConnectorUsageReportingTask { } public start = async (taskManager?: TaskManagerStartContract) => { + if (!this.projectId) { + return; + } if (!taskManager) { this.logger.error( `Missing required task manager service during start of ${CONNECTOR_USAGE_REPORTING_TASK_TYPE}` @@ -111,10 +114,11 @@ export class ConnectorUsageReportingTask { if (!this.projectId) { this.logger.warn( - `Missing required project id while running ${CONNECTOR_USAGE_REPORTING_TASK_TYPE}` + `Missing required project id while running ${CONNECTOR_USAGE_REPORTING_TASK_TYPE}, reporting task will be deleted` ); return { state, + shouldDeleteTask: true, }; }